react-better-html 1.1.276 → 1.1.277
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 +42 -3
- package/dist/index.d.ts +42 -3
- package/dist/index.js +721 -574
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +397 -251
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -72,6 +72,7 @@ __export(index_exports, {
|
|
|
72
72
|
formatPhoneNumber: () => import_react_better_core30.formatPhoneNumber,
|
|
73
73
|
generateApi: () => import_react_better_core30.generateApi,
|
|
74
74
|
generateEventEmitter: () => import_react_better_core30.generateEventEmitter,
|
|
75
|
+
generateI18n: () => generateI18n,
|
|
75
76
|
generateLocalStorage: () => generateLocalStorage,
|
|
76
77
|
generateRandomString: () => import_react_better_core30.generateRandomString,
|
|
77
78
|
getBrowser: () => getBrowser,
|
|
@@ -3156,7 +3157,18 @@ var useBetterHtmlContext = () => {
|
|
|
3156
3157
|
throw new Error(
|
|
3157
3158
|
"`useBetterHtmlContext()` must be used within a `<BetterHtmlProvider>`. Make sure to add one at the root of your component tree."
|
|
3158
3159
|
);
|
|
3159
|
-
const {
|
|
3160
|
+
const {
|
|
3161
|
+
alerts,
|
|
3162
|
+
setAlerts,
|
|
3163
|
+
setLanguage,
|
|
3164
|
+
languages,
|
|
3165
|
+
setLanguages,
|
|
3166
|
+
setSideMenuIsCollapsed,
|
|
3167
|
+
setSideMenuIsOpenMobile,
|
|
3168
|
+
plugins,
|
|
3169
|
+
componentsState,
|
|
3170
|
+
...rest
|
|
3171
|
+
} = context;
|
|
3160
3172
|
return {
|
|
3161
3173
|
...coreContext,
|
|
3162
3174
|
...rest
|
|
@@ -3223,6 +3235,8 @@ function BetterHtmlProviderInternalContent({ children }) {
|
|
|
3223
3235
|
function BetterHtmlProviderInternal({ config, plugins, children }) {
|
|
3224
3236
|
const betterCoreContext = (0, import_react_better_core13.useBetterCoreContext)();
|
|
3225
3237
|
const [alerts, setAlerts] = (0, import_react14.useState)([]);
|
|
3238
|
+
const [language, setLanguage] = (0, import_react14.useState)(localStorage.getItem("language") ?? "");
|
|
3239
|
+
const [languages, setLanguages] = (0, import_react14.useState)({});
|
|
3226
3240
|
const [sideMenuIsCollapsed, setSideMenuIsCollapsed] = (0, import_react_better_core13.useBooleanState)();
|
|
3227
3241
|
const [sideMenuIsOpenMobile, setSideMenuIsOpenMobile] = (0, import_react_better_core13.useBooleanState)();
|
|
3228
3242
|
const [tabGroups, setTabGroups] = (0, import_react14.useState)([]);
|
|
@@ -3235,6 +3249,10 @@ function BetterHtmlProviderInternal({ config, plugins, children }) {
|
|
|
3235
3249
|
},
|
|
3236
3250
|
alerts,
|
|
3237
3251
|
setAlerts,
|
|
3252
|
+
language,
|
|
3253
|
+
setLanguage,
|
|
3254
|
+
languages,
|
|
3255
|
+
setLanguages,
|
|
3238
3256
|
sideMenuIsCollapsed,
|
|
3239
3257
|
setSideMenuIsCollapsed,
|
|
3240
3258
|
sideMenuIsOpenMobile,
|
|
@@ -3252,7 +3270,17 @@ function BetterHtmlProviderInternal({ config, plugins, children }) {
|
|
|
3252
3270
|
}
|
|
3253
3271
|
}
|
|
3254
3272
|
}),
|
|
3255
|
-
[
|
|
3273
|
+
[
|
|
3274
|
+
config,
|
|
3275
|
+
alerts,
|
|
3276
|
+
language,
|
|
3277
|
+
languages,
|
|
3278
|
+
sideMenuIsCollapsed,
|
|
3279
|
+
sideMenuIsOpenMobile,
|
|
3280
|
+
plugins,
|
|
3281
|
+
tabGroups,
|
|
3282
|
+
tabsWithDots
|
|
3283
|
+
]
|
|
3256
3284
|
);
|
|
3257
3285
|
(0, import_react14.useEffect)(() => {
|
|
3258
3286
|
if (!plugins) return;
|
|
@@ -3480,14 +3508,72 @@ function generateLocalStorage() {
|
|
|
3480
3508
|
};
|
|
3481
3509
|
}
|
|
3482
3510
|
|
|
3483
|
-
// src/
|
|
3511
|
+
// src/utils/i18n.tsx
|
|
3484
3512
|
var import_react15 = require("react");
|
|
3485
|
-
var import_react_better_core14 = require("react-better-core");
|
|
3486
3513
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3487
|
-
var
|
|
3514
|
+
var missingTranslation = "MISSING_TRANSLATION";
|
|
3515
|
+
function generateI18n(config) {
|
|
3516
|
+
setTimeout(() => {
|
|
3517
|
+
externalBetterHtmlContextValue?.setLanguages(config.languages);
|
|
3518
|
+
const cachedLanguage = localStorage.getItem("language");
|
|
3519
|
+
const language = !cachedLanguage || !Object.keys(config.languages).includes(cachedLanguage) ? config.defaultLanguage : cachedLanguage;
|
|
3520
|
+
setLanguage(language);
|
|
3521
|
+
}, 1);
|
|
3522
|
+
function setLanguage(language) {
|
|
3523
|
+
externalBetterHtmlContextValue?.setLanguage(language);
|
|
3524
|
+
localStorage.setItem("language", language);
|
|
3525
|
+
}
|
|
3526
|
+
function internalI18n(language) {
|
|
3527
|
+
function translate(getString, template) {
|
|
3528
|
+
const words = config.languages[language]?.words;
|
|
3529
|
+
try {
|
|
3530
|
+
const readyString = words ? getString?.(words) ?? missingTranslation : missingTranslation;
|
|
3531
|
+
if (!template) return readyString;
|
|
3532
|
+
const matches = Array.from(readyString.matchAll(/{([^}]+)}/g));
|
|
3533
|
+
if (matches.length === 0) return readyString;
|
|
3534
|
+
const parts = [];
|
|
3535
|
+
let lastIndex = 0;
|
|
3536
|
+
matches.forEach((match, index) => {
|
|
3537
|
+
const [fullMatch, key] = match;
|
|
3538
|
+
const startIndex = match.index;
|
|
3539
|
+
if (startIndex > lastIndex) parts.push(readyString.substring(lastIndex, startIndex));
|
|
3540
|
+
const readyKey = words.templates[key.trim()] ?? fullMatch;
|
|
3541
|
+
const handler = template[key.trim()];
|
|
3542
|
+
parts.push(handler ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react15.Fragment, { children: handler(readyKey, index) }, fullMatch) : fullMatch);
|
|
3543
|
+
lastIndex = startIndex + fullMatch.length;
|
|
3544
|
+
});
|
|
3545
|
+
if (lastIndex < readyString.length) parts.push(readyString.substring(lastIndex));
|
|
3546
|
+
return parts;
|
|
3547
|
+
} catch (error) {
|
|
3548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: missingTranslation });
|
|
3549
|
+
}
|
|
3550
|
+
}
|
|
3551
|
+
return {
|
|
3552
|
+
t: translate,
|
|
3553
|
+
language,
|
|
3554
|
+
setLanguage
|
|
3555
|
+
};
|
|
3556
|
+
}
|
|
3557
|
+
return {
|
|
3558
|
+
useI18n: () => {
|
|
3559
|
+
const { language } = useBetterHtmlContext();
|
|
3560
|
+
return {
|
|
3561
|
+
...internalI18n(language ?? config.defaultLanguage)
|
|
3562
|
+
};
|
|
3563
|
+
},
|
|
3564
|
+
...internalI18n(externalBetterHtmlContextValue?.language ?? config.defaultLanguage),
|
|
3565
|
+
...config
|
|
3566
|
+
};
|
|
3567
|
+
}
|
|
3568
|
+
|
|
3569
|
+
// src/components/PageHolder.tsx
|
|
3570
|
+
var import_react16 = require("react");
|
|
3571
|
+
var import_react_better_core14 = require("react-better-core");
|
|
3572
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3573
|
+
var PageHolderComponent = (0, import_react16.forwardRef)(function PageHolder({ noMaxContentWidth, children, ...props }, ref) {
|
|
3488
3574
|
const theme2 = (0, import_react_better_core14.useTheme)();
|
|
3489
3575
|
const { app } = useBetterHtmlContextInternal();
|
|
3490
|
-
return /* @__PURE__ */ (0,
|
|
3576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3491
3577
|
Div_default,
|
|
3492
3578
|
{
|
|
3493
3579
|
as: "main",
|
|
@@ -3501,7 +3587,7 @@ var PageHolderComponent = (0, import_react15.forwardRef)(function PageHolder({ n
|
|
|
3501
3587
|
}
|
|
3502
3588
|
);
|
|
3503
3589
|
});
|
|
3504
|
-
PageHolderComponent.center = (0,
|
|
3590
|
+
PageHolderComponent.center = (0, import_react16.forwardRef)(function Center({
|
|
3505
3591
|
height,
|
|
3506
3592
|
pageBackgroundColor,
|
|
3507
3593
|
pageBackgroundImage,
|
|
@@ -3520,7 +3606,7 @@ PageHolderComponent.center = (0, import_react15.forwardRef)(function Center({
|
|
|
3520
3606
|
const breakingPoint = mediaQuery.size1000;
|
|
3521
3607
|
const withSideComponent = sideComponent && !breakingPoint;
|
|
3522
3608
|
const ContentTag = contentInsideBox !== false ? Div_default.box : Div_default;
|
|
3523
|
-
return /* @__PURE__ */ (0,
|
|
3609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3524
3610
|
Div_default.row,
|
|
3525
3611
|
{
|
|
3526
3612
|
position: "relative",
|
|
@@ -3531,7 +3617,7 @@ PageHolderComponent.center = (0, import_react15.forwardRef)(function Center({
|
|
|
3531
3617
|
backgroundColor: pageBackgroundColor,
|
|
3532
3618
|
backgroundImage: pageBackgroundImage,
|
|
3533
3619
|
children: [
|
|
3534
|
-
behindComponent && /* @__PURE__ */ (0,
|
|
3620
|
+
behindComponent && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3535
3621
|
Div_default,
|
|
3536
3622
|
{
|
|
3537
3623
|
position: "fixed",
|
|
@@ -3544,8 +3630,8 @@ PageHolderComponent.center = (0, import_react15.forwardRef)(function Center({
|
|
|
3544
3630
|
children: behindComponent
|
|
3545
3631
|
}
|
|
3546
3632
|
),
|
|
3547
|
-
sideComponentPosition === "left" && withSideComponent && /* @__PURE__ */ (0,
|
|
3548
|
-
/* @__PURE__ */ (0,
|
|
3633
|
+
sideComponentPosition === "left" && withSideComponent && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Div_default, { width: "50%" }),
|
|
3634
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Div_default.column, { position: "relative", width: `${withSideComponent ? 50 : 100}%`, alignItems: "center", zIndex: 2, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3549
3635
|
ContentTag,
|
|
3550
3636
|
{
|
|
3551
3637
|
width: `calc(100% - ${((props.margin ?? props.marginInline) !== void 0 ? parseFloat((props.margin ?? props.marginInline)?.toString() ?? "") : theme2.styles.space) * 2}px)`,
|
|
@@ -3558,8 +3644,8 @@ PageHolderComponent.center = (0, import_react15.forwardRef)(function Center({
|
|
|
3558
3644
|
children
|
|
3559
3645
|
}
|
|
3560
3646
|
) }),
|
|
3561
|
-
sideComponentPosition === "right" && withSideComponent && /* @__PURE__ */ (0,
|
|
3562
|
-
withSideComponent && /* @__PURE__ */ (0,
|
|
3647
|
+
sideComponentPosition === "right" && withSideComponent && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Div_default, { width: "50%" }),
|
|
3648
|
+
withSideComponent && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3563
3649
|
Div_default,
|
|
3564
3650
|
{
|
|
3565
3651
|
position: "fixed",
|
|
@@ -3575,16 +3661,16 @@ PageHolderComponent.center = (0, import_react15.forwardRef)(function Center({
|
|
|
3575
3661
|
}
|
|
3576
3662
|
);
|
|
3577
3663
|
});
|
|
3578
|
-
var PageHolder2 = (0,
|
|
3664
|
+
var PageHolder2 = (0, import_react16.memo)(PageHolderComponent);
|
|
3579
3665
|
PageHolder2.center = PageHolderComponent.center;
|
|
3580
3666
|
var PageHolder_default = PageHolder2;
|
|
3581
3667
|
|
|
3582
3668
|
// src/components/Chip.tsx
|
|
3583
|
-
var
|
|
3669
|
+
var import_react17 = require("react");
|
|
3584
3670
|
var import_react_better_core15 = require("react-better-core");
|
|
3585
|
-
var
|
|
3671
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3586
3672
|
var borderRadiusOffset = 1.3;
|
|
3587
|
-
var ChipComponent = (0,
|
|
3673
|
+
var ChipComponent = (0, import_react17.forwardRef)(function Chip({
|
|
3588
3674
|
text,
|
|
3589
3675
|
beforeText,
|
|
3590
3676
|
afterText,
|
|
@@ -3598,14 +3684,14 @@ var ChipComponent = (0, import_react16.forwardRef)(function Chip({
|
|
|
3598
3684
|
...props
|
|
3599
3685
|
}, ref) {
|
|
3600
3686
|
const theme2 = (0, import_react_better_core15.useTheme)();
|
|
3601
|
-
const onClickElement = (0,
|
|
3687
|
+
const onClickElement = (0, import_react17.useCallback)(
|
|
3602
3688
|
(event) => {
|
|
3603
3689
|
onClick?.(event);
|
|
3604
3690
|
onClickWithValue?.(value);
|
|
3605
3691
|
},
|
|
3606
3692
|
[onClick, onClickWithValue, value]
|
|
3607
3693
|
);
|
|
3608
|
-
return /* @__PURE__ */ (0,
|
|
3694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3609
3695
|
Div_default,
|
|
3610
3696
|
{
|
|
3611
3697
|
width: "fit-content",
|
|
@@ -3618,19 +3704,19 @@ var ChipComponent = (0, import_react16.forwardRef)(function Chip({
|
|
|
3618
3704
|
cursor: onClick || onClickWithValue ? "pointer" : void 0,
|
|
3619
3705
|
...props,
|
|
3620
3706
|
ref,
|
|
3621
|
-
children: /* @__PURE__ */ (0,
|
|
3707
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Div_default.row, { height: "100%", alignItems: "center", gap: theme2.styles.gap, children: [
|
|
3622
3708
|
beforeText,
|
|
3623
|
-
typeof text === "string" ? /* @__PURE__ */ (0,
|
|
3709
|
+
typeof text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text_default, { color: color ?? theme2.colors.textPrimary, children: text }) : text,
|
|
3624
3710
|
afterText
|
|
3625
3711
|
] })
|
|
3626
3712
|
}
|
|
3627
3713
|
);
|
|
3628
3714
|
});
|
|
3629
|
-
ChipComponent.colored = (0,
|
|
3715
|
+
ChipComponent.colored = (0, import_react17.forwardRef)(function Colored({ color, withWhiteBackground, ...props }, ref) {
|
|
3630
3716
|
const theme2 = (0, import_react_better_core15.useTheme)();
|
|
3631
3717
|
const { colorTheme } = (0, import_react_better_core15.useBetterCoreContext)();
|
|
3632
3718
|
const readyColor = color ?? theme2.colors.textSecondary;
|
|
3633
|
-
const chip = /* @__PURE__ */ (0,
|
|
3719
|
+
const chip = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3634
3720
|
ChipComponent,
|
|
3635
3721
|
{
|
|
3636
3722
|
color: colorTheme === "light" ? (0, import_react_better_core15.darkenColor)(readyColor, 0.7) : (0, import_react_better_core15.lightenColor)(readyColor, 0.7),
|
|
@@ -3640,7 +3726,7 @@ ChipComponent.colored = (0, import_react16.forwardRef)(function Colored({ color,
|
|
|
3640
3726
|
...props
|
|
3641
3727
|
}
|
|
3642
3728
|
);
|
|
3643
|
-
return withWhiteBackground ? /* @__PURE__ */ (0,
|
|
3729
|
+
return withWhiteBackground ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3644
3730
|
Div_default,
|
|
3645
3731
|
{
|
|
3646
3732
|
width: "fit-content",
|
|
@@ -3650,19 +3736,19 @@ ChipComponent.colored = (0, import_react16.forwardRef)(function Colored({ color,
|
|
|
3650
3736
|
}
|
|
3651
3737
|
) : chip;
|
|
3652
3738
|
});
|
|
3653
|
-
var Chip2 = (0,
|
|
3739
|
+
var Chip2 = (0, import_react17.memo)(ChipComponent);
|
|
3654
3740
|
Chip2.colored = ChipComponent.colored;
|
|
3655
3741
|
var Chip_default = Chip2;
|
|
3656
3742
|
|
|
3657
3743
|
// src/components/InputField.tsx
|
|
3658
|
-
var
|
|
3744
|
+
var import_react22 = require("react");
|
|
3659
3745
|
var import_react_better_core19 = require("react-better-core");
|
|
3660
3746
|
var import_styled_components11 = __toESM(require("styled-components"));
|
|
3661
3747
|
|
|
3662
3748
|
// src/components/Label.tsx
|
|
3663
|
-
var
|
|
3749
|
+
var import_react18 = require("react");
|
|
3664
3750
|
var import_react_better_core16 = require("react-better-core");
|
|
3665
|
-
var
|
|
3751
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3666
3752
|
function Label(labelProps) {
|
|
3667
3753
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
3668
3754
|
const {
|
|
@@ -3678,7 +3764,7 @@ function Label(labelProps) {
|
|
|
3678
3764
|
htmlFor
|
|
3679
3765
|
} = useComponentsPropsMerger(betterHtmlContextInternal.components.label?.style?.default, labelProps);
|
|
3680
3766
|
const theme2 = (0, import_react_better_core16.useTheme)();
|
|
3681
|
-
return /* @__PURE__ */ (0,
|
|
3767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3682
3768
|
Text_default,
|
|
3683
3769
|
{
|
|
3684
3770
|
as: "label",
|
|
@@ -3692,7 +3778,7 @@ function Label(labelProps) {
|
|
|
3692
3778
|
"aria-required": required,
|
|
3693
3779
|
children: [
|
|
3694
3780
|
text,
|
|
3695
|
-
required && /* @__PURE__ */ (0,
|
|
3781
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3696
3782
|
Text_default,
|
|
3697
3783
|
{
|
|
3698
3784
|
as: "span",
|
|
@@ -3711,14 +3797,14 @@ function Label(labelProps) {
|
|
|
3711
3797
|
}
|
|
3712
3798
|
);
|
|
3713
3799
|
}
|
|
3714
|
-
var Label_default = (0,
|
|
3800
|
+
var Label_default = (0, import_react18.memo)(Label);
|
|
3715
3801
|
|
|
3716
3802
|
// src/components/Dropdown.tsx
|
|
3717
|
-
var import_react18 = require("react");
|
|
3718
|
-
var import_react_better_core17 = require("react-better-core");
|
|
3719
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3720
3803
|
var import_react19 = require("react");
|
|
3721
|
-
var
|
|
3804
|
+
var import_react_better_core17 = require("react-better-core");
|
|
3805
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3806
|
+
var import_react20 = require("react");
|
|
3807
|
+
var DropdownComponent = (0, import_react19.forwardRef)(function Dropdown(dropdownProps, ref) {
|
|
3722
3808
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
3723
3809
|
const {
|
|
3724
3810
|
label,
|
|
@@ -3744,6 +3830,7 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
3744
3830
|
debounceDelay = 0.5,
|
|
3745
3831
|
debounceIsLoading,
|
|
3746
3832
|
debounceMinimumSymbolsRequired,
|
|
3833
|
+
withoutArrow,
|
|
3747
3834
|
withoutClearButton,
|
|
3748
3835
|
withoutRenderingOptionsWhenClosed,
|
|
3749
3836
|
onChange,
|
|
@@ -3752,34 +3839,35 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
3752
3839
|
renderOptionDivider,
|
|
3753
3840
|
withMultiselect,
|
|
3754
3841
|
id,
|
|
3842
|
+
textAlign,
|
|
3755
3843
|
...props
|
|
3756
3844
|
} = useComponentsPropsMerger(
|
|
3757
3845
|
betterHtmlContextInternal.components.dropdown?.style?.default,
|
|
3758
3846
|
dropdownProps
|
|
3759
3847
|
);
|
|
3760
3848
|
const theme2 = (0, import_react_better_core17.useTheme)();
|
|
3761
|
-
const inputFieldHolderRef = (0,
|
|
3762
|
-
const buttonsRef = (0,
|
|
3763
|
-
const inputRef = (0,
|
|
3849
|
+
const inputFieldHolderRef = (0, import_react19.useRef)(null);
|
|
3850
|
+
const buttonsRef = (0, import_react19.useRef)(null);
|
|
3851
|
+
const inputRef = (0, import_react19.useRef)(null);
|
|
3764
3852
|
const [isOpen, setIsOpen] = (0, import_react_better_core17.useBooleanState)();
|
|
3765
3853
|
const [isOpenLate, setIsOpenLate] = (0, import_react_better_core17.useBooleanState)();
|
|
3766
3854
|
const [isFocused, setIsFocused] = (0, import_react_better_core17.useBooleanState)();
|
|
3767
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
3855
|
+
const [searchQuery, setSearchQuery] = (0, import_react19.useState)("");
|
|
3768
3856
|
const [_, debouncedSearchQuery, setDebouncedSearchQuery, isLoadingDebouncedSearchQuery] = (0, import_react_better_core17.useDebounceState)(
|
|
3769
3857
|
"",
|
|
3770
3858
|
debounceDelay
|
|
3771
3859
|
);
|
|
3772
|
-
const [focusedOptionIndex, setFocusedOptionIndex] = (0,
|
|
3773
|
-
const [internalValue, setInternalValue] = (0,
|
|
3860
|
+
const [focusedOptionIndex, setFocusedOptionIndex] = (0, import_react19.useState)();
|
|
3861
|
+
const [internalValue, setInternalValue] = (0, import_react19.useState)(defaultValue);
|
|
3774
3862
|
const value = controlledValue ?? internalValue;
|
|
3775
|
-
const filteredOptions = (0,
|
|
3863
|
+
const filteredOptions = (0, import_react19.useMemo)(() => {
|
|
3776
3864
|
if (!searchQuery) return options;
|
|
3777
3865
|
const query = searchQuery.toLowerCase();
|
|
3778
3866
|
return options.filter(
|
|
3779
3867
|
(option) => option.label.toLowerCase().includes(query) || option.searchValues?.some((value2) => value2.toLowerCase().includes(query))
|
|
3780
3868
|
);
|
|
3781
3869
|
}, [options, searchQuery]);
|
|
3782
|
-
const onKeyDownInputField = (0,
|
|
3870
|
+
const onKeyDownInputField = (0, import_react19.useCallback)(
|
|
3783
3871
|
(event) => {
|
|
3784
3872
|
if (event.key === "Enter" || !withSearch && event.key === " ") {
|
|
3785
3873
|
event.preventDefault();
|
|
@@ -3835,7 +3923,7 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
3835
3923
|
withMultiselect
|
|
3836
3924
|
]
|
|
3837
3925
|
);
|
|
3838
|
-
const onClickOption = (0,
|
|
3926
|
+
const onClickOption = (0, import_react19.useCallback)(
|
|
3839
3927
|
(option) => {
|
|
3840
3928
|
if (!option.disabled) {
|
|
3841
3929
|
const clickedValue = option.value;
|
|
@@ -3852,7 +3940,7 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
3852
3940
|
},
|
|
3853
3941
|
[onChange, internalValue, controlledValue, withMultiselect]
|
|
3854
3942
|
);
|
|
3855
|
-
const onClickClearButton = (0,
|
|
3943
|
+
const onClickClearButton = (0, import_react19.useCallback)(
|
|
3856
3944
|
(event) => {
|
|
3857
3945
|
event.stopPropagation();
|
|
3858
3946
|
setInternalValue(void 0);
|
|
@@ -3864,7 +3952,7 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
3864
3952
|
},
|
|
3865
3953
|
[onChange]
|
|
3866
3954
|
);
|
|
3867
|
-
const onChangeValue = (0,
|
|
3955
|
+
const onChangeValue = (0, import_react19.useCallback)(
|
|
3868
3956
|
(newValue) => {
|
|
3869
3957
|
setSearchQuery(newValue);
|
|
3870
3958
|
setIsOpen.setTrue();
|
|
@@ -3873,19 +3961,19 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
3873
3961
|
},
|
|
3874
3962
|
[withDebounce, onChangeSearch]
|
|
3875
3963
|
);
|
|
3876
|
-
const selectedOption = (0,
|
|
3964
|
+
const selectedOption = (0, import_react19.useMemo)(
|
|
3877
3965
|
() => withMultiselect ? options.filter((option) => Array.isArray(value) ? value.includes(option.value) : false) : options.find((option) => option.value === value),
|
|
3878
3966
|
[options, value]
|
|
3879
3967
|
);
|
|
3880
|
-
const renderedOptions = (0,
|
|
3881
|
-
() => /* @__PURE__ */ (0,
|
|
3968
|
+
const renderedOptions = (0, import_react19.useMemo)(
|
|
3969
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3882
3970
|
renderOptionDivider ? renderOptionDivider(void 0, filteredOptions[0], -1, 0) : void 0,
|
|
3883
3971
|
filteredOptions.map((option, index) => {
|
|
3884
3972
|
const isSelected = withMultiselect ? Array.isArray(value) ? value.includes(option.value) : false : option.value === value;
|
|
3885
3973
|
const isDisabled = option.disabled;
|
|
3886
3974
|
const isFocused2 = index === focusedOptionIndex;
|
|
3887
|
-
return /* @__PURE__ */ (0,
|
|
3888
|
-
/* @__PURE__ */ (0,
|
|
3975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react19.Fragment, { children: [
|
|
3976
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3889
3977
|
Div_default,
|
|
3890
3978
|
{
|
|
3891
3979
|
color: isDisabled ? theme2.colors.textSecondary + "80" : isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
@@ -3900,7 +3988,7 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
3900
3988
|
role: "option",
|
|
3901
3989
|
"aria-selected": isSelected,
|
|
3902
3990
|
"aria-disabled": isDisabled,
|
|
3903
|
-
children: renderOption ? renderOption(option, index, isSelected) : /* @__PURE__ */ (0,
|
|
3991
|
+
children: renderOption ? renderOption(option, index, isSelected) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, { children: !option.renderType || option.renderType === "default" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text_default, { children: option.label }) : option.renderType === "chip" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Chip_default, { text: option.label, ...option.chipProps }) : option.renderType === "chip.colored" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Chip_default.colored, { text: option.label, withWhiteBackground: true, ...option.chipProps }) : void 0 })
|
|
3904
3992
|
}
|
|
3905
3993
|
),
|
|
3906
3994
|
renderOptionDivider ? renderOptionDivider(
|
|
@@ -3923,10 +4011,10 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
3923
4011
|
renderOptionDivider
|
|
3924
4012
|
]
|
|
3925
4013
|
);
|
|
3926
|
-
(0,
|
|
4014
|
+
(0, import_react19.useEffect)(() => {
|
|
3927
4015
|
setInternalValue(controlledValue);
|
|
3928
4016
|
}, [controlledValue]);
|
|
3929
|
-
(0,
|
|
4017
|
+
(0, import_react19.useEffect)(() => {
|
|
3930
4018
|
if (isOpen) {
|
|
3931
4019
|
setIsOpenLate.setTrue();
|
|
3932
4020
|
if (withSearch && inputRef.current) inputRef.current.focus();
|
|
@@ -3937,10 +4025,10 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
3937
4025
|
};
|
|
3938
4026
|
}
|
|
3939
4027
|
}, [isOpen, withSearch]);
|
|
3940
|
-
(0,
|
|
4028
|
+
(0, import_react19.useEffect)(() => {
|
|
3941
4029
|
setFocusedOptionIndex(void 0);
|
|
3942
4030
|
}, [filteredOptions]);
|
|
3943
|
-
(0,
|
|
4031
|
+
(0, import_react19.useEffect)(() => {
|
|
3944
4032
|
const handleClickOutside = (event) => {
|
|
3945
4033
|
if (inputFieldHolderRef.current && buttonsRef.current && !inputFieldHolderRef.current.contains(event.target) && !buttonsRef.current.contains(event.target)) {
|
|
3946
4034
|
setIsOpen.setFalse();
|
|
@@ -3955,14 +4043,14 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
3955
4043
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
3956
4044
|
};
|
|
3957
4045
|
}, [isOpen]);
|
|
3958
|
-
(0,
|
|
4046
|
+
(0, import_react19.useEffect)(() => {
|
|
3959
4047
|
if (!withDebounce) return;
|
|
3960
4048
|
onChangeSearch?.(debouncedSearchQuery);
|
|
3961
4049
|
}, [withDebounce, onChangeSearch, debouncedSearchQuery]);
|
|
3962
4050
|
const displayValue = (withSearch && isFocused ? searchQuery : !Array.isArray(selectedOption) ? selectedOption?.label : void 0) ?? "";
|
|
3963
4051
|
const withClearButton = isOpen && (Array.isArray(selectedOption) ? selectedOption.length > 0 : selectedOption);
|
|
3964
4052
|
const readyPlaceholder = placeholder ?? `Select ${!withMultiselect ? "an " : ""}${label?.toLowerCase() ?? (0, import_react_better_core17.getPluralWord)("option", withMultiselect ? 2 : 1)}`;
|
|
3965
|
-
return /* @__PURE__ */ (0,
|
|
4053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Div_default.column, { width: "100%", position: "relative", userSelect: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3966
4054
|
InputField_default,
|
|
3967
4055
|
{
|
|
3968
4056
|
label,
|
|
@@ -3975,6 +4063,7 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
3975
4063
|
errorText,
|
|
3976
4064
|
infoText,
|
|
3977
4065
|
required: withMultiselect ? (Array.isArray(value) ? value.length > 0 : value !== void 0) ? false : required : required,
|
|
4066
|
+
textAlign,
|
|
3978
4067
|
name,
|
|
3979
4068
|
disabled,
|
|
3980
4069
|
readOnly: !withSearch,
|
|
@@ -3984,13 +4073,13 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
3984
4073
|
placeholder: withSearch ? selectedOption && !Array.isArray(selectedOption) ? selectedOption.label : readyPlaceholder : readyPlaceholder,
|
|
3985
4074
|
leftIcon,
|
|
3986
4075
|
autoComplete: "off",
|
|
3987
|
-
className: `react-better-html-dropdown${Array.isArray(selectedOption) && selectedOption.length > 0 ? " react-better-html-dropdown-multiselect" : ""}${isOpen ? " react-better-html-dropdown-open" : ""}${isOpenLate ? " react-better-html-dropdown-open-late" : ""}${inputFieldClassName ? ` ${inputFieldClassName}` : ""}`,
|
|
4076
|
+
className: `react-better-html-dropdown${withoutArrow ? " react-better-html-dropdown-without-arrow" : ""}${Array.isArray(selectedOption) && selectedOption.length > 0 ? " react-better-html-dropdown-multiselect" : ""}${isOpen ? " react-better-html-dropdown-open" : ""}${isOpenLate ? " react-better-html-dropdown-open-late" : ""}${inputFieldClassName ? ` ${inputFieldClassName}` : ""}`,
|
|
3988
4077
|
onClick: !disabled ? withMultiselect ? setIsOpen.setTrue : setIsOpen.toggle : void 0,
|
|
3989
4078
|
onFocus: setIsFocused.setTrue,
|
|
3990
4079
|
onBlur: setIsFocused.setFalse,
|
|
3991
4080
|
onKeyDown: onKeyDownInputField,
|
|
3992
4081
|
onChangeValue: withSearch ? onChangeValue : void 0,
|
|
3993
|
-
insideInputFieldBeforeComponent: Array.isArray(selectedOption) && selectedOption.length > 0 ? /* @__PURE__ */ (0,
|
|
4082
|
+
insideInputFieldBeforeComponent: Array.isArray(selectedOption) && selectedOption.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3994
4083
|
Div_default,
|
|
3995
4084
|
{
|
|
3996
4085
|
width: "100%",
|
|
@@ -4003,14 +4092,14 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
4003
4092
|
paddingBlock: theme2.styles.gap,
|
|
4004
4093
|
paddingInline: (theme2.styles.space + theme2.styles.gap) / 2,
|
|
4005
4094
|
transition: theme2.styles.transition,
|
|
4006
|
-
children: /* @__PURE__ */ (0,
|
|
4095
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Div_default.row, { width: "100%", flexWrap: "wrap", gap: theme2.styles.gap, children: selectedOption.map((option) => {
|
|
4007
4096
|
const ChipComponentTag = !option.renderType || option.renderType === "default" || option.renderType === "chip" ? Chip_default : option.renderType === "chip.colored" ? Chip_default.colored : Chip_default;
|
|
4008
4097
|
const withXButton = isFocused || isOpen;
|
|
4009
|
-
return /* @__PURE__ */ (0,
|
|
4098
|
+
return /* @__PURE__ */ (0, import_react20.createElement)(
|
|
4010
4099
|
ChipComponentTag,
|
|
4011
4100
|
{
|
|
4012
4101
|
text: option.label,
|
|
4013
|
-
afterText: withXButton && /* @__PURE__ */ (0,
|
|
4102
|
+
afterText: withXButton && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4014
4103
|
Button_default.icon,
|
|
4015
4104
|
{
|
|
4016
4105
|
icon: "XMark",
|
|
@@ -4032,8 +4121,8 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
4032
4121
|
}) })
|
|
4033
4122
|
}
|
|
4034
4123
|
) : void 0,
|
|
4035
|
-
insideInputFieldAfterComponent: /* @__PURE__ */ (0,
|
|
4036
|
-
/* @__PURE__ */ (0,
|
|
4124
|
+
insideInputFieldAfterComponent: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
4125
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4037
4126
|
Div_default,
|
|
4038
4127
|
{
|
|
4039
4128
|
position: "absolute",
|
|
@@ -4055,10 +4144,10 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
4055
4144
|
transition: theme2.styles.transition,
|
|
4056
4145
|
role: "listbox",
|
|
4057
4146
|
"aria-label": label,
|
|
4058
|
-
children: isLoadingDebouncedSearchQuery || debounceIsLoading ? /* @__PURE__ */ (0,
|
|
4147
|
+
children: isLoadingDebouncedSearchQuery || debounceIsLoading ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Div_default, { padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Loader_default.text, {}) }) : filteredOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, { children: (withoutRenderingOptionsWhenClosed ? isOpen || isOpenLate : true) ? renderedOptions : void 0 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Div_default, { padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text_default.unknown, { textAlign: "left", children: debounceMinimumSymbolsRequired !== void 0 && searchQuery.length < debounceMinimumSymbolsRequired ? `Enter at least ${debounceMinimumSymbolsRequired} characters` : "No options" }) })
|
|
4059
4148
|
}
|
|
4060
4149
|
),
|
|
4061
|
-
/* @__PURE__ */ (0,
|
|
4150
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
4062
4151
|
Div_default.row,
|
|
4063
4152
|
{
|
|
4064
4153
|
position: "absolute",
|
|
@@ -4073,7 +4162,7 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
4073
4162
|
zIndex: isOpen || isOpenLate ? 1001 : void 0,
|
|
4074
4163
|
ref: buttonsRef,
|
|
4075
4164
|
children: [
|
|
4076
|
-
!withoutClearButton && /* @__PURE__ */ (0,
|
|
4165
|
+
!withoutClearButton && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4077
4166
|
Button_default.icon,
|
|
4078
4167
|
{
|
|
4079
4168
|
icon: "XMark",
|
|
@@ -4086,7 +4175,7 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
4086
4175
|
disabled: !withClearButton
|
|
4087
4176
|
}
|
|
4088
4177
|
),
|
|
4089
|
-
/* @__PURE__ */ (0,
|
|
4178
|
+
!withoutArrow && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4090
4179
|
Icon_default,
|
|
4091
4180
|
{
|
|
4092
4181
|
name: "chevronDown",
|
|
@@ -4114,21 +4203,21 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
|
|
|
4114
4203
|
}
|
|
4115
4204
|
) });
|
|
4116
4205
|
});
|
|
4117
|
-
DropdownComponent.countries = (0,
|
|
4206
|
+
DropdownComponent.countries = (0, import_react19.forwardRef)(function Countries(dropdownProps, ref) {
|
|
4118
4207
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4119
4208
|
const props = useComponentsPropsMerger(
|
|
4120
4209
|
betterHtmlContextInternal.components.dropdown?.style?.countries,
|
|
4121
4210
|
dropdownProps
|
|
4122
4211
|
);
|
|
4123
4212
|
const theme2 = (0, import_react_better_core17.useTheme)();
|
|
4124
|
-
const renderOption = (0,
|
|
4125
|
-
(option, index, isSelected) => /* @__PURE__ */ (0,
|
|
4126
|
-
/* @__PURE__ */ (0,
|
|
4127
|
-
/* @__PURE__ */ (0,
|
|
4213
|
+
const renderOption = (0, import_react19.useCallback)(
|
|
4214
|
+
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
4215
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
4216
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text_default, { children: option.label })
|
|
4128
4217
|
] }),
|
|
4129
4218
|
[]
|
|
4130
4219
|
);
|
|
4131
|
-
const options = (0,
|
|
4220
|
+
const options = (0, import_react19.useMemo)(
|
|
4132
4221
|
() => import_react_better_core17.countries.map(
|
|
4133
4222
|
(country) => ({
|
|
4134
4223
|
value: country.code,
|
|
@@ -4139,7 +4228,7 @@ DropdownComponent.countries = (0, import_react18.forwardRef)(function Countries(
|
|
|
4139
4228
|
),
|
|
4140
4229
|
[]
|
|
4141
4230
|
);
|
|
4142
|
-
return /* @__PURE__ */ (0,
|
|
4231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4143
4232
|
DropdownComponent,
|
|
4144
4233
|
{
|
|
4145
4234
|
placeholder: "Select a country",
|
|
@@ -4151,15 +4240,63 @@ DropdownComponent.countries = (0, import_react18.forwardRef)(function Countries(
|
|
|
4151
4240
|
}
|
|
4152
4241
|
);
|
|
4153
4242
|
});
|
|
4154
|
-
|
|
4243
|
+
DropdownComponent.language = (0, import_react19.forwardRef)(function Countries2({ isSmall, ...dropdownProps }, ref) {
|
|
4244
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4245
|
+
const { inputFieldClassName, ...props } = useComponentsPropsMerger(
|
|
4246
|
+
betterHtmlContextInternal.components.dropdown?.style?.language,
|
|
4247
|
+
dropdownProps
|
|
4248
|
+
);
|
|
4249
|
+
const theme2 = (0, import_react_better_core17.useTheme)();
|
|
4250
|
+
const renderOption = (0, import_react19.useCallback)(
|
|
4251
|
+
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { alignItems: "center", justifyContent: isSmall ? "center" : void 0, gap: theme2.styles.gap, children: [
|
|
4252
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Image_default, { src: `https://flagcdn.com/w80/${option.data?.flagCode.toString().toLowerCase()}.webp`, width: 20 }),
|
|
4253
|
+
!isSmall && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text_default, { children: option.label })
|
|
4254
|
+
] }),
|
|
4255
|
+
[isSmall]
|
|
4256
|
+
);
|
|
4257
|
+
const onChange = (0, import_react19.useCallback)((value) => {
|
|
4258
|
+
betterHtmlContextInternal.setLanguage(value);
|
|
4259
|
+
localStorage.setItem("language", value);
|
|
4260
|
+
}, []);
|
|
4261
|
+
const options = (0, import_react19.useMemo)(
|
|
4262
|
+
() => Object.values(betterHtmlContextInternal.languages).map(
|
|
4263
|
+
(data) => ({
|
|
4264
|
+
value: data.code,
|
|
4265
|
+
label: isSmall ? data.code.toUpperCase() : data.name,
|
|
4266
|
+
data,
|
|
4267
|
+
searchValues: [data.code]
|
|
4268
|
+
})
|
|
4269
|
+
),
|
|
4270
|
+
[]
|
|
4271
|
+
);
|
|
4272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4273
|
+
DropdownComponent,
|
|
4274
|
+
{
|
|
4275
|
+
placeholder: isSmall ? "lang" : "Select a language",
|
|
4276
|
+
withoutClearButton: true,
|
|
4277
|
+
withoutArrow: isSmall,
|
|
4278
|
+
width: isSmall ? 60 : void 0,
|
|
4279
|
+
textAlign: isSmall ? "center" : void 0,
|
|
4280
|
+
inputFieldClassName: `${inputFieldClassName}${isSmall ? " react-better-html-dropdown-no-horizontal-padding" : ""}`,
|
|
4281
|
+
options,
|
|
4282
|
+
renderOption,
|
|
4283
|
+
value: betterHtmlContextInternal.language,
|
|
4284
|
+
onChange,
|
|
4285
|
+
ref,
|
|
4286
|
+
...props
|
|
4287
|
+
}
|
|
4288
|
+
);
|
|
4289
|
+
});
|
|
4290
|
+
var Dropdown2 = (0, import_react19.memo)(DropdownComponent);
|
|
4155
4291
|
Dropdown2.countries = DropdownComponent.countries;
|
|
4292
|
+
Dropdown2.language = DropdownComponent.language;
|
|
4156
4293
|
var Dropdown_default = Dropdown2;
|
|
4157
4294
|
|
|
4158
4295
|
// src/components/Calendar.tsx
|
|
4159
|
-
var
|
|
4296
|
+
var import_react21 = require("react");
|
|
4160
4297
|
var import_react_better_core18 = require("react-better-core");
|
|
4161
4298
|
var import_styled_components10 = __toESM(require("styled-components"));
|
|
4162
|
-
var
|
|
4299
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
4163
4300
|
var getMonthName = (month, short = false) => {
|
|
4164
4301
|
return [
|
|
4165
4302
|
short ? "Jan" : "January",
|
|
@@ -4210,24 +4347,24 @@ var SelectComponent = import_styled_components10.default.select.withConfig({
|
|
|
4210
4347
|
`;
|
|
4211
4348
|
function Calendar({ value, minDate, maxDate, onChange }) {
|
|
4212
4349
|
const theme2 = (0, import_react_better_core18.useTheme)();
|
|
4213
|
-
const internalYearSelectId = (0,
|
|
4214
|
-
const [currentDate, setCurrentDate] = (0,
|
|
4215
|
-
const [currentMonth, setCurrentMonth] = (0,
|
|
4216
|
-
const [currentYear, setCurrentYear] = (0,
|
|
4217
|
-
const daysInMonth = (0,
|
|
4218
|
-
const onClickPreviousMonthButton = (0,
|
|
4350
|
+
const internalYearSelectId = (0, import_react21.useId)();
|
|
4351
|
+
const [currentDate, setCurrentDate] = (0, import_react21.useState)(value ? new Date(value) : void 0);
|
|
4352
|
+
const [currentMonth, setCurrentMonth] = (0, import_react21.useState)(currentDate?.getMonth() ?? (/* @__PURE__ */ new Date()).getMonth());
|
|
4353
|
+
const [currentYear, setCurrentYear] = (0, import_react21.useState)(currentDate?.getFullYear() ?? (/* @__PURE__ */ new Date()).getFullYear());
|
|
4354
|
+
const daysInMonth = (0, import_react21.useMemo)(() => new Date(currentYear, currentMonth + 1, 0).getDate(), [currentMonth, currentYear]);
|
|
4355
|
+
const onClickPreviousMonthButton = (0, import_react21.useCallback)(() => {
|
|
4219
4356
|
const newMonth = currentMonth === 0 ? 11 : currentMonth - 1;
|
|
4220
4357
|
const newYear = currentMonth === 0 ? currentYear - 1 : currentYear;
|
|
4221
4358
|
setCurrentMonth(newMonth);
|
|
4222
4359
|
setCurrentYear(newYear);
|
|
4223
4360
|
}, [currentMonth, currentYear]);
|
|
4224
|
-
const onClickNextMonthButton = (0,
|
|
4361
|
+
const onClickNextMonthButton = (0, import_react21.useCallback)(() => {
|
|
4225
4362
|
const newMonth = currentMonth === 11 ? 0 : currentMonth + 1;
|
|
4226
4363
|
const newYear = currentMonth === 11 ? currentYear + 1 : currentYear;
|
|
4227
4364
|
setCurrentMonth(newMonth);
|
|
4228
4365
|
setCurrentYear(newYear);
|
|
4229
4366
|
}, [currentMonth, currentYear]);
|
|
4230
|
-
const onClickDay = (0,
|
|
4367
|
+
const onClickDay = (0, import_react21.useCallback)(
|
|
4231
4368
|
(day) => {
|
|
4232
4369
|
if (!day) return;
|
|
4233
4370
|
const newDate = new Date(currentYear, currentMonth, day);
|
|
@@ -4238,25 +4375,25 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
4238
4375
|
},
|
|
4239
4376
|
[currentMonth, currentYear, onChange]
|
|
4240
4377
|
);
|
|
4241
|
-
const onClickClear = (0,
|
|
4378
|
+
const onClickClear = (0, import_react21.useCallback)(() => {
|
|
4242
4379
|
setCurrentDate(void 0);
|
|
4243
4380
|
onChange?.(void 0);
|
|
4244
4381
|
}, []);
|
|
4245
|
-
const onClickToday = (0,
|
|
4382
|
+
const onClickToday = (0, import_react21.useCallback)(() => {
|
|
4246
4383
|
const today = /* @__PURE__ */ new Date();
|
|
4247
4384
|
setCurrentDate(today);
|
|
4248
4385
|
onChange?.(
|
|
4249
4386
|
`${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`
|
|
4250
4387
|
);
|
|
4251
4388
|
}, [onChange]);
|
|
4252
|
-
const onChangeYearSelect = (0,
|
|
4389
|
+
const onChangeYearSelect = (0, import_react21.useCallback)((event) => {
|
|
4253
4390
|
setCurrentYear(parseInt(event.target.value));
|
|
4254
4391
|
}, []);
|
|
4255
|
-
const firstDayOfMonth = (0,
|
|
4392
|
+
const firstDayOfMonth = (0, import_react21.useMemo)(() => {
|
|
4256
4393
|
const day = new Date(currentYear, currentMonth, 1).getDay();
|
|
4257
4394
|
return day === 0 ? 6 : day - 1;
|
|
4258
4395
|
}, [currentMonth, currentYear]);
|
|
4259
|
-
const days = (0,
|
|
4396
|
+
const days = (0, import_react21.useMemo)(() => {
|
|
4260
4397
|
const result = [];
|
|
4261
4398
|
for (let index = 0; index < firstDayOfMonth; index++) {
|
|
4262
4399
|
result.push(void 0);
|
|
@@ -4266,44 +4403,44 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
4266
4403
|
}
|
|
4267
4404
|
return result;
|
|
4268
4405
|
}, [daysInMonth, firstDayOfMonth]);
|
|
4269
|
-
(0,
|
|
4406
|
+
(0, import_react21.useEffect)(() => {
|
|
4270
4407
|
if (!value) return;
|
|
4271
4408
|
const date = new Date(value);
|
|
4272
4409
|
setCurrentDate(date);
|
|
4273
4410
|
setCurrentMonth(date.getMonth());
|
|
4274
4411
|
setCurrentYear(date.getFullYear());
|
|
4275
4412
|
}, [value]);
|
|
4276
|
-
return /* @__PURE__ */ (0,
|
|
4277
|
-
/* @__PURE__ */ (0,
|
|
4278
|
-
/* @__PURE__ */ (0,
|
|
4279
|
-
/* @__PURE__ */ (0,
|
|
4280
|
-
/* @__PURE__ */ (0,
|
|
4281
|
-
/* @__PURE__ */ (0,
|
|
4282
|
-
/* @__PURE__ */ (0,
|
|
4283
|
-
/* @__PURE__ */ (0,
|
|
4284
|
-
/* @__PURE__ */ (0,
|
|
4413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", maxWidth: 320, gap: theme2.styles.gap, padding: theme2.styles.space / 2, userSelect: "none", children: [
|
|
4414
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
|
|
4415
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button_default.icon, { icon: "chevronLeft", onClick: onClickPreviousMonthButton }),
|
|
4416
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { alignItems: "center", gap: 4, children: [
|
|
4417
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { fontWeight: 700, children: getMonthName(currentMonth) }),
|
|
4418
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectWrapperComponent, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { position: "relative", alignItems: "center", gap: 2, children: [
|
|
4419
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { fontWeight: 700, children: currentYear }),
|
|
4420
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon_default, { name: "chevronDown", size: 12 }),
|
|
4421
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4285
4422
|
SelectComponent,
|
|
4286
4423
|
{
|
|
4287
4424
|
theme: theme2,
|
|
4288
4425
|
value: currentYear,
|
|
4289
4426
|
onChange: onChangeYearSelect,
|
|
4290
4427
|
id: internalYearSelectId,
|
|
4291
|
-
children: yearsRange.map((year) => /* @__PURE__ */ (0,
|
|
4428
|
+
children: yearsRange.map((year) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: year, children: year }, year))
|
|
4292
4429
|
}
|
|
4293
4430
|
)
|
|
4294
4431
|
] }) })
|
|
4295
4432
|
] }),
|
|
4296
|
-
/* @__PURE__ */ (0,
|
|
4433
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button_default.icon, { icon: "chevronRight", onClick: onClickNextMonthButton })
|
|
4297
4434
|
] }),
|
|
4298
|
-
/* @__PURE__ */ (0,
|
|
4299
|
-
weekDaysIndex.map((day) => /* @__PURE__ */ (0,
|
|
4435
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.grid, { width: "100%", gridTemplateColumns: "repeat(7, 1fr)", gap: theme2.styles.gap / 2, children: [
|
|
4436
|
+
weekDaysIndex.map((day) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Div_default.row, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", children: getWeekDayName(day, true) }) }, day)),
|
|
4300
4437
|
days.map((day, index) => {
|
|
4301
4438
|
const thisDayDate = new Date(currentYear, currentMonth, day);
|
|
4302
4439
|
const isSelected = day !== void 0 && day === currentDate?.getDate() && currentMonth === currentDate.getMonth() && currentYear === currentDate.getFullYear();
|
|
4303
4440
|
const isToday = thisDayDate.getDate() === (/* @__PURE__ */ new Date()).getDate() && thisDayDate.getMonth() === (/* @__PURE__ */ new Date()).getMonth() && thisDayDate.getFullYear() === (/* @__PURE__ */ new Date()).getFullYear();
|
|
4304
4441
|
const isWeekend = thisDayDate.getDay() === 6 || thisDayDate.getDay() === 0;
|
|
4305
4442
|
const isDisabled = minDate && thisDayDate.getTime() < minDate.getTime() || maxDate && thisDayDate.getTime() > maxDate.getTime();
|
|
4306
|
-
return /* @__PURE__ */ (0,
|
|
4443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
4307
4444
|
Div_default.row,
|
|
4308
4445
|
{
|
|
4309
4446
|
position: "relative",
|
|
@@ -4320,7 +4457,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
4320
4457
|
value: day,
|
|
4321
4458
|
onClickWithValue: !isDisabled ? onClickDay : void 0,
|
|
4322
4459
|
children: [
|
|
4323
|
-
day && /* @__PURE__ */ (0,
|
|
4460
|
+
day && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4324
4461
|
Text_default,
|
|
4325
4462
|
{
|
|
4326
4463
|
fontSize: 14,
|
|
@@ -4329,7 +4466,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
4329
4466
|
children: day
|
|
4330
4467
|
}
|
|
4331
4468
|
),
|
|
4332
|
-
isDisabled && /* @__PURE__ */ (0,
|
|
4469
|
+
isDisabled && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4333
4470
|
Div_default,
|
|
4334
4471
|
{
|
|
4335
4472
|
position: "absolute",
|
|
@@ -4348,8 +4485,8 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
4348
4485
|
);
|
|
4349
4486
|
})
|
|
4350
4487
|
] }),
|
|
4351
|
-
/* @__PURE__ */ (0,
|
|
4352
|
-
/* @__PURE__ */ (0,
|
|
4488
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
|
|
4489
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Div_default, { isTabAccessed: true, cursor: "pointer", onClick: onClickClear, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4353
4490
|
Text_default,
|
|
4354
4491
|
{
|
|
4355
4492
|
fontSize: 14,
|
|
@@ -4359,7 +4496,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
4359
4496
|
children: "Clear"
|
|
4360
4497
|
}
|
|
4361
4498
|
) }),
|
|
4362
|
-
/* @__PURE__ */ (0,
|
|
4499
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Div_default, { isTabAccessed: true, cursor: "pointer", onClick: onClickToday, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4363
4500
|
Text_default,
|
|
4364
4501
|
{
|
|
4365
4502
|
fontSize: 14,
|
|
@@ -4372,10 +4509,10 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
4372
4509
|
] })
|
|
4373
4510
|
] });
|
|
4374
4511
|
}
|
|
4375
|
-
var Calendar_default = (0,
|
|
4512
|
+
var Calendar_default = (0, import_react21.memo)(Calendar);
|
|
4376
4513
|
|
|
4377
4514
|
// src/components/InputField.tsx
|
|
4378
|
-
var
|
|
4515
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4379
4516
|
var buttonWidth = 50;
|
|
4380
4517
|
var colorPickerSpacing = 4;
|
|
4381
4518
|
var colorPickerColorWidth = 12 + 27 + colorPickerSpacing;
|
|
@@ -4485,6 +4622,15 @@ var InputElement = import_styled_components11.default.input.withConfig({
|
|
|
4485
4622
|
&.react-better-html-dropdown {
|
|
4486
4623
|
padding-right: ${(props) => props.theme.styles.space + 16 + props.theme.styles.space - props.theme.styles.borderWidth}px;
|
|
4487
4624
|
|
|
4625
|
+
&.react-better-html-dropdown-without-arrow {
|
|
4626
|
+
padding-right: ${(props) => props.theme.styles.space}px;
|
|
4627
|
+
}
|
|
4628
|
+
|
|
4629
|
+
&.react-better-html-dropdown-no-horizontal-padding {
|
|
4630
|
+
padding-left: 0px;
|
|
4631
|
+
padding-right: 0px;
|
|
4632
|
+
}
|
|
4633
|
+
|
|
4488
4634
|
&.react-better-html-dropdown-multiselect {
|
|
4489
4635
|
border-top: none;
|
|
4490
4636
|
border-top-left-radius: 0px;
|
|
@@ -4556,7 +4702,7 @@ var TextareaElement = import_styled_components11.default.textarea.withConfig({
|
|
|
4556
4702
|
`;
|
|
4557
4703
|
var hours = Array.from({ length: 24 }, (_, index) => index);
|
|
4558
4704
|
var minutes = Array.from({ length: 60 }, (_, index) => index);
|
|
4559
|
-
var InputFieldComponent = (0,
|
|
4705
|
+
var InputFieldComponent = (0, import_react22.forwardRef)(function InputField(inputFieldProps, ref) {
|
|
4560
4706
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4561
4707
|
const {
|
|
4562
4708
|
label,
|
|
@@ -4588,7 +4734,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inp
|
|
|
4588
4734
|
...props
|
|
4589
4735
|
} = useComponentsPropsMerger(betterHtmlContextInternal.components.inputField?.style?.default, inputFieldProps);
|
|
4590
4736
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4591
|
-
const internalId = (0,
|
|
4737
|
+
const internalId = (0, import_react22.useId)();
|
|
4592
4738
|
const { colorTheme } = (0, import_react_better_core19.useBetterCoreContext)();
|
|
4593
4739
|
const [_, debouncedValue, setDebouncedValue] = (0, import_react_better_core19.useDebounceState)(
|
|
4594
4740
|
props.value?.toString() ?? "",
|
|
@@ -4597,7 +4743,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inp
|
|
|
4597
4743
|
const { style, hoverStyle, excludeStyle, restProps } = useComponentPropsGrouper(props, true);
|
|
4598
4744
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
4599
4745
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
4600
|
-
const onChangeElement = (0,
|
|
4746
|
+
const onChangeElement = (0, import_react22.useCallback)(
|
|
4601
4747
|
(event) => {
|
|
4602
4748
|
const newValue = event.target.value;
|
|
4603
4749
|
if (withDebounce) {
|
|
@@ -4610,19 +4756,19 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inp
|
|
|
4610
4756
|
},
|
|
4611
4757
|
[onChange, onChangeValue, withDebounce]
|
|
4612
4758
|
);
|
|
4613
|
-
const leftIconZIndex = (0,
|
|
4759
|
+
const leftIconZIndex = (0, import_react22.useMemo)(
|
|
4614
4760
|
() => ["react-better-html-dropdown-open-late", "react-better-html-inputField-dateTime-opened-late"].some(
|
|
4615
4761
|
(classNameItem) => props.className?.includes(classNameItem)
|
|
4616
4762
|
) ? 1002 : 1,
|
|
4617
4763
|
[props.className]
|
|
4618
4764
|
);
|
|
4619
|
-
(0,
|
|
4765
|
+
(0, import_react22.useEffect)(() => {
|
|
4620
4766
|
if (!withDebounce) return;
|
|
4621
4767
|
onChangeValue?.(debouncedValue);
|
|
4622
4768
|
}, [withDebounce, onChangeValue, debouncedValue]);
|
|
4623
4769
|
const readyId = id ?? internalId;
|
|
4624
|
-
return /* @__PURE__ */ (0,
|
|
4625
|
-
label && /* @__PURE__ */ (0,
|
|
4770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { width: "100%", gap: labelGap ?? theme2.styles.gap / 2, ...excludeStyle, children: [
|
|
4771
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4626
4772
|
Label_default,
|
|
4627
4773
|
{
|
|
4628
4774
|
text: label,
|
|
@@ -4636,8 +4782,8 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inp
|
|
|
4636
4782
|
htmlFor: readyId
|
|
4637
4783
|
}
|
|
4638
4784
|
),
|
|
4639
|
-
/* @__PURE__ */ (0,
|
|
4640
|
-
prefix && /* @__PURE__ */ (0,
|
|
4785
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { alignItems: "stretch", width: "100%", children: [
|
|
4786
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4641
4787
|
Div_default.row,
|
|
4642
4788
|
{
|
|
4643
4789
|
alignItems: "center",
|
|
@@ -4651,10 +4797,10 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inp
|
|
|
4651
4797
|
children: prefix
|
|
4652
4798
|
}
|
|
4653
4799
|
),
|
|
4654
|
-
/* @__PURE__ */ (0,
|
|
4800
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default, { position: "relative", width: "100%", height: "fit-content", ref: holderRef, children: [
|
|
4655
4801
|
insideInputFieldBeforeComponent,
|
|
4656
|
-
/* @__PURE__ */ (0,
|
|
4657
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
4802
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default, { position: "relative", width: "100%", height: "fit-content", children: [
|
|
4803
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4658
4804
|
Icon_default,
|
|
4659
4805
|
{
|
|
4660
4806
|
name: leftIcon,
|
|
@@ -4666,7 +4812,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inp
|
|
|
4666
4812
|
zIndex: leftIconZIndex
|
|
4667
4813
|
}
|
|
4668
4814
|
),
|
|
4669
|
-
/* @__PURE__ */ (0,
|
|
4815
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4670
4816
|
InputElement,
|
|
4671
4817
|
{
|
|
4672
4818
|
theme: theme2,
|
|
@@ -4688,7 +4834,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inp
|
|
|
4688
4834
|
ref
|
|
4689
4835
|
}
|
|
4690
4836
|
),
|
|
4691
|
-
rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0,
|
|
4837
|
+
rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4692
4838
|
Button_default.icon,
|
|
4693
4839
|
{
|
|
4694
4840
|
icon: rightIcon,
|
|
@@ -4698,7 +4844,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inp
|
|
|
4698
4844
|
transform: "translateY(-50%)",
|
|
4699
4845
|
onClick: onClickRightIcon
|
|
4700
4846
|
}
|
|
4701
|
-
) : /* @__PURE__ */ (0,
|
|
4847
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4702
4848
|
Icon_default,
|
|
4703
4849
|
{
|
|
4704
4850
|
name: rightIcon,
|
|
@@ -4712,7 +4858,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inp
|
|
|
4712
4858
|
insideInputFieldAfterComponent
|
|
4713
4859
|
] })
|
|
4714
4860
|
] }),
|
|
4715
|
-
suffix && /* @__PURE__ */ (0,
|
|
4861
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4716
4862
|
Div_default.row,
|
|
4717
4863
|
{
|
|
4718
4864
|
alignItems: "center",
|
|
@@ -4727,7 +4873,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inp
|
|
|
4727
4873
|
}
|
|
4728
4874
|
)
|
|
4729
4875
|
] }),
|
|
4730
|
-
(errorText || infoText) && /* @__PURE__ */ (0,
|
|
4876
|
+
(errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4731
4877
|
Text_default,
|
|
4732
4878
|
{
|
|
4733
4879
|
as: "span",
|
|
@@ -4739,7 +4885,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inp
|
|
|
4739
4885
|
)
|
|
4740
4886
|
] });
|
|
4741
4887
|
});
|
|
4742
|
-
InputFieldComponent.multiline = (0,
|
|
4888
|
+
InputFieldComponent.multiline = (0, import_react22.forwardRef)(function Multiline(inputFieldProps, ref) {
|
|
4743
4889
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4744
4890
|
const {
|
|
4745
4891
|
label,
|
|
@@ -4765,12 +4911,12 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4765
4911
|
inputFieldProps
|
|
4766
4912
|
);
|
|
4767
4913
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4768
|
-
const internalId = (0,
|
|
4914
|
+
const internalId = (0, import_react22.useId)();
|
|
4769
4915
|
const { colorTheme } = (0, import_react_better_core19.useBetterCoreContext)();
|
|
4770
4916
|
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
4771
4917
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
4772
4918
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
4773
|
-
const onChangeElement = (0,
|
|
4919
|
+
const onChangeElement = (0, import_react22.useCallback)(
|
|
4774
4920
|
(event) => {
|
|
4775
4921
|
onChange?.(event);
|
|
4776
4922
|
onChangeValue?.(event.target.value);
|
|
@@ -4778,8 +4924,8 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4778
4924
|
[onChange, onChangeValue]
|
|
4779
4925
|
);
|
|
4780
4926
|
const readyId = id ?? internalId;
|
|
4781
|
-
return /* @__PURE__ */ (0,
|
|
4782
|
-
label && /* @__PURE__ */ (0,
|
|
4927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { gap: labelGap ?? theme2.styles.gap / 2, children: [
|
|
4928
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4783
4929
|
Label_default,
|
|
4784
4930
|
{
|
|
4785
4931
|
text: label,
|
|
@@ -4793,8 +4939,8 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4793
4939
|
htmlFor: readyId
|
|
4794
4940
|
}
|
|
4795
4941
|
),
|
|
4796
|
-
/* @__PURE__ */ (0,
|
|
4797
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
4942
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default, { position: "relative", width: "100%", children: [
|
|
4943
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4798
4944
|
Icon_default,
|
|
4799
4945
|
{
|
|
4800
4946
|
name: leftIcon,
|
|
@@ -4805,7 +4951,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4805
4951
|
pointerEvents: "none"
|
|
4806
4952
|
}
|
|
4807
4953
|
),
|
|
4808
|
-
/* @__PURE__ */ (0,
|
|
4954
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4809
4955
|
TextareaElement,
|
|
4810
4956
|
{
|
|
4811
4957
|
theme: theme2,
|
|
@@ -4825,7 +4971,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4825
4971
|
ref
|
|
4826
4972
|
}
|
|
4827
4973
|
),
|
|
4828
|
-
rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0,
|
|
4974
|
+
rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4829
4975
|
Button_default.icon,
|
|
4830
4976
|
{
|
|
4831
4977
|
icon: rightIcon,
|
|
@@ -4835,7 +4981,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4835
4981
|
transform: "translateY(-50%)",
|
|
4836
4982
|
onClick: onClickRightIcon
|
|
4837
4983
|
}
|
|
4838
|
-
) : /* @__PURE__ */ (0,
|
|
4984
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4839
4985
|
Icon_default,
|
|
4840
4986
|
{
|
|
4841
4987
|
name: rightIcon,
|
|
@@ -4847,7 +4993,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4847
4993
|
}
|
|
4848
4994
|
) : void 0
|
|
4849
4995
|
] }),
|
|
4850
|
-
(errorText || infoText) && /* @__PURE__ */ (0,
|
|
4996
|
+
(errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4851
4997
|
Text_default,
|
|
4852
4998
|
{
|
|
4853
4999
|
as: "span",
|
|
@@ -4860,13 +5006,13 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4860
5006
|
)
|
|
4861
5007
|
] });
|
|
4862
5008
|
});
|
|
4863
|
-
InputFieldComponent.email = (0,
|
|
5009
|
+
InputFieldComponent.email = (0, import_react22.forwardRef)(function Email(inputFieldProps, ref) {
|
|
4864
5010
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4865
5011
|
const props = useComponentsPropsMerger(
|
|
4866
5012
|
betterHtmlContextInternal.components.inputField?.style?.email,
|
|
4867
5013
|
inputFieldProps
|
|
4868
5014
|
);
|
|
4869
|
-
return /* @__PURE__ */ (0,
|
|
5015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4870
5016
|
InputFieldComponent,
|
|
4871
5017
|
{
|
|
4872
5018
|
type: "email",
|
|
@@ -4879,14 +5025,14 @@ InputFieldComponent.email = (0, import_react21.forwardRef)(function Email(inputF
|
|
|
4879
5025
|
}
|
|
4880
5026
|
);
|
|
4881
5027
|
});
|
|
4882
|
-
InputFieldComponent.password = (0,
|
|
5028
|
+
InputFieldComponent.password = (0, import_react22.forwardRef)(function Password(inputFieldProps, ref) {
|
|
4883
5029
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4884
5030
|
const props = useComponentsPropsMerger(
|
|
4885
5031
|
betterHtmlContextInternal.components.inputField?.style?.password,
|
|
4886
5032
|
inputFieldProps
|
|
4887
5033
|
);
|
|
4888
5034
|
const [isPassword, setIsPassword] = (0, import_react_better_core19.useBooleanState)(true);
|
|
4889
|
-
return /* @__PURE__ */ (0,
|
|
5035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4890
5036
|
InputFieldComponent,
|
|
4891
5037
|
{
|
|
4892
5038
|
type: isPassword ? "password" : "text",
|
|
@@ -4901,39 +5047,39 @@ InputFieldComponent.password = (0, import_react21.forwardRef)(function Password(
|
|
|
4901
5047
|
}
|
|
4902
5048
|
);
|
|
4903
5049
|
});
|
|
4904
|
-
InputFieldComponent.search = (0,
|
|
5050
|
+
InputFieldComponent.search = (0, import_react22.forwardRef)(function Search(inputFieldProps, ref) {
|
|
4905
5051
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4906
5052
|
const { value, onChangeValue, onFocus, onBlur, ...props } = useComponentsPropsMerger(
|
|
4907
5053
|
betterHtmlContextInternal.components.inputField?.style?.search,
|
|
4908
5054
|
inputFieldProps
|
|
4909
5055
|
);
|
|
4910
|
-
const [inputFieldValue, setInputFieldValue] = (0,
|
|
5056
|
+
const [inputFieldValue, setInputFieldValue] = (0, import_react22.useState)(value?.toString() ?? "");
|
|
4911
5057
|
const [inputFieldFocused, setInputFieldFocused] = (0, import_react_better_core19.useBooleanState)();
|
|
4912
|
-
const onChangeValueElement = (0,
|
|
5058
|
+
const onChangeValueElement = (0, import_react22.useCallback)(
|
|
4913
5059
|
(value2) => {
|
|
4914
5060
|
setInputFieldValue(value2);
|
|
4915
5061
|
onChangeValue?.(value2);
|
|
4916
5062
|
},
|
|
4917
5063
|
[onChangeValue]
|
|
4918
5064
|
);
|
|
4919
|
-
const onFocusElement = (0,
|
|
5065
|
+
const onFocusElement = (0, import_react22.useCallback)(
|
|
4920
5066
|
(event) => {
|
|
4921
5067
|
setInputFieldFocused.setTrue();
|
|
4922
5068
|
onFocus?.(event);
|
|
4923
5069
|
},
|
|
4924
5070
|
[onFocus]
|
|
4925
5071
|
);
|
|
4926
|
-
const onBlurElement = (0,
|
|
5072
|
+
const onBlurElement = (0, import_react22.useCallback)(
|
|
4927
5073
|
(event) => {
|
|
4928
5074
|
setTimeout(() => setInputFieldFocused.setFalse(), 0.1 * 1e3);
|
|
4929
5075
|
onBlur?.(event);
|
|
4930
5076
|
},
|
|
4931
5077
|
[onBlur]
|
|
4932
5078
|
);
|
|
4933
|
-
const onClickRightIcon = (0,
|
|
5079
|
+
const onClickRightIcon = (0, import_react22.useCallback)(() => {
|
|
4934
5080
|
onChangeValueElement("");
|
|
4935
5081
|
}, [onChangeValueElement]);
|
|
4936
|
-
return /* @__PURE__ */ (0,
|
|
5082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4937
5083
|
InputFieldComponent,
|
|
4938
5084
|
{
|
|
4939
5085
|
leftIcon: "magnifyingGlass",
|
|
@@ -4949,7 +5095,7 @@ InputFieldComponent.search = (0, import_react21.forwardRef)(function Search(inpu
|
|
|
4949
5095
|
}
|
|
4950
5096
|
);
|
|
4951
5097
|
});
|
|
4952
|
-
InputFieldComponent.phoneNumber = (0,
|
|
5098
|
+
InputFieldComponent.phoneNumber = (0, import_react22.forwardRef)(function PhoneNumber(inputFieldProps, ref) {
|
|
4953
5099
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4954
5100
|
const {
|
|
4955
5101
|
label,
|
|
@@ -4964,24 +5110,24 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
4964
5110
|
...props
|
|
4965
5111
|
} = useComponentsPropsMerger(betterHtmlContextInternal.components.inputField?.style?.phoneNumber, inputFieldProps);
|
|
4966
5112
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4967
|
-
const internalId = (0,
|
|
4968
|
-
const [dropdownValue, setDropdownValue] = (0,
|
|
4969
|
-
const [inputFieldValue, setInputFieldValue] = (0,
|
|
4970
|
-
const renderOption = (0,
|
|
4971
|
-
(option, index, isSelected) => /* @__PURE__ */ (0,
|
|
4972
|
-
/* @__PURE__ */ (0,
|
|
4973
|
-
/* @__PURE__ */ (0,
|
|
5113
|
+
const internalId = (0, import_react22.useId)();
|
|
5114
|
+
const [dropdownValue, setDropdownValue] = (0, import_react22.useState)();
|
|
5115
|
+
const [inputFieldValue, setInputFieldValue] = (0, import_react22.useState)(value?.toString() ?? "");
|
|
5116
|
+
const renderOption = (0, import_react22.useCallback)(
|
|
5117
|
+
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5118
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
5119
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { children: option.label })
|
|
4974
5120
|
] }),
|
|
4975
5121
|
[]
|
|
4976
5122
|
);
|
|
4977
|
-
const onChangeDropdown = (0,
|
|
5123
|
+
const onChangeDropdown = (0, import_react22.useCallback)(
|
|
4978
5124
|
(value2) => {
|
|
4979
5125
|
setDropdownValue(value2);
|
|
4980
5126
|
onChangeValue?.(value2 ? `+${value2}${inputFieldValue}` : inputFieldValue);
|
|
4981
5127
|
},
|
|
4982
5128
|
[onChangeValue, inputFieldValue]
|
|
4983
5129
|
);
|
|
4984
|
-
const onChangeValueElement = (0,
|
|
5130
|
+
const onChangeValueElement = (0, import_react22.useCallback)(
|
|
4985
5131
|
(value2) => {
|
|
4986
5132
|
const readyValue = value2.replace(/\D/g, "");
|
|
4987
5133
|
setInputFieldValue(readyValue);
|
|
@@ -4989,7 +5135,7 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
4989
5135
|
},
|
|
4990
5136
|
[onChangeValue, dropdownValue]
|
|
4991
5137
|
);
|
|
4992
|
-
const options = (0,
|
|
5138
|
+
const options = (0, import_react22.useMemo)(
|
|
4993
5139
|
() => import_react_better_core19.countries.map((country) => ({
|
|
4994
5140
|
value: country.phoneNumberExtension,
|
|
4995
5141
|
label: `+${country.phoneNumberExtension}`,
|
|
@@ -4997,13 +5143,13 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
4997
5143
|
})),
|
|
4998
5144
|
[]
|
|
4999
5145
|
);
|
|
5000
|
-
const defaultValue = (0,
|
|
5146
|
+
const defaultValue = (0, import_react22.useMemo)(() => {
|
|
5001
5147
|
const thisTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
5002
5148
|
const initialDefaultValue = options.find((option) => option.data?.timeZone === thisTimeZone)?.value ?? "";
|
|
5003
5149
|
setDropdownValue(initialDefaultValue);
|
|
5004
5150
|
return initialDefaultValue;
|
|
5005
5151
|
}, [options]);
|
|
5006
|
-
(0,
|
|
5152
|
+
(0, import_react22.useEffect)(() => {
|
|
5007
5153
|
if (value === void 0 || value === null) return;
|
|
5008
5154
|
const newValue = value.toString();
|
|
5009
5155
|
const country = import_react_better_core19.countries.find(
|
|
@@ -5021,8 +5167,8 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
5021
5167
|
}, [value]);
|
|
5022
5168
|
const readyId = id ?? internalId;
|
|
5023
5169
|
const readyLabel = betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.label ?? label;
|
|
5024
|
-
return /* @__PURE__ */ (0,
|
|
5025
|
-
readyLabel && /* @__PURE__ */ (0,
|
|
5170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, children: [
|
|
5171
|
+
readyLabel && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5026
5172
|
Label_default,
|
|
5027
5173
|
{
|
|
5028
5174
|
text: readyLabel,
|
|
@@ -5036,8 +5182,8 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
5036
5182
|
htmlFor: readyId
|
|
5037
5183
|
}
|
|
5038
5184
|
),
|
|
5039
|
-
/* @__PURE__ */ (0,
|
|
5040
|
-
/* @__PURE__ */ (0,
|
|
5185
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { children: [
|
|
5186
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5041
5187
|
Dropdown_default,
|
|
5042
5188
|
{
|
|
5043
5189
|
options,
|
|
@@ -5055,7 +5201,7 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
5055
5201
|
withoutRenderingOptionsWhenClosed: true
|
|
5056
5202
|
}
|
|
5057
5203
|
),
|
|
5058
|
-
/* @__PURE__ */ (0,
|
|
5204
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5059
5205
|
InputFieldComponent,
|
|
5060
5206
|
{
|
|
5061
5207
|
...betterHtmlContextInternal.components.inputField?.style?.phoneNumber,
|
|
@@ -5072,14 +5218,14 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
5072
5218
|
] })
|
|
5073
5219
|
] });
|
|
5074
5220
|
});
|
|
5075
|
-
InputFieldComponent.date = (0,
|
|
5221
|
+
InputFieldComponent.date = (0, import_react22.forwardRef)(function Date2({ minDate, maxDate, dropdownPosition = "left", ...inputFieldProps }, ref) {
|
|
5076
5222
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5077
5223
|
const props = useComponentsPropsMerger(
|
|
5078
5224
|
betterHtmlContextInternal.components.inputField?.style?.date,
|
|
5079
5225
|
inputFieldProps
|
|
5080
5226
|
);
|
|
5081
5227
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
5082
|
-
const holderRef = (0,
|
|
5228
|
+
const holderRef = (0, import_react22.useRef)(null);
|
|
5083
5229
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
5084
5230
|
const {
|
|
5085
5231
|
internalValue,
|
|
@@ -5088,19 +5234,19 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
5088
5234
|
insideInputFieldComponentProps,
|
|
5089
5235
|
isFocused
|
|
5090
5236
|
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5091
|
-
const onChange = (0,
|
|
5237
|
+
const onChange = (0, import_react22.useCallback)(
|
|
5092
5238
|
(date) => {
|
|
5093
5239
|
restInputFieldProps.onChangeValue?.(date ?? "");
|
|
5094
5240
|
setInternalValue(date ?? "");
|
|
5095
5241
|
},
|
|
5096
5242
|
[restInputFieldProps.onChangeValue]
|
|
5097
5243
|
);
|
|
5098
|
-
return /* @__PURE__ */ (0,
|
|
5244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5099
5245
|
InputFieldComponent,
|
|
5100
5246
|
{
|
|
5101
5247
|
...betterHtmlContextInternal.components.inputField?.style?.date,
|
|
5102
5248
|
type: "date",
|
|
5103
|
-
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0,
|
|
5249
|
+
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
5104
5250
|
Div_default,
|
|
5105
5251
|
{
|
|
5106
5252
|
position: "absolute",
|
|
@@ -5115,7 +5261,7 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
5115
5261
|
userSelect: "none",
|
|
5116
5262
|
...insideInputFieldComponentProps,
|
|
5117
5263
|
children: [
|
|
5118
|
-
/* @__PURE__ */ (0,
|
|
5264
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5119
5265
|
Div_default,
|
|
5120
5266
|
{
|
|
5121
5267
|
position: "absolute",
|
|
@@ -5128,7 +5274,7 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
5128
5274
|
transition: theme2.styles.transition
|
|
5129
5275
|
}
|
|
5130
5276
|
),
|
|
5131
|
-
/* @__PURE__ */ (0,
|
|
5277
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Calendar_default, { value: internalValue, minDate, maxDate, onChange })
|
|
5132
5278
|
]
|
|
5133
5279
|
}
|
|
5134
5280
|
) : void 0,
|
|
@@ -5139,7 +5285,7 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
5139
5285
|
}
|
|
5140
5286
|
);
|
|
5141
5287
|
});
|
|
5142
|
-
InputFieldComponent.dateTime = (0,
|
|
5288
|
+
InputFieldComponent.dateTime = (0, import_react22.forwardRef)(function DateTime({
|
|
5143
5289
|
hoursToRender,
|
|
5144
5290
|
minutesToRender,
|
|
5145
5291
|
minDate,
|
|
@@ -5155,9 +5301,9 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5155
5301
|
inputFieldProps
|
|
5156
5302
|
);
|
|
5157
5303
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
5158
|
-
const holderRef = (0,
|
|
5159
|
-
const selectedHourRef = (0,
|
|
5160
|
-
const selectedMinuteRef = (0,
|
|
5304
|
+
const holderRef = (0, import_react22.useRef)(null);
|
|
5305
|
+
const selectedHourRef = (0, import_react22.useRef)(null);
|
|
5306
|
+
const selectedMinuteRef = (0, import_react22.useRef)(null);
|
|
5161
5307
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
5162
5308
|
const {
|
|
5163
5309
|
internalValue,
|
|
@@ -5167,15 +5313,15 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5167
5313
|
isOpen,
|
|
5168
5314
|
isFocused
|
|
5169
5315
|
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5170
|
-
const readyHours = (0,
|
|
5316
|
+
const readyHours = (0, import_react22.useMemo)(
|
|
5171
5317
|
() => hoursToRender?.filter((hour) => hour >= 0 && hour <= 23) ?? hours,
|
|
5172
5318
|
[hoursToRender]
|
|
5173
5319
|
);
|
|
5174
|
-
const readyMinutes = (0,
|
|
5320
|
+
const readyMinutes = (0, import_react22.useMemo)(
|
|
5175
5321
|
() => minutesToRender?.filter((hour) => hour >= 0 && hour <= 59) ?? minutes,
|
|
5176
5322
|
[minutesToRender]
|
|
5177
5323
|
);
|
|
5178
|
-
const onChange = (0,
|
|
5324
|
+
const onChange = (0, import_react22.useCallback)(
|
|
5179
5325
|
(date) => {
|
|
5180
5326
|
const newValue = date ? `${date}T${internalValue?.toString().split("T")[1] ?? defaultTimeAfterDatePick}` : "";
|
|
5181
5327
|
restInputFieldProps.onChangeValue?.(newValue);
|
|
@@ -5183,7 +5329,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5183
5329
|
},
|
|
5184
5330
|
[internalValue, defaultTimeAfterDatePick, restInputFieldProps.onChangeValue]
|
|
5185
5331
|
);
|
|
5186
|
-
const onBlur = (0,
|
|
5332
|
+
const onBlur = (0, import_react22.useCallback)(
|
|
5187
5333
|
(event) => {
|
|
5188
5334
|
if (hoursToRender || minutesToRender) {
|
|
5189
5335
|
const value = event.target.value;
|
|
@@ -5209,7 +5355,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5209
5355
|
restInputFieldProps.onBlur
|
|
5210
5356
|
]
|
|
5211
5357
|
);
|
|
5212
|
-
const onClickHour = (0,
|
|
5358
|
+
const onClickHour = (0, import_react22.useCallback)(
|
|
5213
5359
|
(hour) => {
|
|
5214
5360
|
const newTime = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
5215
5361
|
const today = defaultDateAfterTimePick ?? `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
@@ -5219,7 +5365,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5219
5365
|
},
|
|
5220
5366
|
[defaultDateAfterTimePick, internalValue, restInputFieldProps.onChangeValue]
|
|
5221
5367
|
);
|
|
5222
|
-
const onClickMinute = (0,
|
|
5368
|
+
const onClickMinute = (0, import_react22.useCallback)(
|
|
5223
5369
|
(minute) => {
|
|
5224
5370
|
const newTime = `${internalValue?.toString().split("T")?.[1]?.split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
5225
5371
|
const today = defaultDateAfterTimePick ?? `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
@@ -5229,7 +5375,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5229
5375
|
},
|
|
5230
5376
|
[defaultDateAfterTimePick, internalValue, restInputFieldProps.onChangeValue]
|
|
5231
5377
|
);
|
|
5232
|
-
(0,
|
|
5378
|
+
(0, import_react22.useEffect)(() => {
|
|
5233
5379
|
if (isOpen && selectedHourRef.current)
|
|
5234
5380
|
selectedHourRef.current.scrollIntoView({ block: "nearest", behavior: "instant" });
|
|
5235
5381
|
if (isOpen && selectedMinuteRef.current)
|
|
@@ -5238,12 +5384,12 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5238
5384
|
const valueHour = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[0]).toString();
|
|
5239
5385
|
const valueMinute = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[1]).toString();
|
|
5240
5386
|
const topSpacing = 32 + theme2.styles.space / 2 + theme2.styles.gap;
|
|
5241
|
-
return /* @__PURE__ */ (0,
|
|
5387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5242
5388
|
InputFieldComponent,
|
|
5243
5389
|
{
|
|
5244
5390
|
...betterHtmlContextInternal.components.inputField?.style?.dateTime,
|
|
5245
5391
|
type: "datetime-local",
|
|
5246
|
-
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0,
|
|
5392
|
+
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
5247
5393
|
Div_default,
|
|
5248
5394
|
{
|
|
5249
5395
|
position: "absolute",
|
|
@@ -5259,7 +5405,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5259
5405
|
userSelect: "none",
|
|
5260
5406
|
...insideInputFieldComponentProps,
|
|
5261
5407
|
children: [
|
|
5262
|
-
/* @__PURE__ */ (0,
|
|
5408
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5263
5409
|
Div_default,
|
|
5264
5410
|
{
|
|
5265
5411
|
position: "absolute",
|
|
@@ -5272,9 +5418,9 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5272
5418
|
transition: theme2.styles.transition
|
|
5273
5419
|
}
|
|
5274
5420
|
),
|
|
5275
|
-
/* @__PURE__ */ (0,
|
|
5276
|
-
/* @__PURE__ */ (0,
|
|
5277
|
-
/* @__PURE__ */ (0,
|
|
5421
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { gap: theme2.styles.space, children: [
|
|
5422
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Calendar_default, { value: internalValue, minDate, maxDate, onChange }),
|
|
5423
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
5278
5424
|
Div_default.row,
|
|
5279
5425
|
{
|
|
5280
5426
|
height: 276,
|
|
@@ -5283,9 +5429,9 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5283
5429
|
paddingBottom: theme2.styles.space / 2,
|
|
5284
5430
|
paddingRight: theme2.styles.space / 2,
|
|
5285
5431
|
children: [
|
|
5286
|
-
/* @__PURE__ */ (0,
|
|
5287
|
-
/* @__PURE__ */ (0,
|
|
5288
|
-
/* @__PURE__ */ (0,
|
|
5432
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default, { height: "100%", children: [
|
|
5433
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "H" }),
|
|
5434
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5289
5435
|
Div_default,
|
|
5290
5436
|
{
|
|
5291
5437
|
className: "react-better-html-no-scrollbar",
|
|
@@ -5295,7 +5441,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5295
5441
|
tabIndex: -1,
|
|
5296
5442
|
children: readyHours.map((hour) => {
|
|
5297
5443
|
const isSelected = hour.toString() === valueHour;
|
|
5298
|
-
return /* @__PURE__ */ (0,
|
|
5444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5299
5445
|
Div_default.row,
|
|
5300
5446
|
{
|
|
5301
5447
|
alignItems: "center",
|
|
@@ -5309,7 +5455,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5309
5455
|
value: hour,
|
|
5310
5456
|
onClickWithValue: onClickHour,
|
|
5311
5457
|
ref: isSelected ? selectedHourRef : void 0,
|
|
5312
|
-
children: /* @__PURE__ */ (0,
|
|
5458
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
|
|
5313
5459
|
},
|
|
5314
5460
|
hour
|
|
5315
5461
|
);
|
|
@@ -5317,9 +5463,9 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5317
5463
|
}
|
|
5318
5464
|
)
|
|
5319
5465
|
] }),
|
|
5320
|
-
/* @__PURE__ */ (0,
|
|
5321
|
-
/* @__PURE__ */ (0,
|
|
5322
|
-
/* @__PURE__ */ (0,
|
|
5466
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default, { height: "100%", children: [
|
|
5467
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "M" }),
|
|
5468
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5323
5469
|
Div_default,
|
|
5324
5470
|
{
|
|
5325
5471
|
className: "react-better-html-no-scrollbar",
|
|
@@ -5329,7 +5475,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5329
5475
|
tabIndex: -1,
|
|
5330
5476
|
children: readyMinutes.map((minute) => {
|
|
5331
5477
|
const isSelected = minute.toString() === valueMinute;
|
|
5332
|
-
return /* @__PURE__ */ (0,
|
|
5478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5333
5479
|
Div_default.row,
|
|
5334
5480
|
{
|
|
5335
5481
|
alignItems: "center",
|
|
@@ -5343,7 +5489,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5343
5489
|
value: minute,
|
|
5344
5490
|
onClickWithValue: onClickMinute,
|
|
5345
5491
|
ref: isSelected ? selectedMinuteRef : void 0,
|
|
5346
|
-
children: /* @__PURE__ */ (0,
|
|
5492
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
|
|
5347
5493
|
},
|
|
5348
5494
|
minute
|
|
5349
5495
|
);
|
|
@@ -5366,16 +5512,16 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5366
5512
|
}
|
|
5367
5513
|
);
|
|
5368
5514
|
});
|
|
5369
|
-
InputFieldComponent.time = (0,
|
|
5515
|
+
InputFieldComponent.time = (0, import_react22.forwardRef)(function Time({ hoursToRender, minutesToRender, minTime, maxTime, dropdownPosition = "left", ...inputFieldProps }, ref) {
|
|
5370
5516
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5371
5517
|
const props = useComponentsPropsMerger(
|
|
5372
5518
|
betterHtmlContextInternal.components.inputField?.style?.time,
|
|
5373
5519
|
inputFieldProps
|
|
5374
5520
|
);
|
|
5375
5521
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
5376
|
-
const holderRef = (0,
|
|
5377
|
-
const selectedHourRef = (0,
|
|
5378
|
-
const selectedMinuteRef = (0,
|
|
5522
|
+
const holderRef = (0, import_react22.useRef)(null);
|
|
5523
|
+
const selectedHourRef = (0, import_react22.useRef)(null);
|
|
5524
|
+
const selectedMinuteRef = (0, import_react22.useRef)(null);
|
|
5379
5525
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
5380
5526
|
const minHours = minTime ? parseInt(minTime.split(":")[0]) : void 0;
|
|
5381
5527
|
const minMinutes = minTime ? parseInt(minTime.split(":")[1]) : void 0;
|
|
@@ -5389,15 +5535,15 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5389
5535
|
isOpen,
|
|
5390
5536
|
isFocused
|
|
5391
5537
|
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5392
|
-
const readyHours = (0,
|
|
5538
|
+
const readyHours = (0, import_react22.useMemo)(
|
|
5393
5539
|
() => hoursToRender?.filter((hour) => hour >= 0 && hour <= 23) ?? hours,
|
|
5394
5540
|
[hoursToRender]
|
|
5395
5541
|
);
|
|
5396
|
-
const readyMinutes = (0,
|
|
5542
|
+
const readyMinutes = (0, import_react22.useMemo)(
|
|
5397
5543
|
() => minutesToRender?.filter((hour) => hour >= 0 && hour <= 59) ?? minutes,
|
|
5398
5544
|
[minutesToRender]
|
|
5399
5545
|
);
|
|
5400
|
-
const onBlur = (0,
|
|
5546
|
+
const onBlur = (0, import_react22.useCallback)(
|
|
5401
5547
|
(event) => {
|
|
5402
5548
|
if (!!minHours || !!maxHours || !!minMinutes || !!maxMinutes || hoursToRender || minutesToRender) {
|
|
5403
5549
|
const value = event.target.value;
|
|
@@ -5425,7 +5571,7 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5425
5571
|
restInputFieldProps.onBlur
|
|
5426
5572
|
]
|
|
5427
5573
|
);
|
|
5428
|
-
const onClickHour = (0,
|
|
5574
|
+
const onClickHour = (0, import_react22.useCallback)(
|
|
5429
5575
|
(hour) => {
|
|
5430
5576
|
const value = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
5431
5577
|
restInputFieldProps.onChangeValue?.(value);
|
|
@@ -5433,7 +5579,7 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5433
5579
|
},
|
|
5434
5580
|
[internalValue, restInputFieldProps.onChangeValue]
|
|
5435
5581
|
);
|
|
5436
|
-
const onClickMinute = (0,
|
|
5582
|
+
const onClickMinute = (0, import_react22.useCallback)(
|
|
5437
5583
|
(minute) => {
|
|
5438
5584
|
const value = `${internalValue?.toString().split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
5439
5585
|
restInputFieldProps.onChangeValue?.(value);
|
|
@@ -5441,7 +5587,7 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5441
5587
|
},
|
|
5442
5588
|
[internalValue, restInputFieldProps.onChangeValue]
|
|
5443
5589
|
);
|
|
5444
|
-
(0,
|
|
5590
|
+
(0, import_react22.useEffect)(() => {
|
|
5445
5591
|
if (isOpen && selectedHourRef.current)
|
|
5446
5592
|
selectedHourRef.current.scrollIntoView({ block: "nearest", behavior: "instant" });
|
|
5447
5593
|
if (isOpen && selectedMinuteRef.current)
|
|
@@ -5449,12 +5595,12 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5449
5595
|
}, [isOpen]);
|
|
5450
5596
|
const valueHour = parseInt(internalValue?.toString().split(":")?.[0]).toString();
|
|
5451
5597
|
const valueMinute = parseInt(internalValue?.toString().split(":")?.[1]).toString();
|
|
5452
|
-
return /* @__PURE__ */ (0,
|
|
5598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5453
5599
|
InputFieldComponent,
|
|
5454
5600
|
{
|
|
5455
5601
|
...betterHtmlContextInternal.components.inputField?.style?.time,
|
|
5456
5602
|
type: "time",
|
|
5457
|
-
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0,
|
|
5603
|
+
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
5458
5604
|
Div_default,
|
|
5459
5605
|
{
|
|
5460
5606
|
position: "absolute",
|
|
@@ -5471,7 +5617,7 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5471
5617
|
userSelect: "none",
|
|
5472
5618
|
...insideInputFieldComponentProps,
|
|
5473
5619
|
children: [
|
|
5474
|
-
/* @__PURE__ */ (0,
|
|
5620
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5475
5621
|
Div_default,
|
|
5476
5622
|
{
|
|
5477
5623
|
position: "absolute",
|
|
@@ -5484,8 +5630,8 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5484
5630
|
transition: theme2.styles.transition
|
|
5485
5631
|
}
|
|
5486
5632
|
),
|
|
5487
|
-
/* @__PURE__ */ (0,
|
|
5488
|
-
/* @__PURE__ */ (0,
|
|
5633
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { height: "100%", children: [
|
|
5634
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5489
5635
|
Div_default,
|
|
5490
5636
|
{
|
|
5491
5637
|
className: "react-better-html-no-scrollbar",
|
|
@@ -5496,7 +5642,7 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5496
5642
|
children: readyHours.map((hour) => {
|
|
5497
5643
|
const isSelected = hour.toString() === valueHour;
|
|
5498
5644
|
const isDisabled = minHours && hour < minHours || maxHours && hour > maxHours;
|
|
5499
|
-
return /* @__PURE__ */ (0,
|
|
5645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5500
5646
|
Div_default.row,
|
|
5501
5647
|
{
|
|
5502
5648
|
alignItems: "center",
|
|
@@ -5510,14 +5656,14 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5510
5656
|
value: hour,
|
|
5511
5657
|
onClickWithValue: !isDisabled ? onClickHour : void 0,
|
|
5512
5658
|
ref: isSelected ? selectedHourRef : void 0,
|
|
5513
|
-
children: /* @__PURE__ */ (0,
|
|
5659
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
|
|
5514
5660
|
},
|
|
5515
5661
|
hour
|
|
5516
5662
|
);
|
|
5517
5663
|
})
|
|
5518
5664
|
}
|
|
5519
5665
|
),
|
|
5520
|
-
/* @__PURE__ */ (0,
|
|
5666
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5521
5667
|
Div_default,
|
|
5522
5668
|
{
|
|
5523
5669
|
className: "react-better-html-no-scrollbar",
|
|
@@ -5529,7 +5675,7 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5529
5675
|
const isSelected = minute.toString() === valueMinute;
|
|
5530
5676
|
const currentHour = parseInt(valueHour);
|
|
5531
5677
|
const isDisabled = minHours !== void 0 && minMinutes !== void 0 && currentHour === minHours && minute < minMinutes || maxHours !== void 0 && maxMinutes !== void 0 && currentHour === maxHours && minute > maxMinutes;
|
|
5532
|
-
return /* @__PURE__ */ (0,
|
|
5678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5533
5679
|
Div_default.row,
|
|
5534
5680
|
{
|
|
5535
5681
|
alignItems: "center",
|
|
@@ -5543,7 +5689,7 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5543
5689
|
value: minute,
|
|
5544
5690
|
onClickWithValue: !isDisabled ? onClickMinute : void 0,
|
|
5545
5691
|
ref: isSelected ? selectedMinuteRef : void 0,
|
|
5546
|
-
children: /* @__PURE__ */ (0,
|
|
5692
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
|
|
5547
5693
|
},
|
|
5548
5694
|
minute
|
|
5549
5695
|
);
|
|
@@ -5563,30 +5709,30 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5563
5709
|
}
|
|
5564
5710
|
);
|
|
5565
5711
|
});
|
|
5566
|
-
InputFieldComponent.color = (0,
|
|
5712
|
+
InputFieldComponent.color = (0, import_react22.forwardRef)(function Color4({ ...inputFieldProps }, ref) {
|
|
5567
5713
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5568
5714
|
const { value, onChangeValue, ...props } = useComponentsPropsMerger(
|
|
5569
5715
|
betterHtmlContextInternal.components.inputField?.style?.time,
|
|
5570
5716
|
inputFieldProps
|
|
5571
5717
|
);
|
|
5572
|
-
const [inputFieldValue, setInputFieldValue] = (0,
|
|
5573
|
-
const onChangeValueElement = (0,
|
|
5718
|
+
const [inputFieldValue, setInputFieldValue] = (0, import_react22.useState)(value ?? "#000000");
|
|
5719
|
+
const onChangeValueElement = (0, import_react22.useCallback)(
|
|
5574
5720
|
(value2) => {
|
|
5575
5721
|
setInputFieldValue(value2);
|
|
5576
5722
|
onChangeValue?.(value2);
|
|
5577
5723
|
},
|
|
5578
5724
|
[onChangeValue]
|
|
5579
5725
|
);
|
|
5580
|
-
(0,
|
|
5726
|
+
(0, import_react22.useEffect)(() => {
|
|
5581
5727
|
if (value === void 0) return;
|
|
5582
5728
|
setInputFieldValue(value);
|
|
5583
5729
|
}, [value]);
|
|
5584
|
-
return /* @__PURE__ */ (0,
|
|
5730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5585
5731
|
InputFieldComponent,
|
|
5586
5732
|
{
|
|
5587
5733
|
...betterHtmlContextInternal.components.inputField?.style?.color,
|
|
5588
5734
|
type: "color",
|
|
5589
|
-
insideInputFieldAfterComponent: /* @__PURE__ */ (0,
|
|
5735
|
+
insideInputFieldAfterComponent: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5590
5736
|
Div_default.row,
|
|
5591
5737
|
{
|
|
5592
5738
|
position: "absolute",
|
|
@@ -5598,7 +5744,7 @@ InputFieldComponent.color = (0, import_react21.forwardRef)(function Color4({ ...
|
|
|
5598
5744
|
pointerEvents: "none",
|
|
5599
5745
|
userSelect: "none",
|
|
5600
5746
|
paddingLeft: colorPickerColorWidth,
|
|
5601
|
-
children: /* @__PURE__ */ (0,
|
|
5747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { children: inputFieldValue })
|
|
5602
5748
|
}
|
|
5603
5749
|
),
|
|
5604
5750
|
value: inputFieldValue,
|
|
@@ -5608,7 +5754,7 @@ InputFieldComponent.color = (0, import_react21.forwardRef)(function Color4({ ...
|
|
|
5608
5754
|
}
|
|
5609
5755
|
);
|
|
5610
5756
|
});
|
|
5611
|
-
var InputField2 = (0,
|
|
5757
|
+
var InputField2 = (0, import_react22.memo)(InputFieldComponent);
|
|
5612
5758
|
InputField2.multiline = InputFieldComponent.multiline;
|
|
5613
5759
|
InputField2.email = InputFieldComponent.email;
|
|
5614
5760
|
InputField2.password = InputFieldComponent.password;
|
|
@@ -5621,10 +5767,10 @@ InputField2.color = InputFieldComponent.color;
|
|
|
5621
5767
|
var InputField_default = InputField2;
|
|
5622
5768
|
|
|
5623
5769
|
// src/components/ToggleInput.tsx
|
|
5624
|
-
var
|
|
5770
|
+
var import_react23 = require("react");
|
|
5625
5771
|
var import_react_better_core20 = require("react-better-core");
|
|
5626
5772
|
var import_styled_components12 = __toESM(require("styled-components"));
|
|
5627
|
-
var
|
|
5773
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
5628
5774
|
var componentSize = 26;
|
|
5629
5775
|
var switchComponentBallGap = 3;
|
|
5630
5776
|
var switchComponentMouseDownDifference = 4;
|
|
@@ -5721,7 +5867,7 @@ var SwitchElement = import_styled_components12.default.div.withConfig({
|
|
|
5721
5867
|
${(props) => props.hoverStyle}
|
|
5722
5868
|
}
|
|
5723
5869
|
`;
|
|
5724
|
-
var ToggleInputComponent = (0,
|
|
5870
|
+
var ToggleInputComponent = (0, import_react23.forwardRef)(function ToggleInput({
|
|
5725
5871
|
label,
|
|
5726
5872
|
labelFontFamily,
|
|
5727
5873
|
labelFontSize,
|
|
@@ -5747,13 +5893,13 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5747
5893
|
...props
|
|
5748
5894
|
}, ref) {
|
|
5749
5895
|
const theme2 = (0, import_react_better_core20.useTheme)();
|
|
5750
|
-
const internalId = (0,
|
|
5896
|
+
const internalId = (0, import_react23.useId)();
|
|
5751
5897
|
const { colorTheme } = (0, import_react_better_core20.useBetterCoreContext)();
|
|
5752
5898
|
const { style, hoverStyle, excludeStyle, restProps } = useComponentPropsGrouper(props, true);
|
|
5753
5899
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
5754
5900
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
5755
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
5756
|
-
const onChangeElement = (0,
|
|
5901
|
+
const [internalChecked, setInternalChecked] = (0, import_react23.useState)(false);
|
|
5902
|
+
const onChangeElement = (0, import_react23.useCallback)(
|
|
5757
5903
|
(event) => {
|
|
5758
5904
|
const newIsChecked = event.target.checked;
|
|
5759
5905
|
if (controlledChecked === void 0) setInternalChecked(newIsChecked);
|
|
@@ -5762,14 +5908,14 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5762
5908
|
[onChange, controlledChecked, value]
|
|
5763
5909
|
);
|
|
5764
5910
|
const checked = controlledChecked ?? internalChecked;
|
|
5765
|
-
const onClickText = (0,
|
|
5911
|
+
const onClickText = (0, import_react23.useCallback)(() => {
|
|
5766
5912
|
const newIsChecked = !checked;
|
|
5767
5913
|
if (controlledChecked === void 0) setInternalChecked(newIsChecked);
|
|
5768
5914
|
onChange?.(newIsChecked, value);
|
|
5769
5915
|
}, [checked, controlledChecked, onChange, value]);
|
|
5770
5916
|
const readyId = id ?? internalId;
|
|
5771
|
-
return /* @__PURE__ */ (0,
|
|
5772
|
-
label && /* @__PURE__ */ (0,
|
|
5917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Div_default.column, { gap: labelGap ?? theme2.styles.gap, ...excludeStyle, children: [
|
|
5918
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5773
5919
|
Label_default,
|
|
5774
5920
|
{
|
|
5775
5921
|
text: label,
|
|
@@ -5783,9 +5929,9 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5783
5929
|
htmlFor: readyId
|
|
5784
5930
|
}
|
|
5785
5931
|
),
|
|
5786
|
-
/* @__PURE__ */ (0,
|
|
5787
|
-
/* @__PURE__ */ (0,
|
|
5788
|
-
/* @__PURE__ */ (0,
|
|
5932
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5933
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Div_default.row, { position: "relative", alignItems: "center", children: [
|
|
5934
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5789
5935
|
InputElement2,
|
|
5790
5936
|
{
|
|
5791
5937
|
theme: theme2,
|
|
@@ -5803,7 +5949,7 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5803
5949
|
...ariaProps
|
|
5804
5950
|
}
|
|
5805
5951
|
),
|
|
5806
|
-
props.type === "checkbox" ? /* @__PURE__ */ (0,
|
|
5952
|
+
props.type === "checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5807
5953
|
Icon_default,
|
|
5808
5954
|
{
|
|
5809
5955
|
name: "check",
|
|
@@ -5817,7 +5963,7 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5817
5963
|
pointerEvents: "none",
|
|
5818
5964
|
transition: theme2.styles.transition
|
|
5819
5965
|
}
|
|
5820
|
-
) : props.type === "radio" ? /* @__PURE__ */ (0,
|
|
5966
|
+
) : props.type === "radio" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5821
5967
|
Div_default,
|
|
5822
5968
|
{
|
|
5823
5969
|
position: "absolute",
|
|
@@ -5833,7 +5979,7 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5833
5979
|
}
|
|
5834
5980
|
) : void 0
|
|
5835
5981
|
] }),
|
|
5836
|
-
text ? /* @__PURE__ */ (0,
|
|
5982
|
+
text ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
5837
5983
|
Text_default,
|
|
5838
5984
|
{
|
|
5839
5985
|
fontFamily: textFontFamily,
|
|
@@ -5846,21 +5992,21 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5846
5992
|
onClick: onClickText,
|
|
5847
5993
|
children: [
|
|
5848
5994
|
text,
|
|
5849
|
-
required && !label && /* @__PURE__ */ (0,
|
|
5995
|
+
required && !label && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text_default, { as: "span", fontSize: theme2.styles.fontSize, color: theme2.colors.error, children: [
|
|
5850
5996
|
" ",
|
|
5851
5997
|
"*"
|
|
5852
5998
|
] })
|
|
5853
5999
|
]
|
|
5854
6000
|
}
|
|
5855
|
-
) : textAdvanced ? /* @__PURE__ */ (0,
|
|
6001
|
+
) : textAdvanced ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Div_default.row, { userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
|
|
5856
6002
|
textAdvanced,
|
|
5857
|
-
required && !label && /* @__PURE__ */ (0,
|
|
6003
|
+
required && !label && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text_default, { as: "span", fontSize: theme2.styles.fontSize, color: theme2.colors.error, marginLeft: 4, children: [
|
|
5858
6004
|
" ",
|
|
5859
6005
|
"*"
|
|
5860
6006
|
] })
|
|
5861
6007
|
] }) : void 0
|
|
5862
6008
|
] }),
|
|
5863
|
-
(errorText || infoText) && /* @__PURE__ */ (0,
|
|
6009
|
+
(errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5864
6010
|
Text_default,
|
|
5865
6011
|
{
|
|
5866
6012
|
as: "span",
|
|
@@ -5873,23 +6019,23 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5873
6019
|
] });
|
|
5874
6020
|
});
|
|
5875
6021
|
var ToggleInput_default = {
|
|
5876
|
-
checkbox: (0,
|
|
6022
|
+
checkbox: (0, import_react23.forwardRef)(function Checkbox(checkboxProps, ref) {
|
|
5877
6023
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5878
6024
|
const props = useComponentsPropsMerger(
|
|
5879
6025
|
betterHtmlContextInternal.components.toggleInput?.style?.checkbox,
|
|
5880
6026
|
checkboxProps
|
|
5881
6027
|
);
|
|
5882
|
-
return /* @__PURE__ */ (0,
|
|
6028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ToggleInputComponent, { type: "checkbox", ref, ...props });
|
|
5883
6029
|
}),
|
|
5884
|
-
radiobutton: (0,
|
|
6030
|
+
radiobutton: (0, import_react23.forwardRef)(function RadioButton(radiobuttonProps, ref) {
|
|
5885
6031
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5886
6032
|
const props = useComponentsPropsMerger(
|
|
5887
6033
|
betterHtmlContextInternal.components.toggleInput?.style?.radiobutton,
|
|
5888
6034
|
radiobuttonProps
|
|
5889
6035
|
);
|
|
5890
|
-
return /* @__PURE__ */ (0,
|
|
6036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ToggleInputComponent, { type: "radio", ref, ...props });
|
|
5891
6037
|
}),
|
|
5892
|
-
switch: (0,
|
|
6038
|
+
switch: (0, import_react23.forwardRef)(function Switch(switchProps, ref) {
|
|
5893
6039
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5894
6040
|
const {
|
|
5895
6041
|
label,
|
|
@@ -5912,22 +6058,22 @@ var ToggleInput_default = {
|
|
|
5912
6058
|
switchProps
|
|
5913
6059
|
);
|
|
5914
6060
|
const theme2 = (0, import_react_better_core20.useTheme)();
|
|
5915
|
-
const internalId = (0,
|
|
6061
|
+
const internalId = (0, import_react23.useId)();
|
|
5916
6062
|
const { style, hoverStyle, excludeStyle, restProps } = useComponentPropsGrouper(props, true);
|
|
5917
6063
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
5918
6064
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
5919
6065
|
const [internalChecked, setInternalChecked] = (0, import_react_better_core20.useBooleanState)();
|
|
5920
6066
|
const [isMouseDown, setIsMouseDown] = (0, import_react_better_core20.useBooleanState)();
|
|
5921
6067
|
const checked = controlledChecked ?? internalChecked;
|
|
5922
|
-
const onClickElement = (0,
|
|
6068
|
+
const onClickElement = (0, import_react23.useCallback)(() => {
|
|
5923
6069
|
if (disabled) return;
|
|
5924
6070
|
const newIsChecked = !checked;
|
|
5925
6071
|
if (controlledChecked === void 0) setInternalChecked.setState(newIsChecked);
|
|
5926
6072
|
onChange?.(newIsChecked, value);
|
|
5927
6073
|
}, [disabled, checked, onChange, controlledChecked, value]);
|
|
5928
6074
|
const readyId = id ?? internalId;
|
|
5929
|
-
return /* @__PURE__ */ (0,
|
|
5930
|
-
label && /* @__PURE__ */ (0,
|
|
6075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Div_default.column, { width: "fit-content", gap: theme2.styles.gap, ...excludeStyle, children: [
|
|
6076
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5931
6077
|
Label_default,
|
|
5932
6078
|
{
|
|
5933
6079
|
text: label,
|
|
@@ -5941,7 +6087,7 @@ var ToggleInput_default = {
|
|
|
5941
6087
|
htmlFor: readyId
|
|
5942
6088
|
}
|
|
5943
6089
|
),
|
|
5944
|
-
/* @__PURE__ */ (0,
|
|
6090
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5945
6091
|
Div_default.row,
|
|
5946
6092
|
{
|
|
5947
6093
|
alignItems: "center",
|
|
@@ -5955,7 +6101,7 @@ var ToggleInput_default = {
|
|
|
5955
6101
|
onTouchStart: setIsMouseDown.setTrue,
|
|
5956
6102
|
onTouchEnd: setIsMouseDown.setFalse,
|
|
5957
6103
|
onTouchCancel: setIsMouseDown.setFalse,
|
|
5958
|
-
children: /* @__PURE__ */ (0,
|
|
6104
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5959
6105
|
SwitchElement,
|
|
5960
6106
|
{
|
|
5961
6107
|
theme: theme2,
|
|
@@ -5975,7 +6121,7 @@ var ToggleInput_default = {
|
|
|
5975
6121
|
)
|
|
5976
6122
|
}
|
|
5977
6123
|
),
|
|
5978
|
-
(errorText || infoText) && /* @__PURE__ */ (0,
|
|
6124
|
+
(errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5979
6125
|
Text_default,
|
|
5980
6126
|
{
|
|
5981
6127
|
as: "span",
|
|
@@ -5990,10 +6136,10 @@ var ToggleInput_default = {
|
|
|
5990
6136
|
};
|
|
5991
6137
|
|
|
5992
6138
|
// src/components/Form.tsx
|
|
5993
|
-
var
|
|
6139
|
+
var import_react24 = require("react");
|
|
5994
6140
|
var import_react_better_core21 = require("react-better-core");
|
|
5995
|
-
var
|
|
5996
|
-
var FormComponent = (0,
|
|
6141
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6142
|
+
var FormComponent = (0, import_react24.forwardRef)(function Form({
|
|
5997
6143
|
form,
|
|
5998
6144
|
name,
|
|
5999
6145
|
submitButtonText,
|
|
@@ -6018,7 +6164,7 @@ var FormComponent = (0, import_react23.forwardRef)(function Form({
|
|
|
6018
6164
|
...props
|
|
6019
6165
|
}, ref) {
|
|
6020
6166
|
const theme2 = (0, import_react_better_core21.useTheme)();
|
|
6021
|
-
const submitButtonIsDisabledInternal = (0,
|
|
6167
|
+
const submitButtonIsDisabledInternal = (0, import_react24.useMemo)(() => {
|
|
6022
6168
|
if (!form || !form.requiredFields) return false;
|
|
6023
6169
|
return Object.entries(form.values).some(
|
|
6024
6170
|
([key, value]) => form.requiredFields?.includes(key) && (value === void 0 || value === null || value?.toString().trim() === "")
|
|
@@ -6026,17 +6172,17 @@ var FormComponent = (0, import_react23.forwardRef)(function Form({
|
|
|
6026
6172
|
}, [form]);
|
|
6027
6173
|
const SubmitButtonTag = isDestructive ? Button_default.destructive : Button_default;
|
|
6028
6174
|
const submitButtonIsDisabledFinal = submitButtonIsDisabled || submitButtonIsDisabledInternal;
|
|
6029
|
-
return /* @__PURE__ */ (0,
|
|
6030
|
-
gap !== void 0 || withDividers ? /* @__PURE__ */ (0,
|
|
6175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Div_default, { width: "100%", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("form", { name, onSubmit: onSubmit ?? form?.onSubmit, id, ref, children: [
|
|
6176
|
+
gap !== void 0 || withDividers ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Div_default.column, { gap: gap ?? (withDividers ? theme2.styles.space : theme2.styles.gap), children: withDividers ? import_react24.Children.toArray(children).map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react24.Fragment, { children: [
|
|
6031
6177
|
child,
|
|
6032
|
-
index <
|
|
6178
|
+
index < import_react24.Children.toArray(children).length - 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6033
6179
|
Divider_default.horizontal,
|
|
6034
6180
|
{
|
|
6035
6181
|
width: theme2.styles.borderWidth === 0 ? 1 : theme2.styles.borderWidth
|
|
6036
6182
|
}
|
|
6037
6183
|
)
|
|
6038
6184
|
] }, index)) : children }) : children,
|
|
6039
|
-
submitButtonText && /* @__PURE__ */ (0,
|
|
6185
|
+
submitButtonText && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
6040
6186
|
Div_default.row,
|
|
6041
6187
|
{
|
|
6042
6188
|
alignItems: "center",
|
|
@@ -6045,7 +6191,7 @@ var FormComponent = (0, import_react23.forwardRef)(function Form({
|
|
|
6045
6191
|
marginTop: theme2.styles.space,
|
|
6046
6192
|
children: [
|
|
6047
6193
|
renderActionButtons,
|
|
6048
|
-
onClickCancel && /* @__PURE__ */ (0,
|
|
6194
|
+
onClickCancel && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6049
6195
|
Button_default.secondary,
|
|
6050
6196
|
{
|
|
6051
6197
|
text: cancelButtonText ?? "Cancel",
|
|
@@ -6056,7 +6202,7 @@ var FormComponent = (0, import_react23.forwardRef)(function Form({
|
|
|
6056
6202
|
onClick: onClickCancel
|
|
6057
6203
|
}
|
|
6058
6204
|
),
|
|
6059
|
-
/* @__PURE__ */ (0,
|
|
6205
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6060
6206
|
SubmitButtonTag,
|
|
6061
6207
|
{
|
|
6062
6208
|
text: submitButtonText,
|
|
@@ -6072,24 +6218,24 @@ var FormComponent = (0, import_react23.forwardRef)(function Form({
|
|
|
6072
6218
|
)
|
|
6073
6219
|
] }) });
|
|
6074
6220
|
});
|
|
6075
|
-
var Form2 = (0,
|
|
6221
|
+
var Form2 = (0, import_react24.memo)(FormComponent);
|
|
6076
6222
|
var Form_default = Form2;
|
|
6077
6223
|
|
|
6078
6224
|
// src/components/FormRow.tsx
|
|
6079
|
-
var
|
|
6225
|
+
var import_react25 = require("react");
|
|
6080
6226
|
var import_react_better_core22 = require("react-better-core");
|
|
6081
|
-
var
|
|
6082
|
-
var FormRowComponent = (0,
|
|
6227
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
6228
|
+
var FormRowComponent = (0, import_react25.forwardRef)(function FormRow({ oneItemOnly, noBreakingPoint, asColumn, gap, children, ...props }, ref) {
|
|
6083
6229
|
const theme2 = (0, import_react_better_core22.useTheme)();
|
|
6084
6230
|
const mediaQuery = useMediaQuery();
|
|
6085
6231
|
const breakingPoint = asColumn ?? (!noBreakingPoint ? mediaQuery.size900 : false);
|
|
6086
6232
|
const readyGap = breakingPoint || noBreakingPoint && mediaQuery.size900 ? theme2.styles.gap : theme2.styles.space * 2;
|
|
6087
|
-
return /* @__PURE__ */ (0,
|
|
6233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Div_default.row, { alignItems: "center", gap: gap ?? readyGap, invertFlexDirection: breakingPoint, ...props, ref, children: [
|
|
6088
6234
|
children,
|
|
6089
|
-
oneItemOnly && /* @__PURE__ */ (0,
|
|
6235
|
+
oneItemOnly && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Div_default, { width: "100%" })
|
|
6090
6236
|
] });
|
|
6091
6237
|
});
|
|
6092
|
-
FormRowComponent.withTitle = (0,
|
|
6238
|
+
FormRowComponent.withTitle = (0, import_react25.forwardRef)(function WithTitle({
|
|
6093
6239
|
icon,
|
|
6094
6240
|
title,
|
|
6095
6241
|
titleAs = "h3",
|
|
@@ -6110,22 +6256,22 @@ FormRowComponent.withTitle = (0, import_react24.forwardRef)(function WithTitle({
|
|
|
6110
6256
|
const theme2 = (0, import_react_better_core22.useTheme)();
|
|
6111
6257
|
const mediaQuery = useMediaQuery();
|
|
6112
6258
|
const titleGap = theme2.styles.space;
|
|
6113
|
-
return /* @__PURE__ */ (0,
|
|
6114
|
-
/* @__PURE__ */ (0,
|
|
6115
|
-
icon && /* @__PURE__ */ (0,
|
|
6116
|
-
/* @__PURE__ */ (0,
|
|
6117
|
-
/* @__PURE__ */ (0,
|
|
6259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(FormRowComponent, { ...props, ref, children: [
|
|
6260
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Div_default.row, { width: "100%", alignItems: "center", gap: titleGap, children: [
|
|
6261
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon_default, { name: icon }),
|
|
6262
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
6263
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Text_default, { as: titleAs, fontSize: titleFontSize, children: [
|
|
6118
6264
|
title,
|
|
6119
|
-
required && /* @__PURE__ */ (0,
|
|
6265
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Text_default, { as: "span", fontSize: theme2.styles.fontSize, color: theme2.colors.error, children: [
|
|
6120
6266
|
" ",
|
|
6121
6267
|
"*"
|
|
6122
6268
|
] })
|
|
6123
6269
|
] }),
|
|
6124
|
-
description && /* @__PURE__ */ (0,
|
|
6270
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { fontSize: descriptionFontSize ?? theme2.styles.fontSize, color: theme2.colors.textSecondary, children: description })
|
|
6125
6271
|
] }),
|
|
6126
|
-
isLoading && /* @__PURE__ */ (0,
|
|
6272
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Div_default, { width: 26 - titleGap })
|
|
6127
6273
|
] }),
|
|
6128
|
-
/* @__PURE__ */ (0,
|
|
6274
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
6129
6275
|
Div_default.row,
|
|
6130
6276
|
{
|
|
6131
6277
|
position: "relative",
|
|
@@ -6134,7 +6280,7 @@ FormRowComponent.withTitle = (0, import_react24.forwardRef)(function WithTitle({
|
|
|
6134
6280
|
justifyContent: alignChildren,
|
|
6135
6281
|
gap: theme2.styles.gap,
|
|
6136
6282
|
children: [
|
|
6137
|
-
/* @__PURE__ */ (0,
|
|
6283
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
6138
6284
|
Div_default,
|
|
6139
6285
|
{
|
|
6140
6286
|
position: "absolute",
|
|
@@ -6143,38 +6289,38 @@ FormRowComponent.withTitle = (0, import_react24.forwardRef)(function WithTitle({
|
|
|
6143
6289
|
transform: "translateY(-50%)",
|
|
6144
6290
|
opacity: !isLoading ? 0 : void 0,
|
|
6145
6291
|
pointerEvents: !isLoading ? "none" : void 0,
|
|
6146
|
-
children: /* @__PURE__ */ (0,
|
|
6292
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Loader_default, {})
|
|
6147
6293
|
}
|
|
6148
6294
|
),
|
|
6149
6295
|
children,
|
|
6150
|
-
withActions && /* @__PURE__ */ (0,
|
|
6151
|
-
onClickReset && /* @__PURE__ */ (0,
|
|
6152
|
-
/* @__PURE__ */ (0,
|
|
6296
|
+
withActions && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
6297
|
+
onClickReset && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button_default.icon, { icon: "XMark", loaderName: resetButtonLoaderName, onClick: onClickReset }),
|
|
6298
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button_default.icon, { icon: "check", loaderName: saveButtonLoaderName, onClick: onClickSave })
|
|
6153
6299
|
] })
|
|
6154
6300
|
]
|
|
6155
6301
|
}
|
|
6156
6302
|
)
|
|
6157
6303
|
] });
|
|
6158
6304
|
});
|
|
6159
|
-
var FormRow2 = (0,
|
|
6305
|
+
var FormRow2 = (0, import_react25.memo)(FormRowComponent);
|
|
6160
6306
|
FormRow2.withTitle = FormRowComponent.withTitle;
|
|
6161
6307
|
var FormRow_default = FormRow2;
|
|
6162
6308
|
|
|
6163
6309
|
// src/components/ColorThemeSwitch.tsx
|
|
6164
|
-
var
|
|
6310
|
+
var import_react26 = require("react");
|
|
6165
6311
|
var import_react_better_core23 = require("react-better-core");
|
|
6166
|
-
var
|
|
6312
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
6167
6313
|
var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
6168
6314
|
withMoon,
|
|
6169
6315
|
className,
|
|
6170
6316
|
...props
|
|
6171
6317
|
}) {
|
|
6172
|
-
const [value, setValue] = (0,
|
|
6173
|
-
const onChangeSwitch = (0,
|
|
6318
|
+
const [value, setValue] = (0, import_react26.useState)(localStorage.getItem("theme") === "dark");
|
|
6319
|
+
const onChangeSwitch = (0, import_react26.useCallback)((checked) => {
|
|
6174
6320
|
setValue(checked);
|
|
6175
6321
|
document.querySelector("html")?.setAttribute("data-theme", checked ? "dark" : "light");
|
|
6176
6322
|
}, []);
|
|
6177
|
-
(0,
|
|
6323
|
+
(0, import_react26.useEffect)(() => {
|
|
6178
6324
|
const html = document.querySelector("html");
|
|
6179
6325
|
if (!html) return;
|
|
6180
6326
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -6192,7 +6338,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
6192
6338
|
observer.disconnect();
|
|
6193
6339
|
};
|
|
6194
6340
|
}, []);
|
|
6195
|
-
return /* @__PURE__ */ (0,
|
|
6341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
6196
6342
|
ToggleInput_default.switch,
|
|
6197
6343
|
{
|
|
6198
6344
|
className: `react-better-html-color-theme-switch ${withMoon ? ` react-better-html-color-theme-switch-with-moon` : ""}${className ? ` ${className}` : ""}`,
|
|
@@ -6204,25 +6350,25 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
6204
6350
|
};
|
|
6205
6351
|
ColorThemeSwitchComponent.withText = function WithText({ withMoon, className, ...props }) {
|
|
6206
6352
|
const theme2 = (0, import_react_better_core23.useTheme)();
|
|
6207
|
-
return /* @__PURE__ */ (0,
|
|
6208
|
-
/* @__PURE__ */ (0,
|
|
6209
|
-
/* @__PURE__ */ (0,
|
|
6210
|
-
/* @__PURE__ */ (0,
|
|
6353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Div_default.row, { width: "fit-content", alignItems: "center", gap: theme2.styles.gap, userSelect: "none", ...props, children: [
|
|
6354
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { children: "Light" }),
|
|
6355
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ColorThemeSwitchComponent, { withMoon, className }),
|
|
6356
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { children: "Dark" })
|
|
6211
6357
|
] });
|
|
6212
6358
|
};
|
|
6213
|
-
var ColorThemeSwitch2 = (0,
|
|
6359
|
+
var ColorThemeSwitch2 = (0, import_react26.memo)(ColorThemeSwitchComponent);
|
|
6214
6360
|
ColorThemeSwitch2.withText = ColorThemeSwitchComponent.withText;
|
|
6215
6361
|
var ColorThemeSwitch_default = ColorThemeSwitch2;
|
|
6216
6362
|
|
|
6217
6363
|
// src/components/Table.tsx
|
|
6218
|
-
var
|
|
6364
|
+
var import_react28 = require("react");
|
|
6219
6365
|
var import_react_better_core25 = require("react-better-core");
|
|
6220
6366
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
6221
6367
|
|
|
6222
6368
|
// src/components/Pagination.tsx
|
|
6223
|
-
var
|
|
6369
|
+
var import_react27 = require("react");
|
|
6224
6370
|
var import_react_better_core24 = require("react-better-core");
|
|
6225
|
-
var
|
|
6371
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
6226
6372
|
var PaginationComponent = function Pagination({
|
|
6227
6373
|
currentPage = 1,
|
|
6228
6374
|
itemsLength = 0,
|
|
@@ -6235,19 +6381,19 @@ var PaginationComponent = function Pagination({
|
|
|
6235
6381
|
}) {
|
|
6236
6382
|
const theme2 = (0, import_react_better_core24.useTheme)();
|
|
6237
6383
|
const mediaQuery = useMediaQuery();
|
|
6238
|
-
const [currentPageInternal, setCurrentPage] = (0,
|
|
6384
|
+
const [currentPageInternal, setCurrentPage] = (0, import_react27.useState)(currentPage);
|
|
6239
6385
|
const pageCountInternal = pageCount ?? (itemsPerPage !== void 0 ? Math.ceil(itemsLength / itemsPerPage) : 1);
|
|
6240
|
-
const onClickPreviousPageElement = (0,
|
|
6386
|
+
const onClickPreviousPageElement = (0, import_react27.useCallback)(() => {
|
|
6241
6387
|
const newPage = currentPageInternal <= 1 ? 1 : currentPageInternal - 1;
|
|
6242
6388
|
setCurrentPage(newPage);
|
|
6243
6389
|
onClickPreviousPage?.(newPage);
|
|
6244
6390
|
}, [currentPageInternal, onClickPreviousPage]);
|
|
6245
|
-
const onClickNextPageElement = (0,
|
|
6391
|
+
const onClickNextPageElement = (0, import_react27.useCallback)(() => {
|
|
6246
6392
|
const newPage = currentPageInternal >= pageCountInternal ? pageCountInternal : currentPageInternal + 1;
|
|
6247
6393
|
setCurrentPage(newPage);
|
|
6248
6394
|
onClickNextPage?.(newPage);
|
|
6249
6395
|
}, [currentPageInternal, pageCountInternal, onClickNextPage]);
|
|
6250
|
-
const paginationItems = (0,
|
|
6396
|
+
const paginationItems = (0, import_react27.useMemo)(() => {
|
|
6251
6397
|
const halfRange = Math.floor(maximumVisiblePages2 / 2);
|
|
6252
6398
|
let startPage = Math.max(1, currentPageInternal - halfRange);
|
|
6253
6399
|
let endPage = Math.min(pageCountInternal, currentPageInternal + halfRange);
|
|
@@ -6262,15 +6408,15 @@ var PaginationComponent = function Pagination({
|
|
|
6262
6408
|
(_, index) => startPage + index
|
|
6263
6409
|
);
|
|
6264
6410
|
}, [pageCountInternal, currentPageInternal]);
|
|
6265
|
-
(0,
|
|
6411
|
+
(0, import_react27.useEffect)(() => {
|
|
6266
6412
|
onChangePage?.(currentPageInternal);
|
|
6267
6413
|
}, [currentPageInternal, onChangePage]);
|
|
6268
|
-
(0,
|
|
6414
|
+
(0, import_react27.useEffect)(() => {
|
|
6269
6415
|
setCurrentPage(currentPage);
|
|
6270
6416
|
}, [currentPage]);
|
|
6271
6417
|
const mobileFooterBreakingPoint = mediaQuery.size700 && pageCountInternal > maximumVisiblePages2 / 1.4;
|
|
6272
|
-
return /* @__PURE__ */ (0,
|
|
6273
|
-
pageCountInternal > maximumVisiblePages2 && /* @__PURE__ */ (0,
|
|
6418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.row, { alignItems: "center", justifyContent: "center", gap: theme2.styles.gap * 2, children: [
|
|
6419
|
+
pageCountInternal > maximumVisiblePages2 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6274
6420
|
Button_default.icon,
|
|
6275
6421
|
{
|
|
6276
6422
|
icon: "doubleChevronLeft",
|
|
@@ -6279,8 +6425,8 @@ var PaginationComponent = function Pagination({
|
|
|
6279
6425
|
onClickWithValue: setCurrentPage
|
|
6280
6426
|
}
|
|
6281
6427
|
),
|
|
6282
|
-
/* @__PURE__ */ (0,
|
|
6283
|
-
/* @__PURE__ */ (0,
|
|
6428
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button_default.icon, { icon: "chevronLeft", disabled: currentPageInternal === 1, onClick: onClickPreviousPageElement }),
|
|
6429
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6284
6430
|
Div_default.row,
|
|
6285
6431
|
{
|
|
6286
6432
|
alignItems: "center",
|
|
@@ -6289,14 +6435,14 @@ var PaginationComponent = function Pagination({
|
|
|
6289
6435
|
gap: theme2.styles.gap,
|
|
6290
6436
|
children: paginationItems.map((pageIndex) => {
|
|
6291
6437
|
const isActive = currentPageInternal === pageIndex;
|
|
6292
|
-
return /* @__PURE__ */ (0,
|
|
6438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6293
6439
|
Div_default,
|
|
6294
6440
|
{
|
|
6295
6441
|
cursor: "pointer",
|
|
6296
6442
|
userSelect: "none",
|
|
6297
6443
|
value: pageIndex,
|
|
6298
6444
|
onClickWithValue: setCurrentPage,
|
|
6299
|
-
children: /* @__PURE__ */ (0,
|
|
6445
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6300
6446
|
Text_default,
|
|
6301
6447
|
{
|
|
6302
6448
|
fontWeight: isActive ? 700 : 400,
|
|
@@ -6311,7 +6457,7 @@ var PaginationComponent = function Pagination({
|
|
|
6311
6457
|
})
|
|
6312
6458
|
}
|
|
6313
6459
|
),
|
|
6314
|
-
/* @__PURE__ */ (0,
|
|
6460
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6315
6461
|
Button_default.icon,
|
|
6316
6462
|
{
|
|
6317
6463
|
icon: "chevronRight",
|
|
@@ -6319,7 +6465,7 @@ var PaginationComponent = function Pagination({
|
|
|
6319
6465
|
onClick: onClickNextPageElement
|
|
6320
6466
|
}
|
|
6321
6467
|
),
|
|
6322
|
-
pageCountInternal > maximumVisiblePages2 && /* @__PURE__ */ (0,
|
|
6468
|
+
pageCountInternal > maximumVisiblePages2 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6323
6469
|
Button_default.icon,
|
|
6324
6470
|
{
|
|
6325
6471
|
icon: "doubleChevronRight",
|
|
@@ -6330,11 +6476,11 @@ var PaginationComponent = function Pagination({
|
|
|
6330
6476
|
)
|
|
6331
6477
|
] });
|
|
6332
6478
|
};
|
|
6333
|
-
var Pagination2 = (0,
|
|
6479
|
+
var Pagination2 = (0, import_react27.memo)(PaginationComponent);
|
|
6334
6480
|
var Pagination_default = Pagination2;
|
|
6335
6481
|
|
|
6336
6482
|
// src/components/Table.tsx
|
|
6337
|
-
var
|
|
6483
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
6338
6484
|
var defaultImageWidth = 160;
|
|
6339
6485
|
var maximumVisiblePages = 11;
|
|
6340
6486
|
var TableStyledComponent = import_styled_components13.default.table.withConfig({
|
|
@@ -6480,7 +6626,7 @@ var filterPresetsText = {
|
|
|
6480
6626
|
nextMonth: "Next month",
|
|
6481
6627
|
nextYear: "Next year"
|
|
6482
6628
|
};
|
|
6483
|
-
var TableComponent = (0,
|
|
6629
|
+
var TableComponent = (0, import_react28.forwardRef)(function Table({
|
|
6484
6630
|
name,
|
|
6485
6631
|
columns,
|
|
6486
6632
|
data,
|
|
@@ -6507,14 +6653,14 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6507
6653
|
const theme2 = (0, import_react_better_core25.useTheme)();
|
|
6508
6654
|
const mediaQuery = useMediaQuery();
|
|
6509
6655
|
const { colorTheme } = (0, import_react_better_core25.useBetterCoreContext)();
|
|
6510
|
-
const filterModalRef = (0,
|
|
6511
|
-
const readyColumns = (0,
|
|
6512
|
-
const columnsRef = (0,
|
|
6656
|
+
const filterModalRef = (0, import_react28.useRef)(null);
|
|
6657
|
+
const readyColumns = (0, import_react28.useMemo)(() => columns.filter((column) => !column.hidden), [columns]);
|
|
6658
|
+
const columnsRef = (0, import_react28.useRef)(readyColumns);
|
|
6513
6659
|
columnsRef.current = readyColumns;
|
|
6514
|
-
const [checkedItems, setCheckedItems] = (0,
|
|
6515
|
-
const [expandedRows, setExpandedRows] = (0,
|
|
6516
|
-
const [currentPage, setCurrentPage] = (0,
|
|
6517
|
-
const [filterData, setFilterData] = (0,
|
|
6660
|
+
const [checkedItems, setCheckedItems] = (0, import_react28.useState)([]);
|
|
6661
|
+
const [expandedRows, setExpandedRows] = (0, import_react28.useState)([]);
|
|
6662
|
+
const [currentPage, setCurrentPage] = (0, import_react28.useState)(1);
|
|
6663
|
+
const [filterData, setFilterData] = (0, import_react28.useState)(() => {
|
|
6518
6664
|
if (!memoizeFilters || !name) return defaultFilterData ?? {};
|
|
6519
6665
|
const localStorageData = JSON.parse(localStorage.getItem(`react-better-html-table-filters-${name}`) || "{}");
|
|
6520
6666
|
const timestamp = localStorageData.timestamp;
|
|
@@ -6523,8 +6669,8 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6523
6669
|
if (timeDiff > memoizeFiltersLifespan) return defaultFilterData ?? {};
|
|
6524
6670
|
return data2;
|
|
6525
6671
|
});
|
|
6526
|
-
const [openedFilterColumnIndex, setOpenedFilterColumnIndex] = (0,
|
|
6527
|
-
const [filterListSelectedItems, setFilterListSelectedItems] = (0,
|
|
6672
|
+
const [openedFilterColumnIndex, setOpenedFilterColumnIndex] = (0, import_react28.useState)();
|
|
6673
|
+
const [filterListSelectedItems, setFilterListSelectedItems] = (0, import_react28.useState)();
|
|
6528
6674
|
const openedFilterData = openedFilterColumnIndex !== void 0 ? filterData[openedFilterColumnIndex] : void 0;
|
|
6529
6675
|
const openedFilterColumn = openedFilterColumnIndex !== void 0 ? readyColumns[openedFilterColumnIndex] : void 0;
|
|
6530
6676
|
const filterForm = useForm({
|
|
@@ -6554,26 +6700,26 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6554
6700
|
filterModalRef.current?.close();
|
|
6555
6701
|
}
|
|
6556
6702
|
});
|
|
6557
|
-
const expandColumn = (0,
|
|
6558
|
-
const renderCellContent = (0,
|
|
6703
|
+
const expandColumn = (0, import_react28.useMemo)(() => readyColumns.find((column) => column.type === "expand"), [readyColumns]);
|
|
6704
|
+
const renderCellContent = (0, import_react28.useCallback)(
|
|
6559
6705
|
(column, item, itemIndex) => {
|
|
6560
6706
|
switch (column.type) {
|
|
6561
6707
|
case "text": {
|
|
6562
6708
|
const value = column.keyName ? item[column.keyName] : void 0;
|
|
6563
6709
|
const textProps = (typeof column.getTextProps === "function" ? column.getTextProps?.(item, itemIndex) : column.getTextProps) ?? {};
|
|
6564
|
-
return /* @__PURE__ */ (0,
|
|
6710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text_default, { ...textProps, children: column.format?.(item, itemIndex) ?? String(value ?? "") });
|
|
6565
6711
|
}
|
|
6566
6712
|
case "element": {
|
|
6567
|
-
return column.render?.(item, itemIndex) ?? /* @__PURE__ */ (0,
|
|
6713
|
+
return column.render?.(item, itemIndex) ?? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, {});
|
|
6568
6714
|
}
|
|
6569
6715
|
case "image": {
|
|
6570
6716
|
const imageProps = (typeof column.getImageProps === "function" ? column.getImageProps?.(item, itemIndex) : column.getImageProps) ?? {};
|
|
6571
|
-
return /* @__PURE__ */ (0,
|
|
6717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Image_default, { width: "100%", borderRadius: theme2.styles.borderRadius / 2, ...imageProps });
|
|
6572
6718
|
}
|
|
6573
6719
|
case "checkbox": {
|
|
6574
6720
|
const { onChange, ...toggleInputProps } = (typeof column.getToggleInputProps === "function" ? column.getToggleInputProps?.(item, itemIndex) : column.getToggleInputProps) ?? {};
|
|
6575
6721
|
const checkedValue = checkedItems[itemIndex];
|
|
6576
|
-
return /* @__PURE__ */ (0,
|
|
6722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6577
6723
|
ToggleInput_default.checkbox,
|
|
6578
6724
|
{
|
|
6579
6725
|
checked: checkedValue,
|
|
@@ -6594,7 +6740,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6594
6740
|
);
|
|
6595
6741
|
}
|
|
6596
6742
|
case "expand": {
|
|
6597
|
-
return /* @__PURE__ */ (0,
|
|
6743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Div_default, { isTabAccessed: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6598
6744
|
Icon_default,
|
|
6599
6745
|
{
|
|
6600
6746
|
name: "chevronDown",
|
|
@@ -6604,13 +6750,13 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6604
6750
|
) });
|
|
6605
6751
|
}
|
|
6606
6752
|
default: {
|
|
6607
|
-
return /* @__PURE__ */ (0,
|
|
6753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, {});
|
|
6608
6754
|
}
|
|
6609
6755
|
}
|
|
6610
6756
|
},
|
|
6611
6757
|
[theme2, checkedItems, expandedRows]
|
|
6612
6758
|
);
|
|
6613
|
-
const onClickRowElement = (0,
|
|
6759
|
+
const onClickRowElement = (0, import_react28.useCallback)(
|
|
6614
6760
|
(item, index) => {
|
|
6615
6761
|
if (expandColumn) {
|
|
6616
6762
|
setExpandedRows((oldValue) => {
|
|
@@ -6627,14 +6773,14 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6627
6773
|
},
|
|
6628
6774
|
[onClickRow, expandColumn]
|
|
6629
6775
|
);
|
|
6630
|
-
const onClickAllCheckboxesElement = (0,
|
|
6776
|
+
const onClickAllCheckboxesElement = (0, import_react28.useCallback)(
|
|
6631
6777
|
(checked) => {
|
|
6632
6778
|
onClickAllCheckboxes?.(checked);
|
|
6633
6779
|
setCheckedItems(data.map(() => checked));
|
|
6634
6780
|
},
|
|
6635
6781
|
[onClickAllCheckboxes, data]
|
|
6636
6782
|
);
|
|
6637
|
-
const onClickFilterButton = (0,
|
|
6783
|
+
const onClickFilterButton = (0, import_react28.useCallback)(
|
|
6638
6784
|
(columnIndex) => {
|
|
6639
6785
|
const thisFilterData = filterData[columnIndex];
|
|
6640
6786
|
if (thisFilterData?.type === "number" || thisFilterData?.type === "date" || thisFilterData?.type === "date-time") {
|
|
@@ -6650,12 +6796,12 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6650
6796
|
},
|
|
6651
6797
|
[filterData]
|
|
6652
6798
|
);
|
|
6653
|
-
const onCloseFilterModal = (0,
|
|
6799
|
+
const onCloseFilterModal = (0, import_react28.useCallback)(() => {
|
|
6654
6800
|
setTimeout(() => setOpenedFilterColumnIndex(void 0), 0.2 * 1e3);
|
|
6655
6801
|
setFilterListSelectedItems(void 0);
|
|
6656
6802
|
filterForm.reset();
|
|
6657
6803
|
}, []);
|
|
6658
|
-
const onClickCancelFormFilter = (0,
|
|
6804
|
+
const onClickCancelFormFilter = (0, import_react28.useCallback)(() => {
|
|
6659
6805
|
if (openedFilterColumnIndex === void 0) return;
|
|
6660
6806
|
setFilterData(
|
|
6661
6807
|
(oldValue) => Object.entries({
|
|
@@ -6668,7 +6814,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6668
6814
|
);
|
|
6669
6815
|
filterModalRef.current?.close();
|
|
6670
6816
|
}, [openedFilterColumnIndex]);
|
|
6671
|
-
const onClickFilterListItem = (0,
|
|
6817
|
+
const onClickFilterListItem = (0, import_react28.useCallback)(
|
|
6672
6818
|
(value) => setFilterListSelectedItems((oldValue) => {
|
|
6673
6819
|
if (!oldValue) return [value];
|
|
6674
6820
|
if (oldValue.includes(value)) return oldValue.filter((item) => item !== value);
|
|
@@ -6676,7 +6822,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6676
6822
|
}),
|
|
6677
6823
|
[]
|
|
6678
6824
|
);
|
|
6679
|
-
const onClickFilterPreset = (0,
|
|
6825
|
+
const onClickFilterPreset = (0, import_react28.useCallback)(
|
|
6680
6826
|
(preset) => {
|
|
6681
6827
|
const getValueForDate = (date) => {
|
|
6682
6828
|
if (openedFilterColumn?.filter === "date") return date.toISOString().split("T")[0];
|
|
@@ -6761,7 +6907,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6761
6907
|
},
|
|
6762
6908
|
[openedFilterColumn]
|
|
6763
6909
|
);
|
|
6764
|
-
const renderExpandedRow = (0,
|
|
6910
|
+
const renderExpandedRow = (0, import_react28.useCallback)(
|
|
6765
6911
|
(...props2) => {
|
|
6766
6912
|
const expandColumn2 = readyColumns.find((column) => column.type === "expand");
|
|
6767
6913
|
if (!expandColumn2) return;
|
|
@@ -6769,7 +6915,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6769
6915
|
},
|
|
6770
6916
|
[readyColumns]
|
|
6771
6917
|
);
|
|
6772
|
-
const dataAfterFilter = (0,
|
|
6918
|
+
const dataAfterFilter = (0, import_react28.useMemo)(
|
|
6773
6919
|
() => data.filter(
|
|
6774
6920
|
(item) => Object.entries(filterData).every(([columnIndex, filter]) => {
|
|
6775
6921
|
if (!filter) return true;
|
|
@@ -6798,17 +6944,17 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6798
6944
|
),
|
|
6799
6945
|
[data, filterData]
|
|
6800
6946
|
);
|
|
6801
|
-
const dataAfterPagination = (0,
|
|
6947
|
+
const dataAfterPagination = (0, import_react28.useMemo)(() => {
|
|
6802
6948
|
if (pageSize === void 0) return dataAfterFilter;
|
|
6803
6949
|
if (pageCount !== void 0) return dataAfterFilter;
|
|
6804
6950
|
const pageStartItemIndex = (currentPage - 1) * (pageSize ?? 0);
|
|
6805
6951
|
const pageEndItemIndex = pageStartItemIndex + (pageSize ?? 0);
|
|
6806
6952
|
return dataAfterFilter.slice(pageStartItemIndex, pageEndItemIndex);
|
|
6807
6953
|
}, [dataAfterFilter, pageSize, currentPage, pageCount]);
|
|
6808
|
-
const everythingIsChecked = (0,
|
|
6954
|
+
const everythingIsChecked = (0, import_react28.useMemo)(() => {
|
|
6809
6955
|
return data.length > 0 && checkedItems.every((checked) => checked) && checkedItems.length === data.length;
|
|
6810
6956
|
}, [data, checkedItems]);
|
|
6811
|
-
const possibleFilterListValues = (0,
|
|
6957
|
+
const possibleFilterListValues = (0, import_react28.useMemo)(() => {
|
|
6812
6958
|
if (!openedFilterColumn || openedFilterColumn.filter !== "list") return [];
|
|
6813
6959
|
return openedFilterColumn.list.filter((item) => item !== void 0).map((item) => ({
|
|
6814
6960
|
...item,
|
|
@@ -6822,18 +6968,18 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6822
6968
|
);
|
|
6823
6969
|
}, [data, openedFilterColumn, filterForm.values.search]);
|
|
6824
6970
|
const pageCountInternal = pageCount ?? (pageSize !== void 0 ? Math.ceil(dataAfterFilter.length / pageSize) : 1);
|
|
6825
|
-
const onClickSelectAllFilterListItems = (0,
|
|
6971
|
+
const onClickSelectAllFilterListItems = (0, import_react28.useCallback)(
|
|
6826
6972
|
() => setFilterListSelectedItems(possibleFilterListValues.map((item) => item.value)),
|
|
6827
6973
|
[possibleFilterListValues]
|
|
6828
6974
|
);
|
|
6829
|
-
const onClickDeselectAllFilterListItems = (0,
|
|
6830
|
-
(0,
|
|
6975
|
+
const onClickDeselectAllFilterListItems = (0, import_react28.useCallback)(() => setFilterListSelectedItems([]), []);
|
|
6976
|
+
(0, import_react28.useEffect)(() => {
|
|
6831
6977
|
onChangePage?.(currentPage);
|
|
6832
6978
|
}, [onChangePage, currentPage]);
|
|
6833
|
-
(0,
|
|
6979
|
+
(0, import_react28.useEffect)(() => {
|
|
6834
6980
|
onChangeFilter?.(filterData);
|
|
6835
6981
|
}, [onChangeFilter, filterData]);
|
|
6836
|
-
(0,
|
|
6982
|
+
(0, import_react28.useEffect)(() => {
|
|
6837
6983
|
if (!memoizeFilters) return;
|
|
6838
6984
|
if (!name) return;
|
|
6839
6985
|
localStorage.setItem(
|
|
@@ -6844,10 +6990,10 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6844
6990
|
})
|
|
6845
6991
|
);
|
|
6846
6992
|
}, [memoizeFilters, name, filterData]);
|
|
6847
|
-
(0,
|
|
6993
|
+
(0, import_react28.useEffect)(() => {
|
|
6848
6994
|
onChangeFilterDataValue?.(dataAfterFilter);
|
|
6849
6995
|
}, [onChangeFilterDataValue, dataAfterFilter]);
|
|
6850
|
-
(0,
|
|
6996
|
+
(0, import_react28.useImperativeHandle)(ref, () => {
|
|
6851
6997
|
return {
|
|
6852
6998
|
currentPage,
|
|
6853
6999
|
setCurrentPage,
|
|
@@ -6857,8 +7003,8 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6857
7003
|
}, [currentPage, setCurrentPage, pageCountInternal, setCheckedItems]);
|
|
6858
7004
|
const withFooter = pageSize !== void 0 && pageCountInternal > 1;
|
|
6859
7005
|
const mobileFooterBreakingPoint = mediaQuery.size700 && pageCountInternal > maximumVisiblePages / 1.4;
|
|
6860
|
-
return /* @__PURE__ */ (0,
|
|
6861
|
-
/* @__PURE__ */ (0,
|
|
7006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
7007
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6862
7008
|
Div_default,
|
|
6863
7009
|
{
|
|
6864
7010
|
border: `${theme2.styles.borderWidth}px solid ${theme2.colors.border}`,
|
|
@@ -6866,7 +7012,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6866
7012
|
overflow: !containsOverflowComponents ? "auto" : void 0,
|
|
6867
7013
|
...props,
|
|
6868
7014
|
ref: wrapperComponentRef,
|
|
6869
|
-
children: /* @__PURE__ */ (0,
|
|
7015
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
6870
7016
|
TableStyledComponent,
|
|
6871
7017
|
{
|
|
6872
7018
|
isStriped,
|
|
@@ -6877,14 +7023,14 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6877
7023
|
containsOverflowComponents,
|
|
6878
7024
|
withFooter,
|
|
6879
7025
|
children: [
|
|
6880
|
-
/* @__PURE__ */ (0,
|
|
7026
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { className: "isHeader", children: readyColumns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6881
7027
|
ThStyledComponent,
|
|
6882
7028
|
{
|
|
6883
7029
|
width: column.width ?? (column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.type === "expand" ? 16 : void 0),
|
|
6884
7030
|
minWidth: column.minWidth,
|
|
6885
7031
|
maxWidth: column.maxWidth,
|
|
6886
7032
|
textAlign: column.align,
|
|
6887
|
-
children: /* @__PURE__ */ (0,
|
|
7033
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
6888
7034
|
Div_default.row,
|
|
6889
7035
|
{
|
|
6890
7036
|
width: "100%",
|
|
@@ -6892,15 +7038,15 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6892
7038
|
justifyContent: column.filter ? "space-between" : column.align === "center" ? "center" : column.align === "right" ? "flex-end" : "flex-start",
|
|
6893
7039
|
gap: theme2.styles.gap,
|
|
6894
7040
|
children: [
|
|
6895
|
-
column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ (0,
|
|
7041
|
+
column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6896
7042
|
ToggleInput_default.checkbox,
|
|
6897
7043
|
{
|
|
6898
7044
|
checked: everythingIsChecked,
|
|
6899
7045
|
disabled: data.length === 0,
|
|
6900
7046
|
onChange: onClickAllCheckboxesElement
|
|
6901
7047
|
}
|
|
6902
|
-
) : column.label ? column.renderLabel ? column.renderLabel(column.label) : /* @__PURE__ */ (0,
|
|
6903
|
-
column.filter && /* @__PURE__ */ (0,
|
|
7048
|
+
) : column.label ? column.renderLabel ? column.renderLabel(column.label) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text_default, { children: column.label }) : void 0,
|
|
7049
|
+
column.filter && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6904
7050
|
Button_default.icon,
|
|
6905
7051
|
{
|
|
6906
7052
|
icon: "filter",
|
|
@@ -6915,16 +7061,16 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6915
7061
|
},
|
|
6916
7062
|
column.type + column.label + index
|
|
6917
7063
|
)) }) }),
|
|
6918
|
-
/* @__PURE__ */ (0,
|
|
7064
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tbody", { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { className: "withoutHover", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "noData", colSpan: readyColumns.length, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => {
|
|
6919
7065
|
const realRowIndex = rowIndex + (pageSize ? (currentPage - 1) * pageSize : 0);
|
|
6920
|
-
return /* @__PURE__ */ (0,
|
|
6921
|
-
/* @__PURE__ */ (0,
|
|
7066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react28.Fragment, { children: [
|
|
7067
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6922
7068
|
"tr",
|
|
6923
7069
|
{
|
|
6924
7070
|
className: isInsideTableExpandRow && onClickRow === void 0 && expandColumn === void 0 ? "withoutHover" : void 0,
|
|
6925
7071
|
style: getRowStyle?.(item, realRowIndex),
|
|
6926
7072
|
onClick: () => onClickRowElement(item, realRowIndex),
|
|
6927
|
-
children: readyColumns.map((column, colIndex) => /* @__PURE__ */ (0,
|
|
7073
|
+
children: readyColumns.map((column, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6928
7074
|
TdStyledComponent,
|
|
6929
7075
|
{
|
|
6930
7076
|
textAlign: column.align,
|
|
@@ -6937,10 +7083,10 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6937
7083
|
))
|
|
6938
7084
|
}
|
|
6939
7085
|
),
|
|
6940
|
-
expandedRows[realRowIndex] && /* @__PURE__ */ (0,
|
|
7086
|
+
expandedRows[realRowIndex] && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { className: "withoutHover isExpandRow", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { colSpan: readyColumns.length, children: renderExpandedRow(item, realRowIndex) }) })
|
|
6941
7087
|
] }, JSON.stringify(item) + realRowIndex);
|
|
6942
|
-
}) : /* @__PURE__ */ (0,
|
|
6943
|
-
withFooter && /* @__PURE__ */ (0,
|
|
7088
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { className: "withoutHover", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "noData", colSpan: readyColumns.length, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
|
|
7089
|
+
withFooter && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tfoot", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { className: "isFooter", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { colSpan: readyColumns.length, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
6944
7090
|
Div_default.column,
|
|
6945
7091
|
{
|
|
6946
7092
|
position: "relative",
|
|
@@ -6949,7 +7095,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6949
7095
|
flexReverse: true,
|
|
6950
7096
|
gap: theme2.styles.gap / 2,
|
|
6951
7097
|
children: [
|
|
6952
|
-
/* @__PURE__ */ (0,
|
|
7098
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
6953
7099
|
Text_default,
|
|
6954
7100
|
{
|
|
6955
7101
|
position: mobileFooterBreakingPoint ? "relative" : "absolute",
|
|
@@ -6964,7 +7110,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6964
7110
|
]
|
|
6965
7111
|
}
|
|
6966
7112
|
),
|
|
6967
|
-
/* @__PURE__ */ (0,
|
|
7113
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6968
7114
|
Pagination_default,
|
|
6969
7115
|
{
|
|
6970
7116
|
currentPage,
|
|
@@ -6983,26 +7129,26 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6983
7129
|
)
|
|
6984
7130
|
}
|
|
6985
7131
|
),
|
|
6986
|
-
/* @__PURE__ */ (0,
|
|
7132
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6987
7133
|
Modal_default,
|
|
6988
7134
|
{
|
|
6989
7135
|
title: `Filter ${openedFilterColumn?.label ?? ""}`,
|
|
6990
7136
|
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" : "",
|
|
6991
7137
|
onClose: onCloseFilterModal,
|
|
6992
7138
|
ref: filterModalRef,
|
|
6993
|
-
children: openedFilterColumn ? openedFilterColumn.filter === "number" ? /* @__PURE__ */ (0,
|
|
7139
|
+
children: openedFilterColumn ? openedFilterColumn.filter === "number" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6994
7140
|
Form_default,
|
|
6995
7141
|
{
|
|
6996
7142
|
form: filterForm,
|
|
6997
7143
|
submitButtonText: "Filter",
|
|
6998
7144
|
cancelButtonText: "Clear",
|
|
6999
7145
|
onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
|
|
7000
|
-
children: /* @__PURE__ */ (0,
|
|
7001
|
-
/* @__PURE__ */ (0,
|
|
7002
|
-
/* @__PURE__ */ (0,
|
|
7146
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(FormRow_default, { children: [
|
|
7147
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(InputField_default, { type: "number", label: "Min", ...filterForm.getInputFieldProps("min") }),
|
|
7148
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(InputField_default, { type: "number", label: "Max", ...filterForm.getInputFieldProps("max") })
|
|
7003
7149
|
] })
|
|
7004
7150
|
}
|
|
7005
|
-
) : openedFilterColumn.filter === "date" || openedFilterColumn.filter === "date-time" ? /* @__PURE__ */ (0,
|
|
7151
|
+
) : openedFilterColumn.filter === "date" || openedFilterColumn.filter === "date-time" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
7006
7152
|
Form_default,
|
|
7007
7153
|
{
|
|
7008
7154
|
form: filterForm,
|
|
@@ -7011,16 +7157,16 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
7011
7157
|
cancelButtonText: "Clear",
|
|
7012
7158
|
onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
|
|
7013
7159
|
children: [
|
|
7014
|
-
/* @__PURE__ */ (0,
|
|
7015
|
-
/* @__PURE__ */ (0,
|
|
7016
|
-
/* @__PURE__ */ (0,
|
|
7017
|
-
] }) : /* @__PURE__ */ (0,
|
|
7018
|
-
/* @__PURE__ */ (0,
|
|
7019
|
-
/* @__PURE__ */ (0,
|
|
7160
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FormRow_default, { children: openedFilterColumn.filter === "date" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
7161
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(InputField_default.date, { label: "Min", ...filterForm.getInputFieldProps("min") }),
|
|
7162
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(InputField_default.date, { label: "Max", ...filterForm.getInputFieldProps("max") })
|
|
7163
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
7164
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(InputField_default.dateTime, { label: "Min", ...filterForm.getInputFieldProps("min") }),
|
|
7165
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(InputField_default.dateTime, { label: "Max", ...filterForm.getInputFieldProps("max") })
|
|
7020
7166
|
] }) }),
|
|
7021
|
-
openedFilterColumn.presets && /* @__PURE__ */ (0,
|
|
7022
|
-
/* @__PURE__ */ (0,
|
|
7023
|
-
/* @__PURE__ */ (0,
|
|
7167
|
+
openedFilterColumn.presets && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
7168
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Label_default, { text: "Presets" }),
|
|
7169
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Div_default.row, { alignItems: "center", flexWrap: "wrap", gap: theme2.styles.gap, children: openedFilterColumn.presets.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7024
7170
|
Button_default.secondary,
|
|
7025
7171
|
{
|
|
7026
7172
|
text: filterPresetsText[preset],
|
|
@@ -7033,14 +7179,14 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
7033
7179
|
] })
|
|
7034
7180
|
]
|
|
7035
7181
|
}
|
|
7036
|
-
) : openedFilterColumn.filter === "list" ? /* @__PURE__ */ (0,
|
|
7182
|
+
) : openedFilterColumn.filter === "list" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
7037
7183
|
Form_default,
|
|
7038
7184
|
{
|
|
7039
7185
|
gap: theme2.styles.space,
|
|
7040
7186
|
submitButtonText: "Filter",
|
|
7041
7187
|
cancelButtonText: "Clear",
|
|
7042
|
-
renderActionButtons: /* @__PURE__ */ (0,
|
|
7043
|
-
/* @__PURE__ */ (0,
|
|
7188
|
+
renderActionButtons: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Div_default.row, { marginRight: "auto", alignItems: "center", gap: theme2.styles.gap, children: [
|
|
7189
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7044
7190
|
Button_default.secondary,
|
|
7045
7191
|
{
|
|
7046
7192
|
text: "Select All",
|
|
@@ -7049,7 +7195,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
7049
7195
|
onClick: onClickSelectAllFilterListItems
|
|
7050
7196
|
}
|
|
7051
7197
|
),
|
|
7052
|
-
/* @__PURE__ */ (0,
|
|
7198
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7053
7199
|
Button_default.secondary,
|
|
7054
7200
|
{
|
|
7055
7201
|
text: "Deselect All",
|
|
@@ -7062,7 +7208,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
7062
7208
|
onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
|
|
7063
7209
|
onSubmit: filterForm.onSubmit,
|
|
7064
7210
|
children: [
|
|
7065
|
-
openedFilterColumn?.withSearch && /* @__PURE__ */ (0,
|
|
7211
|
+
openedFilterColumn?.withSearch && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FormRow_default, { oneItemOnly: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7066
7212
|
InputField_default.search,
|
|
7067
7213
|
{
|
|
7068
7214
|
label: "Search",
|
|
@@ -7070,19 +7216,19 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
7070
7216
|
...filterForm.getInputFieldProps("search")
|
|
7071
7217
|
}
|
|
7072
7218
|
) }),
|
|
7073
|
-
/* @__PURE__ */ (0,
|
|
7074
|
-
/* @__PURE__ */ (0,
|
|
7075
|
-
/* @__PURE__ */ (0,
|
|
7219
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
7220
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Label_default, { text: "Possible values" }),
|
|
7221
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Div_default.row, { flexWrap: "wrap", gap: theme2.styles.gap, children: possibleFilterListValues.length > 0 ? possibleFilterListValues.map((value) => {
|
|
7076
7222
|
const isActive = filterListSelectedItems?.includes(value.value);
|
|
7077
|
-
return /* @__PURE__ */ (0,
|
|
7223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7078
7224
|
Div_default.box,
|
|
7079
7225
|
{
|
|
7080
7226
|
isActive,
|
|
7081
7227
|
value: value.value,
|
|
7082
7228
|
onClickWithValue: onClickFilterListItem,
|
|
7083
|
-
children: /* @__PURE__ */ (0,
|
|
7084
|
-
/* @__PURE__ */ (0,
|
|
7085
|
-
openedFilterColumn.withTotalNumber && /* @__PURE__ */ (0,
|
|
7229
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
7230
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text_default, { children: value.label || value.value }),
|
|
7231
|
+
openedFilterColumn.withTotalNumber && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
7086
7232
|
Text_default,
|
|
7087
7233
|
{
|
|
7088
7234
|
fontSize: 14,
|
|
@@ -7098,24 +7244,24 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
7098
7244
|
},
|
|
7099
7245
|
value.value.toString()
|
|
7100
7246
|
);
|
|
7101
|
-
}) : /* @__PURE__ */ (0,
|
|
7247
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text_default.unknown, { children: "No values" }) })
|
|
7102
7248
|
] }),
|
|
7103
|
-
/* @__PURE__ */ (0,
|
|
7249
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Div_default, {})
|
|
7104
7250
|
]
|
|
7105
7251
|
}
|
|
7106
|
-
) : /* @__PURE__ */ (0,
|
|
7252
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text_default.unknown, { children: "Unknown filter" }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Loader_default.box, {})
|
|
7107
7253
|
}
|
|
7108
7254
|
)
|
|
7109
7255
|
] });
|
|
7110
7256
|
});
|
|
7111
|
-
var Table2 = (0,
|
|
7257
|
+
var Table2 = (0, import_react28.memo)(TableComponent);
|
|
7112
7258
|
var Table_default = Table2;
|
|
7113
7259
|
|
|
7114
7260
|
// src/components/Tooltip.tsx
|
|
7115
|
-
var
|
|
7261
|
+
var import_react29 = require("react");
|
|
7116
7262
|
var import_react_better_core26 = require("react-better-core");
|
|
7117
7263
|
var import_styled_components14 = __toESM(require("styled-components"));
|
|
7118
|
-
var
|
|
7264
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
7119
7265
|
var tooltipContainerStyle = (props) => ({
|
|
7120
7266
|
top: import_styled_components14.css`
|
|
7121
7267
|
bottom: calc(100% + ${props.gap}px + ${props.arrowSize}px);
|
|
@@ -7217,10 +7363,10 @@ var arrowStyle = (props, borderWidth) => ({
|
|
|
7217
7363
|
transform: !borderWidth && props.align === "center" ? "translateY(-50%);" : void 0
|
|
7218
7364
|
}
|
|
7219
7365
|
});
|
|
7220
|
-
var Arrow = (0,
|
|
7366
|
+
var Arrow = (0, import_react29.memo)(function Arrow2(props) {
|
|
7221
7367
|
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
7222
7368
|
const { position, size } = props;
|
|
7223
|
-
const outerProps = (0,
|
|
7369
|
+
const outerProps = (0, import_react29.useMemo)(
|
|
7224
7370
|
() => ({
|
|
7225
7371
|
...props,
|
|
7226
7372
|
color: theme2.colors.border
|
|
@@ -7228,7 +7374,7 @@ var Arrow = (0, import_react28.memo)(function Arrow2(props) {
|
|
|
7228
7374
|
[props, theme2]
|
|
7229
7375
|
);
|
|
7230
7376
|
const borderWidth = theme2.styles.borderWidth;
|
|
7231
|
-
return /* @__PURE__ */ (0,
|
|
7377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7232
7378
|
Div_default,
|
|
7233
7379
|
{
|
|
7234
7380
|
position: "absolute",
|
|
@@ -7236,7 +7382,7 @@ var Arrow = (0, import_react28.memo)(function Arrow2(props) {
|
|
|
7236
7382
|
height: 0,
|
|
7237
7383
|
border: `${size}px solid transparent`,
|
|
7238
7384
|
...arrowStyle(outerProps)[position],
|
|
7239
|
-
children: /* @__PURE__ */ (0,
|
|
7385
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7240
7386
|
Div_default,
|
|
7241
7387
|
{
|
|
7242
7388
|
position: "absolute",
|
|
@@ -7249,7 +7395,7 @@ var Arrow = (0, import_react28.memo)(function Arrow2(props) {
|
|
|
7249
7395
|
}
|
|
7250
7396
|
);
|
|
7251
7397
|
});
|
|
7252
|
-
var TooltipComponent = (0,
|
|
7398
|
+
var TooltipComponent = (0, import_react29.forwardRef)(function Tooltip({
|
|
7253
7399
|
position = "bottom",
|
|
7254
7400
|
trigger = "hover",
|
|
7255
7401
|
align = "center",
|
|
@@ -7272,17 +7418,17 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
7272
7418
|
children
|
|
7273
7419
|
}, ref) {
|
|
7274
7420
|
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
7275
|
-
const triggerHolderRef = (0,
|
|
7276
|
-
const contentRef = (0,
|
|
7277
|
-
const tooltipContainerRef = (0,
|
|
7278
|
-
const closeTimerRef = (0,
|
|
7279
|
-
const [isOpen, setIsOpen] = (0,
|
|
7280
|
-
const [isOpenLate, setIsOpenLate] = (0,
|
|
7421
|
+
const triggerHolderRef = (0, import_react29.useRef)(null);
|
|
7422
|
+
const contentRef = (0, import_react29.useRef)(null);
|
|
7423
|
+
const tooltipContainerRef = (0, import_react29.useRef)(null);
|
|
7424
|
+
const closeTimerRef = (0, import_react29.useRef)(void 0);
|
|
7425
|
+
const [isOpen, setIsOpen] = (0, import_react29.useState)(false);
|
|
7426
|
+
const [isOpenLate, setIsOpenLate] = (0, import_react29.useState)(false);
|
|
7281
7427
|
const arrowSize = withArrow ? theme2.styles.gap : 0;
|
|
7282
7428
|
const gap = theme2.styles.gap / 2;
|
|
7283
7429
|
const outsideScreenGap = theme2.styles.gap / 2;
|
|
7284
7430
|
const totalGap = arrowSize + gap;
|
|
7285
|
-
const openTooltip = (0,
|
|
7431
|
+
const openTooltip = (0, import_react29.useCallback)(() => {
|
|
7286
7432
|
if (disabled) return;
|
|
7287
7433
|
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
7288
7434
|
setIsOpen(true);
|
|
@@ -7307,18 +7453,18 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
7307
7453
|
}, 1);
|
|
7308
7454
|
onOpen?.();
|
|
7309
7455
|
}, [disabled, onOpen, outsideScreenGap, totalGap]);
|
|
7310
|
-
const closeTooltip = (0,
|
|
7456
|
+
const closeTooltip = (0, import_react29.useCallback)(() => {
|
|
7311
7457
|
setIsOpen(false);
|
|
7312
7458
|
closeTimerRef.current = setTimeout(() => setIsOpenLate(false), 300);
|
|
7313
7459
|
onClose?.();
|
|
7314
7460
|
}, [onClose]);
|
|
7315
|
-
const onMouseEnter = (0,
|
|
7461
|
+
const onMouseEnter = (0, import_react29.useCallback)(() => {
|
|
7316
7462
|
if (trigger === "hover") openTooltip();
|
|
7317
7463
|
}, [trigger, openTooltip]);
|
|
7318
|
-
const onMouseLeave = (0,
|
|
7464
|
+
const onMouseLeave = (0, import_react29.useCallback)(() => {
|
|
7319
7465
|
if (trigger === "hover") closeTooltip();
|
|
7320
7466
|
}, [trigger, closeTooltip]);
|
|
7321
|
-
const onClickHolder = (0,
|
|
7467
|
+
const onClickHolder = (0, import_react29.useCallback)(
|
|
7322
7468
|
(event) => {
|
|
7323
7469
|
if (trigger === "click") {
|
|
7324
7470
|
if (!isOpen) openTooltip();
|
|
@@ -7327,7 +7473,7 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
7327
7473
|
},
|
|
7328
7474
|
[trigger, openTooltip, isOpen, closeTooltip]
|
|
7329
7475
|
);
|
|
7330
|
-
const onClickOutside = (0,
|
|
7476
|
+
const onClickOutside = (0, import_react29.useCallback)(
|
|
7331
7477
|
(event) => {
|
|
7332
7478
|
if (!isOpen) return;
|
|
7333
7479
|
if (trigger !== "click") return;
|
|
@@ -7337,7 +7483,7 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
7337
7483
|
},
|
|
7338
7484
|
[trigger, isOpen, closeTooltip]
|
|
7339
7485
|
);
|
|
7340
|
-
(0,
|
|
7486
|
+
(0, import_react29.useEffect)(() => {
|
|
7341
7487
|
if (trigger === "click") {
|
|
7342
7488
|
document.addEventListener("mousedown", onClickOutside);
|
|
7343
7489
|
return () => {
|
|
@@ -7345,18 +7491,18 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
7345
7491
|
};
|
|
7346
7492
|
}
|
|
7347
7493
|
}, [trigger, onClickOutside]);
|
|
7348
|
-
(0,
|
|
7494
|
+
(0, import_react29.useEffect)(() => {
|
|
7349
7495
|
if (!disabled) return;
|
|
7350
7496
|
closeTooltip();
|
|
7351
7497
|
}, [disabled]);
|
|
7352
|
-
(0,
|
|
7498
|
+
(0, import_react29.useImperativeHandle)(ref, () => {
|
|
7353
7499
|
return {
|
|
7354
7500
|
isOpen,
|
|
7355
7501
|
open: openTooltip,
|
|
7356
7502
|
close: closeTooltip
|
|
7357
7503
|
};
|
|
7358
7504
|
}, [isOpen, openTooltip, closeTooltip]);
|
|
7359
|
-
return /* @__PURE__ */ (0,
|
|
7505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
7360
7506
|
Div_default,
|
|
7361
7507
|
{
|
|
7362
7508
|
position: "relative",
|
|
@@ -7366,7 +7512,7 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
7366
7512
|
onMouseEnter,
|
|
7367
7513
|
onMouseLeave,
|
|
7368
7514
|
children: [
|
|
7369
|
-
/* @__PURE__ */ (0,
|
|
7515
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7370
7516
|
Div_default,
|
|
7371
7517
|
{
|
|
7372
7518
|
width: childrenWrapperWidth,
|
|
@@ -7376,7 +7522,7 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
7376
7522
|
children
|
|
7377
7523
|
}
|
|
7378
7524
|
),
|
|
7379
|
-
/* @__PURE__ */ (0,
|
|
7525
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7380
7526
|
TooltipContainer,
|
|
7381
7527
|
{
|
|
7382
7528
|
theme: theme2,
|
|
@@ -7389,8 +7535,8 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
7389
7535
|
isOpen,
|
|
7390
7536
|
role: "tooltip",
|
|
7391
7537
|
ref: tooltipContainerRef,
|
|
7392
|
-
children: (isOpen || isOpenLate) && /* @__PURE__ */ (0,
|
|
7393
|
-
/* @__PURE__ */ (0,
|
|
7538
|
+
children: (isOpen || isOpenLate) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default, { position: "relative", ref: contentRef, children: [
|
|
7539
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7394
7540
|
Div_default.box,
|
|
7395
7541
|
{
|
|
7396
7542
|
position: "relative",
|
|
@@ -7404,7 +7550,7 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
7404
7550
|
children: content
|
|
7405
7551
|
}
|
|
7406
7552
|
),
|
|
7407
|
-
/* @__PURE__ */ (0,
|
|
7553
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7408
7554
|
Div_default,
|
|
7409
7555
|
{
|
|
7410
7556
|
position: "absolute",
|
|
@@ -7418,7 +7564,7 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
7418
7564
|
borderTopRightRadius: 999
|
|
7419
7565
|
}
|
|
7420
7566
|
),
|
|
7421
|
-
withArrow && /* @__PURE__ */ (0,
|
|
7567
|
+
withArrow && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7422
7568
|
Arrow,
|
|
7423
7569
|
{
|
|
7424
7570
|
position,
|
|
@@ -7436,7 +7582,7 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
7436
7582
|
}
|
|
7437
7583
|
);
|
|
7438
7584
|
});
|
|
7439
|
-
TooltipComponent.item = (0,
|
|
7585
|
+
TooltipComponent.item = (0, import_react29.forwardRef)(function Item({
|
|
7440
7586
|
icon,
|
|
7441
7587
|
iconColor,
|
|
7442
7588
|
text,
|
|
@@ -7450,7 +7596,7 @@ TooltipComponent.item = (0, import_react28.forwardRef)(function Item({
|
|
|
7450
7596
|
onClickWithValue
|
|
7451
7597
|
}, ref) {
|
|
7452
7598
|
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
7453
|
-
return /* @__PURE__ */ (0,
|
|
7599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
7454
7600
|
Div_default.row,
|
|
7455
7601
|
{
|
|
7456
7602
|
alignItems: "center",
|
|
@@ -7468,18 +7614,18 @@ TooltipComponent.item = (0, import_react28.forwardRef)(function Item({
|
|
|
7468
7614
|
onClickWithValue: !disabled ? onClickWithValue : void 0,
|
|
7469
7615
|
ref,
|
|
7470
7616
|
children: [
|
|
7471
|
-
icon && /* @__PURE__ */ (0,
|
|
7472
|
-
/* @__PURE__ */ (0,
|
|
7473
|
-
/* @__PURE__ */ (0,
|
|
7474
|
-
description && /* @__PURE__ */ (0,
|
|
7617
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Icon_default, { name: icon, color: iconColor ?? (!isActive ? theme2.colors.textSecondary : void 0) }),
|
|
7618
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
7619
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text_default, { fontWeight: isActive ? 700 : void 0, color: textColor ?? theme2.colors.textPrimary, children: text }),
|
|
7620
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text_default, { fontSize: 14, color: theme2.colors.textSecondary, children: description })
|
|
7475
7621
|
] })
|
|
7476
7622
|
]
|
|
7477
7623
|
}
|
|
7478
7624
|
);
|
|
7479
7625
|
});
|
|
7480
|
-
TooltipComponent.divider = (0,
|
|
7626
|
+
TooltipComponent.divider = (0, import_react29.forwardRef)(function DividerComponent(props, ref) {
|
|
7481
7627
|
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
7482
|
-
return /* @__PURE__ */ (0,
|
|
7628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7483
7629
|
Divider_default.horizontal,
|
|
7484
7630
|
{
|
|
7485
7631
|
width: theme2.styles.borderWidth === 0 ? 1 : theme2.styles.borderWidth,
|
|
@@ -7489,9 +7635,9 @@ TooltipComponent.divider = (0, import_react28.forwardRef)(function DividerCompon
|
|
|
7489
7635
|
}
|
|
7490
7636
|
);
|
|
7491
7637
|
});
|
|
7492
|
-
TooltipComponent.sectionTitle = (0,
|
|
7638
|
+
TooltipComponent.sectionTitle = (0, import_react29.forwardRef)(function SectionTitle({ text, ...props }, ref) {
|
|
7493
7639
|
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
7494
|
-
return /* @__PURE__ */ (0,
|
|
7640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7495
7641
|
Text_default,
|
|
7496
7642
|
{
|
|
7497
7643
|
fontSize: 12,
|
|
@@ -7505,20 +7651,20 @@ TooltipComponent.sectionTitle = (0, import_react28.forwardRef)(function SectionT
|
|
|
7505
7651
|
}
|
|
7506
7652
|
);
|
|
7507
7653
|
});
|
|
7508
|
-
var Tooltip2 = (0,
|
|
7654
|
+
var Tooltip2 = (0, import_react29.memo)(TooltipComponent);
|
|
7509
7655
|
Tooltip2.item = TooltipComponent.item;
|
|
7510
7656
|
Tooltip2.divider = TooltipComponent.divider;
|
|
7511
7657
|
Tooltip2.sectionTitle = TooltipComponent.sectionTitle;
|
|
7512
7658
|
var Tooltip_default = Tooltip2;
|
|
7513
7659
|
|
|
7514
7660
|
// src/components/Tabs.tsx
|
|
7515
|
-
var
|
|
7661
|
+
var import_react30 = require("react");
|
|
7516
7662
|
var import_react_better_core27 = require("react-better-core");
|
|
7517
|
-
var
|
|
7663
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
7518
7664
|
var tabBottomLineWidth = 2;
|
|
7519
7665
|
var tabDotSize = 6;
|
|
7520
7666
|
var defaultTabName = "tab";
|
|
7521
|
-
var TabsComponent = (0,
|
|
7667
|
+
var TabsComponent = (0, import_react30.forwardRef)(function Tabs({
|
|
7522
7668
|
tabs,
|
|
7523
7669
|
name,
|
|
7524
7670
|
accentColor,
|
|
@@ -7533,11 +7679,11 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({
|
|
|
7533
7679
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
7534
7680
|
const theme2 = (0, import_react_better_core27.useTheme)();
|
|
7535
7681
|
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
7536
|
-
const { componentsState } = useBetterHtmlContextInternal();
|
|
7537
|
-
const firstRenderPassedRef = (0,
|
|
7538
|
-
const tabsRef = (0,
|
|
7682
|
+
const { language, componentsState } = useBetterHtmlContextInternal();
|
|
7683
|
+
const firstRenderPassedRef = (0, import_react30.useRef)(false);
|
|
7684
|
+
const tabsRef = (0, import_react30.useRef)({});
|
|
7539
7685
|
const tabsGap = gap ?? (style === "box" ? theme2.styles.gap / 2 : 0);
|
|
7540
|
-
const [selectedTabId, setSelectedTabId] = (0,
|
|
7686
|
+
const [selectedTabId, setSelectedTabId] = (0, import_react30.useState)(() => {
|
|
7541
7687
|
const selectedTabId2 = tabs[0];
|
|
7542
7688
|
if (!selectedTabId2) return "";
|
|
7543
7689
|
if (urlQuery) {
|
|
@@ -7548,8 +7694,8 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({
|
|
|
7548
7694
|
}
|
|
7549
7695
|
return selectedTabId2.id;
|
|
7550
7696
|
});
|
|
7551
|
-
const [rerenderState, setRerenderState] = (0,
|
|
7552
|
-
const onClickTab = (0,
|
|
7697
|
+
const [rerenderState, setRerenderState] = (0, import_react30.useState)(0);
|
|
7698
|
+
const onClickTab = (0, import_react30.useCallback)(
|
|
7553
7699
|
(tabId) => {
|
|
7554
7700
|
setSelectedTabId(tabId);
|
|
7555
7701
|
onChange?.(tabId);
|
|
@@ -7564,19 +7710,19 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({
|
|
|
7564
7710
|
},
|
|
7565
7711
|
[onChange, name, urlQuery, keepUrlHistory]
|
|
7566
7712
|
);
|
|
7567
|
-
const width = (0,
|
|
7713
|
+
const width = (0, import_react30.useMemo)(
|
|
7568
7714
|
() => tabsRef.current[selectedTabId]?.getBoundingClientRect().width ?? 0,
|
|
7569
7715
|
[rerenderState, selectedTabId]
|
|
7570
7716
|
);
|
|
7571
|
-
const leftSpacing = (0,
|
|
7717
|
+
const leftSpacing = (0, import_react30.useMemo)(() => {
|
|
7572
7718
|
const selectedTabIndex = tabs.findIndex((tab) => tab.id === selectedTabId);
|
|
7573
7719
|
let spacing = 0;
|
|
7574
7720
|
Object.values(tabsRef.current).forEach((tab, index) => {
|
|
7575
7721
|
if (index < selectedTabIndex) spacing += (tab?.getBoundingClientRect().width ?? 0) + tabsGap;
|
|
7576
7722
|
});
|
|
7577
7723
|
return spacing;
|
|
7578
|
-
}, [selectedTabId, tabs, tabsGap]);
|
|
7579
|
-
(0,
|
|
7724
|
+
}, [rerenderState, selectedTabId, tabs, tabsGap]);
|
|
7725
|
+
(0, import_react30.useEffect)(() => {
|
|
7580
7726
|
const timeout = setTimeout(() => {
|
|
7581
7727
|
setRerenderState(Math.random());
|
|
7582
7728
|
firstRenderPassedRef.current = true;
|
|
@@ -7584,8 +7730,8 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({
|
|
|
7584
7730
|
return () => {
|
|
7585
7731
|
clearTimeout(timeout);
|
|
7586
7732
|
};
|
|
7587
|
-
}, []);
|
|
7588
|
-
(0,
|
|
7733
|
+
}, [language]);
|
|
7734
|
+
(0, import_react30.useEffect)(() => {
|
|
7589
7735
|
componentsState.tabs.setTabGroups((oldValue) => {
|
|
7590
7736
|
const thisTabGroup = oldValue.find((item) => item.name === (name ?? defaultTabName));
|
|
7591
7737
|
if (thisTabGroup) {
|
|
@@ -7606,33 +7752,33 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({
|
|
|
7606
7752
|
}
|
|
7607
7753
|
});
|
|
7608
7754
|
}, [selectedTabId, name]);
|
|
7609
|
-
(0,
|
|
7755
|
+
(0, import_react30.useEffect)(() => {
|
|
7610
7756
|
tabsRef.current[selectedTabId]?.scrollIntoView({
|
|
7611
7757
|
behavior: firstRenderPassedRef.current ? "smooth" : void 0,
|
|
7612
7758
|
block: "nearest"
|
|
7613
7759
|
});
|
|
7614
7760
|
}, [selectedTabId]);
|
|
7615
|
-
(0,
|
|
7761
|
+
(0, import_react30.useEffect)(() => {
|
|
7616
7762
|
return () => {
|
|
7617
7763
|
componentsState.tabs.setTabGroups(
|
|
7618
7764
|
(oldValue) => oldValue.filter((item) => item.name !== (name ?? defaultTabName))
|
|
7619
7765
|
);
|
|
7620
7766
|
};
|
|
7621
7767
|
}, []);
|
|
7622
|
-
(0,
|
|
7768
|
+
(0, import_react30.useEffect)(() => {
|
|
7623
7769
|
onChange?.(selectedTabId);
|
|
7624
7770
|
}, []);
|
|
7625
|
-
(0,
|
|
7771
|
+
(0, import_react30.useImperativeHandle)(ref, () => {
|
|
7626
7772
|
return {
|
|
7627
7773
|
selectedTab: selectedTabId,
|
|
7628
7774
|
selectTab: onClickTab
|
|
7629
7775
|
};
|
|
7630
7776
|
}, [selectedTabId, onClickTab]);
|
|
7631
|
-
return /* @__PURE__ */ (0,
|
|
7632
|
-
/* @__PURE__ */ (0,
|
|
7633
|
-
/* @__PURE__ */ (0,
|
|
7777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
7778
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
7779
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
7634
7780
|
const selected = tab.id === selectedTabId;
|
|
7635
|
-
return /* @__PURE__ */ (0,
|
|
7781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
7636
7782
|
Div_default,
|
|
7637
7783
|
{
|
|
7638
7784
|
className: `react-better-html-tabs-tab${selected ? " react-better-html-tabs-tab-selected" : ""}`,
|
|
@@ -7655,7 +7801,7 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({
|
|
|
7655
7801
|
tabsRef.current[tab.id] = ref2;
|
|
7656
7802
|
},
|
|
7657
7803
|
children: [
|
|
7658
|
-
componentsState.tabs.tabsWithDots.includes(tab.id) && /* @__PURE__ */ (0,
|
|
7804
|
+
componentsState.tabs.tabsWithDots.includes(tab.id) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
7659
7805
|
Div_default,
|
|
7660
7806
|
{
|
|
7661
7807
|
position: "absolute",
|
|
@@ -7668,7 +7814,7 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({
|
|
|
7668
7814
|
transition: theme2.styles.transition
|
|
7669
7815
|
}
|
|
7670
7816
|
),
|
|
7671
|
-
/* @__PURE__ */ (0,
|
|
7817
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
7672
7818
|
Text_default,
|
|
7673
7819
|
{
|
|
7674
7820
|
fontWeight: 700,
|
|
@@ -7683,7 +7829,7 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({
|
|
|
7683
7829
|
tab.id
|
|
7684
7830
|
);
|
|
7685
7831
|
}) }),
|
|
7686
|
-
style !== "box" && !noBottomLine && /* @__PURE__ */ (0,
|
|
7832
|
+
style !== "box" && !noBottomLine && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
7687
7833
|
Div_default,
|
|
7688
7834
|
{
|
|
7689
7835
|
position: "absolute",
|
|
@@ -7696,16 +7842,16 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({
|
|
|
7696
7842
|
}
|
|
7697
7843
|
)
|
|
7698
7844
|
] }),
|
|
7699
|
-
children && /* @__PURE__ */ (0,
|
|
7845
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Div_default, { width: "100%", children })
|
|
7700
7846
|
] });
|
|
7701
7847
|
});
|
|
7702
7848
|
TabsComponent.content = function Content({ tabId, tabWithDot, tabsGroupName, isInitialTab, children }) {
|
|
7703
7849
|
const { componentsState } = useBetterHtmlContextInternal();
|
|
7704
|
-
const thisTabGroupData = (0,
|
|
7850
|
+
const thisTabGroupData = (0, import_react30.useMemo)(
|
|
7705
7851
|
() => componentsState.tabs.tabGroups.find((item) => item.name === (tabsGroupName ?? defaultTabName)),
|
|
7706
7852
|
[componentsState.tabs, tabsGroupName]
|
|
7707
7853
|
);
|
|
7708
|
-
(0,
|
|
7854
|
+
(0, import_react30.useEffect)(() => {
|
|
7709
7855
|
if (tabWithDot) {
|
|
7710
7856
|
componentsState.tabs.setTabsWithDots?.(
|
|
7711
7857
|
(oldValue) => oldValue.includes(tabId) ? oldValue : [...oldValue, tabId]
|
|
@@ -7716,19 +7862,19 @@ TabsComponent.content = function Content({ tabId, tabWithDot, tabsGroupName, isI
|
|
|
7716
7862
|
);
|
|
7717
7863
|
}
|
|
7718
7864
|
}, [tabWithDot]);
|
|
7719
|
-
return (thisTabGroupData ? thisTabGroupData.selectedTab === tabId : isInitialTab) ? /* @__PURE__ */ (0,
|
|
7865
|
+
return (thisTabGroupData ? thisTabGroupData.selectedTab === tabId : isInitialTab) ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Div_default, { width: "100%", children }) : void 0;
|
|
7720
7866
|
};
|
|
7721
|
-
var Tabs2 = (0,
|
|
7867
|
+
var Tabs2 = (0, import_react30.memo)(TabsComponent);
|
|
7722
7868
|
Tabs2.content = TabsComponent.content;
|
|
7723
7869
|
var Tabs_default = Tabs2;
|
|
7724
7870
|
|
|
7725
7871
|
// src/components/Foldable.tsx
|
|
7726
|
-
var
|
|
7872
|
+
var import_react31 = require("react");
|
|
7727
7873
|
var import_react_better_core28 = require("react-better-core");
|
|
7728
|
-
var
|
|
7874
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
7729
7875
|
var animationDurationClose = 0.15;
|
|
7730
7876
|
var animationDurationOpen = animationDurationClose * 2;
|
|
7731
|
-
var FoldableComponent = (0,
|
|
7877
|
+
var FoldableComponent = (0, import_react31.forwardRef)(function Foldable({
|
|
7732
7878
|
isOpen: controlledIsOpen,
|
|
7733
7879
|
defaultOpen = false,
|
|
7734
7880
|
icon,
|
|
@@ -7758,23 +7904,23 @@ var FoldableComponent = (0, import_react30.forwardRef)(function Foldable({
|
|
|
7758
7904
|
...props
|
|
7759
7905
|
}, ref) {
|
|
7760
7906
|
const theme2 = (0, import_react_better_core28.useTheme)();
|
|
7761
|
-
const bodyRef = (0,
|
|
7907
|
+
const bodyRef = (0, import_react31.useRef)(null);
|
|
7762
7908
|
const [internalIsOpen, setInternalIsOpen] = (0, import_react_better_core28.useBooleanState)(defaultOpen);
|
|
7763
|
-
const [bodyVirtualHeight, setBodyVirtualHeight] = (0,
|
|
7909
|
+
const [bodyVirtualHeight, setBodyVirtualHeight] = (0, import_react31.useState)();
|
|
7764
7910
|
const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
|
|
7765
|
-
const open = (0,
|
|
7911
|
+
const open = (0, import_react31.useCallback)(() => {
|
|
7766
7912
|
if (controlledIsOpen === void 0) setInternalIsOpen.setTrue();
|
|
7767
7913
|
onOpenChange?.(true);
|
|
7768
7914
|
}, [controlledIsOpen, onOpenChange]);
|
|
7769
|
-
const close = (0,
|
|
7915
|
+
const close = (0, import_react31.useCallback)(() => {
|
|
7770
7916
|
if (controlledIsOpen === void 0) setInternalIsOpen.setFalse();
|
|
7771
7917
|
onOpenChange?.(false);
|
|
7772
7918
|
}, [controlledIsOpen, onOpenChange]);
|
|
7773
|
-
const toggleOpen = (0,
|
|
7919
|
+
const toggleOpen = (0, import_react31.useCallback)(() => {
|
|
7774
7920
|
if (controlledIsOpen === void 0) setInternalIsOpen.toggle();
|
|
7775
7921
|
onOpenChange?.(!isOpen);
|
|
7776
7922
|
}, [controlledIsOpen, isOpen, onOpenChange]);
|
|
7777
|
-
(0,
|
|
7923
|
+
(0, import_react31.useEffect)(() => {
|
|
7778
7924
|
if (!bodyRef.current) return;
|
|
7779
7925
|
const body = bodyRef.current;
|
|
7780
7926
|
setBodyVirtualHeight(body.scrollHeight * 2);
|
|
@@ -7785,7 +7931,7 @@ var FoldableComponent = (0, import_react30.forwardRef)(function Foldable({
|
|
|
7785
7931
|
clearTimeout(timeout);
|
|
7786
7932
|
};
|
|
7787
7933
|
}, [isOpen]);
|
|
7788
|
-
(0,
|
|
7934
|
+
(0, import_react31.useEffect)(() => {
|
|
7789
7935
|
if (!isOpen) return;
|
|
7790
7936
|
if (!bodyRef.current) return;
|
|
7791
7937
|
const observer = new ResizeObserver(() => {
|
|
@@ -7797,7 +7943,7 @@ var FoldableComponent = (0, import_react30.forwardRef)(function Foldable({
|
|
|
7797
7943
|
observer.disconnect();
|
|
7798
7944
|
};
|
|
7799
7945
|
}, [isOpen]);
|
|
7800
|
-
(0,
|
|
7946
|
+
(0, import_react31.useImperativeHandle)(ref, () => {
|
|
7801
7947
|
return {
|
|
7802
7948
|
open,
|
|
7803
7949
|
close,
|
|
@@ -7805,9 +7951,9 @@ var FoldableComponent = (0, import_react30.forwardRef)(function Foldable({
|
|
|
7805
7951
|
isOpen
|
|
7806
7952
|
};
|
|
7807
7953
|
}, [open, close, toggleOpen, isOpen]);
|
|
7808
|
-
const arrow = /* @__PURE__ */ (0,
|
|
7809
|
-
return /* @__PURE__ */ (0,
|
|
7810
|
-
renderHeader ? renderHeader(isOpen, toggleOpen) : /* @__PURE__ */ (0,
|
|
7954
|
+
const arrow = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon_default, { name: "chevronDown", transform: `rotate(${isOpen ? 180 : 0}deg)`, transition: theme2.styles.transition });
|
|
7955
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Div_default.column, { width: "100%", ...props, children: [
|
|
7956
|
+
renderHeader ? renderHeader(isOpen, toggleOpen) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
7811
7957
|
Div_default.row,
|
|
7812
7958
|
{
|
|
7813
7959
|
width: "100%",
|
|
@@ -7820,7 +7966,7 @@ var FoldableComponent = (0, import_react30.forwardRef)(function Foldable({
|
|
|
7820
7966
|
userSelect: "none",
|
|
7821
7967
|
children: [
|
|
7822
7968
|
arrowPosition === "left" && arrow,
|
|
7823
|
-
/* @__PURE__ */ (0,
|
|
7969
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Div_default, { flex: 1, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7824
7970
|
PageHeader_default,
|
|
7825
7971
|
{
|
|
7826
7972
|
icon,
|
|
@@ -7848,8 +7994,8 @@ var FoldableComponent = (0, import_react30.forwardRef)(function Foldable({
|
|
|
7848
7994
|
]
|
|
7849
7995
|
}
|
|
7850
7996
|
),
|
|
7851
|
-
/* @__PURE__ */ (0,
|
|
7852
|
-
/* @__PURE__ */ (0,
|
|
7997
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Div_default, { height: isOpen ? 1 : 0, opacity: isOpen ? 1 : 0, transition: theme2.styles.transition, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Divider_default.horizontal, { width: theme2.styles.borderWidth === 0 ? 1 : theme2.styles.borderWidth }) }),
|
|
7998
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7853
7999
|
Div_default,
|
|
7854
8000
|
{
|
|
7855
8001
|
maxHeight: isOpen ? bodyVirtualHeight : 0,
|
|
@@ -7858,14 +8004,14 @@ var FoldableComponent = (0, import_react30.forwardRef)(function Foldable({
|
|
|
7858
8004
|
overflow: !isOpen ? "hidden" : void 0,
|
|
7859
8005
|
pointerEvents: !isOpen ? "none" : void 0,
|
|
7860
8006
|
ref: bodyRef,
|
|
7861
|
-
children: /* @__PURE__ */ (0,
|
|
8007
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Div_default, { paddingBlock: theme2.styles.gap, paddingInline: headerPaddingInline, children })
|
|
7862
8008
|
}
|
|
7863
8009
|
)
|
|
7864
8010
|
] });
|
|
7865
8011
|
});
|
|
7866
|
-
FoldableComponent.box = (0,
|
|
8012
|
+
FoldableComponent.box = (0, import_react31.forwardRef)(function Box3({ ...props }, ref) {
|
|
7867
8013
|
const theme2 = (0, import_react_better_core28.useTheme)();
|
|
7868
|
-
return /* @__PURE__ */ (0,
|
|
8014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7869
8015
|
FoldableComponent,
|
|
7870
8016
|
{
|
|
7871
8017
|
backgroundColor: theme2.colors.backgroundContent,
|
|
@@ -7878,25 +8024,25 @@ FoldableComponent.box = (0, import_react30.forwardRef)(function Box3({ ...props
|
|
|
7878
8024
|
}
|
|
7879
8025
|
);
|
|
7880
8026
|
});
|
|
7881
|
-
var Foldable2 = (0,
|
|
8027
|
+
var Foldable2 = (0, import_react31.memo)(FoldableComponent);
|
|
7882
8028
|
Foldable2.box = FoldableComponent.box;
|
|
7883
8029
|
var Foldable_default = Foldable2;
|
|
7884
8030
|
|
|
7885
8031
|
// src/components/SideMenu.tsx
|
|
7886
|
-
var
|
|
8032
|
+
var import_react32 = require("react");
|
|
7887
8033
|
var import_react_better_core29 = require("react-better-core");
|
|
7888
|
-
var
|
|
8034
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
7889
8035
|
var tabDotSize2 = 6;
|
|
7890
|
-
var sideMenuContext = (0,
|
|
8036
|
+
var sideMenuContext = (0, import_react32.createContext)(void 0);
|
|
7891
8037
|
var SideMenuContextProvider = sideMenuContext.Provider;
|
|
7892
8038
|
var useSideMenuContext = () => {
|
|
7893
|
-
const context = (0,
|
|
8039
|
+
const context = (0, import_react32.useContext)(sideMenuContext);
|
|
7894
8040
|
if (!context) {
|
|
7895
8041
|
throw new Error("`useSideMenuContext` must be used within a `<SideMenuContextProvider>` component");
|
|
7896
8042
|
}
|
|
7897
8043
|
return context;
|
|
7898
8044
|
};
|
|
7899
|
-
var MenuItemTypeItem = (0,
|
|
8045
|
+
var MenuItemTypeItem = (0, import_react32.memo)(function MenuItemTypeItem2({
|
|
7900
8046
|
item,
|
|
7901
8047
|
backgroundColor,
|
|
7902
8048
|
activeItemColor,
|
|
@@ -7911,7 +8057,7 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
7911
8057
|
const { activeItem, setActiveItem } = useSideMenuContext();
|
|
7912
8058
|
const [isOpened, setIsOpened] = (0, import_react_better_core29.useBooleanState)();
|
|
7913
8059
|
const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
|
|
7914
|
-
const onClickElement = (0,
|
|
8060
|
+
const onClickElement = (0, import_react32.useCallback)(() => {
|
|
7915
8061
|
if (item.disabled) return;
|
|
7916
8062
|
if (!item.children) setActiveItem((oldValue) => oldValue?.href === item.href ? oldValue : void 0);
|
|
7917
8063
|
if (item.children) {
|
|
@@ -7923,7 +8069,7 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
7923
8069
|
item.onClick?.(item);
|
|
7924
8070
|
}
|
|
7925
8071
|
}, [onClick, item, isCollapsed]);
|
|
7926
|
-
const childrenHaveDot = (0,
|
|
8072
|
+
const childrenHaveDot = (0, import_react32.useMemo)(
|
|
7927
8073
|
() => item.children?.some((child) => child.type === "item" && child.withDot) ?? false,
|
|
7928
8074
|
[item]
|
|
7929
8075
|
);
|
|
@@ -7937,19 +8083,19 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
7937
8083
|
const lineWidth = 2;
|
|
7938
8084
|
const lineEndRadius = iconSize / 2 + iconGap * 2;
|
|
7939
8085
|
const backgroundColorContrast = activeItemColor ? (0, import_react_better_core29.calculateColorContrast)(activeItemColor, theme2.colors.primary) : 21;
|
|
7940
|
-
const content = /* @__PURE__ */ (0,
|
|
8086
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
7941
8087
|
Tooltip_default,
|
|
7942
8088
|
{
|
|
7943
|
-
content: /* @__PURE__ */ (0,
|
|
7944
|
-
/* @__PURE__ */ (0,
|
|
7945
|
-
item.children && /* @__PURE__ */ (0,
|
|
8089
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
8090
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text_default, { whiteSpace: "nowrap", children: item.text }),
|
|
8091
|
+
item.children && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon_default, { name: "chevronDown", color: theme2.colors.textSecondary, size: 14 })
|
|
7946
8092
|
] }),
|
|
7947
8093
|
contentPointerEvents: "none",
|
|
7948
8094
|
withArrow: true,
|
|
7949
8095
|
childrenWrapperWidth: "100%",
|
|
7950
8096
|
disabled: !isCollapsed,
|
|
7951
8097
|
position: "right",
|
|
7952
|
-
children: /* @__PURE__ */ (0,
|
|
8098
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
7953
8099
|
Div_default.row,
|
|
7954
8100
|
{
|
|
7955
8101
|
alignItems: "center",
|
|
@@ -7967,7 +8113,7 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
7967
8113
|
opacity: item.disabled ? 0.6 : void 0,
|
|
7968
8114
|
onClick: onClickElement,
|
|
7969
8115
|
children: [
|
|
7970
|
-
/* @__PURE__ */ (0,
|
|
8116
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
7971
8117
|
Icon_default,
|
|
7972
8118
|
{
|
|
7973
8119
|
name: item.iconName,
|
|
@@ -7976,7 +8122,7 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
7976
8122
|
flexShrink: 0
|
|
7977
8123
|
}
|
|
7978
8124
|
),
|
|
7979
|
-
/* @__PURE__ */ (0,
|
|
8125
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
7980
8126
|
Text_default,
|
|
7981
8127
|
{
|
|
7982
8128
|
flex: 1,
|
|
@@ -7987,7 +8133,7 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
7987
8133
|
children: item.text
|
|
7988
8134
|
}
|
|
7989
8135
|
),
|
|
7990
|
-
item.children && /* @__PURE__ */ (0,
|
|
8136
|
+
item.children && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
7991
8137
|
Icon_default,
|
|
7992
8138
|
{
|
|
7993
8139
|
name: "chevronDown",
|
|
@@ -7997,7 +8143,7 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
7997
8143
|
transition: theme2.styles.transition
|
|
7998
8144
|
}
|
|
7999
8145
|
),
|
|
8000
|
-
/* @__PURE__ */ (0,
|
|
8146
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8001
8147
|
Div_default,
|
|
8002
8148
|
{
|
|
8003
8149
|
position: "absolute",
|
|
@@ -8016,7 +8162,7 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
8016
8162
|
)
|
|
8017
8163
|
}
|
|
8018
8164
|
);
|
|
8019
|
-
(0,
|
|
8165
|
+
(0, import_react32.useEffect)(() => {
|
|
8020
8166
|
if (!item.href) return;
|
|
8021
8167
|
const isActive2 = location.pathname === "/" ? location.pathname === item.href : location.pathname.startsWith(item.href) && item.href !== "/";
|
|
8022
8168
|
if (!isActive2) return;
|
|
@@ -8027,21 +8173,21 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
8027
8173
|
} : oldValue
|
|
8028
8174
|
);
|
|
8029
8175
|
}, [location.pathname]);
|
|
8030
|
-
(0,
|
|
8176
|
+
(0, import_react32.useEffect)(() => {
|
|
8031
8177
|
if (!item.children) return;
|
|
8032
8178
|
const toBeOpened = item.children.some(
|
|
8033
8179
|
(child) => child.type === "item" ? child.href ? location.pathname === "/" ? location.pathname === child.href : location.pathname.startsWith(child.href) && child.href !== "/" : false : false
|
|
8034
8180
|
);
|
|
8035
8181
|
if (!isCollapsed) setIsOpened.setState(toBeOpened);
|
|
8036
8182
|
}, [item, isCollapsed]);
|
|
8037
|
-
(0,
|
|
8183
|
+
(0, import_react32.useEffect)(() => {
|
|
8038
8184
|
if (!isCollapsed) return;
|
|
8039
8185
|
setIsOpened.setFalse();
|
|
8040
8186
|
}, [isCollapsed]);
|
|
8041
8187
|
const LinkComponentTag = components.button?.tagReplacement?.linkComponent ?? "a";
|
|
8042
|
-
return /* @__PURE__ */ (0,
|
|
8043
|
-
item.href ? /* @__PURE__ */ (0,
|
|
8044
|
-
item.children && /* @__PURE__ */ (0,
|
|
8188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
8189
|
+
item.href ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(LinkComponentTag, { to: item.href, href: item.href, onClick: onClickElement, children: content }) : content,
|
|
8190
|
+
item.children && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
8045
8191
|
Div_default.column,
|
|
8046
8192
|
{
|
|
8047
8193
|
position: "relative",
|
|
@@ -8052,7 +8198,7 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
8052
8198
|
overflow: "hidden",
|
|
8053
8199
|
transition: `max-height ${theme2.styles.transition}, margin-top ${theme2.styles.transition}`,
|
|
8054
8200
|
children: [
|
|
8055
|
-
item.children.map((child) => /* @__PURE__ */ (0,
|
|
8201
|
+
item.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8056
8202
|
MenuItemComponent,
|
|
8057
8203
|
{
|
|
8058
8204
|
item: child,
|
|
@@ -8062,7 +8208,7 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
8062
8208
|
},
|
|
8063
8209
|
child.text
|
|
8064
8210
|
)),
|
|
8065
|
-
/* @__PURE__ */ (0,
|
|
8211
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
8066
8212
|
Div_default,
|
|
8067
8213
|
{
|
|
8068
8214
|
position: "absolute",
|
|
@@ -8071,7 +8217,7 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
8071
8217
|
left: paddingLeft + iconSize / 2,
|
|
8072
8218
|
zIndex: -1,
|
|
8073
8219
|
children: [
|
|
8074
|
-
/* @__PURE__ */ (0,
|
|
8220
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8075
8221
|
Div_default,
|
|
8076
8222
|
{
|
|
8077
8223
|
position: "relative",
|
|
@@ -8081,7 +8227,7 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
8081
8227
|
zIndex: 1
|
|
8082
8228
|
}
|
|
8083
8229
|
),
|
|
8084
|
-
/* @__PURE__ */ (0,
|
|
8230
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8085
8231
|
Div_default,
|
|
8086
8232
|
{
|
|
8087
8233
|
position: "absolute",
|
|
@@ -8105,13 +8251,13 @@ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
|
8105
8251
|
)
|
|
8106
8252
|
] });
|
|
8107
8253
|
});
|
|
8108
|
-
var MenuItemTypeDivider = (0,
|
|
8254
|
+
var MenuItemTypeDivider = (0, import_react32.memo)(function MenuItemTypeDivider2({ item }) {
|
|
8109
8255
|
const theme2 = (0, import_react_better_core29.useTheme)();
|
|
8110
8256
|
const { sideMenuIsCollapsed } = useBetterHtmlContextInternal();
|
|
8111
8257
|
const { items } = useSideMenuContext();
|
|
8112
8258
|
const isCollapsed = sideMenuIsCollapsed && !item.shortText;
|
|
8113
8259
|
const isFirst = items[0]?.type === item.type && items[0]?.text === item.text;
|
|
8114
|
-
return /* @__PURE__ */ (0,
|
|
8260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8115
8261
|
Div_default.row,
|
|
8116
8262
|
{
|
|
8117
8263
|
maxHeight: !isCollapsed ? 30 : theme2.styles.gap + 1,
|
|
@@ -8119,7 +8265,7 @@ var MenuItemTypeDivider = (0, import_react31.memo)(function MenuItemTypeDivider2
|
|
|
8119
8265
|
paddingInline: theme2.styles.gap,
|
|
8120
8266
|
overflow: "hidden",
|
|
8121
8267
|
transition: `max-height ${theme2.styles.transition}, padding-top ${theme2.styles.transition}`,
|
|
8122
|
-
children: sideMenuIsCollapsed && item.shortText || !sideMenuIsCollapsed ? /* @__PURE__ */ (0,
|
|
8268
|
+
children: sideMenuIsCollapsed && item.shortText || !sideMenuIsCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8123
8269
|
Text_default,
|
|
8124
8270
|
{
|
|
8125
8271
|
width: "100%",
|
|
@@ -8131,12 +8277,12 @@ var MenuItemTypeDivider = (0, import_react31.memo)(function MenuItemTypeDivider2
|
|
|
8131
8277
|
whiteSpace: "nowrap",
|
|
8132
8278
|
children: sideMenuIsCollapsed ? item.shortText : item.text
|
|
8133
8279
|
}
|
|
8134
|
-
) : !isFirst ? /* @__PURE__ */ (0,
|
|
8280
|
+
) : !isFirst ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Divider_default.horizontal, {}) : void 0
|
|
8135
8281
|
}
|
|
8136
8282
|
);
|
|
8137
8283
|
});
|
|
8138
|
-
var MenuItemComponent = (0,
|
|
8139
|
-
return /* @__PURE__ */ (0,
|
|
8284
|
+
var MenuItemComponent = (0, import_react32.memo)(function MenuItemComponent2({ item, ...props }) {
|
|
8285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Div_default, { width: "100%", children: item.type === "item" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(MenuItemTypeItem, { item, ...props }) : item.type === "divider" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(MenuItemTypeDivider, { item }) : void 0 });
|
|
8140
8286
|
});
|
|
8141
8287
|
var SideMenuComponent = function SideMenu({
|
|
8142
8288
|
items,
|
|
@@ -8168,15 +8314,15 @@ var SideMenuComponent = function SideMenu({
|
|
|
8168
8314
|
const theme2 = (0, import_react_better_core29.useTheme)();
|
|
8169
8315
|
const mediaQuery = useMediaQuery();
|
|
8170
8316
|
const { components, sideMenuIsCollapsed, setSideMenuIsCollapsed, sideMenuIsOpenMobile, setSideMenuIsOpenMobile } = useBetterHtmlContextInternal();
|
|
8171
|
-
const [activeItem, setActiveItem] = (0,
|
|
8172
|
-
const [itemsState, setItemsState] = (0,
|
|
8173
|
-
const [bottomItemsState, setBottomItemsState] = (0,
|
|
8174
|
-
const onClickXButton = (0,
|
|
8317
|
+
const [activeItem, setActiveItem] = (0, import_react32.useState)();
|
|
8318
|
+
const [itemsState, setItemsState] = (0, import_react32.useState)(items);
|
|
8319
|
+
const [bottomItemsState, setBottomItemsState] = (0, import_react32.useState)(bottomItems);
|
|
8320
|
+
const onClickXButton = (0, import_react32.useCallback)(() => {
|
|
8175
8321
|
setSideMenuIsOpenMobile.setFalse();
|
|
8176
8322
|
}, []);
|
|
8177
|
-
const readyItems = (0,
|
|
8178
|
-
const readyBottomItems = (0,
|
|
8179
|
-
const contextValue = (0,
|
|
8323
|
+
const readyItems = (0, import_react32.useMemo)(() => items.filter((item) => !item.hidden), [items]);
|
|
8324
|
+
const readyBottomItems = (0, import_react32.useMemo)(() => bottomItems?.filter((item) => !item.hidden), [bottomItems]);
|
|
8325
|
+
const contextValue = (0, import_react32.useMemo)(
|
|
8180
8326
|
() => ({
|
|
8181
8327
|
activeItem,
|
|
8182
8328
|
setActiveItem,
|
|
@@ -8192,13 +8338,13 @@ var SideMenuComponent = function SideMenu({
|
|
|
8192
8338
|
const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + theme2.styles.space;
|
|
8193
8339
|
const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
|
|
8194
8340
|
const logoSize = sideMenuCollapsedWidth - theme2.styles.space * 2;
|
|
8195
|
-
(0,
|
|
8341
|
+
(0, import_react32.useEffect)(() => {
|
|
8196
8342
|
setItemsState(items);
|
|
8197
8343
|
}, [items]);
|
|
8198
|
-
(0,
|
|
8344
|
+
(0, import_react32.useEffect)(() => {
|
|
8199
8345
|
setBottomItemsState(bottomItems);
|
|
8200
8346
|
}, [bottomItems]);
|
|
8201
|
-
const itemsComponent = /* @__PURE__ */ (0,
|
|
8347
|
+
const itemsComponent = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8202
8348
|
Div_default.column,
|
|
8203
8349
|
{
|
|
8204
8350
|
width: "100%",
|
|
@@ -8206,7 +8352,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
8206
8352
|
overflowY: !isCollapsed ? "auto" : void 0,
|
|
8207
8353
|
paddingInline: !renderItemsHolder ? theme2.styles.space : void 0,
|
|
8208
8354
|
paddingBottom: !renderItemsHolder ? !isCollapsable && !readyBottomItems ? theme2.styles.space : void 0 : void 0,
|
|
8209
|
-
children: /* @__PURE__ */ (0,
|
|
8355
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Div_default.column, { gap: theme2.styles.gap / 2, children: readyItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8210
8356
|
MenuItemComponent,
|
|
8211
8357
|
{
|
|
8212
8358
|
item,
|
|
@@ -8216,11 +8362,11 @@ var SideMenuComponent = function SideMenu({
|
|
|
8216
8362
|
location,
|
|
8217
8363
|
onClick: onClickXButton
|
|
8218
8364
|
},
|
|
8219
|
-
item.text
|
|
8365
|
+
item.type + item.text
|
|
8220
8366
|
)) })
|
|
8221
8367
|
}
|
|
8222
8368
|
);
|
|
8223
|
-
const bottomItemsComponent = /* @__PURE__ */ (0,
|
|
8369
|
+
const bottomItemsComponent = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8224
8370
|
Div_default.column,
|
|
8225
8371
|
{
|
|
8226
8372
|
borderTop: mediaQuery.size1000 ? `solid ${theme2.styles.borderWidth}px ${theme2.colors.border}` : void 0,
|
|
@@ -8229,7 +8375,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
8229
8375
|
paddingTop: mediaQuery.size1000 ? theme2.styles.space : void 0,
|
|
8230
8376
|
paddingInline: !renderItemsHolder ? theme2.styles.space : void 0,
|
|
8231
8377
|
paddingBottom: !renderItemsHolder ? !isCollapsable ? theme2.styles.space : void 0 : void 0,
|
|
8232
|
-
children: readyBottomItems?.map((item) => /* @__PURE__ */ (0,
|
|
8378
|
+
children: readyBottomItems?.map((item) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8233
8379
|
MenuItemComponent,
|
|
8234
8380
|
{
|
|
8235
8381
|
item,
|
|
@@ -8239,11 +8385,11 @@ var SideMenuComponent = function SideMenu({
|
|
|
8239
8385
|
location,
|
|
8240
8386
|
onClick: onClickXButton
|
|
8241
8387
|
},
|
|
8242
|
-
item.text
|
|
8388
|
+
item.type + item.text
|
|
8243
8389
|
))
|
|
8244
8390
|
}
|
|
8245
8391
|
);
|
|
8246
|
-
return /* @__PURE__ */ (0,
|
|
8392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SideMenuContextProvider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
8247
8393
|
Div_default.column,
|
|
8248
8394
|
{
|
|
8249
8395
|
as: "aside",
|
|
@@ -8261,9 +8407,9 @@ var SideMenuComponent = function SideMenu({
|
|
|
8261
8407
|
userSelect: "none",
|
|
8262
8408
|
zIndex: 10,
|
|
8263
8409
|
children: [
|
|
8264
|
-
/* @__PURE__ */ (0,
|
|
8265
|
-
(logoAssetName || logoUrl || withCloseButton && mediaQuery.size1000) && /* @__PURE__ */ (0,
|
|
8266
|
-
(logoAssetName || logoUrl) && /* @__PURE__ */ (0,
|
|
8410
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Div_default.column, { width: "100%", height: "100%", gap: gap ?? theme2.styles.space, children: [
|
|
8411
|
+
(logoAssetName || logoUrl || withCloseButton && mediaQuery.size1000) && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Div_default.row, { alignItems: "center", paddingInline: theme2.styles.space, children: [
|
|
8412
|
+
(logoAssetName || logoUrl) && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(LinkComponentTag, { to: "/", href: "/", onClick: onClickXButton, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
8267
8413
|
Div_default.row,
|
|
8268
8414
|
{
|
|
8269
8415
|
alignItems: "center",
|
|
@@ -8272,7 +8418,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
8272
8418
|
whiteSpace: "nowrap",
|
|
8273
8419
|
gap: theme2.styles.gap,
|
|
8274
8420
|
children: [
|
|
8275
|
-
/* @__PURE__ */ (0,
|
|
8421
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8276
8422
|
Image_default,
|
|
8277
8423
|
{
|
|
8278
8424
|
name: logoAssetName,
|
|
@@ -8282,7 +8428,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
8282
8428
|
objectFit: "contain"
|
|
8283
8429
|
}
|
|
8284
8430
|
),
|
|
8285
|
-
logoText && /* @__PURE__ */ (0,
|
|
8431
|
+
logoText && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8286
8432
|
Text_default,
|
|
8287
8433
|
{
|
|
8288
8434
|
fontFamily: logoFontFamily,
|
|
@@ -8297,23 +8443,23 @@ var SideMenuComponent = function SideMenu({
|
|
|
8297
8443
|
]
|
|
8298
8444
|
}
|
|
8299
8445
|
) }),
|
|
8300
|
-
withCloseButton && mediaQuery.size1000 && /* @__PURE__ */ (0,
|
|
8446
|
+
withCloseButton && mediaQuery.size1000 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button_default.icon, { icon: "XMark", marginLeft: "auto", onClick: onClickXButton })
|
|
8301
8447
|
] }),
|
|
8302
8448
|
itemsAdditionalComponent,
|
|
8303
|
-
!isLoading ? /* @__PURE__ */ (0,
|
|
8449
|
+
!isLoading ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
8304
8450
|
renderItemsHolder ? renderItemsHolder(itemsComponent) : itemsComponent,
|
|
8305
8451
|
betweenItemsAdditionalComponent,
|
|
8306
|
-
readyBottomItems && /* @__PURE__ */ (0,
|
|
8307
|
-
] }) : /* @__PURE__ */ (0,
|
|
8452
|
+
readyBottomItems && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: renderBottomItemsHolder ? renderBottomItemsHolder(bottomItemsComponent) : bottomItemsComponent })
|
|
8453
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Div_default, { flex: 1, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Loader_default.box, { text: isCollapsed ? "" : void 0 }) }),
|
|
8308
8454
|
bottomItemsAdditionalComponent,
|
|
8309
|
-
isCollapsable && /* @__PURE__ */ (0,
|
|
8455
|
+
isCollapsable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8310
8456
|
Div_default,
|
|
8311
8457
|
{
|
|
8312
8458
|
borderTop: `solid ${theme2.styles.borderWidth}px ${theme2.colors.border}`,
|
|
8313
8459
|
marginTop: !readyBottomItems ? "auto" : void 0,
|
|
8314
8460
|
paddingInline: theme2.styles.space,
|
|
8315
8461
|
paddingBlock: theme2.styles.space,
|
|
8316
|
-
children: /* @__PURE__ */ (0,
|
|
8462
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8317
8463
|
Div_default.row,
|
|
8318
8464
|
{
|
|
8319
8465
|
alignItems: "center",
|
|
@@ -8325,7 +8471,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
8325
8471
|
isTabAccessed: true,
|
|
8326
8472
|
paddingBlock: theme2.styles.gap,
|
|
8327
8473
|
onClick: setSideMenuIsCollapsed.toggle,
|
|
8328
|
-
children: /* @__PURE__ */ (0,
|
|
8474
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8329
8475
|
Icon_default,
|
|
8330
8476
|
{
|
|
8331
8477
|
name: "chevronRight",
|
|
@@ -8340,7 +8486,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
8340
8486
|
}
|
|
8341
8487
|
)
|
|
8342
8488
|
] }),
|
|
8343
|
-
widthMobileHandle && /* @__PURE__ */ (0,
|
|
8489
|
+
widthMobileHandle && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8344
8490
|
Div_default.row,
|
|
8345
8491
|
{
|
|
8346
8492
|
position: "absolute",
|
|
@@ -8360,7 +8506,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
8360
8506
|
transform: !mediaQuery.size1000 ? "translateX(-100%)" : void 0,
|
|
8361
8507
|
transition: theme2.styles.transition,
|
|
8362
8508
|
onClick: setSideMenuIsOpenMobile.toggle,
|
|
8363
|
-
children: /* @__PURE__ */ (0,
|
|
8509
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8364
8510
|
Icon_default,
|
|
8365
8511
|
{
|
|
8366
8512
|
name: "chevronRight",
|
|
@@ -8372,7 +8518,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
8372
8518
|
)
|
|
8373
8519
|
}
|
|
8374
8520
|
),
|
|
8375
|
-
absoluteComponent && /* @__PURE__ */ (0,
|
|
8521
|
+
absoluteComponent && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Div_default, { position: "absolute", top: 0, left: 0, pointerEvents: "none", zIndex: 2, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Div_default, { pointerEvents: "all", children: absoluteComponent }) })
|
|
8376
8522
|
]
|
|
8377
8523
|
}
|
|
8378
8524
|
) });
|
|
@@ -8387,7 +8533,7 @@ SideMenuComponent.pageHolder = function SideMenuPageHolder({
|
|
|
8387
8533
|
const { components, sideMenuIsCollapsed } = useBetterHtmlContextInternal();
|
|
8388
8534
|
const sideMenuWidth = components.sideMenu?.width ?? defaultSideMenuWidth;
|
|
8389
8535
|
const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + theme2.styles.space;
|
|
8390
|
-
return /* @__PURE__ */ (0,
|
|
8536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
8391
8537
|
Div_default,
|
|
8392
8538
|
{
|
|
8393
8539
|
position: "relative",
|
|
@@ -8396,7 +8542,7 @@ SideMenuComponent.pageHolder = function SideMenuPageHolder({
|
|
|
8396
8542
|
transition: theme2.styles.transition,
|
|
8397
8543
|
children: [
|
|
8398
8544
|
additionalTopComponent,
|
|
8399
|
-
/* @__PURE__ */ (0,
|
|
8545
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PageHolder_default, { ...props }),
|
|
8400
8546
|
additionalBottomComponent
|
|
8401
8547
|
]
|
|
8402
8548
|
}
|
|
@@ -8406,12 +8552,12 @@ SideMenuComponent.burgerButton = function BurgerButton({ position = "left", onCl
|
|
|
8406
8552
|
const theme2 = (0, import_react_better_core29.useTheme)();
|
|
8407
8553
|
const { sideMenuIsOpenMobile, setSideMenuIsOpenMobile } = useBetterHtmlContextInternal();
|
|
8408
8554
|
const [isHovered, setIsHovered] = (0, import_react_better_core29.useBooleanState)();
|
|
8409
|
-
const onClickElement = (0,
|
|
8555
|
+
const onClickElement = (0, import_react32.useCallback)(() => {
|
|
8410
8556
|
setSideMenuIsOpenMobile.toggle();
|
|
8411
8557
|
onClick?.(!sideMenuIsOpenMobile);
|
|
8412
8558
|
}, [onClick, sideMenuIsOpenMobile]);
|
|
8413
8559
|
const width = 2;
|
|
8414
|
-
return /* @__PURE__ */ (0,
|
|
8560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
8415
8561
|
Div_default,
|
|
8416
8562
|
{
|
|
8417
8563
|
position: "relative",
|
|
@@ -8423,7 +8569,7 @@ SideMenuComponent.burgerButton = function BurgerButton({ position = "left", onCl
|
|
|
8423
8569
|
onMouseOut: setIsHovered.setFalse,
|
|
8424
8570
|
onClick: onClickElement,
|
|
8425
8571
|
children: [
|
|
8426
|
-
/* @__PURE__ */ (0,
|
|
8572
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8427
8573
|
Div_default,
|
|
8428
8574
|
{
|
|
8429
8575
|
position: "absolute",
|
|
@@ -8438,7 +8584,7 @@ SideMenuComponent.burgerButton = function BurgerButton({ position = "left", onCl
|
|
|
8438
8584
|
transition: theme2.styles.transition
|
|
8439
8585
|
}
|
|
8440
8586
|
),
|
|
8441
|
-
/* @__PURE__ */ (0,
|
|
8587
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8442
8588
|
Div_default,
|
|
8443
8589
|
{
|
|
8444
8590
|
position: "absolute",
|
|
@@ -8454,7 +8600,7 @@ SideMenuComponent.burgerButton = function BurgerButton({ position = "left", onCl
|
|
|
8454
8600
|
transition: theme2.styles.transition
|
|
8455
8601
|
}
|
|
8456
8602
|
),
|
|
8457
|
-
/* @__PURE__ */ (0,
|
|
8603
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8458
8604
|
Div_default,
|
|
8459
8605
|
{
|
|
8460
8606
|
position: "absolute",
|
|
@@ -8473,7 +8619,7 @@ SideMenuComponent.burgerButton = function BurgerButton({ position = "left", onCl
|
|
|
8473
8619
|
}
|
|
8474
8620
|
);
|
|
8475
8621
|
};
|
|
8476
|
-
var SideMenu2 = (0,
|
|
8622
|
+
var SideMenu2 = (0, import_react32.memo)(SideMenuComponent);
|
|
8477
8623
|
SideMenu2.pageHolder = SideMenuComponent.pageHolder;
|
|
8478
8624
|
SideMenu2.burgerButton = SideMenuComponent.burgerButton;
|
|
8479
8625
|
var SideMenu_default = SideMenu2;
|
|
@@ -8521,6 +8667,7 @@ var SideMenu_default = SideMenu2;
|
|
|
8521
8667
|
formatPhoneNumber,
|
|
8522
8668
|
generateApi,
|
|
8523
8669
|
generateEventEmitter,
|
|
8670
|
+
generateI18n,
|
|
8524
8671
|
generateLocalStorage,
|
|
8525
8672
|
generateRandomString,
|
|
8526
8673
|
getBrowser,
|