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