@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20260925110206 → 0.8.1-dev.20260929055955
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/DataBindingControls-VSLL4WV2.mjs +882 -0
- package/dist/DataBindingControls-Z2AHWFYX.mjs +880 -0
- package/dist/{InputControlClient-A3V5YRWH.mjs → InputControlClient-QMFSUGTK.mjs} +4 -6
- package/dist/{LinkNodeButton-WXAW3ZD6.mjs → LinkNodeButton-U6AJUMFA.mjs} +1 -1
- package/dist/{Pagination-STOHS3LO.mjs → Pagination-6R4XZLF6.mjs} +3 -5
- package/dist/{Pagination-V53JCR6P.mjs → Pagination-RMAXCIL7.mjs} +71 -27
- package/dist/{chunk-4WMSS6CE.mjs → chunk-3IMICDQR.mjs} +0 -1
- package/dist/{chunk-N57RANHY.mjs → chunk-JT7G3DNR.mjs} +392 -31
- package/dist/{chunk-GCG4OYDJ.mjs → chunk-N3EYMPAJ.mjs} +31 -0
- package/dist/{chunk-I3ND2ZRE.mjs → chunk-Q4AFJYT5.mjs} +32 -2
- package/dist/{chunk-K6GGVJCI.mjs → chunk-RSUG2VPX.mjs} +1 -1
- package/dist/index.d.mts +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +884 -130
- package/dist/index.mjs +46 -30
- package/dist/server.js +691 -2317
- package/dist/server.mjs +6 -9
- package/package.json +1 -1
- package/dist/DataBindingControls-25UC5W3R.mjs +0 -502
- package/dist/DataBindingControls-6IS5F3QX.mjs +0 -498
- package/dist/InputControlClient-NHXG4QBU.mjs +0 -1836
- package/dist/chunk-2R26M6CK.mjs +0 -30
- package/dist/chunk-6PW2RLUJ.mjs +0 -52
- package/dist/chunk-F4DNLPFN.mjs +0 -36
- package/dist/chunk-HRDHAIZF.mjs +0 -33
- package/dist/chunk-XDTWUEVR.mjs +0 -13
package/dist/server.js
CHANGED
|
@@ -3145,37 +3145,13 @@ var init_IframeClient = __esm({
|
|
|
3145
3145
|
});
|
|
3146
3146
|
|
|
3147
3147
|
// src/components/controls/edit/InputControlType.tsx
|
|
3148
|
-
var Constants
|
|
3148
|
+
var Constants;
|
|
3149
3149
|
var init_InputControlType = __esm({
|
|
3150
3150
|
"src/components/controls/edit/InputControlType.tsx"() {
|
|
3151
3151
|
"use strict";
|
|
3152
3152
|
Constants = {
|
|
3153
3153
|
pagesize: 10
|
|
3154
3154
|
};
|
|
3155
|
-
InputControlType = {
|
|
3156
|
-
lineTextInput: "lineTextInput",
|
|
3157
|
-
multilineTextInput: "multilineTextInput",
|
|
3158
|
-
emailInput: "emailInput",
|
|
3159
|
-
numberInput: "numberInput",
|
|
3160
|
-
checkboxInput: "checkboxInput",
|
|
3161
|
-
moneyInput: "moneyInput",
|
|
3162
|
-
select: "select",
|
|
3163
|
-
percentageInput: "percentageInput",
|
|
3164
|
-
assetUpload: "assetUpload",
|
|
3165
|
-
phoneInput: "phoneInput",
|
|
3166
|
-
otpInput: "otpInput",
|
|
3167
|
-
datetimeInput: "datetimeInput",
|
|
3168
|
-
timeInput: "timeInput",
|
|
3169
|
-
colorInput: "colorInput",
|
|
3170
|
-
selectWithSearchInput: "selectWithSearchInput",
|
|
3171
|
-
selectWithSearchPanel: "selectWithSearchPanel",
|
|
3172
|
-
switchInput: "switchInput",
|
|
3173
|
-
dateInput: "dateInput",
|
|
3174
|
-
radioInput: "radioInput",
|
|
3175
|
-
videoInput: "videoInput",
|
|
3176
|
-
referenceInput: "referenceInput"
|
|
3177
|
-
};
|
|
3178
|
-
InputControlType_default = InputControlType;
|
|
3179
3155
|
}
|
|
3180
3156
|
});
|
|
3181
3157
|
|
|
@@ -3689,2125 +3665,232 @@ var init_Pagination = __esm({
|
|
|
3689
3665
|
}
|
|
3690
3666
|
});
|
|
3691
3667
|
|
|
3692
|
-
// src/components/
|
|
3693
|
-
var
|
|
3694
|
-
|
|
3695
|
-
|
|
3668
|
+
// src/components/pageRenderingEngine/nodes/DataBindingControls.tsx
|
|
3669
|
+
var DataBindingControls_exports = {};
|
|
3670
|
+
__export(DataBindingControls_exports, {
|
|
3671
|
+
default: () => DataBindingControls_default
|
|
3672
|
+
});
|
|
3673
|
+
var import_react39, import_navigation, import_jsx_runtime65, humanize, escapeODataString, parseFacetSelections, buildFacetFilter, parseODataSearch, SearchIcon, ResetIcon, FilterSlidersIcon, ChevronDownIcon, CheckIcon, CloseIcon, MapPinIcon, BriefcaseIcon, FileTextIcon, TagIcon, getCategoryIcon, normalizeSortOption, DataBindingControls, DataBindingControls_default;
|
|
3674
|
+
var init_DataBindingControls = __esm({
|
|
3675
|
+
"src/components/pageRenderingEngine/nodes/DataBindingControls.tsx"() {
|
|
3696
3676
|
"use strict";
|
|
3697
|
-
|
|
3677
|
+
"use client";
|
|
3678
|
+
import_react39 = require("react");
|
|
3679
|
+
import_navigation = require("next/navigation");
|
|
3680
|
+
init_Button();
|
|
3681
|
+
init_StyleTypes();
|
|
3698
3682
|
import_jsx_runtime65 = require("react/jsx-runtime");
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
groupKey: props.groupKey
|
|
3709
|
-
}
|
|
3710
|
-
);
|
|
3683
|
+
humanize = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim();
|
|
3684
|
+
escapeODataString = (value) => value.replace(/'/g, "''");
|
|
3685
|
+
parseFacetSelections = (filter) => {
|
|
3686
|
+
const selections = /* @__PURE__ */ new Map();
|
|
3687
|
+
if (!filter || !filter.trim()) return selections;
|
|
3688
|
+
const expression = /(?:^|[\s()]+(?:and[\s()]+)?)([\w./-]+)\s+eq\s+'((?:''|[^'])*)'/gi;
|
|
3689
|
+
for (const match of filter.matchAll(expression)) {
|
|
3690
|
+
if (match[1] && match[2] !== void 0) {
|
|
3691
|
+
selections.set(match[1].trim(), match[2].replace(/''/g, "'"));
|
|
3711
3692
|
}
|
|
3712
|
-
}
|
|
3713
|
-
|
|
3714
|
-
if (props.value !== void 0 && props.value !== null) {
|
|
3715
|
-
value = props.value;
|
|
3716
|
-
}
|
|
3717
|
-
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_react39.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("label", { className: "block mb-1", children: [
|
|
3718
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
|
|
3719
|
-
" ",
|
|
3720
|
-
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
3721
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3722
|
-
"textarea",
|
|
3723
|
-
{
|
|
3724
|
-
name: props.name,
|
|
3725
|
-
id: props.name,
|
|
3726
|
-
value,
|
|
3727
|
-
onChange: textChangeHandler,
|
|
3728
|
-
onBlur: props?.onBlur,
|
|
3729
|
-
rows: 4,
|
|
3730
|
-
required: props?.attributes?.required,
|
|
3731
|
-
placeholder: props?.attributes?.placeholder,
|
|
3732
|
-
maxLength: props?.attributes?.maxLength,
|
|
3733
|
-
disabled: props?.attributes?.readOnly,
|
|
3734
|
-
minLength: props?.attributes?.minLength,
|
|
3735
|
-
className: "peer mt-1 py-1.5 block w-full rounded shadow-sm input"
|
|
3736
|
-
}
|
|
3737
|
-
),
|
|
3738
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
3739
|
-
] }) });
|
|
3693
|
+
}
|
|
3694
|
+
return selections;
|
|
3740
3695
|
};
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3696
|
+
buildFacetFilter = (selections) => Array.from(selections.entries()).map(([field, value]) => `${field} eq '${escapeODataString(value)}'`).join(" and ");
|
|
3697
|
+
parseODataSearch = (value) => {
|
|
3698
|
+
if (!value) return "";
|
|
3699
|
+
const trimmedValue = value.trim();
|
|
3700
|
+
if (trimmedValue.startsWith("'") && trimmedValue.endsWith("'")) {
|
|
3701
|
+
return trimmedValue.slice(1, -1).replace(/''/g, "'");
|
|
3702
|
+
}
|
|
3703
|
+
return trimmedValue;
|
|
3704
|
+
};
|
|
3705
|
+
SearchIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
3706
|
+
"svg",
|
|
3707
|
+
{
|
|
3708
|
+
"aria-hidden": "true",
|
|
3709
|
+
className,
|
|
3710
|
+
fill: "none",
|
|
3711
|
+
viewBox: "0 0 24 24",
|
|
3712
|
+
stroke: "currentColor",
|
|
3713
|
+
strokeWidth: "2",
|
|
3714
|
+
children: [
|
|
3715
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("circle", { cx: "11", cy: "11", r: "7" }),
|
|
3716
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("path", { strokeLinecap: "round", d: "m20 20-4-4" })
|
|
3717
|
+
]
|
|
3718
|
+
}
|
|
3719
|
+
);
|
|
3720
|
+
ResetIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
3721
|
+
"svg",
|
|
3722
|
+
{
|
|
3723
|
+
"aria-hidden": "true",
|
|
3724
|
+
className,
|
|
3725
|
+
fill: "none",
|
|
3726
|
+
viewBox: "0 0 24 24",
|
|
3727
|
+
stroke: "currentColor",
|
|
3728
|
+
strokeWidth: "2",
|
|
3729
|
+
children: [
|
|
3730
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v6h6" }),
|
|
3731
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3732
|
+
"path",
|
|
3757
3733
|
{
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
groupKey: props.groupKey
|
|
3734
|
+
strokeLinecap: "round",
|
|
3735
|
+
strokeLinejoin: "round",
|
|
3736
|
+
d: "M5.5 15a8 8 0 1 0 .6-7.8L4 10"
|
|
3762
3737
|
}
|
|
3763
|
-
)
|
|
3764
|
-
|
|
3765
|
-
};
|
|
3766
|
-
let value = "";
|
|
3767
|
-
if (props.value !== void 0 && props.value !== null) {
|
|
3768
|
-
value = props.value;
|
|
3769
|
-
}
|
|
3770
|
-
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react40.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("label", { className: "block", children: [
|
|
3771
|
-
props?.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "text-sm inline-block pb-1 font-medium ", children: props?.attributes?.label }),
|
|
3772
|
-
" ",
|
|
3773
|
-
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "bg-error-weak !bg-transparent", children: "*" }),
|
|
3774
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
3775
|
-
"input",
|
|
3776
|
-
{
|
|
3777
|
-
type: "text",
|
|
3778
|
-
name: props.name,
|
|
3779
|
-
id: props.name,
|
|
3780
|
-
value,
|
|
3781
|
-
onChange: textChangeHandler,
|
|
3782
|
-
onBlur: props?.onBlur,
|
|
3783
|
-
autoFocus: props?.attributes?.autoFocus,
|
|
3784
|
-
required: props?.attributes?.required,
|
|
3785
|
-
placeholder: props?.attributes?.placeholder,
|
|
3786
|
-
maxLength: props?.attributes?.maxLength,
|
|
3787
|
-
pattern: props?.attributes?.pattern,
|
|
3788
|
-
disabled: props?.attributes?.readOnly,
|
|
3789
|
-
minLength: props?.attributes?.minLength,
|
|
3790
|
-
className: `peer input mt-1 py-1.5 block w-full rounded shadow-sm transition-all duration-500 ease-in-out
|
|
3791
|
-
${props?.inputClasses ? props.inputClasses : ``}
|
|
3792
|
-
`
|
|
3793
|
-
}
|
|
3794
|
-
),
|
|
3795
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
3796
|
-
] }) });
|
|
3797
|
-
};
|
|
3798
|
-
LineTextInput_default = LineTextInput;
|
|
3799
|
-
}
|
|
3800
|
-
});
|
|
3801
|
-
|
|
3802
|
-
// src/components/controls/edit/MoneyInput.tsx
|
|
3803
|
-
var import_react41, import_jsx_runtime67, MoneyInput, MoneyInput_default;
|
|
3804
|
-
var init_MoneyInput = __esm({
|
|
3805
|
-
"src/components/controls/edit/MoneyInput.tsx"() {
|
|
3806
|
-
"use strict";
|
|
3807
|
-
import_react41 = __toESM(require("react"));
|
|
3808
|
-
import_jsx_runtime67 = require("react/jsx-runtime");
|
|
3809
|
-
MoneyInput = (props) => {
|
|
3810
|
-
const textChangeHandler = (event) => {
|
|
3811
|
-
const rawValue = event.target.value;
|
|
3812
|
-
const numericValue = parseFloat(rawValue);
|
|
3813
|
-
if (rawValue === "" || !isNaN(numericValue) && numericValue >= 0) {
|
|
3814
|
-
if (props.callback !== void 0) {
|
|
3815
|
-
props.callback({
|
|
3816
|
-
name: props.name,
|
|
3817
|
-
value: rawValue,
|
|
3818
|
-
index: props.index,
|
|
3819
|
-
groupKey: props.groupKey
|
|
3820
|
-
});
|
|
3821
|
-
}
|
|
3822
|
-
}
|
|
3823
|
-
};
|
|
3824
|
-
const handleWheel = (event) => {
|
|
3825
|
-
event.preventDefault();
|
|
3826
|
-
event.target.blur();
|
|
3827
|
-
};
|
|
3828
|
-
let value = "";
|
|
3829
|
-
if (props.value !== void 0 && props.value !== null) {
|
|
3830
|
-
value = props.value;
|
|
3738
|
+
)
|
|
3739
|
+
]
|
|
3831
3740
|
}
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
" ",
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
{
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3741
|
+
);
|
|
3742
|
+
FilterSlidersIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
3743
|
+
"svg",
|
|
3744
|
+
{
|
|
3745
|
+
"aria-hidden": "true",
|
|
3746
|
+
className,
|
|
3747
|
+
fill: "none",
|
|
3748
|
+
viewBox: "0 0 24 24",
|
|
3749
|
+
stroke: "currentColor",
|
|
3750
|
+
strokeWidth: "2",
|
|
3751
|
+
children: [
|
|
3752
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3 4h18M3 12h18M3 20h18" }),
|
|
3753
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("circle", { cx: "8", cy: "4", r: "2", fill: "currentColor" }),
|
|
3754
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("circle", { cx: "16", cy: "12", r: "2", fill: "currentColor" }),
|
|
3755
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("circle", { cx: "10", cy: "20", r: "2", fill: "currentColor" })
|
|
3756
|
+
]
|
|
3757
|
+
}
|
|
3758
|
+
);
|
|
3759
|
+
ChevronDownIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3760
|
+
"svg",
|
|
3761
|
+
{
|
|
3762
|
+
"aria-hidden": "true",
|
|
3763
|
+
className,
|
|
3764
|
+
fill: "none",
|
|
3765
|
+
viewBox: "0 0 24 24",
|
|
3766
|
+
stroke: "currentColor",
|
|
3767
|
+
strokeWidth: "2",
|
|
3768
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m19 9-7 7-7-7" })
|
|
3769
|
+
}
|
|
3770
|
+
);
|
|
3771
|
+
CheckIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3772
|
+
"svg",
|
|
3773
|
+
{
|
|
3774
|
+
"aria-hidden": "true",
|
|
3775
|
+
className,
|
|
3776
|
+
fill: "none",
|
|
3777
|
+
viewBox: "0 0 24 24",
|
|
3778
|
+
stroke: "currentColor",
|
|
3779
|
+
strokeWidth: "2.5",
|
|
3780
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
|
|
3781
|
+
}
|
|
3782
|
+
);
|
|
3783
|
+
CloseIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3784
|
+
"svg",
|
|
3785
|
+
{
|
|
3786
|
+
"aria-hidden": "true",
|
|
3787
|
+
className,
|
|
3788
|
+
fill: "none",
|
|
3789
|
+
viewBox: "0 0 24 24",
|
|
3790
|
+
stroke: "currentColor",
|
|
3791
|
+
strokeWidth: "2",
|
|
3792
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
3793
|
+
}
|
|
3794
|
+
);
|
|
3795
|
+
MapPinIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
3796
|
+
"svg",
|
|
3797
|
+
{
|
|
3798
|
+
"aria-hidden": "true",
|
|
3799
|
+
className,
|
|
3800
|
+
fill: "none",
|
|
3801
|
+
viewBox: "0 0 24 24",
|
|
3802
|
+
stroke: "currentColor",
|
|
3803
|
+
strokeWidth: "2",
|
|
3804
|
+
children: [
|
|
3805
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3806
|
+
"path",
|
|
3807
|
+
{
|
|
3808
|
+
strokeLinecap: "round",
|
|
3809
|
+
strokeLinejoin: "round",
|
|
3810
|
+
d: "M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"
|
|
3899
3811
|
}
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
});
|
|
3908
|
-
};
|
|
3909
|
-
const inputChangeHandler = (event) => {
|
|
3910
|
-
props.callback?.({
|
|
3911
|
-
name: props.name,
|
|
3912
|
-
value: event.target.value,
|
|
3913
|
-
index: props.index,
|
|
3914
|
-
groupKey: props.groupKey
|
|
3915
|
-
});
|
|
3916
|
-
};
|
|
3917
|
-
(0, import_react42.useEffect)(() => {
|
|
3918
|
-
async function fetchData() {
|
|
3919
|
-
if (props.dataset) {
|
|
3920
|
-
setList(props.dataset);
|
|
3921
|
-
return;
|
|
3922
|
-
}
|
|
3923
|
-
if (props.dataSource && props.serviceClient) {
|
|
3924
|
-
let dataSource = props.dataSource;
|
|
3925
|
-
let response;
|
|
3926
|
-
if (props.dataSourceDependsOn) {
|
|
3927
|
-
if (!props.dependentValue) {
|
|
3928
|
-
setList([]);
|
|
3929
|
-
return;
|
|
3930
|
-
}
|
|
3931
|
-
dataSource = dataSource.replace(
|
|
3932
|
-
`{${props.dataSourceDependsOn}}`,
|
|
3933
|
-
props.dependentValue
|
|
3934
|
-
);
|
|
3812
|
+
),
|
|
3813
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3814
|
+
"path",
|
|
3815
|
+
{
|
|
3816
|
+
strokeLinecap: "round",
|
|
3817
|
+
strokeLinejoin: "round",
|
|
3818
|
+
d: "M15 11a3 3 0 11-6 0 3 3 0 016 0z"
|
|
3935
3819
|
}
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
props.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "text-sm font-medium inline-block pb-1", children: props.attributes?.label }),
|
|
3952
|
-
" ",
|
|
3953
|
-
props.attributes?.label && props.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
3954
|
-
list && list.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
3955
|
-
"input",
|
|
3820
|
+
)
|
|
3821
|
+
]
|
|
3822
|
+
}
|
|
3823
|
+
);
|
|
3824
|
+
BriefcaseIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3825
|
+
"svg",
|
|
3826
|
+
{
|
|
3827
|
+
"aria-hidden": "true",
|
|
3828
|
+
className,
|
|
3829
|
+
fill: "none",
|
|
3830
|
+
viewBox: "0 0 24 24",
|
|
3831
|
+
stroke: "currentColor",
|
|
3832
|
+
strokeWidth: "2",
|
|
3833
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3834
|
+
"path",
|
|
3956
3835
|
{
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
value,
|
|
3961
|
-
onChange: inputChangeHandler,
|
|
3962
|
-
required: props.attributes?.required,
|
|
3963
|
-
placeholder: props.attributes?.placeholder,
|
|
3964
|
-
maxLength: props.attributes?.maxLength,
|
|
3965
|
-
pattern: props.attributes?.pattern,
|
|
3966
|
-
disabled: props.attributes?.readOnly,
|
|
3967
|
-
minLength: props.attributes?.minLength,
|
|
3968
|
-
className: `peer input select mt-1 py-1.5 block w-full rounded shadow-sm ${props.inputClasses ?? ""}`
|
|
3836
|
+
strokeLinecap: "round",
|
|
3837
|
+
strokeLinejoin: "round",
|
|
3838
|
+
d: "M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
|
|
3969
3839
|
}
|
|
3970
|
-
)
|
|
3971
|
-
|
|
3972
|
-
|
|
3840
|
+
)
|
|
3841
|
+
}
|
|
3842
|
+
);
|
|
3843
|
+
FileTextIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3844
|
+
"svg",
|
|
3845
|
+
{
|
|
3846
|
+
"aria-hidden": "true",
|
|
3847
|
+
className,
|
|
3848
|
+
fill: "none",
|
|
3849
|
+
viewBox: "0 0 24 24",
|
|
3850
|
+
stroke: "currentColor",
|
|
3851
|
+
strokeWidth: "2",
|
|
3852
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3853
|
+
"path",
|
|
3973
3854
|
{
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
onChange: textChangeHandler,
|
|
3978
|
-
required: props.attributes?.required,
|
|
3979
|
-
disabled: props.attributes?.readOnly,
|
|
3980
|
-
className: `peer select py-1.5 block w-full text-black rounded border-gray-300 shadow-sm
|
|
3981
|
-
focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
|
|
3982
|
-
disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none ${props.inputClasses ?? ""}`,
|
|
3983
|
-
children: [
|
|
3984
|
-
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: "", children: props.attributes?.placeholder || "Select" }),
|
|
3985
|
-
list.map((item, index) => {
|
|
3986
|
-
const keyField = props.dataKeyFieldName;
|
|
3987
|
-
const textField = props.dataTextFieldName;
|
|
3988
|
-
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: item[keyField], children: item[textField] }, index);
|
|
3989
|
-
})
|
|
3990
|
-
]
|
|
3991
|
-
}
|
|
3992
|
-
),
|
|
3993
|
-
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 text-alert text-sm", children: props.attributes?.errorMessage || "" })
|
|
3994
|
-
] });
|
|
3995
|
-
};
|
|
3996
|
-
Select_default = Select;
|
|
3997
|
-
}
|
|
3998
|
-
});
|
|
3999
|
-
|
|
4000
|
-
// src/components/controls/edit/PercentageInput.tsx
|
|
4001
|
-
var import_react43, import_jsx_runtime69, PercentageInput, PercentageInput_default;
|
|
4002
|
-
var init_PercentageInput = __esm({
|
|
4003
|
-
"src/components/controls/edit/PercentageInput.tsx"() {
|
|
4004
|
-
"use strict";
|
|
4005
|
-
import_react43 = __toESM(require("react"));
|
|
4006
|
-
import_jsx_runtime69 = require("react/jsx-runtime");
|
|
4007
|
-
PercentageInput = (props) => {
|
|
4008
|
-
const textChangeHandler = (event) => {
|
|
4009
|
-
const rawValue = event.target.value;
|
|
4010
|
-
const numericValue = parseFloat(rawValue);
|
|
4011
|
-
if (rawValue === "" || !isNaN(numericValue) && numericValue >= 0) {
|
|
4012
|
-
if (props.callback !== void 0) {
|
|
4013
|
-
props.callback({
|
|
4014
|
-
name: props.name,
|
|
4015
|
-
value: rawValue,
|
|
4016
|
-
index: props.index,
|
|
4017
|
-
groupKey: props.groupKey
|
|
4018
|
-
});
|
|
3855
|
+
strokeLinecap: "round",
|
|
3856
|
+
strokeLinejoin: "round",
|
|
3857
|
+
d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
4019
3858
|
}
|
|
4020
|
-
|
|
4021
|
-
};
|
|
4022
|
-
const handleWheel = (event) => {
|
|
4023
|
-
event.preventDefault();
|
|
4024
|
-
event.target.blur();
|
|
4025
|
-
};
|
|
4026
|
-
let value = "";
|
|
4027
|
-
if (props.value !== void 0 && props.value !== null) {
|
|
4028
|
-
value = props.value;
|
|
3859
|
+
)
|
|
4029
3860
|
}
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
" ",
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
3861
|
+
);
|
|
3862
|
+
TagIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3863
|
+
"svg",
|
|
3864
|
+
{
|
|
3865
|
+
"aria-hidden": "true",
|
|
3866
|
+
className,
|
|
3867
|
+
fill: "none",
|
|
3868
|
+
viewBox: "0 0 24 24",
|
|
3869
|
+
stroke: "currentColor",
|
|
3870
|
+
strokeWidth: "2",
|
|
3871
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3872
|
+
"path",
|
|
4041
3873
|
{
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
value,
|
|
4046
|
-
min: 0,
|
|
4047
|
-
onChange: textChangeHandler,
|
|
4048
|
-
onBlur: props?.onBlur,
|
|
4049
|
-
autoFocus: props?.attributes?.autoFocus,
|
|
4050
|
-
onKeyDown: preventNegative,
|
|
4051
|
-
onWheel: handleWheel,
|
|
4052
|
-
required: props?.attributes?.required,
|
|
4053
|
-
placeholder: props?.attributes?.placeholder,
|
|
4054
|
-
pattern: props?.attributes?.pattern,
|
|
4055
|
-
disabled: props?.attributes?.readOnly,
|
|
4056
|
-
max: "100",
|
|
4057
|
-
className: `peer input mt-1 py-1.5 block w-full rounded shadow-sm number-input transition-all duration-500 ease-in-out
|
|
4058
|
-
${props?.inputClasses ? props.inputClasses : ``}
|
|
4059
|
-
`
|
|
3874
|
+
strokeLinecap: "round",
|
|
3875
|
+
strokeLinejoin: "round",
|
|
3876
|
+
d: "M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"
|
|
4060
3877
|
}
|
|
4061
|
-
)
|
|
4062
|
-
|
|
4063
|
-
|
|
3878
|
+
)
|
|
3879
|
+
}
|
|
3880
|
+
);
|
|
3881
|
+
getCategoryIcon = (category) => {
|
|
3882
|
+
const lower = category.toLowerCase();
|
|
3883
|
+
if (lower.includes("location") || lower.includes("city") || lower.includes("country") || lower.includes("state") || lower.includes("address")) {
|
|
3884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(MapPinIcon, { className: "h-4 w-4" });
|
|
3885
|
+
}
|
|
3886
|
+
if (lower.includes("type") || lower.includes("work") || lower.includes("employment") || lower.includes("experience")) {
|
|
3887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(BriefcaseIcon, { className: "h-4 w-4" });
|
|
3888
|
+
}
|
|
3889
|
+
if (lower.includes("department") || lower.includes("category") || lower.includes("role") || lower.includes("industry")) {
|
|
3890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FileTextIcon, { className: "h-4 w-4" });
|
|
3891
|
+
}
|
|
3892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(TagIcon, { className: "h-4 w-4" });
|
|
4064
3893
|
};
|
|
4065
|
-
PercentageInput_default = PercentageInput;
|
|
4066
|
-
}
|
|
4067
|
-
});
|
|
4068
|
-
|
|
4069
|
-
// src/components/controls/edit/PhoneInput.tsx
|
|
4070
|
-
var import_react44, import_jsx_runtime70, PhoneInput, PhoneInput_default;
|
|
4071
|
-
var init_PhoneInput = __esm({
|
|
4072
|
-
"src/components/controls/edit/PhoneInput.tsx"() {
|
|
4073
|
-
"use strict";
|
|
4074
|
-
import_react44 = __toESM(require("react"));
|
|
4075
|
-
import_jsx_runtime70 = require("react/jsx-runtime");
|
|
4076
|
-
PhoneInput = (props) => {
|
|
4077
|
-
const textChangeHandler = (event) => {
|
|
4078
|
-
const text = event.target.value;
|
|
4079
|
-
if (props.callback !== void 0) {
|
|
4080
|
-
props.callback(
|
|
4081
|
-
{
|
|
4082
|
-
name: props.name,
|
|
4083
|
-
value: text,
|
|
4084
|
-
index: props.index,
|
|
4085
|
-
groupKey: props.groupKey
|
|
4086
|
-
}
|
|
4087
|
-
);
|
|
4088
|
-
}
|
|
4089
|
-
};
|
|
4090
|
-
let value = "";
|
|
4091
|
-
if (props.value !== void 0 && props.value !== null) {
|
|
4092
|
-
value = props.value;
|
|
4093
|
-
}
|
|
4094
|
-
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react44.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("label", { className: "block mb-1", children: [
|
|
4095
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
|
|
4096
|
-
" ",
|
|
4097
|
-
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
4098
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center rounded border ", children: [
|
|
4099
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "px-3", children: props.prefix }),
|
|
4100
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4101
|
-
"input",
|
|
4102
|
-
{
|
|
4103
|
-
type: "text",
|
|
4104
|
-
name: props.name,
|
|
4105
|
-
id: props.name,
|
|
4106
|
-
value,
|
|
4107
|
-
onChange: textChangeHandler,
|
|
4108
|
-
required: props?.attributes?.required,
|
|
4109
|
-
placeholder: props?.attributes?.placeholder,
|
|
4110
|
-
maxLength: props?.attributes?.maxLength,
|
|
4111
|
-
pattern: props?.attributes?.pattern,
|
|
4112
|
-
disabled: props?.attributes?.readOnly,
|
|
4113
|
-
minLength: props?.attributes?.minLength,
|
|
4114
|
-
className: "py-1.5 block w-full outline-none border-0 mr-0.5"
|
|
4115
|
-
}
|
|
4116
|
-
)
|
|
4117
|
-
] }),
|
|
4118
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
4119
|
-
] }) });
|
|
4120
|
-
};
|
|
4121
|
-
PhoneInput_default = PhoneInput;
|
|
4122
|
-
}
|
|
4123
|
-
});
|
|
4124
|
-
|
|
4125
|
-
// src/components/controls/edit/NumberInput.tsx
|
|
4126
|
-
var import_react45, import_jsx_runtime71, NumberInput, NumberInput_default;
|
|
4127
|
-
var init_NumberInput = __esm({
|
|
4128
|
-
"src/components/controls/edit/NumberInput.tsx"() {
|
|
4129
|
-
"use strict";
|
|
4130
|
-
import_react45 = __toESM(require("react"));
|
|
4131
|
-
import_jsx_runtime71 = require("react/jsx-runtime");
|
|
4132
|
-
NumberInput = (props) => {
|
|
4133
|
-
const textChangeHandler = (event) => {
|
|
4134
|
-
const text = event.target.value;
|
|
4135
|
-
if (props.callback !== void 0) {
|
|
4136
|
-
props.callback({
|
|
4137
|
-
name: props.name,
|
|
4138
|
-
value: text,
|
|
4139
|
-
index: props.index,
|
|
4140
|
-
groupKey: props.groupKey
|
|
4141
|
-
});
|
|
4142
|
-
}
|
|
4143
|
-
};
|
|
4144
|
-
const handleWheel = (event) => {
|
|
4145
|
-
event.preventDefault();
|
|
4146
|
-
event.target.blur();
|
|
4147
|
-
};
|
|
4148
|
-
let value = "";
|
|
4149
|
-
if (props.value !== void 0 && props.value !== null) {
|
|
4150
|
-
value = props.value;
|
|
4151
|
-
}
|
|
4152
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_react45.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("label", { className: "block", children: [
|
|
4153
|
-
props?.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "text-sm inline-block pb-1 font-medium ", children: props?.attributes?.label }),
|
|
4154
|
-
" ",
|
|
4155
|
-
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
4156
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4157
|
-
"input",
|
|
4158
|
-
{
|
|
4159
|
-
type: "number",
|
|
4160
|
-
name: props.name,
|
|
4161
|
-
id: props.name,
|
|
4162
|
-
value,
|
|
4163
|
-
onChange: textChangeHandler,
|
|
4164
|
-
onWheel: handleWheel,
|
|
4165
|
-
onBlur: props?.onBlur,
|
|
4166
|
-
autoFocus: props?.attributes?.autoFocus,
|
|
4167
|
-
required: props?.attributes?.required,
|
|
4168
|
-
placeholder: props?.attributes?.placeholder,
|
|
4169
|
-
pattern: props?.attributes?.pattern,
|
|
4170
|
-
disabled: props?.attributes?.readOnly,
|
|
4171
|
-
max: props?.attributes?.maxValue,
|
|
4172
|
-
min: props?.attributes?.minValue,
|
|
4173
|
-
className: `peer input mt-1 py-1.5 block w-full rounded shadow-sm number-input transition-all duration-500 ease-in-out
|
|
4174
|
-
${props?.inputClasses ? props.inputClasses : ``}
|
|
4175
|
-
`
|
|
4176
|
-
}
|
|
4177
|
-
),
|
|
4178
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
4179
|
-
] }) });
|
|
4180
|
-
};
|
|
4181
|
-
NumberInput_default = NumberInput;
|
|
4182
|
-
}
|
|
4183
|
-
});
|
|
4184
|
-
|
|
4185
|
-
// src/components/controls/edit/CheckboxInput.tsx
|
|
4186
|
-
var import_react46, import_jsx_runtime72, CheckboxInput, CheckboxInput_default;
|
|
4187
|
-
var init_CheckboxInput = __esm({
|
|
4188
|
-
"src/components/controls/edit/CheckboxInput.tsx"() {
|
|
4189
|
-
"use strict";
|
|
4190
|
-
import_react46 = __toESM(require("react"));
|
|
4191
|
-
import_jsx_runtime72 = require("react/jsx-runtime");
|
|
4192
|
-
CheckboxInput = (props) => {
|
|
4193
|
-
const isReadOnly = props.attributes?.readOnly === true || props.attributes?.readOnly === "true" || props?.readOnly === true || props.disable === true || props.attributes?.disable === true || props.attributes?.disabled === true || props.attributes?.disabled === "true";
|
|
4194
|
-
const textChangeHandler = (event) => {
|
|
4195
|
-
if (isReadOnly) return;
|
|
4196
|
-
const text = event.target.checked;
|
|
4197
|
-
if (props.callback !== void 0) {
|
|
4198
|
-
props.callback({
|
|
4199
|
-
name: props.name,
|
|
4200
|
-
value: text,
|
|
4201
|
-
index: props.index,
|
|
4202
|
-
groupKey: props.groupKey
|
|
4203
|
-
});
|
|
4204
|
-
}
|
|
4205
|
-
};
|
|
4206
|
-
let value = false;
|
|
4207
|
-
if (props.value !== void 0 && props.value !== null && props.value !== "" && (props.value === true || props.value === "true" || props.value.toString().toLowerCase() === "true" || props.value === 1 || props.value === "1")) {
|
|
4208
|
-
value = true;
|
|
4209
|
-
}
|
|
4210
|
-
const customClasses = (props?.inputClasses || "").split(/\s+/).filter((c) => !/^(w-|h-|block|inline-block|py-|px-|p-)/.test(c)).join(" ");
|
|
4211
|
-
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react46.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: `mb-1 ${isReadOnly ? "cursor-not-allowed" : ""}`, children: [
|
|
4212
|
-
props?.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
4213
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
4214
|
-
"label",
|
|
4215
|
-
{
|
|
4216
|
-
htmlFor: props.name,
|
|
4217
|
-
className: "inline-block text-sm font-medium pb-1",
|
|
4218
|
-
children: props.attributes.label
|
|
4219
|
-
}
|
|
4220
|
-
),
|
|
4221
|
-
" ",
|
|
4222
|
-
props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "bg-error-weak", children: "*" })
|
|
4223
|
-
] }),
|
|
4224
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
4225
|
-
"input",
|
|
4226
|
-
{
|
|
4227
|
-
type: "checkbox",
|
|
4228
|
-
name: props.name,
|
|
4229
|
-
id: props.name,
|
|
4230
|
-
checked: value,
|
|
4231
|
-
onChange: textChangeHandler,
|
|
4232
|
-
onBlur: props?.onBlur,
|
|
4233
|
-
autoFocus: props?.attributes?.autoFocus,
|
|
4234
|
-
required: !isReadOnly && Boolean(props?.attributes?.required),
|
|
4235
|
-
placeholder: props?.attributes?.placeholder,
|
|
4236
|
-
maxLength: props?.attributes?.maxLength,
|
|
4237
|
-
pattern: props?.attributes?.pattern,
|
|
4238
|
-
disabled: isReadOnly,
|
|
4239
|
-
readOnly: isReadOnly,
|
|
4240
|
-
tabIndex: isReadOnly ? -1 : void 0,
|
|
4241
|
-
onClick: (e) => {
|
|
4242
|
-
if (isReadOnly) {
|
|
4243
|
-
e.preventDefault();
|
|
4244
|
-
e.stopPropagation();
|
|
4245
|
-
}
|
|
4246
|
-
},
|
|
4247
|
-
minLength: props?.attributes?.minLength,
|
|
4248
|
-
className: `peer mt-1 h-4 w-4 shrink-0 rounded shadow-sm transition-all duration-200 ${isReadOnly ? "cursor-not-allowed pointer-events-none" : "cursor-pointer"} ${customClasses}`
|
|
4249
|
-
}
|
|
4250
|
-
),
|
|
4251
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage || "" })
|
|
4252
|
-
] }) });
|
|
4253
|
-
};
|
|
4254
|
-
CheckboxInput_default = CheckboxInput;
|
|
4255
|
-
}
|
|
4256
|
-
});
|
|
4257
|
-
|
|
4258
|
-
// src/components/controls/edit/OtpInput.tsx
|
|
4259
|
-
var import_react47, import_jsx_runtime73, OtpInput, OtpInput_default;
|
|
4260
|
-
var init_OtpInput = __esm({
|
|
4261
|
-
"src/components/controls/edit/OtpInput.tsx"() {
|
|
4262
|
-
"use strict";
|
|
4263
|
-
import_react47 = __toESM(require("react"));
|
|
4264
|
-
import_jsx_runtime73 = require("react/jsx-runtime");
|
|
4265
|
-
OtpInput = (props) => {
|
|
4266
|
-
const textChangeHandler = (event) => {
|
|
4267
|
-
const text = event.target.value;
|
|
4268
|
-
if (props.callback !== void 0) {
|
|
4269
|
-
props.callback({
|
|
4270
|
-
name: props.name,
|
|
4271
|
-
value: text,
|
|
4272
|
-
index: props.index,
|
|
4273
|
-
groupKey: props.groupKey
|
|
4274
|
-
});
|
|
4275
|
-
}
|
|
4276
|
-
};
|
|
4277
|
-
const handleWheel = (event) => {
|
|
4278
|
-
event.preventDefault();
|
|
4279
|
-
};
|
|
4280
|
-
let value = "";
|
|
4281
|
-
if (props.value !== void 0 && props.value !== null) {
|
|
4282
|
-
value = props.value;
|
|
4283
|
-
}
|
|
4284
|
-
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_react47.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("label", { htmlFor: props.name, className: "block w-full", children: [
|
|
4285
|
-
props?.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "text-sm inline-block pb-1 font-medium ", children: props?.attributes?.label }),
|
|
4286
|
-
" ",
|
|
4287
|
-
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
4288
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
4289
|
-
"input",
|
|
4290
|
-
{
|
|
4291
|
-
type: "text",
|
|
4292
|
-
name: props.name,
|
|
4293
|
-
id: props.name,
|
|
4294
|
-
value,
|
|
4295
|
-
onChange: textChangeHandler,
|
|
4296
|
-
onBlur: props?.onBlur,
|
|
4297
|
-
autoComplete: "off",
|
|
4298
|
-
required: props?.attributes?.required,
|
|
4299
|
-
placeholder: props?.attributes?.placeholder,
|
|
4300
|
-
maxLength: 4,
|
|
4301
|
-
pattern: props?.attributes?.pattern,
|
|
4302
|
-
disabled: props?.attributes?.readOnly,
|
|
4303
|
-
minLength: props?.attributes?.minLength,
|
|
4304
|
-
autoFocus: props?.attributes?.autoFocus,
|
|
4305
|
-
onWheel: handleWheel,
|
|
4306
|
-
className: `peer input mt-1 py-1.5 block w-full rounded shadow-sm tracking-[1.25em] text-center transition-all duration-500 ease-in-out
|
|
4307
|
-
${props?.inputClasses ? props.inputClasses : ``}
|
|
4308
|
-
`
|
|
4309
|
-
}
|
|
4310
|
-
),
|
|
4311
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
4312
|
-
] }) });
|
|
4313
|
-
};
|
|
4314
|
-
OtpInput_default = OtpInput;
|
|
4315
|
-
}
|
|
4316
|
-
});
|
|
4317
|
-
|
|
4318
|
-
// src/components/controls/edit/DateTimeInput.tsx
|
|
4319
|
-
var import_react48, import_jsx_runtime74, DateTimeInput, DateTimeInput_default;
|
|
4320
|
-
var init_DateTimeInput = __esm({
|
|
4321
|
-
"src/components/controls/edit/DateTimeInput.tsx"() {
|
|
4322
|
-
"use strict";
|
|
4323
|
-
import_react48 = __toESM(require("react"));
|
|
4324
|
-
import_jsx_runtime74 = require("react/jsx-runtime");
|
|
4325
|
-
DateTimeInput = (props) => {
|
|
4326
|
-
const textChangeHandler = (event) => {
|
|
4327
|
-
const localDate = new Date(event.target.value);
|
|
4328
|
-
if (props.callback !== void 0) {
|
|
4329
|
-
const utcISOString = localDate.toISOString();
|
|
4330
|
-
props.callback({
|
|
4331
|
-
name: props.name,
|
|
4332
|
-
value: utcISOString,
|
|
4333
|
-
index: props.index,
|
|
4334
|
-
groupKey: props.groupKey
|
|
4335
|
-
});
|
|
4336
|
-
}
|
|
4337
|
-
};
|
|
4338
|
-
let value;
|
|
4339
|
-
let localvalue;
|
|
4340
|
-
let timeZoneAbbr;
|
|
4341
|
-
if (props.value !== void 0 && props.value !== null) {
|
|
4342
|
-
value = props.value;
|
|
4343
|
-
const now = /* @__PURE__ */ new Date();
|
|
4344
|
-
const offsetMinutes = now.getTimezoneOffset();
|
|
4345
|
-
const offsetMilliseconds = offsetMinutes * 60 * 1e3;
|
|
4346
|
-
const valDate = value.toString().includes("Z") ? new Date(value) : /* @__PURE__ */ new Date(value + "Z");
|
|
4347
|
-
const localDate = new Date(valDate.getTime() - offsetMilliseconds);
|
|
4348
|
-
timeZoneAbbr = now.toLocaleTimeString("en", { timeZoneName: "short" }).split(" ")[2];
|
|
4349
|
-
localvalue = localDate?.toISOString()?.slice(0, 16);
|
|
4350
|
-
}
|
|
4351
|
-
const handleKeyDown = (e) => {
|
|
4352
|
-
if (e.key === "Backspace") {
|
|
4353
|
-
e.preventDefault();
|
|
4354
|
-
}
|
|
4355
|
-
};
|
|
4356
|
-
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_react48.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("label", { className: "block mb-1", children: [
|
|
4357
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
|
|
4358
|
-
" ",
|
|
4359
|
-
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
4360
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4361
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
4362
|
-
"input",
|
|
4363
|
-
{
|
|
4364
|
-
type: "datetime-local",
|
|
4365
|
-
name: props.name,
|
|
4366
|
-
id: props.name,
|
|
4367
|
-
value: localvalue,
|
|
4368
|
-
onChange: textChangeHandler,
|
|
4369
|
-
onKeyDown: handleKeyDown,
|
|
4370
|
-
required: props?.attributes?.required,
|
|
4371
|
-
placeholder: props?.attributes?.placeholder,
|
|
4372
|
-
maxLength: props?.attributes?.maxLength,
|
|
4373
|
-
pattern: props?.attributes?.pattern,
|
|
4374
|
-
disabled: props?.attributes?.readOnly,
|
|
4375
|
-
minLength: props?.attributes?.minLength,
|
|
4376
|
-
className: "peer mt-1 py-1.5 block w-full rounded shadow-sm\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n "
|
|
4377
|
-
}
|
|
4378
|
-
),
|
|
4379
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { children: timeZoneAbbr })
|
|
4380
|
-
] }),
|
|
4381
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
4382
|
-
] }) });
|
|
4383
|
-
};
|
|
4384
|
-
DateTimeInput_default = DateTimeInput;
|
|
4385
|
-
}
|
|
4386
|
-
});
|
|
4387
|
-
|
|
4388
|
-
// src/components/controls/edit/ColorInput.tsx
|
|
4389
|
-
var import_react49, import_jsx_runtime75, DEFAULT_COLOR, isValidHex, normalizeColor, ColorInput, ColorInput_default;
|
|
4390
|
-
var init_ColorInput = __esm({
|
|
4391
|
-
"src/components/controls/edit/ColorInput.tsx"() {
|
|
4392
|
-
"use strict";
|
|
4393
|
-
import_react49 = __toESM(require("react"));
|
|
4394
|
-
import_jsx_runtime75 = require("react/jsx-runtime");
|
|
4395
|
-
DEFAULT_COLOR = "#3b82f6";
|
|
4396
|
-
isValidHex = (val) => typeof val === "string" && /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(val.trim());
|
|
4397
|
-
normalizeColor = (val) => {
|
|
4398
|
-
if (isValidHex(val)) {
|
|
4399
|
-
return val.trim();
|
|
4400
|
-
}
|
|
4401
|
-
return DEFAULT_COLOR;
|
|
4402
|
-
};
|
|
4403
|
-
ColorInput = (props) => {
|
|
4404
|
-
const isReadOnly = props.attributes?.readOnly === true || props.attributes?.readOnly === "true" || props?.readOnly === true || props.disable === true || props.attributes?.disable === true || props.attributes?.disabled === true || props.attributes?.disabled === "true";
|
|
4405
|
-
const [color, setColor] = import_react49.default.useState(
|
|
4406
|
-
() => normalizeColor(props.value)
|
|
4407
|
-
);
|
|
4408
|
-
(0, import_react49.useEffect)(() => {
|
|
4409
|
-
const hasValue = props.value !== void 0 && props.value !== null && props.value !== "";
|
|
4410
|
-
if (!hasValue && props.callback && !isReadOnly) {
|
|
4411
|
-
props.callback({
|
|
4412
|
-
name: props.name,
|
|
4413
|
-
value: DEFAULT_COLOR,
|
|
4414
|
-
index: props.index,
|
|
4415
|
-
groupKey: props.groupKey
|
|
4416
|
-
});
|
|
4417
|
-
}
|
|
4418
|
-
}, [isReadOnly]);
|
|
4419
|
-
(0, import_react49.useEffect)(() => {
|
|
4420
|
-
if (props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
4421
|
-
if (typeof props.value === "string") {
|
|
4422
|
-
setColor(normalizeColor(props.value));
|
|
4423
|
-
}
|
|
4424
|
-
}
|
|
4425
|
-
}, [props.value]);
|
|
4426
|
-
const handleColorChange = (event) => {
|
|
4427
|
-
if (isReadOnly) return;
|
|
4428
|
-
const newColor = event.target.value;
|
|
4429
|
-
setColor(newColor);
|
|
4430
|
-
if (props.callback) {
|
|
4431
|
-
props.callback({
|
|
4432
|
-
name: props.name,
|
|
4433
|
-
value: newColor,
|
|
4434
|
-
index: props.index,
|
|
4435
|
-
groupKey: props.groupKey
|
|
4436
|
-
});
|
|
4437
|
-
}
|
|
4438
|
-
};
|
|
4439
|
-
const displayColor = normalizeColor(color || props.value);
|
|
4440
|
-
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react49.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("label", { className: `block ${isReadOnly ? "cursor-not-allowed" : ""}`, children: [
|
|
4441
|
-
props?.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "text-sm inline-block pb-1 font-medium ", children: props?.attributes?.label }),
|
|
4442
|
-
" ",
|
|
4443
|
-
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
4444
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
4445
|
-
"input",
|
|
4446
|
-
{
|
|
4447
|
-
type: "color",
|
|
4448
|
-
name: props.name,
|
|
4449
|
-
title: displayColor,
|
|
4450
|
-
id: props.name,
|
|
4451
|
-
value: displayColor,
|
|
4452
|
-
onChange: handleColorChange,
|
|
4453
|
-
onBlur: props?.onBlur,
|
|
4454
|
-
autoFocus: props?.attributes?.autoFocus,
|
|
4455
|
-
required: !isReadOnly && Boolean(props?.attributes?.required),
|
|
4456
|
-
disabled: isReadOnly,
|
|
4457
|
-
readOnly: isReadOnly,
|
|
4458
|
-
tabIndex: isReadOnly ? -1 : void 0,
|
|
4459
|
-
onClick: (e) => {
|
|
4460
|
-
if (isReadOnly) {
|
|
4461
|
-
e.preventDefault();
|
|
4462
|
-
e.stopPropagation();
|
|
4463
|
-
}
|
|
4464
|
-
},
|
|
4465
|
-
className: `peer block rounded ${isReadOnly ? "cursor-not-allowed pointer-events-none" : "cursor-pointer"} ${props?.inputClasses ? props.inputClasses : ""}`,
|
|
4466
|
-
style: {
|
|
4467
|
-
width: "78px",
|
|
4468
|
-
height: "33px",
|
|
4469
|
-
padding: 0,
|
|
4470
|
-
margin: 0,
|
|
4471
|
-
border: isReadOnly ? "1px solid var(--border, #e2e8f0)" : "1px solid #e2e8f0",
|
|
4472
|
-
borderRadius: "5px",
|
|
4473
|
-
overflow: "hidden",
|
|
4474
|
-
backgroundColor: isReadOnly ? "var(--bg-color, transparent)" : "transparent",
|
|
4475
|
-
appearance: "none",
|
|
4476
|
-
cursor: isReadOnly ? "not-allowed" : "pointer",
|
|
4477
|
-
pointerEvents: isReadOnly ? "none" : "auto"
|
|
4478
|
-
}
|
|
4479
|
-
}
|
|
4480
|
-
),
|
|
4481
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
4482
|
-
] }) });
|
|
4483
|
-
};
|
|
4484
|
-
ColorInput_default = ColorInput;
|
|
4485
|
-
}
|
|
4486
|
-
});
|
|
4487
|
-
|
|
4488
|
-
// src/components/controls/edit/SelectWithSearchInput.tsx
|
|
4489
|
-
var import_react50, import_jsx_runtime76, SelectWithSearchInput, SelectWithSearchInput_default;
|
|
4490
|
-
var init_SelectWithSearchInput = __esm({
|
|
4491
|
-
"src/components/controls/edit/SelectWithSearchInput.tsx"() {
|
|
4492
|
-
"use strict";
|
|
4493
|
-
"use client";
|
|
4494
|
-
import_react50 = __toESM(require("react"));
|
|
4495
|
-
import_jsx_runtime76 = require("react/jsx-runtime");
|
|
4496
|
-
SelectWithSearchInput = (props) => {
|
|
4497
|
-
const [isOpen, setIsOpen] = (0, import_react50.useState)(false);
|
|
4498
|
-
const [searchTerm, setSearchTerm] = (0, import_react50.useState)("");
|
|
4499
|
-
const [highlightedIndex, setHighlightedIndex] = (0, import_react50.useState)(-1);
|
|
4500
|
-
const [selectedItem, setSelectedItem] = (0, import_react50.useState)(
|
|
4501
|
-
null
|
|
4502
|
-
);
|
|
4503
|
-
const [list, setList] = (0, import_react50.useState)([]);
|
|
4504
|
-
const loadData = import_react50.default.useCallback(async () => {
|
|
4505
|
-
if (props.dataset) {
|
|
4506
|
-
setList(props.dataset);
|
|
4507
|
-
return;
|
|
4508
|
-
}
|
|
4509
|
-
if (props.dataSource && props.serviceClient) {
|
|
4510
|
-
let url = props.dataSource;
|
|
4511
|
-
if (props.dataSourceDependsOn && props.dependentValue) {
|
|
4512
|
-
url = url.replace(
|
|
4513
|
-
`{${props.dataSourceDependsOn}}`,
|
|
4514
|
-
props.dependentValue
|
|
4515
|
-
);
|
|
4516
|
-
}
|
|
4517
|
-
const response = await props.serviceClient.get(url);
|
|
4518
|
-
if (response?.result) {
|
|
4519
|
-
setList(response.result);
|
|
4520
|
-
}
|
|
4521
|
-
}
|
|
4522
|
-
}, [
|
|
4523
|
-
props.dataset,
|
|
4524
|
-
props.dataSource,
|
|
4525
|
-
props.serviceClient,
|
|
4526
|
-
props.dataSourceDependsOn,
|
|
4527
|
-
props.dependentValue
|
|
4528
|
-
]);
|
|
4529
|
-
(0, import_react50.useEffect)(() => {
|
|
4530
|
-
loadData();
|
|
4531
|
-
}, [loadData]);
|
|
4532
|
-
(0, import_react50.useEffect)(() => {
|
|
4533
|
-
if (props.value && list.length && props.dataKeyFieldName && props.dataTextFieldName) {
|
|
4534
|
-
const selected = list.find(
|
|
4535
|
-
(x) => String(x[props.dataKeyFieldName]) === String(props.value)
|
|
4536
|
-
);
|
|
4537
|
-
if (selected) {
|
|
4538
|
-
setSearchTerm(selected[props.dataTextFieldName]);
|
|
4539
|
-
setSelectedItem(selected);
|
|
4540
|
-
}
|
|
4541
|
-
}
|
|
4542
|
-
}, [props.value, list, props.dataKeyFieldName, props.dataTextFieldName]);
|
|
4543
|
-
const filteredItems = list.filter((item) => {
|
|
4544
|
-
const text = item[props.dataTextFieldName] ?? "";
|
|
4545
|
-
return text.toString().toLowerCase().includes(searchTerm.toLowerCase());
|
|
4546
|
-
});
|
|
4547
|
-
const handleSelect = (event, item) => {
|
|
4548
|
-
event.preventDefault();
|
|
4549
|
-
setSearchTerm(item[props.dataTextFieldName]);
|
|
4550
|
-
setSelectedItem(item);
|
|
4551
|
-
setIsOpen(false);
|
|
4552
|
-
setHighlightedIndex(-1);
|
|
4553
|
-
const selectedValue = item[props.dataKeyFieldName];
|
|
4554
|
-
if (props.onChange) {
|
|
4555
|
-
props.onChange(selectedValue);
|
|
4556
|
-
}
|
|
4557
|
-
if (props.callback) {
|
|
4558
|
-
props.callback({
|
|
4559
|
-
name: props.name,
|
|
4560
|
-
value: selectedValue,
|
|
4561
|
-
index: props.index,
|
|
4562
|
-
groupKey: props.groupKey
|
|
4563
|
-
});
|
|
4564
|
-
}
|
|
4565
|
-
};
|
|
4566
|
-
const handleKeyDown = (e) => {
|
|
4567
|
-
if (e.key === "ArrowDown") {
|
|
4568
|
-
setHighlightedIndex(
|
|
4569
|
-
(prev) => prev < filteredItems.length - 1 ? prev + 1 : 0
|
|
4570
|
-
);
|
|
4571
|
-
} else if (e.key === "ArrowUp") {
|
|
4572
|
-
setHighlightedIndex(
|
|
4573
|
-
(prev) => prev > 0 ? prev - 1 : filteredItems.length - 1
|
|
4574
|
-
);
|
|
4575
|
-
} else if (e.key === "Enter" && highlightedIndex >= 0) {
|
|
4576
|
-
handleSelect(e, filteredItems[highlightedIndex]);
|
|
4577
|
-
}
|
|
4578
|
-
};
|
|
4579
|
-
const dropdownRef = (0, import_react50.useRef)(null);
|
|
4580
|
-
(0, import_react50.useEffect)(() => {
|
|
4581
|
-
if (highlightedIndex >= 0 && dropdownRef.current) {
|
|
4582
|
-
const highlightedItem = dropdownRef.current.children[highlightedIndex];
|
|
4583
|
-
highlightedItem?.scrollIntoView({
|
|
4584
|
-
behavior: "smooth",
|
|
4585
|
-
block: "nearest"
|
|
4586
|
-
});
|
|
4587
|
-
}
|
|
4588
|
-
}, [highlightedIndex]);
|
|
4589
|
-
const isReadOnly = props.attributes?.readOnly || props.disable || props.attributes?.disable;
|
|
4590
|
-
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "relative", children: [
|
|
4591
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("label", { className: "pb-1", children: [
|
|
4592
|
-
props.attributes?.label,
|
|
4593
|
-
" ",
|
|
4594
|
-
props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "bg-error-weak", children: "*" })
|
|
4595
|
-
] }),
|
|
4596
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "relative", children: [
|
|
4597
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4598
|
-
"input",
|
|
4599
|
-
{
|
|
4600
|
-
type: "text",
|
|
4601
|
-
name: props.name,
|
|
4602
|
-
id: props.name,
|
|
4603
|
-
value: searchTerm,
|
|
4604
|
-
onChange: (e) => {
|
|
4605
|
-
if (!isReadOnly) {
|
|
4606
|
-
setSearchTerm(e.target.value);
|
|
4607
|
-
setIsOpen(true);
|
|
4608
|
-
setHighlightedIndex(-1);
|
|
4609
|
-
}
|
|
4610
|
-
},
|
|
4611
|
-
onFocus: () => {
|
|
4612
|
-
if (!isReadOnly) {
|
|
4613
|
-
setIsOpen(true);
|
|
4614
|
-
}
|
|
4615
|
-
},
|
|
4616
|
-
onKeyDown: handleKeyDown,
|
|
4617
|
-
placeholder: props.attributes?.placeholder ?? "Search...",
|
|
4618
|
-
readOnly: isReadOnly,
|
|
4619
|
-
disabled: isReadOnly,
|
|
4620
|
-
required: props.attributes?.required,
|
|
4621
|
-
className: `peer mt-2 py-1.5 select block w-full text-black rounded border-gray-300 shadow-sm
|
|
4622
|
-
focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
|
|
4623
|
-
disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none
|
|
4624
|
-
${isReadOnly ? "bg-neutral-soft opacity-50 cursor-not-allowed" : "bg-default"}
|
|
4625
|
-
`
|
|
4626
|
-
}
|
|
4627
|
-
),
|
|
4628
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4629
|
-
"button",
|
|
4630
|
-
{
|
|
4631
|
-
type: "button",
|
|
4632
|
-
disabled: isReadOnly,
|
|
4633
|
-
onClick: () => {
|
|
4634
|
-
if (!isReadOnly) {
|
|
4635
|
-
setIsOpen(!isOpen);
|
|
4636
|
-
}
|
|
4637
|
-
},
|
|
4638
|
-
className: "absolute right-2 top-3 h-5 w-5 text-gray-500 focus:outline-none",
|
|
4639
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4640
|
-
"svg",
|
|
4641
|
-
{
|
|
4642
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
4643
|
-
fill: "none",
|
|
4644
|
-
viewBox: "0 0 24 24",
|
|
4645
|
-
strokeWidth: 1.5,
|
|
4646
|
-
stroke: "currentColor",
|
|
4647
|
-
className: "w-full h-full",
|
|
4648
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4649
|
-
"path",
|
|
4650
|
-
{
|
|
4651
|
-
strokeLinecap: "round",
|
|
4652
|
-
strokeLinejoin: "round",
|
|
4653
|
-
d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
|
|
4654
|
-
}
|
|
4655
|
-
)
|
|
4656
|
-
}
|
|
4657
|
-
)
|
|
4658
|
-
}
|
|
4659
|
-
),
|
|
4660
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
|
|
4661
|
-
] }),
|
|
4662
|
-
!isReadOnly && isOpen && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4663
|
-
"div",
|
|
4664
|
-
{
|
|
4665
|
-
ref: dropdownRef,
|
|
4666
|
-
className: "absolute z-10 w-full bg-default border border-gray-200 shadow-lg max-h-48 overflow-y-auto",
|
|
4667
|
-
children: filteredItems.length > 0 ? filteredItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4668
|
-
"button",
|
|
4669
|
-
{
|
|
4670
|
-
onClick: (e) => handleSelect(e, item),
|
|
4671
|
-
className: `w-full px-4 py-2 flex items-center space-x-2 text-left ${index === highlightedIndex ? "bg-gray-200" : "hover:bg-gray-100"}`,
|
|
4672
|
-
role: "option",
|
|
4673
|
-
tabIndex: -1,
|
|
4674
|
-
onMouseEnter: () => setHighlightedIndex(index),
|
|
4675
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { children: item[props.dataTextFieldName] })
|
|
4676
|
-
},
|
|
4677
|
-
item[props.dataKeyFieldName]
|
|
4678
|
-
)) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
|
|
4679
|
-
}
|
|
4680
|
-
)
|
|
4681
|
-
] });
|
|
4682
|
-
};
|
|
4683
|
-
SelectWithSearchInput_default = SelectWithSearchInput;
|
|
4684
|
-
}
|
|
4685
|
-
});
|
|
4686
|
-
|
|
4687
|
-
// src/components/controls/edit/SelectWithSearchPanel.tsx
|
|
4688
|
-
var import_react51, import_jsx_runtime77, SelectWithSearchPanel, SelectWithSearchPanel_default;
|
|
4689
|
-
var init_SelectWithSearchPanel = __esm({
|
|
4690
|
-
"src/components/controls/edit/SelectWithSearchPanel.tsx"() {
|
|
4691
|
-
"use strict";
|
|
4692
|
-
"use client";
|
|
4693
|
-
init_Button();
|
|
4694
|
-
import_react51 = __toESM(require("react"));
|
|
4695
|
-
import_jsx_runtime77 = require("react/jsx-runtime");
|
|
4696
|
-
SelectWithSearchPanel = (props) => {
|
|
4697
|
-
const [isOpen, setIsOpen] = (0, import_react51.useState)(false);
|
|
4698
|
-
const [searchTerm, setSearchTerm] = (0, import_react51.useState)("");
|
|
4699
|
-
const [highlightedIndex, setHighlightedIndex] = (0, import_react51.useState)(0);
|
|
4700
|
-
const [list, setList] = (0, import_react51.useState)([]);
|
|
4701
|
-
const listRef = (0, import_react51.useRef)(null);
|
|
4702
|
-
const [isError, setIsError] = (0, import_react51.useState)(false);
|
|
4703
|
-
const containerRef = (0, import_react51.useRef)(null);
|
|
4704
|
-
const [isCreateOpen, setIsCreateOpen] = (0, import_react51.useState)(false);
|
|
4705
|
-
const [formData, setFormData] = (0, import_react51.useState)({});
|
|
4706
|
-
const getNestedValue7 = (obj, path) => {
|
|
4707
|
-
return path.split(".").reduce((acc, key) => acc?.[key], obj);
|
|
4708
|
-
};
|
|
4709
|
-
(0, import_react51.useEffect)(() => {
|
|
4710
|
-
const handleClickOutside = (event) => {
|
|
4711
|
-
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
4712
|
-
setIsOpen(false);
|
|
4713
|
-
}
|
|
4714
|
-
};
|
|
4715
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
4716
|
-
return () => {
|
|
4717
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
4718
|
-
};
|
|
4719
|
-
}, []);
|
|
4720
|
-
(0, import_react51.useEffect)(() => {
|
|
4721
|
-
async function fetchData() {
|
|
4722
|
-
if (props.dataset) {
|
|
4723
|
-
setList(props.dataset);
|
|
4724
|
-
} else if (props.dataSource && props.serviceClient) {
|
|
4725
|
-
let dataSource = props.dataSource;
|
|
4726
|
-
if (props.dataSourceDependsOn && props.dependentValue) {
|
|
4727
|
-
dataSource = dataSource.replace(
|
|
4728
|
-
`{${props.dataSourceDependsOn}}`,
|
|
4729
|
-
props.dependentValue
|
|
4730
|
-
);
|
|
4731
|
-
}
|
|
4732
|
-
const response = await props.serviceClient.get(dataSource);
|
|
4733
|
-
if (response?.result) setList(response.result);
|
|
4734
|
-
}
|
|
4735
|
-
}
|
|
4736
|
-
fetchData();
|
|
4737
|
-
}, [
|
|
4738
|
-
props.dataSource,
|
|
4739
|
-
props.dependentValue,
|
|
4740
|
-
props.dataset,
|
|
4741
|
-
props.dataSourceDependsOn
|
|
4742
|
-
]);
|
|
4743
|
-
const filteredItems = list?.filter((item) => {
|
|
4744
|
-
const value = getNestedValue7(item, props.dataTextFieldName);
|
|
4745
|
-
return value?.toLowerCase().includes(searchTerm?.toLowerCase());
|
|
4746
|
-
});
|
|
4747
|
-
const playBeep = () => {
|
|
4748
|
-
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
4749
|
-
const oscillator = audioCtx.createOscillator();
|
|
4750
|
-
const gainNode = audioCtx.createGain();
|
|
4751
|
-
oscillator.type = "square";
|
|
4752
|
-
oscillator.frequency.setValueAtTime(300, audioCtx.currentTime);
|
|
4753
|
-
gainNode.gain.setValueAtTime(0.02, audioCtx.currentTime);
|
|
4754
|
-
oscillator.connect(gainNode);
|
|
4755
|
-
gainNode.connect(audioCtx.destination);
|
|
4756
|
-
oscillator.start();
|
|
4757
|
-
setTimeout(() => {
|
|
4758
|
-
oscillator.stop();
|
|
4759
|
-
audioCtx.close();
|
|
4760
|
-
}, 250);
|
|
4761
|
-
};
|
|
4762
|
-
(0, import_react51.useEffect)(() => {
|
|
4763
|
-
const filteredItems2 = list?.filter(
|
|
4764
|
-
(item) => item[props?.dataTextFieldName]?.toLowerCase().includes(searchTerm?.toLowerCase())
|
|
4765
|
-
);
|
|
4766
|
-
if (searchTerm.length > 0 && filteredItems2.length === 0) {
|
|
4767
|
-
playBeep();
|
|
4768
|
-
setIsError(true);
|
|
4769
|
-
} else {
|
|
4770
|
-
setIsError(false);
|
|
4771
|
-
}
|
|
4772
|
-
}, [searchTerm]);
|
|
4773
|
-
const handleSelect = (event, item) => {
|
|
4774
|
-
event.preventDefault();
|
|
4775
|
-
setSearchTerm(getNestedValue7(item, props.dataTextFieldName));
|
|
4776
|
-
if (props.callback) {
|
|
4777
|
-
const val = {};
|
|
4778
|
-
props.callback({
|
|
4779
|
-
name: props.name,
|
|
4780
|
-
value: item[props.dataKeyFieldName],
|
|
4781
|
-
index: props.index,
|
|
4782
|
-
groupKey: props.groupKey
|
|
4783
|
-
});
|
|
4784
|
-
}
|
|
4785
|
-
setHighlightedIndex(0);
|
|
4786
|
-
setIsOpen(false);
|
|
4787
|
-
};
|
|
4788
|
-
const handleKeyDown = (e) => {
|
|
4789
|
-
if (e.key === "Escape") {
|
|
4790
|
-
setIsOpen(false);
|
|
4791
|
-
setHighlightedIndex(-1);
|
|
4792
|
-
} else if (e.key === "ArrowDown") {
|
|
4793
|
-
e.preventDefault();
|
|
4794
|
-
setHighlightedIndex((prev) => {
|
|
4795
|
-
const nextIndex = prev < filteredItems.length - 1 ? prev + 1 : prev;
|
|
4796
|
-
scrollIntoView(nextIndex);
|
|
4797
|
-
return nextIndex;
|
|
4798
|
-
});
|
|
4799
|
-
} else if (e.key === "ArrowUp") {
|
|
4800
|
-
e.preventDefault();
|
|
4801
|
-
setHighlightedIndex((prev) => {
|
|
4802
|
-
const prevIndex = prev > 0 ? prev - 1 : prev;
|
|
4803
|
-
scrollIntoView(prevIndex);
|
|
4804
|
-
return prevIndex;
|
|
4805
|
-
});
|
|
4806
|
-
} else if (e.key === "Enter" && highlightedIndex >= 0) {
|
|
4807
|
-
handleSelect(e, filteredItems[highlightedIndex]);
|
|
4808
|
-
}
|
|
4809
|
-
};
|
|
4810
|
-
const scrollIntoView = (index) => {
|
|
4811
|
-
if (listRef.current) {
|
|
4812
|
-
const item = listRef.current.children[index];
|
|
4813
|
-
if (item) {
|
|
4814
|
-
item.scrollIntoView();
|
|
4815
|
-
}
|
|
4816
|
-
}
|
|
4817
|
-
};
|
|
4818
|
-
const textChangeHandler = (event) => {
|
|
4819
|
-
const newSearchTerm = event.target.value;
|
|
4820
|
-
setSearchTerm(newSearchTerm);
|
|
4821
|
-
setIsOpen(true);
|
|
4822
|
-
setHighlightedIndex(0);
|
|
4823
|
-
};
|
|
4824
|
-
const handleInputChange = (event, field) => {
|
|
4825
|
-
setFormData((prev) => ({ ...prev, [field]: event.target.value }));
|
|
4826
|
-
};
|
|
4827
|
-
const handleSaveModal = (0, import_react51.useCallback)(async () => {
|
|
4828
|
-
console.log("Form Data:", formData);
|
|
4829
|
-
return formData;
|
|
4830
|
-
}, []);
|
|
4831
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "relative", children: [
|
|
4832
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("label", { className: "text-sm mb-1 font-medium", children: [
|
|
4833
|
-
props.attributes?.label,
|
|
4834
|
-
" ",
|
|
4835
|
-
" ",
|
|
4836
|
-
props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "bg-error-weak", children: "*" })
|
|
4837
|
-
] }),
|
|
4838
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { children: [
|
|
4839
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
4840
|
-
"input",
|
|
4841
|
-
{
|
|
4842
|
-
type: "text",
|
|
4843
|
-
name: props.name,
|
|
4844
|
-
id: props.name,
|
|
4845
|
-
value: searchTerm,
|
|
4846
|
-
onChange: textChangeHandler,
|
|
4847
|
-
onFocus: () => setIsOpen(true),
|
|
4848
|
-
onKeyDown: handleKeyDown,
|
|
4849
|
-
placeholder: props.attributes?.placeholder,
|
|
4850
|
-
required: props.attributes?.required,
|
|
4851
|
-
className: `peer mt-1 py-1.5 block w-full text-black rounded border-gray-300 shadow-sm
|
|
4852
|
-
${isError ? "focus:border-red-300 focus:ring focus:ring-red-200 focus:ring-opacity-50" : "focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"}
|
|
4853
|
-
disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none`
|
|
4854
|
-
}
|
|
4855
|
-
),
|
|
4856
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
|
|
4857
|
-
] }),
|
|
4858
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { ref: containerRef, children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_react51.default.Fragment, { children: [
|
|
4859
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "fixed z-50 right-0 bg-white top-[62px] w-1/4 border-l border-gray-200", children: [
|
|
4860
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "flex flex-col p-2 bg-accent-950 text-white", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("h5", { className: "text-md text-white font-medium", children: [
|
|
4861
|
-
"Select a",
|
|
4862
|
-
" ",
|
|
4863
|
-
props.attributes?.label || props.attributes?.heading
|
|
4864
|
-
] }) }),
|
|
4865
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "flex justify-end px-4 border-b py-2 border-gray-200 h-10", children: props.createFields && props.createFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
4866
|
-
"button",
|
|
4867
|
-
{
|
|
4868
|
-
type: "button",
|
|
4869
|
-
className: "text-primary hover:text-primary-800",
|
|
4870
|
-
onMouseDown: (e) => {
|
|
4871
|
-
e.preventDefault();
|
|
4872
|
-
setIsCreateOpen(true);
|
|
4873
|
-
},
|
|
4874
|
-
children: "Create"
|
|
4875
|
-
}
|
|
4876
|
-
) })
|
|
4877
|
-
] }),
|
|
4878
|
-
isCreateOpen && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "fixed right-0 w-1/4 h-full top-[62px] bg-white shadow-lg border-l border-gray-200 z-50", children: [
|
|
4879
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "flex flex-col p-2 bg-accent-950", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("h5", { className: "text-md font-medium text-white", children: [
|
|
4880
|
-
"Create New ",
|
|
4881
|
-
props.attributes?.label
|
|
4882
|
-
] }) }),
|
|
4883
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "flex justify-end px-4 border-b py-2 border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
4884
|
-
"button",
|
|
4885
|
-
{
|
|
4886
|
-
type: "button",
|
|
4887
|
-
onClick: () => setIsCreateOpen(false),
|
|
4888
|
-
className: "text-red-600 hover:text-red-800",
|
|
4889
|
-
children: "Close"
|
|
4890
|
-
}
|
|
4891
|
-
) }),
|
|
4892
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "p-4", children: [
|
|
4893
|
-
props.createFields?.map((field) => /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "mb-4", children: [
|
|
4894
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("label", { className: "text-sm mb-1 font-medium block", children: field.label }),
|
|
4895
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
4896
|
-
"input",
|
|
4897
|
-
{
|
|
4898
|
-
type: field.type,
|
|
4899
|
-
value: formData[field.name] || "",
|
|
4900
|
-
onChange: (e) => handleInputChange(e, field.name),
|
|
4901
|
-
placeholder: field.placeholder,
|
|
4902
|
-
required: field.required,
|
|
4903
|
-
disabled: field.disabled,
|
|
4904
|
-
pattern: field.pattern,
|
|
4905
|
-
minLength: field.minLength,
|
|
4906
|
-
maxLength: field.maxLength,
|
|
4907
|
-
className: "peer mt-1 py-1.5 block w-full text-black rounded border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
|
|
4908
|
-
}
|
|
4909
|
-
)
|
|
4910
|
-
] }, field.name)),
|
|
4911
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Button_default, { onClick: async () => {
|
|
4912
|
-
handleSaveModal();
|
|
4913
|
-
return { isSuccessful: true };
|
|
4914
|
-
}, className: "w-full", children: [
|
|
4915
|
-
"Save ",
|
|
4916
|
-
props.attributes?.label
|
|
4917
|
-
] })
|
|
4918
|
-
] })
|
|
4919
|
-
] }),
|
|
4920
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
4921
|
-
"div",
|
|
4922
|
-
{
|
|
4923
|
-
ref: listRef,
|
|
4924
|
-
className: "fixed z-10 right-0 mt-[130px] top-0 w-1/4 bg-white border-l border-gray-200 shadow-lg overflow-y-auto",
|
|
4925
|
-
style: { height: "calc(100vh - 130px)" },
|
|
4926
|
-
children: filteredItems.length > 0 ? filteredItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
4927
|
-
"button",
|
|
4928
|
-
{
|
|
4929
|
-
onClick: (e) => {
|
|
4930
|
-
handleSelect(e, item);
|
|
4931
|
-
},
|
|
4932
|
-
className: `w-full px-4 py-2 flex items-center space-x-2 text-left border-b border-gray-200 ${index === highlightedIndex ? "bg-gray-200" : "hover:bg-gray-100"}`,
|
|
4933
|
-
role: "option",
|
|
4934
|
-
tabIndex: -1,
|
|
4935
|
-
onMouseEnter: () => setHighlightedIndex(index),
|
|
4936
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { children: getNestedValue7(item, props.dataTextFieldName) })
|
|
4937
|
-
}
|
|
4938
|
-
) }, item[props.dataKeyFieldName])) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
|
|
4939
|
-
}
|
|
4940
|
-
)
|
|
4941
|
-
] }) })
|
|
4942
|
-
] });
|
|
4943
|
-
};
|
|
4944
|
-
SelectWithSearchPanel_default = SelectWithSearchPanel;
|
|
4945
|
-
}
|
|
4946
|
-
});
|
|
4947
|
-
|
|
4948
|
-
// src/components/controls/edit/EmailInput.tsx
|
|
4949
|
-
var import_react52, import_jsx_runtime78, EmailInput, EmailInput_default;
|
|
4950
|
-
var init_EmailInput = __esm({
|
|
4951
|
-
"src/components/controls/edit/EmailInput.tsx"() {
|
|
4952
|
-
"use strict";
|
|
4953
|
-
import_react52 = __toESM(require("react"));
|
|
4954
|
-
import_jsx_runtime78 = require("react/jsx-runtime");
|
|
4955
|
-
EmailInput = (props) => {
|
|
4956
|
-
const textChangeHandler = (event) => {
|
|
4957
|
-
const text = event.target.value;
|
|
4958
|
-
if (text) {
|
|
4959
|
-
const atIndex = text.indexOf("@");
|
|
4960
|
-
const dotIndex = text.indexOf(".", atIndex);
|
|
4961
|
-
if (dotIndex < atIndex || text.length - dotIndex <= 2) {
|
|
4962
|
-
event.target.setCustomValidity("invaild-value");
|
|
4963
|
-
} else {
|
|
4964
|
-
event.target.setCustomValidity("");
|
|
4965
|
-
}
|
|
4966
|
-
}
|
|
4967
|
-
if (props.callback !== void 0) {
|
|
4968
|
-
props.callback({
|
|
4969
|
-
name: props.name,
|
|
4970
|
-
value: text,
|
|
4971
|
-
index: props.index,
|
|
4972
|
-
groupKey: props.groupKey
|
|
4973
|
-
});
|
|
4974
|
-
}
|
|
4975
|
-
};
|
|
4976
|
-
let value = "";
|
|
4977
|
-
if (props.value !== void 0 && props.value !== null) {
|
|
4978
|
-
value = props.value;
|
|
4979
|
-
}
|
|
4980
|
-
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react52.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("label", { className: "block", children: [
|
|
4981
|
-
props?.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "text-sm inline-block pb-1 font-medium ", children: props?.attributes?.label }),
|
|
4982
|
-
" ",
|
|
4983
|
-
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
4984
|
-
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
4985
|
-
"input",
|
|
4986
|
-
{
|
|
4987
|
-
type: "email",
|
|
4988
|
-
name: props.name,
|
|
4989
|
-
id: props.name,
|
|
4990
|
-
value,
|
|
4991
|
-
onChange: textChangeHandler,
|
|
4992
|
-
onBlur: props?.onBlur,
|
|
4993
|
-
autoFocus: props?.attributes?.autoFocus,
|
|
4994
|
-
required: props?.attributes?.required,
|
|
4995
|
-
placeholder: props?.attributes?.placeholder,
|
|
4996
|
-
maxLength: props?.attributes?.maxLength,
|
|
4997
|
-
pattern: props?.attributes?.pattern,
|
|
4998
|
-
disabled: props?.attributes?.readOnly,
|
|
4999
|
-
minLength: props?.attributes?.minLength,
|
|
5000
|
-
className: `peer input mt-1 py-1.5 block w-full rounded shadow-sm transition-all duration-500 ease-in-out
|
|
5001
|
-
${props?.inputClasses ? props.inputClasses : ``}
|
|
5002
|
-
`
|
|
5003
|
-
}
|
|
5004
|
-
),
|
|
5005
|
-
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
5006
|
-
] }) });
|
|
5007
|
-
};
|
|
5008
|
-
EmailInput_default = EmailInput;
|
|
5009
|
-
}
|
|
5010
|
-
});
|
|
5011
|
-
|
|
5012
|
-
// src/components/controls/edit/TimeInput.tsx
|
|
5013
|
-
var import_react53, import_jsx_runtime79, TimeInput, TimeInput_default;
|
|
5014
|
-
var init_TimeInput = __esm({
|
|
5015
|
-
"src/components/controls/edit/TimeInput.tsx"() {
|
|
5016
|
-
"use strict";
|
|
5017
|
-
"use client";
|
|
5018
|
-
import_react53 = __toESM(require("react"));
|
|
5019
|
-
import_jsx_runtime79 = require("react/jsx-runtime");
|
|
5020
|
-
TimeInput = (props) => {
|
|
5021
|
-
const timeChangeHandler = (event) => {
|
|
5022
|
-
const timeValue = event.target.value;
|
|
5023
|
-
if (props.callback) {
|
|
5024
|
-
props.callback({
|
|
5025
|
-
name: props.name,
|
|
5026
|
-
value: timeValue,
|
|
5027
|
-
index: props.index,
|
|
5028
|
-
groupKey: props.groupKey
|
|
5029
|
-
});
|
|
5030
|
-
}
|
|
5031
|
-
};
|
|
5032
|
-
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react53.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("label", { className: "block", children: [
|
|
5033
|
-
props?.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "text-sm inline-block pb-1 font-medium", children: props?.attributes?.label }),
|
|
5034
|
-
" ",
|
|
5035
|
-
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
5036
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
5037
|
-
"input",
|
|
5038
|
-
{
|
|
5039
|
-
type: "time",
|
|
5040
|
-
name: props.name,
|
|
5041
|
-
id: props.name,
|
|
5042
|
-
value: typeof props.value === "boolean" ? "" : props.value ?? "",
|
|
5043
|
-
onChange: timeChangeHandler,
|
|
5044
|
-
onBlur: props?.onBlur,
|
|
5045
|
-
autoFocus: props?.attributes?.autoFocus,
|
|
5046
|
-
required: props?.attributes?.required,
|
|
5047
|
-
disabled: props?.attributes?.readOnly,
|
|
5048
|
-
className: `peer input mt-1 py-1.5 block w-full rounded shadow-sm transition-all duration-500 ease-in-out
|
|
5049
|
-
${props?.inputClasses ? props.inputClasses : ``}
|
|
5050
|
-
`
|
|
5051
|
-
}
|
|
5052
|
-
) }),
|
|
5053
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ?? "" })
|
|
5054
|
-
] }) });
|
|
5055
|
-
};
|
|
5056
|
-
TimeInput_default = TimeInput;
|
|
5057
|
-
}
|
|
5058
|
-
});
|
|
5059
|
-
|
|
5060
|
-
// src/components/controls/edit/AssetUpload.tsx
|
|
5061
|
-
var import_react54, import_jsx_runtime80, AssetUpload, AssetUpload_default;
|
|
5062
|
-
var init_AssetUpload = __esm({
|
|
5063
|
-
"src/components/controls/edit/AssetUpload.tsx"() {
|
|
5064
|
-
"use strict";
|
|
5065
|
-
"use client";
|
|
5066
|
-
import_react54 = __toESM(require("react"));
|
|
5067
|
-
init_ClientButton();
|
|
5068
|
-
init_StyleTypes();
|
|
5069
|
-
init_AssetUtility();
|
|
5070
|
-
init_Hyperlink();
|
|
5071
|
-
init_Icon();
|
|
5072
|
-
import_jsx_runtime80 = require("react/jsx-runtime");
|
|
5073
|
-
AssetUpload = (props) => {
|
|
5074
|
-
const isDisabled = props.attributes?.disable ?? false;
|
|
5075
|
-
let allValues = [];
|
|
5076
|
-
if (props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
5077
|
-
try {
|
|
5078
|
-
allValues = JSON.parse(props.value.toString());
|
|
5079
|
-
} catch (error) {
|
|
5080
|
-
}
|
|
5081
|
-
}
|
|
5082
|
-
const getInitialTab = () => {
|
|
5083
|
-
if (allValues.length > 0) {
|
|
5084
|
-
const asset = allValues[0];
|
|
5085
|
-
if (asset.posterUrl) {
|
|
5086
|
-
return "video";
|
|
5087
|
-
} else if (asset.assetUrl) {
|
|
5088
|
-
return "image";
|
|
5089
|
-
}
|
|
5090
|
-
}
|
|
5091
|
-
return "image";
|
|
5092
|
-
};
|
|
5093
|
-
const [assetType, setAssetType] = import_react54.default.useState(getInitialTab);
|
|
5094
|
-
(0, import_react54.useEffect)(() => {
|
|
5095
|
-
setAssetType(getInitialTab());
|
|
5096
|
-
}, [props.value]);
|
|
5097
|
-
const assetUploadCallback = (newAsset) => {
|
|
5098
|
-
if (isDisabled) return;
|
|
5099
|
-
let updated = [];
|
|
5100
|
-
updated.push({
|
|
5101
|
-
assetUrl: newAsset.assetUrl,
|
|
5102
|
-
title: newAsset.title,
|
|
5103
|
-
posterUrl: newAsset.posterUrl,
|
|
5104
|
-
intrinsicHeight: newAsset.intrinsicHeight,
|
|
5105
|
-
intrinsicWidth: newAsset.intrinsicWidth
|
|
5106
|
-
});
|
|
5107
|
-
props.callback?.({
|
|
5108
|
-
name: props.name,
|
|
5109
|
-
value: JSON.stringify(updated),
|
|
5110
|
-
index: props.index,
|
|
5111
|
-
groupKey: props.groupKey
|
|
5112
|
-
});
|
|
5113
|
-
};
|
|
5114
|
-
const deleteFile = (index) => {
|
|
5115
|
-
if (isDisabled) return;
|
|
5116
|
-
let existingValue = [];
|
|
5117
|
-
if (props.value) {
|
|
5118
|
-
try {
|
|
5119
|
-
existingValue = JSON.parse(props.value.toString());
|
|
5120
|
-
} catch (error) {
|
|
5121
|
-
}
|
|
5122
|
-
}
|
|
5123
|
-
if (existingValue.length > index) {
|
|
5124
|
-
existingValue.splice(index, 1);
|
|
5125
|
-
props.callback?.({
|
|
5126
|
-
name: props.name,
|
|
5127
|
-
value: JSON.stringify(existingValue),
|
|
5128
|
-
index: props.index,
|
|
5129
|
-
groupKey: props.groupKey
|
|
5130
|
-
});
|
|
5131
|
-
}
|
|
5132
|
-
};
|
|
5133
|
-
const textChangeHandler = (index, event) => {
|
|
5134
|
-
if (isDisabled) return;
|
|
5135
|
-
let existingValue = [];
|
|
5136
|
-
if (props.value) {
|
|
5137
|
-
try {
|
|
5138
|
-
existingValue = JSON.parse(props.value.toString());
|
|
5139
|
-
} catch (error) {
|
|
5140
|
-
}
|
|
5141
|
-
}
|
|
5142
|
-
const text = event.target.value;
|
|
5143
|
-
if (existingValue.length > index) {
|
|
5144
|
-
const updatedArray = [...existingValue];
|
|
5145
|
-
updatedArray[index] = { ...updatedArray[index], title: text };
|
|
5146
|
-
props.callback?.({
|
|
5147
|
-
name: props.name,
|
|
5148
|
-
value: JSON.stringify(updatedArray),
|
|
5149
|
-
index: props.index,
|
|
5150
|
-
groupKey: props.groupKey
|
|
5151
|
-
});
|
|
5152
|
-
}
|
|
5153
|
-
};
|
|
5154
|
-
const getAssetType = (asset) => {
|
|
5155
|
-
if (asset.assetUrl?.endsWith(".m3u8") || asset.posterUrl) return "video";
|
|
5156
|
-
return "image";
|
|
5157
|
-
};
|
|
5158
|
-
const shouldShowDetails = () => {
|
|
5159
|
-
if (allValues.length === 0) return false;
|
|
5160
|
-
const asset = allValues[0];
|
|
5161
|
-
if (assetType === "video") {
|
|
5162
|
-
return Boolean(asset.posterUrl && asset.assetUrl && asset.assetUrl.endsWith(".m3u8"));
|
|
5163
|
-
}
|
|
5164
|
-
if (assetType === "image") {
|
|
5165
|
-
return Boolean(asset.assetUrl && !asset.assetUrl.endsWith(".m3u8"));
|
|
5166
|
-
}
|
|
5167
|
-
return false;
|
|
5168
|
-
};
|
|
5169
|
-
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_react54.default.Fragment, { children: [
|
|
5170
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("label", { className: "block mb-1", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "text-sm font-medium", children: props?.attributes?.label }) }),
|
|
5171
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex gap-6 bg-neutral-100 rounded p-2", children: [
|
|
5172
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5173
|
-
ClientButton_default,
|
|
5174
|
-
{
|
|
5175
|
-
className: assetType === "image" ? "px-2 py-1 rounded bg-body-200 scale-95" : "text-neutral-700",
|
|
5176
|
-
ButtonType: "Link" /* Link */,
|
|
5177
|
-
onClick: () => setAssetType("image"),
|
|
5178
|
-
disabled: isDisabled,
|
|
5179
|
-
children: "Image Upload"
|
|
5180
|
-
}
|
|
5181
|
-
),
|
|
5182
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5183
|
-
ClientButton_default,
|
|
5184
|
-
{
|
|
5185
|
-
className: assetType === "video" ? "bg-body-200 px-2 py-1 rounded-md scale-95" : "text-neutral-700",
|
|
5186
|
-
ButtonType: "Link" /* Link */,
|
|
5187
|
-
onClick: () => setAssetType("video"),
|
|
5188
|
-
disabled: isDisabled,
|
|
5189
|
-
children: "Video Upload"
|
|
5190
|
-
}
|
|
5191
|
-
)
|
|
5192
|
-
] }),
|
|
5193
|
-
shouldShowDetails() && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "relative mt-4 rounded-md p-4 border-2 border-dotted border-gray-300 bg-gray-50", children: [
|
|
5194
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "absolute -top-2.5 left-3 bg-primary-600 text-white text-xs px-2 py-0.5 rounded-full", children: getAssetType(allValues[0]) === "video" ? "Video" : "Image" }),
|
|
5195
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "flex flex-col gap-3", children: allValues.map((digitalAsset, index) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex justify-between items-start gap-5", children: [
|
|
5196
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm w-full", children: [
|
|
5197
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { children: [
|
|
5198
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", { className: "text-gray-500", children: "Title" }),
|
|
5199
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5200
|
-
"input",
|
|
5201
|
-
{
|
|
5202
|
-
type: "text",
|
|
5203
|
-
value: digitalAsset.title,
|
|
5204
|
-
onChange: (event) => textChangeHandler(index, event),
|
|
5205
|
-
placeholder: "title",
|
|
5206
|
-
disabled: isDisabled,
|
|
5207
|
-
className: "w-full mt-1 py-1.5 block rounded border-gray-300 shadow-sm bg-white\n focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50\n disabled:bg-gray-100 disabled:text-gray-400 disabled:cursor-not-allowed"
|
|
5208
|
-
}
|
|
5209
|
-
)
|
|
5210
|
-
] }),
|
|
5211
|
-
digitalAsset.intrinsicWidth && digitalAsset.intrinsicHeight && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { children: [
|
|
5212
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", { className: "text-gray-500", children: "Resolution" }),
|
|
5213
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("p", { className: "font-medium text-gray-900 mt-3", children: [
|
|
5214
|
-
digitalAsset.intrinsicWidth,
|
|
5215
|
-
"\xD7",
|
|
5216
|
-
digitalAsset.intrinsicHeight
|
|
5217
|
-
] })
|
|
5218
|
-
] }),
|
|
5219
|
-
(digitalAsset.assetUrl || digitalAsset.posterUrl) && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { children: [
|
|
5220
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", { className: "text-gray-500", children: "Image / Poster" }),
|
|
5221
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex-shrink-0 flex flex-col gap-3 mt-1", children: [
|
|
5222
|
-
getAssetType(digitalAsset) === "video" && digitalAsset.posterUrl && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5223
|
-
"img",
|
|
5224
|
-
{
|
|
5225
|
-
src: AssetUtility_default.resolveUrl(props.serviceClient?.baseUrl, digitalAsset.posterUrl),
|
|
5226
|
-
alt: digitalAsset.title || "Video poster",
|
|
5227
|
-
className: "w-32 h-auto object-cover rounded border p-1"
|
|
5228
|
-
}
|
|
5229
|
-
),
|
|
5230
|
-
getAssetType(digitalAsset) === "image" && digitalAsset.assetUrl && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5231
|
-
"img",
|
|
5232
|
-
{
|
|
5233
|
-
src: AssetUtility_default.resolveUrl(props.serviceClient?.baseUrl, digitalAsset.assetUrl),
|
|
5234
|
-
alt: digitalAsset.title || "Uploaded image",
|
|
5235
|
-
className: "w-32 h-auto object-cover rounded border p-1"
|
|
5236
|
-
}
|
|
5237
|
-
)
|
|
5238
|
-
] })
|
|
5239
|
-
] }),
|
|
5240
|
-
digitalAsset.assetUrl?.endsWith(".m3u8") && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "col-span-2", children: [
|
|
5241
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", { className: "text-gray-500", children: "HLS Link" }),
|
|
5242
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5243
|
-
Hyperlink,
|
|
5244
|
-
{
|
|
5245
|
-
href: digitalAsset.assetUrl,
|
|
5246
|
-
className: "text-primary-600 underline mt-1 break-all",
|
|
5247
|
-
title: digitalAsset.assetUrl,
|
|
5248
|
-
children: digitalAsset.assetUrl
|
|
5249
|
-
}
|
|
5250
|
-
)
|
|
5251
|
-
] })
|
|
5252
|
-
] }),
|
|
5253
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5254
|
-
"span",
|
|
5255
|
-
{
|
|
5256
|
-
onClick: () => !isDisabled && deleteFile(index),
|
|
5257
|
-
className: isDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
5258
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Icon_default, { className: "w-4 h-4 text-primary", name: "delete" })
|
|
5259
|
-
}
|
|
5260
|
-
)
|
|
5261
|
-
] }, index)) })
|
|
5262
|
-
] })
|
|
5263
|
-
] });
|
|
5264
|
-
};
|
|
5265
|
-
AssetUpload_default = AssetUpload;
|
|
5266
|
-
}
|
|
5267
|
-
});
|
|
5268
|
-
|
|
5269
|
-
// src/components/controls/edit/SwitchInput.tsx
|
|
5270
|
-
var import_react55, import_jsx_runtime81, SwitchInput, SwitchInput_default;
|
|
5271
|
-
var init_SwitchInput = __esm({
|
|
5272
|
-
"src/components/controls/edit/SwitchInput.tsx"() {
|
|
5273
|
-
"use strict";
|
|
5274
|
-
import_react55 = __toESM(require("react"));
|
|
5275
|
-
import_jsx_runtime81 = require("react/jsx-runtime");
|
|
5276
|
-
SwitchInput = (props) => {
|
|
5277
|
-
const textChangeHandler = (event) => {
|
|
5278
|
-
let text = event.target.checked;
|
|
5279
|
-
if (props.callback !== void 0) {
|
|
5280
|
-
props.callback({
|
|
5281
|
-
name: props.name,
|
|
5282
|
-
value: text,
|
|
5283
|
-
index: props.index,
|
|
5284
|
-
groupKey: props.groupKey
|
|
5285
|
-
});
|
|
5286
|
-
}
|
|
5287
|
-
};
|
|
5288
|
-
let value = false;
|
|
5289
|
-
if (props.value != void 0 && props.value != null && props.value != "" && (props.value == "true" || props.value.toString() == "true")) {
|
|
5290
|
-
value = true;
|
|
5291
|
-
}
|
|
5292
|
-
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react55.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "relative flex items-start justify-between gap-4 py-3", children: [
|
|
5293
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "min-w-0", children: props?.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
5294
|
-
"label",
|
|
5295
|
-
{
|
|
5296
|
-
htmlFor: props.name,
|
|
5297
|
-
className: "inline-block text-sm font-semibold text-slate-800",
|
|
5298
|
-
children: [
|
|
5299
|
-
props.attributes.label,
|
|
5300
|
-
props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "bg-error-weak", children: "*" })
|
|
5301
|
-
]
|
|
5302
|
-
}
|
|
5303
|
-
) }),
|
|
5304
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
5305
|
-
"label",
|
|
5306
|
-
{
|
|
5307
|
-
htmlFor: props.name,
|
|
5308
|
-
className: "relative inline-flex shrink-0 cursor-pointer items-center peer-disabled:cursor-not-allowed",
|
|
5309
|
-
children: [
|
|
5310
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
5311
|
-
"input",
|
|
5312
|
-
{
|
|
5313
|
-
type: "checkbox",
|
|
5314
|
-
name: props.name,
|
|
5315
|
-
id: props.name,
|
|
5316
|
-
checked: value,
|
|
5317
|
-
onChange: textChangeHandler,
|
|
5318
|
-
required: props?.attributes?.required,
|
|
5319
|
-
disabled: props?.attributes?.readOnly,
|
|
5320
|
-
className: "peer sr-only"
|
|
5321
|
-
}
|
|
5322
|
-
),
|
|
5323
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
5324
|
-
"div",
|
|
5325
|
-
{
|
|
5326
|
-
className: "h-6 w-11 rounded-full bg-slate-200 shadow-inner\n transition-colors duration-200 ease-in-out\n peer-checked:bg-blue-600\n peer-focus-visible:ring-2 peer-focus-visible:ring-blue-300 peer-focus-visible:ring-offset-2\n peer-disabled:bg-slate-100"
|
|
5327
|
-
}
|
|
5328
|
-
),
|
|
5329
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
5330
|
-
"div",
|
|
5331
|
-
{
|
|
5332
|
-
className: "absolute left-0.5 top-0.5 h-5 w-5 rounded-full bg-default shadow\n transition-transform duration-200 ease-in-out\n peer-checked:translate-x-5\n peer-disabled:bg-slate-50"
|
|
5333
|
-
}
|
|
5334
|
-
),
|
|
5335
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block absolute left-0 top-full mt-1 w-max max-w-[220px] whitespace-normal bg-error-weak text-sm", children: props?.attributes?.errorMessage || "" })
|
|
5336
|
-
]
|
|
5337
|
-
}
|
|
5338
|
-
)
|
|
5339
|
-
] }) });
|
|
5340
|
-
};
|
|
5341
|
-
SwitchInput_default = SwitchInput;
|
|
5342
|
-
}
|
|
5343
|
-
});
|
|
5344
|
-
|
|
5345
|
-
// src/components/utilities/DateTimeUtility.tsx
|
|
5346
|
-
var DateTimeUtility, DateTimeUtility_default;
|
|
5347
|
-
var init_DateTimeUtility = __esm({
|
|
5348
|
-
"src/components/utilities/DateTimeUtility.tsx"() {
|
|
5349
|
-
"use strict";
|
|
5350
|
-
DateTimeUtility = class {
|
|
5351
|
-
constructor() {
|
|
5352
|
-
}
|
|
5353
|
-
static formatDate(date) {
|
|
5354
|
-
if (!date) {
|
|
5355
|
-
throw new Error("Invalid date");
|
|
5356
|
-
}
|
|
5357
|
-
const pad = (num) => num.toString().padStart(2, "0");
|
|
5358
|
-
const year = date.getFullYear();
|
|
5359
|
-
const month = pad(date.getMonth() + 1);
|
|
5360
|
-
const day = pad(date.getDate());
|
|
5361
|
-
const hours = pad(date.getHours());
|
|
5362
|
-
const minutes = pad(date.getMinutes());
|
|
5363
|
-
const seconds = pad(date.getSeconds());
|
|
5364
|
-
return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
|
|
5365
|
-
}
|
|
5366
|
-
static getMonthShortNameCustom(month) {
|
|
5367
|
-
const monthNames = [
|
|
5368
|
-
"Jan",
|
|
5369
|
-
"Feb",
|
|
5370
|
-
"Mar",
|
|
5371
|
-
"Apr",
|
|
5372
|
-
"May",
|
|
5373
|
-
"Jun",
|
|
5374
|
-
"Jul",
|
|
5375
|
-
"Aug",
|
|
5376
|
-
"Sep",
|
|
5377
|
-
"Oct",
|
|
5378
|
-
"Nov",
|
|
5379
|
-
"Dec"
|
|
5380
|
-
];
|
|
5381
|
-
if (month < 1 || month > 12) {
|
|
5382
|
-
throw new Error(
|
|
5383
|
-
"Invalid month. Please provide a value between 1 and 12."
|
|
5384
|
-
);
|
|
5385
|
-
}
|
|
5386
|
-
return monthNames[month - 1];
|
|
5387
|
-
}
|
|
5388
|
-
static getCurrentWeekRange() {
|
|
5389
|
-
const today = /* @__PURE__ */ new Date();
|
|
5390
|
-
const day = today.getDay();
|
|
5391
|
-
const diffToMonday = (day === 0 ? -6 : 1) - day;
|
|
5392
|
-
const monday = new Date(today);
|
|
5393
|
-
monday.setDate(today.getDate() + diffToMonday);
|
|
5394
|
-
monday.setHours(0, 0, 0, 0);
|
|
5395
|
-
const sunday = new Date(monday);
|
|
5396
|
-
sunday.setDate(monday.getDate() + 6);
|
|
5397
|
-
sunday.setHours(23, 59, 59, 999);
|
|
5398
|
-
return { start: monday, end: sunday };
|
|
5399
|
-
}
|
|
5400
|
-
static getCurrentMonthRange() {
|
|
5401
|
-
const now = /* @__PURE__ */ new Date();
|
|
5402
|
-
const start = new Date(now.getFullYear(), now.getMonth(), 1);
|
|
5403
|
-
const end = new Date(now.getFullYear(), now.getMonth() + 1, 0);
|
|
5404
|
-
return { start, end };
|
|
5405
|
-
}
|
|
5406
|
-
static formatShortDate(date) {
|
|
5407
|
-
const day = date.getDate();
|
|
5408
|
-
const month = this.getMonthShortNameCustom(date.getMonth() + 1);
|
|
5409
|
-
return `${day} ${month}`;
|
|
5410
|
-
}
|
|
5411
|
-
static formatIndianCurrencyShort(value) {
|
|
5412
|
-
if (value >= 1e7) {
|
|
5413
|
-
return `${(value / 1e7).toFixed(2)} Cr`;
|
|
5414
|
-
} else if (value >= 1e5) {
|
|
5415
|
-
return `${(value / 1e5).toFixed(2)} L`;
|
|
5416
|
-
} else if (value >= 1e3) {
|
|
5417
|
-
return `${(value / 1e3).toFixed(2)} K`;
|
|
5418
|
-
} else {
|
|
5419
|
-
return `${value}`;
|
|
5420
|
-
}
|
|
5421
|
-
}
|
|
5422
|
-
};
|
|
5423
|
-
DateTimeUtility_default = DateTimeUtility;
|
|
5424
|
-
}
|
|
5425
|
-
});
|
|
5426
|
-
|
|
5427
|
-
// src/components/controls/edit/DateInput.tsx
|
|
5428
|
-
var import_react56, import_jsx_runtime82, DateInput, DateInput_default;
|
|
5429
|
-
var init_DateInput = __esm({
|
|
5430
|
-
"src/components/controls/edit/DateInput.tsx"() {
|
|
5431
|
-
"use strict";
|
|
5432
|
-
import_react56 = require("react");
|
|
5433
|
-
init_DateTimeUtility();
|
|
5434
|
-
import_jsx_runtime82 = require("react/jsx-runtime");
|
|
5435
|
-
DateInput = (props) => {
|
|
5436
|
-
const value = (0, import_react56.useMemo)(() => {
|
|
5437
|
-
if (props.value === void 0 || props.value === null || props.value === "") {
|
|
5438
|
-
return "";
|
|
5439
|
-
}
|
|
5440
|
-
try {
|
|
5441
|
-
const rawValue = String(props.value);
|
|
5442
|
-
const utcDate = new Date(rawValue.endsWith("Z") ? rawValue : `${rawValue}Z`);
|
|
5443
|
-
const localDate = new Date(
|
|
5444
|
-
utcDate.getTime() - utcDate.getTimezoneOffset() * 6e4
|
|
5445
|
-
);
|
|
5446
|
-
return localDate.toISOString().slice(0, 10);
|
|
5447
|
-
} catch {
|
|
5448
|
-
return String(props.value);
|
|
5449
|
-
}
|
|
5450
|
-
}, [props.value]);
|
|
5451
|
-
const changeHandler = (event) => {
|
|
5452
|
-
const dateValue = event.target.value;
|
|
5453
|
-
let callbackValue = dateValue;
|
|
5454
|
-
const parsedDate = new Date(dateValue);
|
|
5455
|
-
if (dateValue && !Number.isNaN(parsedDate.getTime())) {
|
|
5456
|
-
const adjustedDate = new Date(
|
|
5457
|
-
parsedDate.getTime() + 2 * parsedDate.getTimezoneOffset() * 6e4
|
|
5458
|
-
);
|
|
5459
|
-
callbackValue = DateTimeUtility_default.formatDate(adjustedDate);
|
|
5460
|
-
}
|
|
5461
|
-
props.callback?.({
|
|
5462
|
-
name: props.name,
|
|
5463
|
-
value: callbackValue,
|
|
5464
|
-
index: props.index,
|
|
5465
|
-
groupKey: props.groupKey
|
|
5466
|
-
});
|
|
5467
|
-
};
|
|
5468
|
-
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("label", { className: "block mb-1", children: [
|
|
5469
|
-
props.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "text-sm font-medium", children: props.attributes.label }),
|
|
5470
|
-
" ",
|
|
5471
|
-
props.attributes?.label && props.attributes.required && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
5472
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
5473
|
-
"input",
|
|
5474
|
-
{
|
|
5475
|
-
type: "date",
|
|
5476
|
-
name: props.name,
|
|
5477
|
-
id: props.name,
|
|
5478
|
-
value,
|
|
5479
|
-
onChange: changeHandler,
|
|
5480
|
-
required: props.attributes?.required,
|
|
5481
|
-
disabled: props.attributes?.readOnly,
|
|
5482
|
-
max: String(props.attributes?.maxValue ?? "9999-12-31"),
|
|
5483
|
-
className: `peer input mt-1 py-1.5 block w-full rounded shadow-sm ${props.inputClasses ?? ""}`
|
|
5484
|
-
}
|
|
5485
|
-
),
|
|
5486
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
|
|
5487
|
-
] });
|
|
5488
|
-
};
|
|
5489
|
-
DateInput_default = DateInput;
|
|
5490
|
-
}
|
|
5491
|
-
});
|
|
5492
|
-
|
|
5493
|
-
// src/components/controls/edit/RadioInput.tsx
|
|
5494
|
-
var import_react57, import_jsx_runtime83, RadioInput, RadioInput_default;
|
|
5495
|
-
var init_RadioInput = __esm({
|
|
5496
|
-
"src/components/controls/edit/RadioInput.tsx"() {
|
|
5497
|
-
"use strict";
|
|
5498
|
-
import_react57 = require("react");
|
|
5499
|
-
init_Icon();
|
|
5500
|
-
import_jsx_runtime83 = require("react/jsx-runtime");
|
|
5501
|
-
RadioInput = (props) => {
|
|
5502
|
-
const [list, setList] = (0, import_react57.useState)([]);
|
|
5503
|
-
(0, import_react57.useEffect)(() => {
|
|
5504
|
-
async function loadData() {
|
|
5505
|
-
if (props.dataset) {
|
|
5506
|
-
setList(props.dataset);
|
|
5507
|
-
return;
|
|
5508
|
-
}
|
|
5509
|
-
if (!props.dataSource || !props.serviceClient) {
|
|
5510
|
-
setList([]);
|
|
5511
|
-
return;
|
|
5512
|
-
}
|
|
5513
|
-
let dataSource = props.dataSource;
|
|
5514
|
-
if (props.dataSourceDependsOn) {
|
|
5515
|
-
if (!props.dependentValue) {
|
|
5516
|
-
setList([]);
|
|
5517
|
-
return;
|
|
5518
|
-
}
|
|
5519
|
-
dataSource = dataSource.replace(
|
|
5520
|
-
`{${props.dataSourceDependsOn}}`,
|
|
5521
|
-
props.dependentValue
|
|
5522
|
-
);
|
|
5523
|
-
}
|
|
5524
|
-
const response = await props.serviceClient.get(dataSource);
|
|
5525
|
-
setList(response.result ?? []);
|
|
5526
|
-
}
|
|
5527
|
-
loadData();
|
|
5528
|
-
}, [
|
|
5529
|
-
props.dataSource,
|
|
5530
|
-
props.dataSourceDependsOn,
|
|
5531
|
-
props.dataset,
|
|
5532
|
-
props.dependentValue,
|
|
5533
|
-
props.serviceClient
|
|
5534
|
-
]);
|
|
5535
|
-
const changeHandler = (event) => {
|
|
5536
|
-
if (!props.attributes?.readOnly) {
|
|
5537
|
-
props.callback?.({
|
|
5538
|
-
name: props.name,
|
|
5539
|
-
value: event.target.value,
|
|
5540
|
-
index: props.index,
|
|
5541
|
-
groupKey: props.groupKey
|
|
5542
|
-
});
|
|
5543
|
-
}
|
|
5544
|
-
};
|
|
5545
|
-
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "block", children: [
|
|
5546
|
-
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "text-sm font-medium", children: props.attributes?.label }),
|
|
5547
|
-
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "flex flex-col gap-3", children: list.map((item, index) => {
|
|
5548
|
-
const itemValue = item[props.dataKeyFieldName];
|
|
5549
|
-
const isSelected = String(itemValue) === String(props.value ?? "");
|
|
5550
|
-
const isRecommended = props.dataRecommendedValue !== void 0 && String(itemValue) === String(props.dataRecommendedValue);
|
|
5551
|
-
const resultClassName = isSelected ? isRecommended ? "bg-success" : props.dataRecommendedValue ? "bg-alert" : "border-transparent" : "border-transparent";
|
|
5552
|
-
const iconName = isSelected && props.dataRecommendedValue ? isRecommended ? "checkCircle" : "xCircle" : void 0;
|
|
5553
|
-
const inputId = `${props.name}-${props.index ?? 0}-id-${index}`;
|
|
5554
|
-
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
5555
|
-
"div",
|
|
5556
|
-
{
|
|
5557
|
-
className: `font-normal flex items-center justify-between gap-4 cursor-pointer border rounded p-2 ${resultClassName}`,
|
|
5558
|
-
children: [
|
|
5559
|
-
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex gap-4 items-start", children: [
|
|
5560
|
-
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
5561
|
-
"input",
|
|
5562
|
-
{
|
|
5563
|
-
type: "radio",
|
|
5564
|
-
className: "form-radio mt-1.5 focus:outline-none",
|
|
5565
|
-
name: `${props.name}-${props.index ?? 0}`,
|
|
5566
|
-
id: inputId,
|
|
5567
|
-
value: itemValue,
|
|
5568
|
-
checked: isSelected,
|
|
5569
|
-
readOnly: props.attributes?.readOnly,
|
|
5570
|
-
onChange: changeHandler,
|
|
5571
|
-
required: props.attributes?.required
|
|
5572
|
-
}
|
|
5573
|
-
),
|
|
5574
|
-
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("label", { className: "text-body-950 pr-2", htmlFor: inputId, children: item[props.dataTextFieldName] })
|
|
5575
|
-
] }),
|
|
5576
|
-
iconName && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Icon_default, { className: "w-5 h-5 text-success", name: iconName })
|
|
5577
|
-
]
|
|
5578
|
-
},
|
|
5579
|
-
String(itemValue)
|
|
5580
|
-
);
|
|
5581
|
-
}) }),
|
|
5582
|
-
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
|
|
5583
|
-
] });
|
|
5584
|
-
};
|
|
5585
|
-
RadioInput_default = RadioInput;
|
|
5586
|
-
}
|
|
5587
|
-
});
|
|
5588
|
-
|
|
5589
|
-
// src/components/controls/edit/ReferenceInput.tsx
|
|
5590
|
-
var import_jsx_runtime84, ReferenceInput, ReferenceInput_default;
|
|
5591
|
-
var init_ReferenceInput = __esm({
|
|
5592
|
-
"src/components/controls/edit/ReferenceInput.tsx"() {
|
|
5593
|
-
"use strict";
|
|
5594
|
-
init_SelectWithSearchInput();
|
|
5595
|
-
import_jsx_runtime84 = require("react/jsx-runtime");
|
|
5596
|
-
ReferenceInput = (props) => {
|
|
5597
|
-
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(SelectWithSearchInput_default, { ...props });
|
|
5598
|
-
};
|
|
5599
|
-
ReferenceInput_default = ReferenceInput;
|
|
5600
|
-
}
|
|
5601
|
-
});
|
|
5602
|
-
|
|
5603
|
-
// src/components/controls/edit/InputControlClient.tsx
|
|
5604
|
-
var InputControlClient_exports = {};
|
|
5605
|
-
__export(InputControlClient_exports, {
|
|
5606
|
-
default: () => InputControlClient_default
|
|
5607
|
-
});
|
|
5608
|
-
var import_react58, import_jsx_runtime85, InputControl, InputControlClient_default;
|
|
5609
|
-
var init_InputControlClient = __esm({
|
|
5610
|
-
"src/components/controls/edit/InputControlClient.tsx"() {
|
|
5611
|
-
"use strict";
|
|
5612
|
-
"use client";
|
|
5613
|
-
import_react58 = __toESM(require("react"));
|
|
5614
|
-
init_MultilineTextInput();
|
|
5615
|
-
init_LineTextInput();
|
|
5616
|
-
init_MoneyInput();
|
|
5617
|
-
init_InputControlType();
|
|
5618
|
-
init_Select();
|
|
5619
|
-
init_PercentageInput();
|
|
5620
|
-
init_PhoneInput();
|
|
5621
|
-
init_NumberInput();
|
|
5622
|
-
init_CheckboxInput();
|
|
5623
|
-
init_OtpInput();
|
|
5624
|
-
init_DateTimeInput();
|
|
5625
|
-
init_ColorInput();
|
|
5626
|
-
init_SelectWithSearchInput();
|
|
5627
|
-
init_SelectWithSearchPanel();
|
|
5628
|
-
init_EmailInput();
|
|
5629
|
-
init_TimeInput();
|
|
5630
|
-
init_AssetUpload();
|
|
5631
|
-
init_SwitchInput();
|
|
5632
|
-
init_DateInput();
|
|
5633
|
-
init_RadioInput();
|
|
5634
|
-
init_ReferenceInput();
|
|
5635
|
-
import_jsx_runtime85 = require("react/jsx-runtime");
|
|
5636
|
-
InputControl = import_react58.default.forwardRef(
|
|
5637
|
-
(props, ref) => {
|
|
5638
|
-
const ControlComponents = {
|
|
5639
|
-
[InputControlType_default.lineTextInput]: LineTextInput_default,
|
|
5640
|
-
[InputControlType_default.emailInput]: EmailInput_default,
|
|
5641
|
-
[InputControlType_default.multilineTextInput]: MultilineTextInput_default,
|
|
5642
|
-
[InputControlType_default.moneyInput]: MoneyInput_default,
|
|
5643
|
-
[InputControlType_default.select]: Select_default,
|
|
5644
|
-
[InputControlType_default.percentageInput]: PercentageInput_default,
|
|
5645
|
-
[InputControlType_default.phoneInput]: PhoneInput_default,
|
|
5646
|
-
[InputControlType_default.numberInput]: NumberInput_default,
|
|
5647
|
-
[InputControlType_default.checkboxInput]: CheckboxInput_default,
|
|
5648
|
-
[InputControlType_default.otpInput]: OtpInput_default,
|
|
5649
|
-
[InputControlType_default.datetimeInput]: DateTimeInput_default,
|
|
5650
|
-
[InputControlType_default.colorInput]: ColorInput_default,
|
|
5651
|
-
[InputControlType_default.selectWithSearchInput]: SelectWithSearchInput_default,
|
|
5652
|
-
[InputControlType_default.selectWithSearchPanel]: SelectWithSearchPanel_default,
|
|
5653
|
-
[InputControlType_default.timeInput]: TimeInput_default,
|
|
5654
|
-
[InputControlType_default.assetUpload]: AssetUpload_default,
|
|
5655
|
-
[InputControlType_default.switchInput]: SwitchInput_default,
|
|
5656
|
-
[InputControlType_default.dateInput]: DateInput_default,
|
|
5657
|
-
[InputControlType_default.radioInput]: RadioInput_default,
|
|
5658
|
-
[InputControlType_default.referenceInput]: ReferenceInput_default
|
|
5659
|
-
};
|
|
5660
|
-
const SelectedControlComponent = ControlComponents[props.controlType];
|
|
5661
|
-
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react58.default.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(SelectedControlComponent, { ...props }) : "Control not found:" + props.controlType });
|
|
5662
|
-
}
|
|
5663
|
-
);
|
|
5664
|
-
InputControl.displayName = "InputControl";
|
|
5665
|
-
InputControlClient_default = InputControl;
|
|
5666
|
-
}
|
|
5667
|
-
});
|
|
5668
|
-
|
|
5669
|
-
// src/components/controls/edit/InputControl.tsx
|
|
5670
|
-
var import_dynamic13, InputControl2, InputControl_default;
|
|
5671
|
-
var init_InputControl = __esm({
|
|
5672
|
-
"src/components/controls/edit/InputControl.tsx"() {
|
|
5673
|
-
"use strict";
|
|
5674
|
-
import_dynamic13 = __toESM(require("next/dynamic"));
|
|
5675
|
-
InputControl2 = (0, import_dynamic13.default)(() => Promise.resolve().then(() => (init_InputControlClient(), InputControlClient_exports)), {
|
|
5676
|
-
ssr: false
|
|
5677
|
-
});
|
|
5678
|
-
InputControl_default = InputControl2;
|
|
5679
|
-
}
|
|
5680
|
-
});
|
|
5681
|
-
|
|
5682
|
-
// src/components/pageRenderingEngine/nodes/DataBindingControls.tsx
|
|
5683
|
-
var DataBindingControls_exports = {};
|
|
5684
|
-
__export(DataBindingControls_exports, {
|
|
5685
|
-
default: () => DataBindingControls_default
|
|
5686
|
-
});
|
|
5687
|
-
var import_react59, import_navigation, import_jsx_runtime86, humanize, escapeODataString, parseFacetSelections, buildFacetFilter, parseODataSearch, SearchIcon, ResetIcon, FilterSlidersIcon, ChevronDownIcon, CheckIcon, CloseIcon, normalizeSortOption, DataBindingControls, DataBindingControls_default;
|
|
5688
|
-
var init_DataBindingControls = __esm({
|
|
5689
|
-
"src/components/pageRenderingEngine/nodes/DataBindingControls.tsx"() {
|
|
5690
|
-
"use strict";
|
|
5691
|
-
"use client";
|
|
5692
|
-
import_react59 = require("react");
|
|
5693
|
-
import_navigation = require("next/navigation");
|
|
5694
|
-
init_Button();
|
|
5695
|
-
init_InputControl();
|
|
5696
|
-
init_InputControlType();
|
|
5697
|
-
init_StyleTypes();
|
|
5698
|
-
import_jsx_runtime86 = require("react/jsx-runtime");
|
|
5699
|
-
humanize = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim();
|
|
5700
|
-
escapeODataString = (value) => value.replace(/'/g, "''");
|
|
5701
|
-
parseFacetSelections = (filter) => {
|
|
5702
|
-
const selections = /* @__PURE__ */ new Map();
|
|
5703
|
-
if (!filter || !filter.trim()) return selections;
|
|
5704
|
-
const expression = /(?:^|[\s()]+(?:and[\s()]+)?)([\w./-]+)\s+eq\s+'((?:''|[^'])*)'/gi;
|
|
5705
|
-
for (const match of filter.matchAll(expression)) {
|
|
5706
|
-
if (match[1] && match[2] !== void 0) {
|
|
5707
|
-
selections.set(match[1].trim(), match[2].replace(/''/g, "'"));
|
|
5708
|
-
}
|
|
5709
|
-
}
|
|
5710
|
-
return selections;
|
|
5711
|
-
};
|
|
5712
|
-
buildFacetFilter = (selections) => Array.from(selections.entries()).map(([field, value]) => `${field} eq '${escapeODataString(value)}'`).join(" and ");
|
|
5713
|
-
parseODataSearch = (value) => {
|
|
5714
|
-
if (!value) return "";
|
|
5715
|
-
const trimmedValue = value.trim();
|
|
5716
|
-
if (trimmedValue.startsWith("'") && trimmedValue.endsWith("'")) {
|
|
5717
|
-
return trimmedValue.slice(1, -1).replace(/''/g, "'");
|
|
5718
|
-
}
|
|
5719
|
-
return trimmedValue;
|
|
5720
|
-
};
|
|
5721
|
-
SearchIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
5722
|
-
"svg",
|
|
5723
|
-
{
|
|
5724
|
-
"aria-hidden": "true",
|
|
5725
|
-
className,
|
|
5726
|
-
fill: "none",
|
|
5727
|
-
viewBox: "0 0 24 24",
|
|
5728
|
-
stroke: "currentColor",
|
|
5729
|
-
strokeWidth: "2",
|
|
5730
|
-
children: [
|
|
5731
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("circle", { cx: "11", cy: "11", r: "7" }),
|
|
5732
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("path", { strokeLinecap: "round", d: "m20 20-4-4" })
|
|
5733
|
-
]
|
|
5734
|
-
}
|
|
5735
|
-
);
|
|
5736
|
-
ResetIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
5737
|
-
"svg",
|
|
5738
|
-
{
|
|
5739
|
-
"aria-hidden": "true",
|
|
5740
|
-
className,
|
|
5741
|
-
fill: "none",
|
|
5742
|
-
viewBox: "0 0 24 24",
|
|
5743
|
-
stroke: "currentColor",
|
|
5744
|
-
strokeWidth: "2",
|
|
5745
|
-
children: [
|
|
5746
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v6h6" }),
|
|
5747
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5748
|
-
"path",
|
|
5749
|
-
{
|
|
5750
|
-
strokeLinecap: "round",
|
|
5751
|
-
strokeLinejoin: "round",
|
|
5752
|
-
d: "M5.5 15a8 8 0 1 0 .6-7.8L4 10"
|
|
5753
|
-
}
|
|
5754
|
-
)
|
|
5755
|
-
]
|
|
5756
|
-
}
|
|
5757
|
-
);
|
|
5758
|
-
FilterSlidersIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
5759
|
-
"svg",
|
|
5760
|
-
{
|
|
5761
|
-
"aria-hidden": "true",
|
|
5762
|
-
className,
|
|
5763
|
-
fill: "none",
|
|
5764
|
-
viewBox: "0 0 24 24",
|
|
5765
|
-
stroke: "currentColor",
|
|
5766
|
-
strokeWidth: "2",
|
|
5767
|
-
children: [
|
|
5768
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3 4h18M3 12h18M3 20h18" }),
|
|
5769
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("circle", { cx: "8", cy: "4", r: "2", fill: "currentColor" }),
|
|
5770
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("circle", { cx: "16", cy: "12", r: "2", fill: "currentColor" }),
|
|
5771
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("circle", { cx: "10", cy: "20", r: "2", fill: "currentColor" })
|
|
5772
|
-
]
|
|
5773
|
-
}
|
|
5774
|
-
);
|
|
5775
|
-
ChevronDownIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5776
|
-
"svg",
|
|
5777
|
-
{
|
|
5778
|
-
"aria-hidden": "true",
|
|
5779
|
-
className,
|
|
5780
|
-
fill: "none",
|
|
5781
|
-
viewBox: "0 0 24 24",
|
|
5782
|
-
stroke: "currentColor",
|
|
5783
|
-
strokeWidth: "2",
|
|
5784
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m19 9-7 7-7-7" })
|
|
5785
|
-
}
|
|
5786
|
-
);
|
|
5787
|
-
CheckIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5788
|
-
"svg",
|
|
5789
|
-
{
|
|
5790
|
-
"aria-hidden": "true",
|
|
5791
|
-
className,
|
|
5792
|
-
fill: "none",
|
|
5793
|
-
viewBox: "0 0 24 24",
|
|
5794
|
-
stroke: "currentColor",
|
|
5795
|
-
strokeWidth: "2.5",
|
|
5796
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
|
|
5797
|
-
}
|
|
5798
|
-
);
|
|
5799
|
-
CloseIcon = ({ className = "" }) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5800
|
-
"svg",
|
|
5801
|
-
{
|
|
5802
|
-
"aria-hidden": "true",
|
|
5803
|
-
className,
|
|
5804
|
-
fill: "none",
|
|
5805
|
-
viewBox: "0 0 24 24",
|
|
5806
|
-
stroke: "currentColor",
|
|
5807
|
-
strokeWidth: "2",
|
|
5808
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
5809
|
-
}
|
|
5810
|
-
);
|
|
5811
3894
|
normalizeSortOption = (option) => {
|
|
5812
3895
|
const direction = option.direction.trim();
|
|
5813
3896
|
const title = option.title || humanize(option.name);
|
|
@@ -5828,12 +3911,18 @@ var init_DataBindingControls = __esm({
|
|
|
5828
3911
|
}) => {
|
|
5829
3912
|
const router = (0, import_navigation.useRouter)();
|
|
5830
3913
|
const searchParams = (0, import_navigation.useSearchParams)();
|
|
5831
|
-
const [collapsedCategories, setCollapsedCategories] = (0,
|
|
5832
|
-
const [isSortOpen, setIsSortOpen] = (0,
|
|
5833
|
-
const
|
|
5834
|
-
(0,
|
|
3914
|
+
const [collapsedCategories, setCollapsedCategories] = (0, import_react39.useState)({});
|
|
3915
|
+
const [isSortOpen, setIsSortOpen] = (0, import_react39.useState)(false);
|
|
3916
|
+
const [isMobileFiltersOpen, setIsMobileFiltersOpen] = (0, import_react39.useState)(false);
|
|
3917
|
+
const [facetCategorySearch, setFacetCategorySearch] = (0, import_react39.useState)({});
|
|
3918
|
+
const desktopSortDropdownRef = (0, import_react39.useRef)(null);
|
|
3919
|
+
const mobileSortDropdownRef = (0, import_react39.useRef)(null);
|
|
3920
|
+
(0, import_react39.useEffect)(() => {
|
|
5835
3921
|
const handleClickOutside = (event) => {
|
|
5836
|
-
|
|
3922
|
+
const target = event.target;
|
|
3923
|
+
const clickedInsideDesktop = desktopSortDropdownRef.current?.contains(target);
|
|
3924
|
+
const clickedInsideMobile = mobileSortDropdownRef.current?.contains(target);
|
|
3925
|
+
if (!clickedInsideDesktop && !clickedInsideMobile) {
|
|
5837
3926
|
setIsSortOpen(false);
|
|
5838
3927
|
}
|
|
5839
3928
|
};
|
|
@@ -5854,29 +3943,63 @@ var init_DataBindingControls = __esm({
|
|
|
5854
3943
|
const currentSearch = parseODataSearch(
|
|
5855
3944
|
searchParamsSearch !== void 0 && searchParamsSearch !== null ? searchParamsSearch : query?.["$search"]
|
|
5856
3945
|
);
|
|
5857
|
-
const [searchText, setSearchText] = (0,
|
|
5858
|
-
(0,
|
|
3946
|
+
const [searchText, setSearchText] = (0, import_react39.useState)(currentSearch);
|
|
3947
|
+
(0, import_react39.useEffect)(() => {
|
|
5859
3948
|
setSearchText(currentSearch);
|
|
5860
3949
|
}, [currentSearch]);
|
|
5861
|
-
const selectedFacetValues = (0,
|
|
3950
|
+
const selectedFacetValues = (0, import_react39.useMemo)(
|
|
5862
3951
|
() => parseFacetSelections(currentFilter),
|
|
5863
3952
|
[currentFilter]
|
|
5864
3953
|
);
|
|
5865
|
-
|
|
5866
|
-
if (
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
3954
|
+
(0, import_react39.useEffect)(() => {
|
|
3955
|
+
if (isMobileFiltersOpen) {
|
|
3956
|
+
document.body.style.overflow = "hidden";
|
|
3957
|
+
} else {
|
|
3958
|
+
document.body.style.overflow = "";
|
|
3959
|
+
}
|
|
3960
|
+
return () => {
|
|
3961
|
+
document.body.style.overflow = "";
|
|
3962
|
+
};
|
|
3963
|
+
}, [isMobileFiltersOpen]);
|
|
3964
|
+
const activeFacets = (0, import_react39.useMemo)(() => {
|
|
3965
|
+
const facetMap = /* @__PURE__ */ new Map();
|
|
3966
|
+
if (facets) {
|
|
3967
|
+
Object.entries(facets).forEach(([field, values]) => {
|
|
3968
|
+
if (!Array.isArray(values)) return;
|
|
3969
|
+
const filteredValues = values.filter(
|
|
3970
|
+
(item) => item.count > 0 || selectedFacetValues.get(field) === item.value
|
|
3971
|
+
);
|
|
3972
|
+
if (filteredValues.length > 0) {
|
|
3973
|
+
facetMap.set(field, filteredValues);
|
|
3974
|
+
}
|
|
3975
|
+
});
|
|
3976
|
+
}
|
|
3977
|
+
selectedFacetValues.forEach((val, field) => {
|
|
3978
|
+
if (!facetMap.has(field)) {
|
|
3979
|
+
facetMap.set(field, [{ value: val, count: 0 }]);
|
|
3980
|
+
} else {
|
|
3981
|
+
const existing = facetMap.get(field);
|
|
3982
|
+
if (!existing.some((item) => item.value === val)) {
|
|
3983
|
+
existing.push({ value: val, count: 0 });
|
|
3984
|
+
}
|
|
3985
|
+
}
|
|
3986
|
+
});
|
|
3987
|
+
return Array.from(facetMap.entries());
|
|
5875
3988
|
}, [facets, selectedFacetValues]);
|
|
5876
|
-
const normalizedSortOptions = (
|
|
5877
|
-
|
|
3989
|
+
const normalizedSortOptions = (0, import_react39.useMemo)(
|
|
3990
|
+
() => (sortOptions ?? []).filter((option) => option?.name && option?.direction).map(normalizeSortOption).filter((option) => option.value),
|
|
3991
|
+
[sortOptions]
|
|
3992
|
+
);
|
|
3993
|
+
const selectedSortOption = (0, import_react39.useMemo)(() => {
|
|
3994
|
+
if (!normalizedSortOptions.length) return null;
|
|
3995
|
+
const trimmedCurrentSort = currentSort.trim().toLowerCase();
|
|
3996
|
+
if (!trimmedCurrentSort) return normalizedSortOptions[0];
|
|
3997
|
+
return normalizedSortOptions.find(
|
|
3998
|
+
(opt) => opt.value.trim().toLowerCase() === trimmedCurrentSort
|
|
3999
|
+
) || normalizedSortOptions[0];
|
|
4000
|
+
}, [normalizedSortOptions, currentSort]);
|
|
5878
4001
|
const selectedSortLabel = selectedSortOption?.label || "";
|
|
5879
|
-
const getQueryUrl = (0,
|
|
4002
|
+
const getQueryUrl = (0, import_react39.useCallback)(
|
|
5880
4003
|
(updates) => {
|
|
5881
4004
|
const initialParams = searchParams ? searchParams.toString() : "";
|
|
5882
4005
|
const params = new URLSearchParams(initialParams || query || {});
|
|
@@ -5889,18 +4012,16 @@ var init_DataBindingControls = __esm({
|
|
|
5889
4012
|
});
|
|
5890
4013
|
params.delete("$skip");
|
|
5891
4014
|
params.delete("skip");
|
|
5892
|
-
const queryString = Array.from(params.entries()).map(
|
|
5893
|
-
([key, value]) => key === "$filter" || key === "filter" ? `${key}=${encodeURIComponent(value)}` : `${key}=${value}`
|
|
5894
|
-
).join("&");
|
|
4015
|
+
const queryString = Array.from(params.entries()).map(([key, value]) => `${key}=${encodeURIComponent(value)}`).join("&");
|
|
5895
4016
|
return queryString ? `${path}?${queryString}` : path;
|
|
5896
4017
|
},
|
|
5897
4018
|
[path, query, searchParams]
|
|
5898
4019
|
);
|
|
5899
|
-
const navigateWithoutReload = (0,
|
|
4020
|
+
const navigateWithoutReload = (0, import_react39.useCallback)(
|
|
5900
4021
|
(url) => {
|
|
5901
4022
|
if (typeof window !== "undefined") {
|
|
5902
4023
|
const targetUrl = new URL(url, window.location.origin);
|
|
5903
|
-
if (targetUrl.pathname === window.location.pathname && targetUrl.search === window.location.search) {
|
|
4024
|
+
if (targetUrl.pathname === window.location.pathname && decodeURIComponent(targetUrl.search) === decodeURIComponent(window.location.search)) {
|
|
5904
4025
|
return;
|
|
5905
4026
|
}
|
|
5906
4027
|
}
|
|
@@ -5908,6 +4029,18 @@ var init_DataBindingControls = __esm({
|
|
|
5908
4029
|
},
|
|
5909
4030
|
[router]
|
|
5910
4031
|
);
|
|
4032
|
+
const handleSelectSort = (0, import_react39.useCallback)(
|
|
4033
|
+
(sortValue) => {
|
|
4034
|
+
setIsSortOpen(false);
|
|
4035
|
+
navigateWithoutReload(
|
|
4036
|
+
getQueryUrl({
|
|
4037
|
+
$orderby: sortValue || void 0,
|
|
4038
|
+
orderBy: void 0
|
|
4039
|
+
})
|
|
4040
|
+
);
|
|
4041
|
+
},
|
|
4042
|
+
[getQueryUrl, navigateWithoutReload]
|
|
4043
|
+
);
|
|
5911
4044
|
const getFacetUrl = (field, value) => {
|
|
5912
4045
|
const updatedSelections = new Map(selectedFacetValues);
|
|
5913
4046
|
if (value) {
|
|
@@ -5936,7 +4069,7 @@ var init_DataBindingControls = __esm({
|
|
|
5936
4069
|
})
|
|
5937
4070
|
);
|
|
5938
4071
|
};
|
|
5939
|
-
const handleSearch = (0,
|
|
4072
|
+
const handleSearch = (0, import_react39.useCallback)(async () => {
|
|
5940
4073
|
const trimmedSearchText = searchText.trim();
|
|
5941
4074
|
if (trimmedSearchText === currentSearch.trim()) {
|
|
5942
4075
|
return { isSuccessful: true };
|
|
@@ -5948,7 +4081,7 @@ var init_DataBindingControls = __esm({
|
|
|
5948
4081
|
);
|
|
5949
4082
|
return { isSuccessful: true };
|
|
5950
4083
|
}, [currentSearch, getQueryUrl, navigateWithoutReload, searchText]);
|
|
5951
|
-
const handleClearAll = (0,
|
|
4084
|
+
const handleClearAll = (0, import_react39.useCallback)(async () => {
|
|
5952
4085
|
navigateWithoutReload(
|
|
5953
4086
|
getQueryUrl({
|
|
5954
4087
|
$filter: void 0,
|
|
@@ -5959,39 +4092,39 @@ var init_DataBindingControls = __esm({
|
|
|
5959
4092
|
);
|
|
5960
4093
|
return { isSuccessful: true };
|
|
5961
4094
|
}, [getQueryUrl, navigateWithoutReload]);
|
|
5962
|
-
const hasFacetControls = showFacets && activeFacets.length > 0;
|
|
5963
|
-
const hasSortControls = showSortOptions && normalizedSortOptions.length > 0;
|
|
4095
|
+
const hasFacetControls = Boolean(showFacets && (activeFacets.length > 0 || selectedFacetValues.size > 0));
|
|
4096
|
+
const hasSortControls = Boolean(showSortOptions && normalizedSortOptions.length > 0);
|
|
5964
4097
|
const hasActiveFiltersOrSort = Boolean(
|
|
5965
4098
|
currentFilter.trim() || currentSort.trim()
|
|
5966
4099
|
);
|
|
5967
4100
|
const selectedFacetCount = selectedFacetValues.size;
|
|
5968
4101
|
const shouldShowToolbarClearAll = hasActiveFiltersOrSort && !hasFacetControls;
|
|
5969
|
-
const shouldShowToolbar = mode === "toolbar" && (showSearchBar || hasSortControls || shouldShowToolbarClearAll);
|
|
5970
|
-
const shouldShowFacets = mode === "facets" && hasFacetControls;
|
|
4102
|
+
const shouldShowToolbar = mode === "toolbar" && (showSearchBar || hasSortControls || showFacets || shouldShowToolbarClearAll);
|
|
4103
|
+
const shouldShowFacets = mode === "facets" && (hasFacetControls || showFacets && activeFacets.length > 0);
|
|
5971
4104
|
if (!shouldShowToolbar && !shouldShowFacets) {
|
|
5972
4105
|
return null;
|
|
5973
4106
|
}
|
|
5974
|
-
const renderFacetItems = (field, values) => /* @__PURE__ */ (0,
|
|
4107
|
+
const renderFacetItems = (field, values) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "flex flex-col gap-1 pt-1 pb-1", children: values.map((facet) => {
|
|
5975
4108
|
const isSelected = selectedFacetValues.get(field) === facet.value;
|
|
5976
|
-
return /* @__PURE__ */ (0,
|
|
4109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
5977
4110
|
"button",
|
|
5978
4111
|
{
|
|
5979
4112
|
type: "button",
|
|
5980
4113
|
onClick: () => navigateWithoutReload(getFacetUrl(field, facet.value)),
|
|
5981
4114
|
"aria-pressed": isSelected,
|
|
5982
|
-
className: `group flex w-full cursor-pointer items-center justify-between gap-2.5 rounded-md px-2 py-1.5 text-left text-sm transition-all duration-150 ease-out focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary-base ${isSelected ? "bg-neutral-soft font-medium border " : "hover:bg-neutral-weak border border-transparent"}`,
|
|
4115
|
+
className: `group flex w-full cursor-pointer items-center justify-between gap-2.5 rounded-md px-2 py-1.5 text-left text-sm transition-all duration-150 ease-out focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary-base ${isSelected ? "bg-neutral-soft font-medium border border-neutral-soft" : "hover:bg-neutral-weak border border-transparent"}`,
|
|
5983
4116
|
children: [
|
|
5984
|
-
/* @__PURE__ */ (0,
|
|
5985
|
-
/* @__PURE__ */ (0,
|
|
4117
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex min-w-0 items-center gap-2.5", children: [
|
|
4118
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
5986
4119
|
"span",
|
|
5987
4120
|
{
|
|
5988
|
-
className: `flex h-4 w-4 shrink-0 items-center justify-center rounded-[3px] border transition-colors duration-150 ${isSelected ? "bg-primary-base border-primary-base" : " group-hover:border-neutral-strong bg-default"}`,
|
|
5989
|
-
children: isSelected && /* @__PURE__ */ (0,
|
|
4121
|
+
className: `flex h-4 w-4 shrink-0 items-center justify-center rounded-[3px] border transition-colors duration-150 ${isSelected ? "bg-primary-base border-primary-base" : " group-hover:border-neutral-strong bg-default border-neutral-soft"}`,
|
|
4122
|
+
children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(CheckIcon, { className: "h-3 w-3" })
|
|
5990
4123
|
}
|
|
5991
4124
|
),
|
|
5992
|
-
/* @__PURE__ */ (0,
|
|
4125
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "leading-snug break-words", children: facet.value })
|
|
5993
4126
|
] }),
|
|
5994
|
-
/* @__PURE__ */ (0,
|
|
4127
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
5995
4128
|
"span",
|
|
5996
4129
|
{
|
|
5997
4130
|
className: `shrink-0 rounded px-1.5 py-0.5 text-xs transition-colors ml-2 ${isSelected ? "bg-neutral-weak font-semibold" : "bg-neutral-weak font-normal"}`,
|
|
@@ -6003,109 +4136,347 @@ var init_DataBindingControls = __esm({
|
|
|
6003
4136
|
`${field}-${facet.value}`
|
|
6004
4137
|
);
|
|
6005
4138
|
}) });
|
|
6006
|
-
return /* @__PURE__ */ (0,
|
|
4139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
6007
4140
|
"div",
|
|
6008
4141
|
{
|
|
6009
|
-
className: mode === "toolbar" ? "my-6" : "flex flex-col rounded-md border
|
|
4142
|
+
className: mode === "toolbar" ? "my-4 sm:my-6" : "flex flex-col rounded-md border border-neutral-soft bg-default p-4 shadow-sm",
|
|
6010
4143
|
children: [
|
|
6011
|
-
shouldShowToolbar && /* @__PURE__ */ (0,
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
event
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
/* @__PURE__ */ (0,
|
|
6024
|
-
|
|
6025
|
-
|
|
4144
|
+
shouldShowToolbar && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
4145
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "hidden lg:flex lg:items-center lg:justify-between lg:gap-4", children: [
|
|
4146
|
+
showSearchBar && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4147
|
+
"form",
|
|
4148
|
+
{
|
|
4149
|
+
role: "search",
|
|
4150
|
+
className: "flex w-full items-center gap-2 md:min-w-0 md:flex-1",
|
|
4151
|
+
onSubmit: (event) => {
|
|
4152
|
+
event.preventDefault();
|
|
4153
|
+
void handleSearch();
|
|
4154
|
+
},
|
|
4155
|
+
children: [
|
|
4156
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
|
|
4157
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SearchIcon, { className: "pointer-events-none absolute left-3.5 top-1/2 z-10 h-4 w-4 -translate-y-1/2 opacity-60" }),
|
|
4158
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4159
|
+
"input",
|
|
4160
|
+
{
|
|
4161
|
+
type: "text",
|
|
4162
|
+
name: "searchText",
|
|
4163
|
+
value: searchText,
|
|
4164
|
+
onChange: (e) => setSearchText(e.target.value),
|
|
4165
|
+
placeholder: "Search discussions, topics, or keywords...",
|
|
4166
|
+
className: "h-10 w-full rounded-md border border-neutral-soft bg-default py-2 pl-10 pr-4 text-sm shadow-sm transition-colors focus:border-primary-base focus:outline-none focus:ring-1 focus:ring-primary-base"
|
|
4167
|
+
}
|
|
4168
|
+
)
|
|
4169
|
+
] }),
|
|
4170
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4171
|
+
Button_default,
|
|
6026
4172
|
{
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
inputClasses: "!mt-0 !h-10 !rounded-md !border-neutral-soft !bg-default !py-2 !pl-10 !pr-4 !shadow-sm !text-sm focus:!border-primary-base focus:!ring-primary-base"
|
|
4173
|
+
ButtonType: "Primary" /* Solid */,
|
|
4174
|
+
onClick: handleSearch,
|
|
4175
|
+
className: "!h-10 !rounded-md !px-5 !py-0 flex items-center justify-center gap-1.5 shrink-0",
|
|
4176
|
+
children: [
|
|
4177
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SearchIcon, { className: "h-4 w-4" }),
|
|
4178
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { children: "Search" })
|
|
4179
|
+
]
|
|
6035
4180
|
}
|
|
6036
4181
|
)
|
|
6037
|
-
]
|
|
6038
|
-
|
|
6039
|
-
|
|
4182
|
+
]
|
|
4183
|
+
}
|
|
4184
|
+
),
|
|
4185
|
+
hasSortControls && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "relative shrink-0", ref: desktopSortDropdownRef, children: [
|
|
4186
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4187
|
+
"button",
|
|
4188
|
+
{
|
|
4189
|
+
type: "button",
|
|
4190
|
+
onClick: () => setIsSortOpen((prev) => !prev),
|
|
4191
|
+
"aria-expanded": isSortOpen,
|
|
4192
|
+
className: "inline-flex h-10 items-center justify-between gap-2.5 rounded-md border border-neutral-soft bg-default px-3.5 text-sm font-normal shadow-sm transition-all hover:bg-neutral-weak focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-base cursor-pointer whitespace-nowrap",
|
|
4193
|
+
children: [
|
|
4194
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { className: "whitespace-nowrap", children: [
|
|
4195
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "opacity-70", children: "Sort by: " }),
|
|
4196
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "font-semibold", children: selectedSortLabel })
|
|
4197
|
+
] }),
|
|
4198
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4199
|
+
ChevronDownIcon,
|
|
4200
|
+
{
|
|
4201
|
+
className: `h-4 w-4 shrink-0 transition-transform duration-200 ${isSortOpen ? "rotate-180" : ""}`
|
|
4202
|
+
}
|
|
4203
|
+
)
|
|
4204
|
+
]
|
|
4205
|
+
}
|
|
4206
|
+
),
|
|
4207
|
+
isSortOpen && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "absolute right-0 z-50 mt-1.5 w-max min-w-full max-h-80 overflow-y-auto rounded-md border border-neutral-soft bg-default p-1 shadow-lg", children: normalizedSortOptions.map((option) => {
|
|
4208
|
+
const isSelected = selectedSortOption?.value === option.value;
|
|
4209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4210
|
+
"button",
|
|
6040
4211
|
{
|
|
6041
|
-
|
|
6042
|
-
onClick:
|
|
6043
|
-
className:
|
|
4212
|
+
type: "button",
|
|
4213
|
+
onClick: () => handleSelectSort(option.value),
|
|
4214
|
+
className: `flex w-full items-center justify-between gap-4 rounded-md px-3 py-1.5 text-left text-sm transition-colors cursor-pointer whitespace-nowrap ${isSelected ? "bg-primary-base font-semibold" : "hover:bg-neutral-soft font-normal"}`,
|
|
6044
4215
|
children: [
|
|
6045
|
-
/* @__PURE__ */ (0,
|
|
6046
|
-
/* @__PURE__ */ (0,
|
|
4216
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "whitespace-nowrap", children: option.label }),
|
|
4217
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(CheckIcon, { className: "h-4 w-4 shrink-0" })
|
|
6047
4218
|
]
|
|
6048
|
-
}
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
4219
|
+
},
|
|
4220
|
+
option.value
|
|
4221
|
+
);
|
|
4222
|
+
}) })
|
|
4223
|
+
] })
|
|
4224
|
+
] }),
|
|
4225
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-col gap-2.5 lg:hidden", children: [
|
|
4226
|
+
showSearchBar && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4227
|
+
"form",
|
|
6056
4228
|
{
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
4229
|
+
role: "search",
|
|
4230
|
+
className: "relative w-full",
|
|
4231
|
+
onSubmit: (event) => {
|
|
4232
|
+
event.preventDefault();
|
|
4233
|
+
void handleSearch();
|
|
4234
|
+
},
|
|
6061
4235
|
children: [
|
|
6062
|
-
/* @__PURE__ */ (0,
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
] }),
|
|
6066
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
6067
|
-
ChevronDownIcon,
|
|
4236
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SearchIcon, { className: "pointer-events-none absolute left-3.5 top-1/2 z-10 h-4 w-4 -translate-y-1/2 opacity-50" }),
|
|
4237
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4238
|
+
"input",
|
|
6068
4239
|
{
|
|
6069
|
-
|
|
4240
|
+
type: "text",
|
|
4241
|
+
name: "searchTextMobile",
|
|
4242
|
+
value: searchText,
|
|
4243
|
+
onChange: (e) => setSearchText(e.target.value),
|
|
4244
|
+
placeholder: "Search jobs, skills, or keywords...",
|
|
4245
|
+
className: "h-11 w-full rounded-md border border-neutral-soft bg-default py-2.5 pl-10 pr-4 text-sm shadow-sm transition-colors focus:border-primary-base focus:outline-none focus:ring-1 focus:ring-primary-base"
|
|
6070
4246
|
}
|
|
6071
4247
|
)
|
|
6072
4248
|
]
|
|
6073
4249
|
}
|
|
6074
4250
|
),
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
4251
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center justify-between gap-2.5 pt-0.5", children: [
|
|
4252
|
+
showFacets && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
6078
4253
|
"button",
|
|
6079
4254
|
{
|
|
6080
4255
|
type: "button",
|
|
6081
|
-
onClick: () =>
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
})
|
|
6088
|
-
)
|
|
6089
|
-
|
|
6090
|
-
|
|
4256
|
+
onClick: () => setIsMobileFiltersOpen(true),
|
|
4257
|
+
className: "inline-flex h-10 items-center justify-center gap-2 rounded-md border border-neutral-soft bg-default px-3.5 text-sm font-medium shadow-sm transition-all hover:bg-neutral-weak cursor-pointer active:scale-95",
|
|
4258
|
+
children: [
|
|
4259
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FilterSlidersIcon, { className: "h-4 w-4" }),
|
|
4260
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { children: [
|
|
4261
|
+
"Filters",
|
|
4262
|
+
selectedFacetCount > 0 ? ` (${selectedFacetCount})` : ""
|
|
4263
|
+
] }),
|
|
4264
|
+
selectedFacetCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { className: "relative flex h-2 w-2", children: [
|
|
4265
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-primary-base opacity-75" }),
|
|
4266
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-primary-base" })
|
|
4267
|
+
] })
|
|
4268
|
+
]
|
|
4269
|
+
}
|
|
4270
|
+
),
|
|
4271
|
+
hasSortControls && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "relative shrink-0 ml-auto", ref: mobileSortDropdownRef, children: [
|
|
4272
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4273
|
+
"button",
|
|
4274
|
+
{
|
|
4275
|
+
type: "button",
|
|
4276
|
+
onClick: () => setIsSortOpen((prev) => !prev),
|
|
4277
|
+
"aria-expanded": isSortOpen,
|
|
4278
|
+
className: "inline-flex h-10 items-center justify-between gap-2 rounded-md border border-neutral-soft bg-default px-3.5 text-sm font-medium shadow-sm transition-all hover:bg-neutral-weak cursor-pointer whitespace-nowrap",
|
|
4279
|
+
children: [
|
|
4280
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "whitespace-nowrap font-medium", children: selectedSortLabel }),
|
|
4281
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4282
|
+
ChevronDownIcon,
|
|
4283
|
+
{
|
|
4284
|
+
className: `h-4 w-4 shrink-0 transition-transform duration-200 ${isSortOpen ? "rotate-180" : ""}`
|
|
4285
|
+
}
|
|
4286
|
+
)
|
|
4287
|
+
]
|
|
4288
|
+
}
|
|
4289
|
+
),
|
|
4290
|
+
isSortOpen && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "absolute right-0 z-50 mt-1.5 w-max min-w-[160px] max-h-80 overflow-y-auto rounded-md border border-neutral-soft bg-default p-1 shadow-xl", children: normalizedSortOptions.map((option) => {
|
|
4291
|
+
const isSelected = selectedSortOption?.value === option.value;
|
|
4292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4293
|
+
"button",
|
|
4294
|
+
{
|
|
4295
|
+
type: "button",
|
|
4296
|
+
onClick: () => handleSelectSort(option.value),
|
|
4297
|
+
className: `flex w-full items-center justify-between gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors cursor-pointer whitespace-nowrap ${isSelected ? "bg-primary-base font-semibold" : "hover:bg-neutral-soft font-normal"}`,
|
|
4298
|
+
children: [
|
|
4299
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "whitespace-nowrap", children: option.label }),
|
|
4300
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(CheckIcon, { className: "h-4 w-4 shrink-0" })
|
|
4301
|
+
]
|
|
4302
|
+
},
|
|
4303
|
+
option.value
|
|
4304
|
+
);
|
|
4305
|
+
}) })
|
|
4306
|
+
] })
|
|
4307
|
+
] }),
|
|
4308
|
+
selectedFacetCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5 pt-1", children: [
|
|
4309
|
+
Array.from(selectedFacetValues.entries()).map(([field, value]) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4310
|
+
"button",
|
|
4311
|
+
{
|
|
4312
|
+
type: "button",
|
|
4313
|
+
onClick: () => clearFacetField(field),
|
|
4314
|
+
className: "group inline-flex max-w-full cursor-pointer items-center gap-1.5 rounded-md border border-neutral-soft bg-neutral-weak px-2.5 py-1 text-xs transition-colors hover:bg-neutral-soft",
|
|
4315
|
+
title: `Remove filter: ${value}`,
|
|
6091
4316
|
children: [
|
|
6092
|
-
/* @__PURE__ */ (0,
|
|
6093
|
-
|
|
4317
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "font-medium truncate max-w-[140px]", children: value }),
|
|
4318
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(CloseIcon, { className: "h-3 w-3 shrink-0 opacity-60 group-hover:opacity-100" })
|
|
6094
4319
|
]
|
|
6095
4320
|
},
|
|
6096
|
-
|
|
6097
|
-
)
|
|
6098
|
-
|
|
4321
|
+
`mobile-chip-${field}`
|
|
4322
|
+
)),
|
|
4323
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4324
|
+
"button",
|
|
4325
|
+
{
|
|
4326
|
+
type: "button",
|
|
4327
|
+
onClick: () => void handleClearAll(),
|
|
4328
|
+
className: "inline-flex cursor-pointer items-center rounded-md px-2 py-1 text-xs font-semibold underline underline-offset-2 hover:bg-neutral-weak transition-colors ml-auto",
|
|
4329
|
+
children: "Clear all"
|
|
4330
|
+
}
|
|
4331
|
+
)
|
|
4332
|
+
] })
|
|
4333
|
+
] }),
|
|
4334
|
+
isMobileFiltersOpen && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "fixed inset-0 z-50 flex flex-col justify-end lg:hidden", children: [
|
|
4335
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4336
|
+
"div",
|
|
4337
|
+
{
|
|
4338
|
+
className: "fixed inset-0 bg-neutral-stronger/60 backdrop-blur-xs transition-opacity duration-300",
|
|
4339
|
+
onClick: () => setIsMobileFiltersOpen(false),
|
|
4340
|
+
"aria-hidden": "true"
|
|
4341
|
+
}
|
|
4342
|
+
),
|
|
4343
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "relative z-10 flex h-[85vh] max-h-[85vh] w-full flex-col rounded-t-xl border-t border-neutral-soft bg-default shadow-2xl transition-transform duration-300 animate-in slide-in-from-bottom", children: [
|
|
4344
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "pt-2.5 pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "mx-auto h-1.5 w-12 rounded-full bg-neutral-soft" }) }),
|
|
4345
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center justify-between px-5 py-3 border-b border-neutral-soft", children: [
|
|
4346
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("h2", { className: "text-lg font-bold tracking-tight", children: "Filters" }),
|
|
4347
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
4348
|
+
selectedFacetCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4349
|
+
"button",
|
|
4350
|
+
{
|
|
4351
|
+
type: "button",
|
|
4352
|
+
onClick: () => void handleClearAll(),
|
|
4353
|
+
className: "text-xs font-semibold cursor-pointer underline underline-offset-2 hover:opacity-80",
|
|
4354
|
+
children: "Clear all"
|
|
4355
|
+
}
|
|
4356
|
+
),
|
|
4357
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4358
|
+
"button",
|
|
4359
|
+
{
|
|
4360
|
+
type: "button",
|
|
4361
|
+
onClick: () => setIsMobileFiltersOpen(false),
|
|
4362
|
+
className: "p-1 rounded-full hover:bg-neutral-weak transition-colors cursor-pointer",
|
|
4363
|
+
"aria-label": "Close filters",
|
|
4364
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(CloseIcon, { className: "h-5 w-5 opacity-70" })
|
|
4365
|
+
}
|
|
4366
|
+
)
|
|
4367
|
+
] })
|
|
4368
|
+
] }),
|
|
4369
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "flex-1 overflow-y-auto px-5 py-3 space-y-3 divide-y divide-neutral-soft", children: activeFacets.map(([field, values]) => {
|
|
4370
|
+
const isOpen = !collapsedCategories[field];
|
|
4371
|
+
const selectedValue = selectedFacetValues.get(field);
|
|
4372
|
+
const categorySearch = facetCategorySearch[field]?.toLowerCase() || "";
|
|
4373
|
+
const filteredValues = categorySearch ? values.filter((v) => v.value.toLowerCase().includes(categorySearch)) : values;
|
|
4374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "pt-3 first:pt-0", children: [
|
|
4375
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4376
|
+
"button",
|
|
4377
|
+
{
|
|
4378
|
+
type: "button",
|
|
4379
|
+
onClick: () => toggleCategory(field),
|
|
4380
|
+
className: "flex w-full cursor-pointer items-center justify-between rounded-md py-2 text-left transition-colors",
|
|
4381
|
+
children: [
|
|
4382
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-2.5", children: [
|
|
4383
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-neutral-soft bg-neutral-weak", children: getCategoryIcon(field) }),
|
|
4384
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "font-semibold text-sm", children: humanize(field) })
|
|
4385
|
+
] }),
|
|
4386
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4387
|
+
selectedValue && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary-base text-xs font-bold leading-none", children: "1" }),
|
|
4388
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4389
|
+
ChevronDownIcon,
|
|
4390
|
+
{
|
|
4391
|
+
className: `h-4 w-4 transition-transform duration-200 ${isOpen ? "rotate-180" : ""}`
|
|
4392
|
+
}
|
|
4393
|
+
)
|
|
4394
|
+
] })
|
|
4395
|
+
]
|
|
4396
|
+
}
|
|
4397
|
+
),
|
|
4398
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "pt-2 pb-1 pl-1 pr-1 space-y-1.5", children: [
|
|
4399
|
+
values.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "relative mb-2", children: [
|
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SearchIcon, { className: "pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 opacity-50" }),
|
|
4401
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4402
|
+
"input",
|
|
4403
|
+
{
|
|
4404
|
+
type: "text",
|
|
4405
|
+
value: facetCategorySearch[field] || "",
|
|
4406
|
+
onChange: (e) => setFacetCategorySearch((prev) => ({
|
|
4407
|
+
...prev,
|
|
4408
|
+
[field]: e.target.value
|
|
4409
|
+
})),
|
|
4410
|
+
placeholder: `Search ${humanize(field).toLowerCase()}...`,
|
|
4411
|
+
className: "h-8.5 w-full rounded-md border border-neutral-soft bg-neutral-weak py-1 pl-8 pr-3 text-xs focus:border-primary-base focus:outline-none"
|
|
4412
|
+
}
|
|
4413
|
+
)
|
|
4414
|
+
] }),
|
|
4415
|
+
filteredValues.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "py-2 text-center text-xs opacity-60", children: "No matching options" }) : filteredValues.map((facet) => {
|
|
4416
|
+
const isChecked = selectedValue === facet.value;
|
|
4417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4418
|
+
"button",
|
|
4419
|
+
{
|
|
4420
|
+
type: "button",
|
|
4421
|
+
onClick: () => navigateWithoutReload(
|
|
4422
|
+
getFacetUrl(field, facet.value)
|
|
4423
|
+
),
|
|
4424
|
+
"aria-pressed": isChecked,
|
|
4425
|
+
className: `flex w-full cursor-pointer items-center justify-between gap-3 rounded-md px-2.5 py-2 text-left text-sm transition-colors ${isChecked ? "bg-neutral-soft font-medium" : "hover:bg-neutral-weak"}`,
|
|
4426
|
+
children: [
|
|
4427
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
4428
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4429
|
+
"span",
|
|
4430
|
+
{
|
|
4431
|
+
className: `flex h-5 w-5 shrink-0 items-center justify-center rounded-md border transition-colors ${isChecked ? "bg-primary-base border-primary-base" : "border-neutral-soft bg-default"}`,
|
|
4432
|
+
children: isChecked && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(CheckIcon, { className: "h-3.5 w-3.5" })
|
|
4433
|
+
}
|
|
4434
|
+
),
|
|
4435
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "leading-snug break-words", children: facet.value })
|
|
4436
|
+
] }),
|
|
4437
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "shrink-0 text-xs opacity-60 ml-2", children: facet.count })
|
|
4438
|
+
]
|
|
4439
|
+
},
|
|
4440
|
+
`drawer-${field}-${facet.value}`
|
|
4441
|
+
);
|
|
4442
|
+
})
|
|
4443
|
+
] })
|
|
4444
|
+
] }, `drawer-cat-${field}`);
|
|
4445
|
+
}) }),
|
|
4446
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-3 border-t border-neutral-soft bg-default p-4", children: [
|
|
4447
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4448
|
+
"button",
|
|
4449
|
+
{
|
|
4450
|
+
type: "button",
|
|
4451
|
+
onClick: () => setIsMobileFiltersOpen(false),
|
|
4452
|
+
className: "flex-1 h-11 rounded-md border border-neutral-soft bg-default text-sm font-medium transition-colors hover:bg-neutral-weak cursor-pointer flex items-center justify-center",
|
|
4453
|
+
children: "Close"
|
|
4454
|
+
}
|
|
4455
|
+
),
|
|
4456
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4457
|
+
"button",
|
|
4458
|
+
{
|
|
4459
|
+
type: "button",
|
|
4460
|
+
onClick: () => setIsMobileFiltersOpen(false),
|
|
4461
|
+
className: "flex-1 h-11 rounded-md bg-primary-base text-sm font-semibold shadow-md transition-all hover:opacity-90 active:scale-98 cursor-pointer flex items-center justify-center",
|
|
4462
|
+
children: [
|
|
4463
|
+
"Apply Filters",
|
|
4464
|
+
selectedFacetCount > 0 ? ` (${selectedFacetCount})` : ""
|
|
4465
|
+
]
|
|
4466
|
+
}
|
|
4467
|
+
)
|
|
4468
|
+
] })
|
|
4469
|
+
] })
|
|
6099
4470
|
] })
|
|
6100
4471
|
] }),
|
|
6101
|
-
shouldShowFacets && /* @__PURE__ */ (0,
|
|
6102
|
-
/* @__PURE__ */ (0,
|
|
6103
|
-
/* @__PURE__ */ (0,
|
|
6104
|
-
/* @__PURE__ */ (0,
|
|
6105
|
-
/* @__PURE__ */ (0,
|
|
6106
|
-
selectedFacetCount > 0 && /* @__PURE__ */ (0,
|
|
4472
|
+
shouldShowFacets && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
4473
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center justify-between border-b border-neutral-soft pb-3", children: [
|
|
4474
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4475
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FilterSlidersIcon, { className: "h-4 w-4" }),
|
|
4476
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("h2", { className: "text-base font-semibold tracking-tight", children: "Filters" }),
|
|
4477
|
+
selectedFacetCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "flex h-5 items-center justify-center rounded-full bg-primary-base px-2 text-xs font-semibold", children: selectedFacetCount })
|
|
6107
4478
|
] }),
|
|
6108
|
-
hasActiveFiltersOrSort && /* @__PURE__ */ (0,
|
|
4479
|
+
hasActiveFiltersOrSort && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
6109
4480
|
"button",
|
|
6110
4481
|
{
|
|
6111
4482
|
type: "button",
|
|
@@ -6113,46 +4484,49 @@ var init_DataBindingControls = __esm({
|
|
|
6113
4484
|
className: "group inline-flex cursor-pointer items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium transition-colors duration-150 hover:bg-neutral-soft focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary-base",
|
|
6114
4485
|
"aria-label": "Clear all filters and sorting",
|
|
6115
4486
|
children: [
|
|
6116
|
-
/* @__PURE__ */ (0,
|
|
6117
|
-
/* @__PURE__ */ (0,
|
|
4487
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ResetIcon, { className: "h-3.5 w-3.5 transition-transform duration-200 group-hover:-rotate-45" }),
|
|
4488
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { children: "Clear all" })
|
|
6118
4489
|
]
|
|
6119
4490
|
}
|
|
6120
4491
|
)
|
|
6121
4492
|
] }),
|
|
6122
|
-
selectedFacetCount > 0 && /* @__PURE__ */ (0,
|
|
4493
|
+
selectedFacetCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "flex flex-wrap gap-1.5 pb-2.5 border-b border-neutral-soft", children: Array.from(selectedFacetValues.entries()).map(([field, value]) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
6123
4494
|
"button",
|
|
6124
4495
|
{
|
|
6125
4496
|
type: "button",
|
|
6126
4497
|
onClick: () => clearFacetField(field),
|
|
6127
|
-
className: "group inline-flex max-w-full cursor-pointer items-center gap-1.5 rounded-md border bg-neutral-weak px-2.5 py-1 text-xs transition-colors hover:bg-neutral-soft",
|
|
4498
|
+
className: "group inline-flex max-w-full cursor-pointer items-center gap-1.5 rounded-md border border-neutral-soft bg-neutral-weak px-2.5 py-1 text-xs transition-colors hover:bg-neutral-soft",
|
|
6128
4499
|
title: `Remove filter: ${value}`,
|
|
6129
4500
|
children: [
|
|
6130
|
-
/* @__PURE__ */ (0,
|
|
6131
|
-
/* @__PURE__ */ (0,
|
|
4501
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "font-medium truncate max-w-[150px]", children: value }),
|
|
4502
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(CloseIcon, { className: "h-3.5 w-3.5 shrink-0 opacity-60 group-hover:opacity-100" })
|
|
6132
4503
|
]
|
|
6133
4504
|
},
|
|
6134
4505
|
`chip-${field}`
|
|
6135
4506
|
)) }),
|
|
6136
|
-
activeFacets.length === 1 && /* @__PURE__ */ (0,
|
|
6137
|
-
/* @__PURE__ */ (0,
|
|
4507
|
+
activeFacets.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("nav", { "aria-label": `${humanize(activeFacets[0][0])} filters`, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "py-1", children: [
|
|
4508
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "px-1 pb-2 font-medium text-sm", children: humanize(activeFacets[0][0]) }),
|
|
6138
4509
|
renderFacetItems(activeFacets[0][0], activeFacets[0][1])
|
|
6139
4510
|
] }) }),
|
|
6140
|
-
activeFacets.length > 1 && /* @__PURE__ */ (0,
|
|
4511
|
+
activeFacets.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "flex flex-col divide-y divide-neutral-soft", children: activeFacets.map(([field, values]) => {
|
|
6141
4512
|
const isOpen = !collapsedCategories[field];
|
|
6142
|
-
return /* @__PURE__ */ (0,
|
|
4513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
6143
4514
|
"div",
|
|
6144
4515
|
{
|
|
6145
4516
|
className: "py-2 first:pt-0 last:pb-0",
|
|
6146
4517
|
children: [
|
|
6147
|
-
/* @__PURE__ */ (0,
|
|
4518
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
6148
4519
|
"button",
|
|
6149
4520
|
{
|
|
6150
4521
|
type: "button",
|
|
6151
4522
|
onClick: () => toggleCategory(field),
|
|
6152
4523
|
className: "flex w-full cursor-pointer items-center justify-between rounded-md px-1.5 py-1.5 text-sm font-semibold transition-colors duration-150 hover:bg-neutral-weak focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary-base",
|
|
6153
4524
|
children: [
|
|
6154
|
-
/* @__PURE__ */ (0,
|
|
6155
|
-
|
|
4525
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4526
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded border border-neutral-soft bg-neutral-weak", children: getCategoryIcon(field) }),
|
|
4527
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { children: humanize(field) })
|
|
4528
|
+
] }),
|
|
4529
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
6156
4530
|
ChevronDownIcon,
|
|
6157
4531
|
{
|
|
6158
4532
|
className: `h-4 w-4 transition-transform duration-200 ease-out ${isOpen ? "rotate-180" : ""}`
|
|
@@ -6161,7 +4535,7 @@ var init_DataBindingControls = __esm({
|
|
|
6161
4535
|
]
|
|
6162
4536
|
}
|
|
6163
4537
|
),
|
|
6164
|
-
isOpen && /* @__PURE__ */ (0,
|
|
4538
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "pt-1", children: renderFacetItems(field, values) })
|
|
6165
4539
|
]
|
|
6166
4540
|
},
|
|
6167
4541
|
field
|
|
@@ -6181,13 +4555,13 @@ var Slider_exports = {};
|
|
|
6181
4555
|
__export(Slider_exports, {
|
|
6182
4556
|
default: () => Slider_default
|
|
6183
4557
|
});
|
|
6184
|
-
var
|
|
4558
|
+
var import_react40, import_jsx_runtime66, Slider, ArrowButton, ProgressPill, Slider_default;
|
|
6185
4559
|
var init_Slider = __esm({
|
|
6186
4560
|
"src/components/Slider.tsx"() {
|
|
6187
4561
|
"use strict";
|
|
6188
4562
|
"use client";
|
|
6189
|
-
|
|
6190
|
-
|
|
4563
|
+
import_react40 = __toESM(require("react"));
|
|
4564
|
+
import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6191
4565
|
Slider = ({
|
|
6192
4566
|
children,
|
|
6193
4567
|
columns,
|
|
@@ -6208,17 +4582,17 @@ var init_Slider = __esm({
|
|
|
6208
4582
|
progressPosition = "bottom",
|
|
6209
4583
|
scrollByColumns = false
|
|
6210
4584
|
}) => {
|
|
6211
|
-
const [currentSlide, setCurrentSlide] = (0,
|
|
6212
|
-
const [transition, setTransition] = (0,
|
|
4585
|
+
const [currentSlide, setCurrentSlide] = (0, import_react40.useState)(0);
|
|
4586
|
+
const [transition, setTransition] = (0, import_react40.useState)(true);
|
|
6213
4587
|
const initialSlidesToShow = slidesToShow ?? columns ?? 4;
|
|
6214
|
-
const [slidesToShowState, setSlidesToShowState] = (0,
|
|
4588
|
+
const [slidesToShowState, setSlidesToShowState] = (0, import_react40.useState)(
|
|
6215
4589
|
typeof initialSlidesToShow === "number" ? initialSlidesToShow : initialSlidesToShow.large
|
|
6216
4590
|
);
|
|
6217
|
-
const [isPlaying, setIsPlaying] = (0,
|
|
6218
|
-
const trackRef = (0,
|
|
4591
|
+
const [isPlaying, setIsPlaying] = (0, import_react40.useState)(autoplay);
|
|
4592
|
+
const trackRef = (0, import_react40.useRef)(null);
|
|
6219
4593
|
console.log("trackRef:", trackRef);
|
|
6220
|
-
const [videoProgress, setVideoProgress] = (0,
|
|
6221
|
-
(0,
|
|
4594
|
+
const [videoProgress, setVideoProgress] = (0, import_react40.useState)(null);
|
|
4595
|
+
(0, import_react40.useEffect)(() => {
|
|
6222
4596
|
if (typeof initialSlidesToShow === "number") {
|
|
6223
4597
|
setSlidesToShowState(initialSlidesToShow);
|
|
6224
4598
|
return;
|
|
@@ -6236,7 +4610,7 @@ var init_Slider = __esm({
|
|
|
6236
4610
|
window.addEventListener("resize", handleResize);
|
|
6237
4611
|
return () => window.removeEventListener("resize", handleResize);
|
|
6238
4612
|
}, [initialSlidesToShow]);
|
|
6239
|
-
(0,
|
|
4613
|
+
(0, import_react40.useEffect)(() => {
|
|
6240
4614
|
if (!autoplay) return;
|
|
6241
4615
|
const activeSlideElement = trackRef.current?.children[currentSlide];
|
|
6242
4616
|
const videoElement = activeSlideElement?.querySelector("video");
|
|
@@ -6281,7 +4655,7 @@ var init_Slider = __esm({
|
|
|
6281
4655
|
}, autoplay_speed);
|
|
6282
4656
|
return () => clearInterval(timer);
|
|
6283
4657
|
}, [autoplay, autoplay_speed, currentSlide, isPlaying]);
|
|
6284
|
-
const totalSlides =
|
|
4658
|
+
const totalSlides = import_react40.Children.count(children);
|
|
6285
4659
|
const numColumns = columns ?? slidesToShowState;
|
|
6286
4660
|
const slideWidthPercentage = (() => {
|
|
6287
4661
|
if (typeof lastColPercentage !== "number") {
|
|
@@ -6341,24 +4715,24 @@ var init_Slider = __esm({
|
|
|
6341
4715
|
}
|
|
6342
4716
|
};
|
|
6343
4717
|
const translateX = -currentSlide * slideWidthPercentage;
|
|
6344
|
-
const slides =
|
|
6345
|
-
if (!
|
|
4718
|
+
const slides = import_react40.Children.map(children, (child, index) => {
|
|
4719
|
+
if (!import_react40.default.isValidElement(child)) return null;
|
|
6346
4720
|
const childProps = child.props;
|
|
6347
4721
|
const mergedClassName = `${childProps.className ?? ""} w-full`.trim();
|
|
6348
|
-
return /* @__PURE__ */ (0,
|
|
4722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6349
4723
|
"div",
|
|
6350
4724
|
{
|
|
6351
4725
|
className: `flex-none ${scaleOnHover ? "group hover:z-50" : ""} relative`,
|
|
6352
4726
|
style: { width: `calc(${slideWidthPercentage}%)`, paddingRight: gap },
|
|
6353
|
-
children: (0,
|
|
4727
|
+
children: (0, import_react40.cloneElement)(child, {
|
|
6354
4728
|
className: mergedClassName
|
|
6355
4729
|
})
|
|
6356
4730
|
},
|
|
6357
4731
|
index
|
|
6358
4732
|
);
|
|
6359
4733
|
});
|
|
6360
|
-
return /* @__PURE__ */ (0,
|
|
6361
|
-
show_dots && progressPosition === "top" && /* @__PURE__ */ (0,
|
|
4734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "w-full", children: [
|
|
4735
|
+
show_dots && progressPosition === "top" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "flex justify-center space-x-1.5 mb-4", children: Array.from({ length: totalSlides }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6362
4736
|
ProgressPill,
|
|
6363
4737
|
{
|
|
6364
4738
|
active: index === currentSlide,
|
|
@@ -6375,14 +4749,14 @@ var init_Slider = __esm({
|
|
|
6375
4749
|
},
|
|
6376
4750
|
index
|
|
6377
4751
|
)) }),
|
|
6378
|
-
/* @__PURE__ */ (0,
|
|
4752
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
6379
4753
|
"div",
|
|
6380
4754
|
{
|
|
6381
4755
|
className: `relative w-full overflow-hidden ${className}`,
|
|
6382
4756
|
onMouseEnter: handleMouseEnter,
|
|
6383
4757
|
onMouseLeave: handleMouseLeave,
|
|
6384
4758
|
children: [
|
|
6385
|
-
/* @__PURE__ */ (0,
|
|
4759
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6386
4760
|
"div",
|
|
6387
4761
|
{
|
|
6388
4762
|
ref: trackRef,
|
|
@@ -6394,32 +4768,32 @@ var init_Slider = __esm({
|
|
|
6394
4768
|
children: slides
|
|
6395
4769
|
}
|
|
6396
4770
|
),
|
|
6397
|
-
show_arrows && /* @__PURE__ */ (0,
|
|
6398
|
-
/* @__PURE__ */ (0,
|
|
4771
|
+
show_arrows && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
4772
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6399
4773
|
ArrowButton,
|
|
6400
4774
|
{
|
|
6401
4775
|
direction: "left",
|
|
6402
4776
|
onClick: prevSlide,
|
|
6403
4777
|
visible: infinite_scroll || currentSlide > 0,
|
|
6404
4778
|
className: arrowClassName,
|
|
6405
|
-
children: /* @__PURE__ */ (0,
|
|
4779
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.75 19.5 8.25 12l7.5-7.5" }) })
|
|
6406
4780
|
}
|
|
6407
4781
|
),
|
|
6408
|
-
/* @__PURE__ */ (0,
|
|
4782
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6409
4783
|
ArrowButton,
|
|
6410
4784
|
{
|
|
6411
4785
|
direction: "right",
|
|
6412
4786
|
onClick: nextSlide,
|
|
6413
4787
|
visible: infinite_scroll || currentSlide < maxSlide,
|
|
6414
4788
|
className: arrowClassName,
|
|
6415
|
-
children: /* @__PURE__ */ (0,
|
|
4789
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m8.25 4.5 7.5 7.5-7.5 7.5" }) })
|
|
6416
4790
|
}
|
|
6417
4791
|
)
|
|
6418
4792
|
] })
|
|
6419
4793
|
]
|
|
6420
4794
|
}
|
|
6421
4795
|
),
|
|
6422
|
-
show_dots && progressPosition !== "top" && /* @__PURE__ */ (0,
|
|
4796
|
+
show_dots && progressPosition !== "top" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "flex justify-center space-x-1.5 mt-5", children: Array.from({ length: totalSlides }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6423
4797
|
ProgressPill,
|
|
6424
4798
|
{
|
|
6425
4799
|
active: index === currentSlide,
|
|
@@ -6444,7 +4818,7 @@ var init_Slider = __esm({
|
|
|
6444
4818
|
visible,
|
|
6445
4819
|
children,
|
|
6446
4820
|
className = ""
|
|
6447
|
-
}) => /* @__PURE__ */ (0,
|
|
4821
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6448
4822
|
"button",
|
|
6449
4823
|
{
|
|
6450
4824
|
className: `
|
|
@@ -6471,13 +4845,13 @@ var init_Slider = __esm({
|
|
|
6471
4845
|
totalSlides,
|
|
6472
4846
|
customProgress = null
|
|
6473
4847
|
}) => {
|
|
6474
|
-
const [progress, setProgress] = (0,
|
|
6475
|
-
(0,
|
|
4848
|
+
const [progress, setProgress] = (0, import_react40.useState)(0);
|
|
4849
|
+
(0, import_react40.useEffect)(() => {
|
|
6476
4850
|
if (active) {
|
|
6477
4851
|
setProgress(0);
|
|
6478
4852
|
}
|
|
6479
4853
|
}, [active, index]);
|
|
6480
|
-
(0,
|
|
4854
|
+
(0, import_react40.useEffect)(() => {
|
|
6481
4855
|
if (!active || !isPlaying || customProgress !== null) {
|
|
6482
4856
|
if (!active) {
|
|
6483
4857
|
setProgress(0);
|
|
@@ -6532,7 +4906,7 @@ var init_Slider = __esm({
|
|
|
6532
4906
|
const renderProgressBar = () => {
|
|
6533
4907
|
if (style === "modern" && isActive || style === "cumulative" && shouldShowProgress) {
|
|
6534
4908
|
const displayProgress = style === "cumulative" && isFilled ? 100 : customProgress !== null && customProgress !== void 0 ? customProgress : progress;
|
|
6535
|
-
return /* @__PURE__ */ (0,
|
|
4909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6536
4910
|
"div",
|
|
6537
4911
|
{
|
|
6538
4912
|
className: `absolute top-0 left-0 h-full rounded-full ${style === "cumulative" && isFilled ? activeClassName || "bg-white" : activeClassName || "bg-white"} transition-all duration-50 ease-linear`,
|
|
@@ -6544,7 +4918,7 @@ var init_Slider = __esm({
|
|
|
6544
4918
|
};
|
|
6545
4919
|
const renderCumulativeFill = () => {
|
|
6546
4920
|
if (style === "cumulative" && isFilled && !isActive) {
|
|
6547
|
-
return /* @__PURE__ */ (0,
|
|
4921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6548
4922
|
"div",
|
|
6549
4923
|
{
|
|
6550
4924
|
className: `absolute top-0 left-0 h-full rounded-full ${activeClassName || "bg-white"} transition-all duration-300`,
|
|
@@ -6554,7 +4928,7 @@ var init_Slider = __esm({
|
|
|
6554
4928
|
}
|
|
6555
4929
|
return null;
|
|
6556
4930
|
};
|
|
6557
|
-
return /* @__PURE__ */ (0,
|
|
4931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
6558
4932
|
"button",
|
|
6559
4933
|
{
|
|
6560
4934
|
className: `${baseClasses} ${getStyleClasses()}`,
|
|
@@ -6582,7 +4956,7 @@ __export(server_exports, {
|
|
|
6582
4956
|
module.exports = __toCommonJS(server_exports);
|
|
6583
4957
|
|
|
6584
4958
|
// src/components/pageRenderingEngine/PageBodyRenderer.tsx
|
|
6585
|
-
var
|
|
4959
|
+
var import_react42 = __toESM(require("react"));
|
|
6586
4960
|
|
|
6587
4961
|
// src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
|
|
6588
4962
|
var import_react28 = __toESM(require("react"));
|
|
@@ -7780,8 +6154,8 @@ var WidgetNode = (props) => {
|
|
|
7780
6154
|
var WidgetNode_default = WidgetNode;
|
|
7781
6155
|
|
|
7782
6156
|
// src/components/pageRenderingEngine/nodes/DivContainer.tsx
|
|
7783
|
-
var
|
|
7784
|
-
var
|
|
6157
|
+
var import_dynamic13 = __toESM(require("next/dynamic"));
|
|
6158
|
+
var import_react41 = __toESM(require("react"));
|
|
7785
6159
|
|
|
7786
6160
|
// src/components/pageRenderingEngine/nodes/EmbedNode.tsx
|
|
7787
6161
|
var import_dynamic10 = __toESM(require("next/dynamic"));
|
|
@@ -8967,12 +7341,12 @@ var GoogleMapNode = (props) => {
|
|
|
8967
7341
|
var GoogleMapNode_default = GoogleMapNode;
|
|
8968
7342
|
|
|
8969
7343
|
// src/components/pageRenderingEngine/nodes/DivContainer.tsx
|
|
8970
|
-
var
|
|
8971
|
-
var Pagination2 = (0,
|
|
8972
|
-
var DataBindingControls2 = (0,
|
|
7344
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
7345
|
+
var Pagination2 = (0, import_dynamic13.default)(() => Promise.resolve().then(() => (init_Pagination(), Pagination_exports)), { ssr: true });
|
|
7346
|
+
var DataBindingControls2 = (0, import_dynamic13.default)(() => Promise.resolve().then(() => (init_DataBindingControls(), DataBindingControls_exports)), {
|
|
8973
7347
|
ssr: true
|
|
8974
7348
|
});
|
|
8975
|
-
var Slider2 = (0,
|
|
7349
|
+
var Slider2 = (0, import_dynamic13.default)(() => Promise.resolve().then(() => (init_Slider(), Slider_exports)), {
|
|
8976
7350
|
ssr: false
|
|
8977
7351
|
});
|
|
8978
7352
|
function toCamelCase(str) {
|
|
@@ -9252,7 +7626,7 @@ var DivContainer = async (props) => {
|
|
|
9252
7626
|
}
|
|
9253
7627
|
const SelectedNode = NodeTypes2[node.type];
|
|
9254
7628
|
if (!SelectedNode) return null;
|
|
9255
|
-
return /* @__PURE__ */ (0,
|
|
7629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react41.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9256
7630
|
SelectedNode,
|
|
9257
7631
|
{
|
|
9258
7632
|
node,
|
|
@@ -9344,7 +7718,7 @@ var DivContainer = async (props) => {
|
|
|
9344
7718
|
item,
|
|
9345
7719
|
idx,
|
|
9346
7720
|
props.href ? void 0 : item?.links?.view
|
|
9347
|
-
)?.map((child, i) => /* @__PURE__ */ (0,
|
|
7721
|
+
)?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react41.default.Fragment, { children: child }, i)) : renderChildren2(props.node.children, props, item, idx)
|
|
9348
7722
|
);
|
|
9349
7723
|
}
|
|
9350
7724
|
return props.node.children.flatMap((node, childIndex) => {
|
|
@@ -9462,17 +7836,17 @@ var DivContainer = async (props) => {
|
|
|
9462
7836
|
dataBindingProperties?.showFacets || dataBindingProperties?.showSortOptions || dataBindingProperties?.showSearchBar
|
|
9463
7837
|
);
|
|
9464
7838
|
const WrapperComponent = Wrapper;
|
|
9465
|
-
const renderedContainer = /* @__PURE__ */ (0,
|
|
7839
|
+
const renderedContainer = /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9466
7840
|
WrapperComponent,
|
|
9467
7841
|
{
|
|
9468
7842
|
id: guid,
|
|
9469
7843
|
style: combinedStyles,
|
|
9470
7844
|
className: classNames || void 0,
|
|
9471
7845
|
...wrapperProps,
|
|
9472
|
-
children: shouldShowNoDataMessage ? hasActiveFilter ? /* @__PURE__ */ (0,
|
|
7846
|
+
children: shouldShowNoDataMessage ? hasActiveFilter ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(NoFilterResultsFound_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(NoDataFound_default, {}) : renderContainerChildren()
|
|
9473
7847
|
}
|
|
9474
7848
|
);
|
|
9475
|
-
const paginationControl = dataBindingProperties?.enablePagination ? /* @__PURE__ */ (0,
|
|
7849
|
+
const paginationControl = dataBindingProperties?.enablePagination ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9476
7850
|
Pagination2,
|
|
9477
7851
|
{
|
|
9478
7852
|
path: props.path,
|
|
@@ -9480,15 +7854,15 @@ var DivContainer = async (props) => {
|
|
|
9480
7854
|
dataset: response
|
|
9481
7855
|
}
|
|
9482
7856
|
) : null;
|
|
9483
|
-
return /* @__PURE__ */ (0,
|
|
9484
|
-
/* @__PURE__ */ (0,
|
|
7857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_react41.default.Fragment, { children: [
|
|
7858
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9485
7859
|
"style",
|
|
9486
7860
|
{
|
|
9487
7861
|
dangerouslySetInnerHTML: { __html: cssResult.css + animationCSS }
|
|
9488
7862
|
}
|
|
9489
7863
|
),
|
|
9490
|
-
showDataBindingControls ? /* @__PURE__ */ (0,
|
|
9491
|
-
/* @__PURE__ */ (0,
|
|
7864
|
+
showDataBindingControls ? /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_react41.default.Fragment, { children: [
|
|
7865
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9492
7866
|
DataBindingControls2,
|
|
9493
7867
|
{
|
|
9494
7868
|
mode: "toolbar",
|
|
@@ -9501,16 +7875,16 @@ var DivContainer = async (props) => {
|
|
|
9501
7875
|
showSearchBar: dataBindingProperties?.showSearchBar
|
|
9502
7876
|
}
|
|
9503
7877
|
),
|
|
9504
|
-
/* @__PURE__ */ (0,
|
|
7878
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
9505
7879
|
"div",
|
|
9506
7880
|
{
|
|
9507
7881
|
className: dataBindingProperties?.showFacets ? "grid items-start gap-6 lg:grid-cols-[minmax(0,1fr)_18rem]" : void 0,
|
|
9508
7882
|
children: [
|
|
9509
|
-
/* @__PURE__ */ (0,
|
|
7883
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "min-w-0", children: [
|
|
9510
7884
|
renderedContainer,
|
|
9511
7885
|
paginationControl
|
|
9512
7886
|
] }),
|
|
9513
|
-
dataBindingProperties?.showFacets && /* @__PURE__ */ (0,
|
|
7887
|
+
dataBindingProperties?.showFacets && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("aside", { className: "hidden lg:block", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9514
7888
|
DataBindingControls2,
|
|
9515
7889
|
{
|
|
9516
7890
|
mode: "facets",
|
|
@@ -9523,16 +7897,16 @@ var DivContainer = async (props) => {
|
|
|
9523
7897
|
]
|
|
9524
7898
|
}
|
|
9525
7899
|
)
|
|
9526
|
-
] }) : /* @__PURE__ */ (0,
|
|
7900
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_react41.default.Fragment, { children: [
|
|
9527
7901
|
renderedContainer,
|
|
9528
|
-
paginationControl && /* @__PURE__ */ (0,
|
|
7902
|
+
paginationControl && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { children: paginationControl })
|
|
9529
7903
|
] })
|
|
9530
7904
|
] });
|
|
9531
7905
|
};
|
|
9532
7906
|
var DivContainer_default = DivContainer;
|
|
9533
7907
|
|
|
9534
7908
|
// src/components/pageRenderingEngine/PageBodyRenderer.tsx
|
|
9535
|
-
var
|
|
7909
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
9536
7910
|
var NodeTypes = {
|
|
9537
7911
|
["paragraph"]: ParagraphNode_default,
|
|
9538
7912
|
["heading"]: HeadingNode_default,
|
|
@@ -9570,14 +7944,14 @@ var PageBodyRenderer = (props) => {
|
|
|
9570
7944
|
}
|
|
9571
7945
|
return true;
|
|
9572
7946
|
};
|
|
9573
|
-
return /* @__PURE__ */ (0,
|
|
7947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react42.default.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
|
|
9574
7948
|
{
|
|
9575
7949
|
}
|
|
9576
7950
|
const SelectedNode = NodeTypes[node.type];
|
|
9577
7951
|
if (!shouldRenderNode(node)) {
|
|
9578
7952
|
return null;
|
|
9579
7953
|
}
|
|
9580
|
-
return /* @__PURE__ */ (0,
|
|
7954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react42.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react42.default.Fragment, { children: node.type == "layout-container" ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react42.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
9581
7955
|
SelectedNode,
|
|
9582
7956
|
{
|
|
9583
7957
|
node,
|
|
@@ -9593,7 +7967,7 @@ var PageBodyRenderer = (props) => {
|
|
|
9593
7967
|
device: props.device,
|
|
9594
7968
|
widgetRenderer: props.widgetRenderer
|
|
9595
7969
|
}
|
|
9596
|
-
) }) : /* @__PURE__ */ (0,
|
|
7970
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react42.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
9597
7971
|
SelectedNode,
|
|
9598
7972
|
{
|
|
9599
7973
|
node,
|