warqadui 0.0.298 → 0.0.299

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -37,6 +37,7 @@ __export(index_exports, {
37
37
  AccountStatements: () => Statements_default,
38
38
  Accounts: () => Accounts_default,
39
39
  AdminProtectedRoute: () => AdminProtectedRoute,
40
+ AntdInputAntdFormInput: () => inputs_default,
40
41
  Badge: () => Badge,
41
42
  BrandField: () => Feilds_default3,
42
43
  BrandForm: () => BrandForm_default,
@@ -51567,14 +51568,1395 @@ var ProductList2 = ({ value = false }) => {
51567
51568
  };
51568
51569
  var ProductList_default = ProductList2;
51569
51570
 
51570
- // src/Antd/inputs/index.tsx
51571
- var inputs_exports = {};
51572
- __export(inputs_exports, {
51573
- AntdInputs: () => AntdInputs
51574
- });
51575
- var AntdInputs = {
51576
- ...inputs_exports
51571
+ // src/Antd/inputs/FormField.tsx
51572
+ var import_lucide_react132 = require("lucide-react");
51573
+ var import_jsx_runtime281 = require("react/jsx-runtime");
51574
+ var FormField = ({
51575
+ label,
51576
+ id,
51577
+ required,
51578
+ error,
51579
+ hint,
51580
+ topRight,
51581
+ className = "",
51582
+ children
51583
+ }) => {
51584
+ const errorMessage = typeof error === "string" ? error : null;
51585
+ return /* @__PURE__ */ (0, import_jsx_runtime281.jsxs)("div", { className: `space-y-1.5 ${className}`, children: [
51586
+ (label || topRight) && /* @__PURE__ */ (0, import_jsx_runtime281.jsxs)("div", { className: "flex items-center justify-between text-xs font-semibold text-zinc-700 dark:text-zinc-300", children: [
51587
+ label && /* @__PURE__ */ (0, import_jsx_runtime281.jsxs)("label", { htmlFor: id, className: "flex items-center gap-1", children: [
51588
+ /* @__PURE__ */ (0, import_jsx_runtime281.jsx)("span", { children: label }),
51589
+ required && /* @__PURE__ */ (0, import_jsx_runtime281.jsx)("span", { className: "text-rose-500", children: "*" })
51590
+ ] }),
51591
+ topRight && /* @__PURE__ */ (0, import_jsx_runtime281.jsx)("div", { className: "text-[11px] font-normal text-zinc-400", children: topRight })
51592
+ ] }),
51593
+ children,
51594
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime281.jsxs)("div", { className: "flex items-center gap-1.5 text-[11px] text-rose-600 dark:text-rose-400 font-medium pt-0.5 animate-in fade-in duration-150", children: [
51595
+ /* @__PURE__ */ (0, import_jsx_runtime281.jsx)(import_lucide_react132.AlertCircle, { size: 13, className: "shrink-0 text-rose-500" }),
51596
+ /* @__PURE__ */ (0, import_jsx_runtime281.jsx)("span", { children: errorMessage })
51597
+ ] }),
51598
+ !errorMessage && hint && /* @__PURE__ */ (0, import_jsx_runtime281.jsx)("p", { className: "text-[11px] text-zinc-400 dark:text-zinc-500 pt-0.5 leading-relaxed", children: hint })
51599
+ ] });
51600
+ };
51601
+ var FormField_default = FormField;
51602
+
51603
+ // src/Antd/inputs/TextInput.tsx
51604
+ var import_react174 = require("react");
51605
+ var import_lucide_react133 = require("lucide-react");
51606
+ var import_react_hook_form81 = require("react-hook-form");
51607
+
51608
+ // src/Antd/inputs/types.ts
51609
+ var import_react_hook_form80 = require("react-hook-form");
51610
+ function getFormFieldError(name, methodsOrForm, manualError) {
51611
+ if (typeof manualError === "string") return manualError;
51612
+ if (!methodsOrForm || !name) return null;
51613
+ const errors = methodsOrForm.formState?.errors || methodsOrForm.errors;
51614
+ if (!errors) return null;
51615
+ const nameParts = String(name).split(".");
51616
+ let currentError = errors;
51617
+ for (const part of nameParts) {
51618
+ currentError = currentError?.[part];
51619
+ }
51620
+ return currentError?.message || null;
51621
+ }
51622
+ function useFormInstance(methods, form) {
51623
+ if (methods) return methods;
51624
+ if (form) return form;
51625
+ try {
51626
+ const context = (0, import_react_hook_form80.useFormContext)();
51627
+ return context || null;
51628
+ } catch {
51629
+ return null;
51630
+ }
51631
+ }
51632
+
51633
+ // src/Antd/inputs/TextInput.tsx
51634
+ var import_jsx_runtime282 = require("react/jsx-runtime");
51635
+ var RHFInput = (0, import_react174.forwardRef)(
51636
+ ({ activeForm, name, value, onChange, onBlur, ...rest }, ref2) => {
51637
+ const { field } = (0, import_react_hook_form81.useController)({
51638
+ name,
51639
+ control: activeForm.control,
51640
+ defaultValue: value ?? ""
51641
+ });
51642
+ return /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
51643
+ "input",
51644
+ {
51645
+ ...rest,
51646
+ name: field.name,
51647
+ value: value !== void 0 ? value : field.value ?? "",
51648
+ onChange: (e) => {
51649
+ field.onChange(e);
51650
+ onChange?.(e);
51651
+ },
51652
+ onBlur: (e) => {
51653
+ field.onBlur();
51654
+ onBlur?.(e);
51655
+ },
51656
+ ref: (node) => {
51657
+ field.ref(node);
51658
+ if (typeof ref2 === "function") ref2(node);
51659
+ else if (ref2) ref2.current = node;
51660
+ }
51661
+ }
51662
+ );
51663
+ }
51664
+ );
51665
+ RHFInput.displayName = "RHFInput";
51666
+ var TextInput = (0, import_react174.forwardRef)(
51667
+ ({
51668
+ label,
51669
+ name,
51670
+ methods,
51671
+ form,
51672
+ id,
51673
+ required,
51674
+ disabled,
51675
+ readOnly,
51676
+ error,
51677
+ hint,
51678
+ topRight,
51679
+ icon,
51680
+ rightIcon,
51681
+ prefix,
51682
+ suffix,
51683
+ placeholder,
51684
+ className = "",
51685
+ inputClassName = "",
51686
+ containerClassName = "",
51687
+ size = "md",
51688
+ type = "text",
51689
+ value,
51690
+ onChange,
51691
+ onFocus,
51692
+ onBlur,
51693
+ ...rest
51694
+ }, ref2) => {
51695
+ const [showPassword, setShowPassword] = (0, import_react174.useState)(false);
51696
+ const activeForm = useFormInstance(methods, form);
51697
+ const inputId = id || name || (label ? String(label).toLowerCase().replace(/\s+/g, "-") : void 0);
51698
+ const errorMessage = getFormFieldError(name, activeForm, error);
51699
+ const hasError = Boolean(errorMessage);
51700
+ const sizeHeightClass = size === "sm" ? "h-8 text-xs" : size === "lg" ? "h-12 text-sm" : "h-10 text-xs";
51701
+ const watchedValue = activeForm?.watch?.(name);
51702
+ (0, import_react174.useEffect)(() => {
51703
+ if (activeForm && name && activeForm.formState?.errors?.root) {
51704
+ activeForm.clearErrors("root");
51705
+ }
51706
+ }, [watchedValue, name, activeForm]);
51707
+ const actualType = type === "password" ? showPassword ? "text" : "password" : type;
51708
+ const commonInputClasses = `w-full rounded-xl border font-normal transition-all placeholder:text-zinc-400 dark:placeholder:text-zinc-500 ${sizeHeightClass} ${icon ? "pl-9" : prefix ? "pl-3 rounded-l-none" : "pl-3"} ${type === "password" || rightIcon ? "pr-9" : suffix ? "pr-3 rounded-r-none" : "pr-3"} ${hasError ? "border-rose-400 dark:border-rose-800 bg-rose-50/20 dark:bg-rose-950/20 text-rose-900 dark:text-rose-200 focus:outline-none focus:ring-2 focus:ring-rose-500/20 focus:border-rose-500" : "border-zinc-200 dark:border-zinc-700 bg-zinc-50/50 dark:bg-zinc-800/60 text-zinc-900 dark:text-zinc-100 focus:outline-none focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-500"} ${disabled ? "opacity-60 cursor-not-allowed bg-zinc-100 dark:bg-zinc-800/40" : ""} ${inputClassName}`;
51709
+ return /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
51710
+ FormField_default,
51711
+ {
51712
+ label,
51713
+ id: inputId,
51714
+ required,
51715
+ error: errorMessage,
51716
+ hint,
51717
+ topRight,
51718
+ className,
51719
+ children: /* @__PURE__ */ (0, import_jsx_runtime282.jsxs)("div", { className: `relative flex items-center ${containerClassName}`, children: [
51720
+ prefix && /* @__PURE__ */ (0, import_jsx_runtime282.jsx)("div", { className: "inline-flex items-center px-3 h-full border border-r-0 border-zinc-200 dark:border-zinc-700 bg-zinc-100/70 dark:bg-zinc-800 text-zinc-500 text-xs rounded-l-xl select-none shrink-0", children: prefix }),
51721
+ icon && /* @__PURE__ */ (0, import_jsx_runtime282.jsx)("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-zinc-400", children: icon }),
51722
+ activeForm && name ? /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
51723
+ RHFInput,
51724
+ {
51725
+ ref: ref2,
51726
+ activeForm,
51727
+ name,
51728
+ id: inputId,
51729
+ type: actualType,
51730
+ disabled,
51731
+ readOnly,
51732
+ placeholder,
51733
+ onFocus,
51734
+ onBlur,
51735
+ className: commonInputClasses,
51736
+ value,
51737
+ onChange,
51738
+ ...rest
51739
+ }
51740
+ ) : /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
51741
+ "input",
51742
+ {
51743
+ ref: ref2,
51744
+ id: inputId,
51745
+ name,
51746
+ type: actualType,
51747
+ disabled,
51748
+ readOnly,
51749
+ placeholder,
51750
+ onFocus,
51751
+ onBlur,
51752
+ value: value !== void 0 ? value : "",
51753
+ onChange,
51754
+ className: commonInputClasses,
51755
+ ...rest
51756
+ }
51757
+ ),
51758
+ type === "password" && /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
51759
+ "button",
51760
+ {
51761
+ type: "button",
51762
+ onClick: () => setShowPassword(!showPassword),
51763
+ className: "absolute inset-y-0 right-0 pr-3 flex items-center text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-200 transition-colors focus:outline-none cursor-pointer",
51764
+ tabIndex: -1,
51765
+ children: showPassword ? /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(import_lucide_react133.EyeOff, { size: 15 }) : /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(import_lucide_react133.Eye, { size: 15 })
51766
+ }
51767
+ ),
51768
+ type !== "password" && rightIcon && /* @__PURE__ */ (0, import_jsx_runtime282.jsx)("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none text-zinc-400", children: rightIcon }),
51769
+ suffix && /* @__PURE__ */ (0, import_jsx_runtime282.jsx)("div", { className: "inline-flex items-center px-3 h-full border border-l-0 border-zinc-200 dark:border-zinc-700 bg-zinc-100/70 dark:bg-zinc-800 text-zinc-500 text-xs rounded-r-xl select-none shrink-0", children: suffix })
51770
+ ] })
51771
+ }
51772
+ );
51773
+ }
51774
+ );
51775
+ TextInput.displayName = "TextInput";
51776
+ var TextInput_default = TextInput;
51777
+
51778
+ // src/Antd/inputs/EmailInput.tsx
51779
+ var import_react175 = require("react");
51780
+ var import_lucide_react134 = require("lucide-react");
51781
+ var import_jsx_runtime283 = require("react/jsx-runtime");
51782
+ var EmailInput = (0, import_react175.forwardRef)(
51783
+ ({
51784
+ name,
51785
+ methods,
51786
+ form,
51787
+ icon = /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(import_lucide_react134.Mail, { size: 15 }),
51788
+ placeholder = "e.g. name@example.com",
51789
+ validateFormat = true,
51790
+ error,
51791
+ value,
51792
+ ...rest
51793
+ }, ref2) => {
51794
+ const activeForm = useFormInstance(methods, form);
51795
+ const rhfError = getFormFieldError(name, activeForm, error);
51796
+ const computedError = (0, import_react175.useMemo)(() => {
51797
+ if (rhfError) return rhfError;
51798
+ if (!validateFormat || activeForm) return null;
51799
+ const strVal = typeof value === "string" ? value.trim() : "";
51800
+ if (!strVal) return null;
51801
+ const isValidEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(strVal);
51802
+ if (!isValidEmail) {
51803
+ return "Please enter a valid email address (e.g. customer@example.com)";
51804
+ }
51805
+ return null;
51806
+ }, [rhfError, validateFormat, activeForm, value]);
51807
+ return /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
51808
+ TextInput_default,
51809
+ {
51810
+ ref: ref2,
51811
+ name,
51812
+ methods,
51813
+ form,
51814
+ type: "email",
51815
+ autoComplete: "email",
51816
+ icon,
51817
+ placeholder,
51818
+ error: computedError,
51819
+ value,
51820
+ ...rest
51821
+ }
51822
+ );
51823
+ }
51824
+ );
51825
+ EmailInput.displayName = "EmailInput";
51826
+
51827
+ // src/Antd/inputs/PhoneInput.tsx
51828
+ var import_react176 = require("react");
51829
+ var import_react_phone_number_input2 = __toESM(require("react-phone-number-input"));
51830
+ var import_style2 = require("react-phone-number-input/style.css");
51831
+ var import_react_hook_form82 = require("react-hook-form");
51832
+ var import_jsx_runtime284 = require("react/jsx-runtime");
51833
+ var isValidPhoneNumber2 = (phone) => {
51834
+ if (!phone || typeof phone !== "string" || !phone.trim()) return false;
51835
+ try {
51836
+ return (0, import_react_phone_number_input2.isValidPhoneNumber)(phone.trim());
51837
+ } catch (e) {
51838
+ return false;
51839
+ }
51840
+ };
51841
+ var PhoneInput2 = (0, import_react176.forwardRef)(
51842
+ ({
51843
+ label = "Phone Number",
51844
+ id,
51845
+ name,
51846
+ methods,
51847
+ form,
51848
+ required,
51849
+ disabled,
51850
+ readOnly,
51851
+ error,
51852
+ hint,
51853
+ topRight,
51854
+ icon,
51855
+ placeholder = "e.g. 712 345 678",
51856
+ className = "",
51857
+ inputClassName = "",
51858
+ containerClassName = "",
51859
+ value,
51860
+ onChange,
51861
+ defaultCountry = "KE",
51862
+ international = true,
51863
+ withCountryCallingCode = true,
51864
+ ...props
51865
+ }, ref2) => {
51866
+ const activeForm = useFormInstance(methods, form);
51867
+ const inputId = id || name || "phone-input";
51868
+ const errorMessage = getFormFieldError(name, activeForm, error);
51869
+ const hasError = Boolean(errorMessage);
51870
+ const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
51871
+ FormField_default,
51872
+ {
51873
+ label,
51874
+ id: inputId,
51875
+ required,
51876
+ error: errorMessage,
51877
+ hint,
51878
+ topRight,
51879
+ className,
51880
+ children: /* @__PURE__ */ (0, import_jsx_runtime284.jsxs)("div", { className: `relative ${containerClassName}`, children: [
51881
+ icon && /* @__PURE__ */ (0, import_jsx_runtime284.jsx)("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none z-10 text-zinc-400", children: icon }),
51882
+ /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
51883
+ import_react_phone_number_input2.default,
51884
+ {
51885
+ ref: ref2,
51886
+ id: inputId,
51887
+ name,
51888
+ defaultCountry,
51889
+ international,
51890
+ withCountryCallingCode,
51891
+ value: currentValue,
51892
+ onChange: (val) => onChangeHandler(val ? String(val) : ""),
51893
+ disabled: disabled || readOnly,
51894
+ placeholder,
51895
+ className: `flex items-center w-full h-10 rounded-xl border bg-zinc-50/50 dark:bg-zinc-800/60 text-zinc-900 dark:text-zinc-100 transition-all font-mono text-xs ${icon ? "pl-9" : "pl-3"} pr-3 ${hasError ? "border-rose-400 dark:border-rose-800 bg-rose-50/20 dark:bg-rose-950/20 text-rose-900 dark:text-rose-200 focus-within:ring-2 focus-within:ring-rose-500/20 focus-within:border-rose-500" : "border-zinc-200 dark:border-zinc-700 focus-within:ring-2 focus-within:ring-emerald-500/20 focus-within:border-emerald-500"} ${disabled ? "opacity-60 cursor-not-allowed bg-zinc-100 dark:bg-zinc-800/40" : ""} [&_.PhoneInputCountry]:mr-2.5 [&_.PhoneInputCountry]:flex [&_.PhoneInputCountry]:items-center [&_.PhoneInputCountryIcon]:rounded-xs [&_.PhoneInputCountryIcon]:shadow-xs [&_.PhoneInputCountrySelect]:cursor-pointer [&_.PhoneInputCountrySelectArrow]:text-zinc-400 [&_.PhoneInputCountrySelectArrow]:opacity-70 [&_.PhoneInputInput]:bg-transparent [&_.PhoneInputInput]:border-none [&_.PhoneInputInput]:outline-none [&_.PhoneInputInput]:text-xs [&_.PhoneInputInput]:font-mono [&_.PhoneInputInput]:text-zinc-900 [&_.PhoneInputInput]:dark:text-zinc-100 [&_.PhoneInputInput::placeholder]:text-zinc-400 [&_.PhoneInputInput]:w-full [&_.PhoneInputInput]:h-full [&_.PhoneInputInput]:focus:ring-0 ${inputClassName}`,
51896
+ ...props
51897
+ }
51898
+ )
51899
+ ] })
51900
+ }
51901
+ );
51902
+ if (activeForm && name) {
51903
+ return /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
51904
+ import_react_hook_form82.Controller,
51905
+ {
51906
+ name,
51907
+ control: activeForm.control,
51908
+ rules: {
51909
+ validate: (val) => !val || isValidPhoneNumber2(val) ? true : "Invalid phone number"
51910
+ },
51911
+ render: ({ field: { onChange: fieldOnChange, value: fieldValue } }) => renderInput(
51912
+ (val) => {
51913
+ fieldOnChange(val);
51914
+ onChange?.(val);
51915
+ },
51916
+ fieldValue || ""
51917
+ )
51918
+ }
51919
+ );
51920
+ }
51921
+ return renderInput(onChange || (() => {
51922
+ }), value || "");
51923
+ }
51924
+ );
51925
+ PhoneInput2.displayName = "PhoneInput";
51926
+
51927
+ // src/Antd/inputs/NumberInput.tsx
51928
+ var import_react177 = require("react");
51929
+ var import_lucide_react135 = require("lucide-react");
51930
+ var import_react_hook_form83 = require("react-hook-form");
51931
+ var import_jsx_runtime285 = require("react/jsx-runtime");
51932
+ var NumberInput = (0, import_react177.forwardRef)(
51933
+ ({
51934
+ label,
51935
+ id,
51936
+ name,
51937
+ methods,
51938
+ form,
51939
+ required,
51940
+ disabled,
51941
+ readOnly,
51942
+ error,
51943
+ hint,
51944
+ topRight,
51945
+ icon,
51946
+ rightIcon,
51947
+ prefix,
51948
+ suffix,
51949
+ placeholder = "0",
51950
+ className = "",
51951
+ inputClassName = "",
51952
+ containerClassName = "",
51953
+ size = "md",
51954
+ value,
51955
+ onChange,
51956
+ min,
51957
+ max,
51958
+ step = 1,
51959
+ allowDecimals = true,
51960
+ showControls = false,
51961
+ formatSeparators = false,
51962
+ ...rest
51963
+ }, ref2) => {
51964
+ const activeForm = useFormInstance(methods, form);
51965
+ const inputId = id || name || (label ? String(label).toLowerCase().replace(/\s+/g, "-") : void 0);
51966
+ const errorMessage = getFormFieldError(name, activeForm, error);
51967
+ const hasError = Boolean(errorMessage);
51968
+ const sizeHeightClass = size === "sm" ? "h-8 text-xs" : size === "lg" ? "h-12 text-sm" : "h-10 text-xs";
51969
+ const formatDisplay = (val) => {
51970
+ if (val === void 0 || val === null || val === "") return "";
51971
+ if (formatSeparators) {
51972
+ return String(val).split(".").map(
51973
+ (part, idx) => idx === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part
51974
+ ).join(".");
51975
+ }
51976
+ return String(val);
51977
+ };
51978
+ const renderInput = (inputRef, currentValue, onValueChange, onInputBlur) => {
51979
+ const displayVal = formatDisplay(currentValue);
51980
+ const handleChange = (e) => {
51981
+ const rawVal = e.target.value.replace(/,/g, "").trim();
51982
+ if (rawVal === "" || rawVal === "-") {
51983
+ onValueChange(void 0, rawVal);
51984
+ return;
51985
+ }
51986
+ const regex = allowDecimals ? /^-?\d*\.?\d*$/ : /^-?\d*$/;
51987
+ if (!regex.test(rawVal)) {
51988
+ return;
51989
+ }
51990
+ const parsed = allowDecimals ? parseFloat(rawVal) : parseInt(rawVal, 10);
51991
+ onValueChange(isNaN(parsed) ? void 0 : parsed, rawVal);
51992
+ };
51993
+ const handleStep = (delta) => {
51994
+ if (disabled || readOnly) return;
51995
+ const current = typeof currentValue === "number" ? currentValue : parseFloat(String(currentValue || 0).replace(/,/g, "")) || 0;
51996
+ let nextVal = current + delta * step;
51997
+ if (min !== void 0 && nextVal < min) nextVal = min;
51998
+ if (max !== void 0 && nextVal > max) nextVal = max;
51999
+ const rounded = allowDecimals ? parseFloat(nextVal.toFixed(6)) : Math.round(nextVal);
52000
+ onValueChange(rounded, String(rounded));
52001
+ };
52002
+ return /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
52003
+ FormField_default,
52004
+ {
52005
+ label,
52006
+ id: inputId,
52007
+ required,
52008
+ error: errorMessage,
52009
+ hint,
52010
+ topRight,
52011
+ className,
52012
+ children: /* @__PURE__ */ (0, import_jsx_runtime285.jsxs)("div", { className: `relative flex items-center ${containerClassName}`, children: [
52013
+ prefix && /* @__PURE__ */ (0, import_jsx_runtime285.jsx)("div", { className: "inline-flex items-center px-3 h-full border border-r-0 border-zinc-200 dark:border-zinc-700 bg-zinc-100/70 dark:bg-zinc-800 text-zinc-500 text-xs rounded-l-xl select-none shrink-0", children: prefix }),
52014
+ icon && /* @__PURE__ */ (0, import_jsx_runtime285.jsx)("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-zinc-400", children: icon }),
52015
+ /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
52016
+ "input",
52017
+ {
52018
+ ref: inputRef || ref2,
52019
+ id: inputId,
52020
+ name,
52021
+ type: "text",
52022
+ inputMode: allowDecimals ? "decimal" : "numeric",
52023
+ value: displayVal,
52024
+ onChange: handleChange,
52025
+ onBlur: onInputBlur,
52026
+ disabled,
52027
+ readOnly,
52028
+ placeholder,
52029
+ className: `w-full rounded-xl border font-mono transition-all placeholder:text-zinc-400 ${sizeHeightClass} ${icon ? "pl-9" : prefix ? "pl-3 rounded-l-none" : "pl-3"} ${showControls ? "pr-8" : rightIcon ? "pr-9" : suffix ? "pr-3 rounded-r-none" : "pr-3"} ${hasError ? "border-rose-400 dark:border-rose-800 bg-rose-50/20 dark:bg-rose-950/20 text-rose-900 dark:text-rose-200 focus:outline-none focus:ring-2 focus:ring-rose-500/20 focus:border-rose-500" : "border-zinc-200 dark:border-zinc-700 bg-zinc-50/50 dark:bg-zinc-800/60 text-zinc-900 dark:text-zinc-100 focus:outline-none focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-500"} ${disabled ? "opacity-60 cursor-not-allowed bg-zinc-100 dark:bg-zinc-800/40" : ""} ${inputClassName}`,
52030
+ ...rest
52031
+ }
52032
+ ),
52033
+ showControls && !disabled && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime285.jsxs)("div", { className: "absolute inset-y-1 right-1 flex flex-col justify-between w-6 border-l border-zinc-200 dark:border-zinc-700 pl-1", children: [
52034
+ /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
52035
+ "button",
52036
+ {
52037
+ type: "button",
52038
+ tabIndex: -1,
52039
+ onClick: () => handleStep(1),
52040
+ className: "flex-1 flex items-center justify-center text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-xs cursor-pointer",
52041
+ children: /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(import_lucide_react135.ChevronUp, { size: 11 })
52042
+ }
52043
+ ),
52044
+ /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
52045
+ "button",
52046
+ {
52047
+ type: "button",
52048
+ tabIndex: -1,
52049
+ onClick: () => handleStep(-1),
52050
+ className: "flex-1 flex items-center justify-center text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-xs cursor-pointer",
52051
+ children: /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(import_lucide_react135.ChevronDown, { size: 11 })
52052
+ }
52053
+ )
52054
+ ] }),
52055
+ !showControls && rightIcon && /* @__PURE__ */ (0, import_jsx_runtime285.jsx)("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none text-zinc-400", children: rightIcon }),
52056
+ suffix && /* @__PURE__ */ (0, import_jsx_runtime285.jsx)("div", { className: "inline-flex items-center px-3 h-full border border-l-0 border-zinc-200 dark:border-zinc-700 bg-zinc-100/70 dark:bg-zinc-800 text-zinc-500 text-xs rounded-r-xl select-none shrink-0", children: suffix })
52057
+ ] })
52058
+ }
52059
+ );
52060
+ };
52061
+ if (activeForm && name) {
52062
+ return /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
52063
+ import_react_hook_form83.Controller,
52064
+ {
52065
+ control: activeForm.control,
52066
+ name,
52067
+ render: ({
52068
+ field: {
52069
+ onChange: fieldOnChange,
52070
+ value: fieldValue,
52071
+ ref: fieldRef,
52072
+ onBlur: fieldOnBlur
52073
+ }
52074
+ }) => renderInput(
52075
+ fieldRef,
52076
+ fieldValue !== void 0 ? fieldValue : value !== void 0 ? value : "",
52077
+ (numVal, rawStr) => {
52078
+ fieldOnChange(numVal !== void 0 ? numVal : "");
52079
+ onChange?.(numVal, rawStr);
52080
+ },
52081
+ fieldOnBlur
52082
+ )
52083
+ }
52084
+ );
52085
+ }
52086
+ return renderInput(
52087
+ ref2,
52088
+ value !== void 0 ? value : "",
52089
+ (numVal, rawStr) => {
52090
+ onChange?.(numVal, rawStr);
52091
+ }
52092
+ );
52093
+ }
52094
+ );
52095
+ NumberInput.displayName = "NumberInput";
52096
+
52097
+ // src/Antd/inputs/AmountInput.tsx
52098
+ var import_react178 = require("react");
52099
+ var import_react_hook_form84 = require("react-hook-form");
52100
+ var import_jsx_runtime286 = require("react/jsx-runtime");
52101
+ var AmountInput = (0, import_react178.forwardRef)(
52102
+ ({
52103
+ label,
52104
+ id,
52105
+ name,
52106
+ methods,
52107
+ form,
52108
+ required,
52109
+ disabled,
52110
+ readOnly,
52111
+ error,
52112
+ hint,
52113
+ topRight,
52114
+ icon,
52115
+ rightIcon,
52116
+ suffix,
52117
+ placeholder = "0.00",
52118
+ className = "",
52119
+ inputClassName = "",
52120
+ containerClassName = "",
52121
+ size = "md",
52122
+ value,
52123
+ onChange,
52124
+ currency = "KES",
52125
+ currencyPosition = "prefix",
52126
+ decimals = 2,
52127
+ allowNegative = false,
52128
+ min,
52129
+ max,
52130
+ formatSeparators = true,
52131
+ ...rest
52132
+ }, ref2) => {
52133
+ const activeForm = useFormInstance(methods, form);
52134
+ const inputId = id || name || (label ? String(label).toLowerCase().replace(/\s+/g, "-") : void 0);
52135
+ const errorMessage = getFormFieldError(name, activeForm, error);
52136
+ const hasError = Boolean(errorMessage);
52137
+ const formatNumber = (val) => {
52138
+ if (val === void 0 || val === null || val === "") return "";
52139
+ const num = typeof val === "number" ? val : parseFloat(String(val).replace(/,/g, ""));
52140
+ if (isNaN(num)) return "";
52141
+ if (formatSeparators) {
52142
+ return num.toLocaleString("en-US", {
52143
+ minimumFractionDigits: 0,
52144
+ maximumFractionDigits: decimals
52145
+ });
52146
+ }
52147
+ return String(num);
52148
+ };
52149
+ const sizeHeightClass = size === "sm" ? "h-8 text-xs" : size === "lg" ? "h-12 text-sm" : "h-10 text-xs";
52150
+ const currencyBadge = currency ? /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("span", { className: "font-semibold text-zinc-600 dark:text-zinc-300 font-mono text-[11px] tracking-wide", children: currency }) : null;
52151
+ const renderInput = (inputRef, currentValue, onValueChange, onInputBlur) => {
52152
+ const [isFocused, setIsFocused] = (0, import_react178.useState)(false);
52153
+ const [displayValue, setDisplayValue] = (0, import_react178.useState)(
52154
+ () => formatNumber(currentValue)
52155
+ );
52156
+ (0, import_react178.useEffect)(() => {
52157
+ if (!isFocused) {
52158
+ setDisplayValue(formatNumber(currentValue));
52159
+ }
52160
+ }, [currentValue, isFocused]);
52161
+ const handleFocus = () => {
52162
+ setIsFocused(true);
52163
+ if (currentValue !== void 0 && currentValue !== "") {
52164
+ setDisplayValue(String(currentValue).replace(/,/g, ""));
52165
+ }
52166
+ };
52167
+ const handleBlur = () => {
52168
+ setIsFocused(false);
52169
+ setDisplayValue(formatNumber(currentValue));
52170
+ onInputBlur?.();
52171
+ };
52172
+ const handleChange = (e) => {
52173
+ let rawVal = e.target.value.replace(/,/g, "").trim();
52174
+ if (rawVal === "" || allowNegative && rawVal === "-") {
52175
+ setDisplayValue(rawVal);
52176
+ onValueChange(void 0, rawVal);
52177
+ return;
52178
+ }
52179
+ const regex = allowNegative ? decimals > 0 ? /^-?\d*\.?\d*$/ : /^-?\d*$/ : decimals > 0 ? /^\d*\.?\d*$/ : /^\d*$/;
52180
+ if (!regex.test(rawVal)) {
52181
+ return;
52182
+ }
52183
+ if (decimals > 0 && rawVal.includes(".")) {
52184
+ const parts = rawVal.split(".");
52185
+ if (parts[1].length > decimals) {
52186
+ rawVal = `${parts[0]}.${parts[1].slice(0, decimals)}`;
52187
+ }
52188
+ }
52189
+ setDisplayValue(rawVal);
52190
+ const parsed = parseFloat(rawVal);
52191
+ if (!isNaN(parsed)) {
52192
+ let finalNum = parsed;
52193
+ if (min !== void 0 && finalNum < min) finalNum = min;
52194
+ if (max !== void 0 && finalNum > max) finalNum = max;
52195
+ onValueChange(finalNum, rawVal);
52196
+ } else {
52197
+ onValueChange(void 0, rawVal);
52198
+ }
52199
+ };
52200
+ return /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(
52201
+ FormField_default,
52202
+ {
52203
+ label,
52204
+ id: inputId,
52205
+ required,
52206
+ error: errorMessage,
52207
+ hint,
52208
+ topRight,
52209
+ className,
52210
+ children: /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)("div", { className: `relative flex items-center ${containerClassName}`, children: [
52211
+ currencyPosition === "prefix" && currencyBadge && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("div", { className: "inline-flex items-center px-3 h-10 border border-r-0 border-zinc-200 dark:border-zinc-700 bg-zinc-100/70 dark:bg-zinc-800 rounded-l-xl select-none shrink-0", children: currencyBadge }),
52212
+ icon && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-zinc-400", children: icon }),
52213
+ /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(
52214
+ "input",
52215
+ {
52216
+ ref: inputRef || ref2,
52217
+ id: inputId,
52218
+ name,
52219
+ type: "text",
52220
+ inputMode: "decimal",
52221
+ value: displayValue,
52222
+ onChange: handleChange,
52223
+ onFocus: handleFocus,
52224
+ onBlur: handleBlur,
52225
+ disabled,
52226
+ readOnly,
52227
+ placeholder,
52228
+ className: `w-full rounded-xl border font-mono font-medium transition-all placeholder:text-zinc-400 ${sizeHeightClass} ${icon ? "pl-9" : currencyPosition === "prefix" && currencyBadge ? "pl-3 rounded-l-none" : "pl-3"} ${rightIcon ? "pr-9" : currencyPosition === "suffix" && currencyBadge ? "pr-3 rounded-r-none" : suffix ? "pr-3 rounded-r-none" : "pr-3"} ${hasError ? "border-rose-400 dark:border-rose-800 bg-rose-50/20 dark:bg-rose-950/20 text-rose-900 dark:text-rose-200 focus:outline-none focus:ring-2 focus:ring-rose-500/20 focus:border-rose-500" : "border-zinc-200 dark:border-zinc-700 bg-zinc-50/50 dark:bg-zinc-800/60 text-zinc-900 dark:text-zinc-100 focus:outline-none focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-500"} ${disabled ? "opacity-60 cursor-not-allowed bg-zinc-100 dark:bg-zinc-800/40" : ""} ${inputClassName}`,
52229
+ ...rest
52230
+ }
52231
+ ),
52232
+ rightIcon && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none text-zinc-400", children: rightIcon }),
52233
+ currencyPosition === "suffix" && currencyBadge && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("div", { className: "inline-flex items-center px-3 h-10 border border-l-0 border-zinc-200 dark:border-zinc-700 bg-zinc-100/70 dark:bg-zinc-800 rounded-r-xl select-none shrink-0", children: currencyBadge }),
52234
+ suffix && !currencyBadge && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("div", { className: "inline-flex items-center px-3 h-10 border border-l-0 border-zinc-200 dark:border-zinc-700 bg-zinc-100/70 dark:bg-zinc-800 text-zinc-500 text-xs rounded-r-xl select-none shrink-0", children: suffix })
52235
+ ] })
52236
+ }
52237
+ );
52238
+ };
52239
+ if (activeForm && name) {
52240
+ return /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(
52241
+ import_react_hook_form84.Controller,
52242
+ {
52243
+ control: activeForm.control,
52244
+ name,
52245
+ render: ({
52246
+ field: {
52247
+ onChange: fieldOnChange,
52248
+ value: fieldValue,
52249
+ ref: fieldRef,
52250
+ onBlur: fieldOnBlur
52251
+ }
52252
+ }) => renderInput(
52253
+ fieldRef,
52254
+ fieldValue !== void 0 ? fieldValue : value !== void 0 ? value : "",
52255
+ (numVal, rawStr) => {
52256
+ fieldOnChange(numVal !== void 0 ? numVal : "");
52257
+ onChange?.(numVal, rawStr);
52258
+ },
52259
+ fieldOnBlur
52260
+ )
52261
+ }
52262
+ );
52263
+ }
52264
+ return renderInput(
52265
+ ref2,
52266
+ value !== void 0 ? value : "",
52267
+ (numVal, rawStr) => {
52268
+ onChange?.(numVal, rawStr);
52269
+ }
52270
+ );
52271
+ }
52272
+ );
52273
+ AmountInput.displayName = "AmountInput";
52274
+
52275
+ // src/Antd/inputs/SelectInput.tsx
52276
+ var import_react179 = require("react");
52277
+ var import_lucide_react136 = require("lucide-react");
52278
+ var import_react_hook_form85 = require("react-hook-form");
52279
+ var import_jsx_runtime287 = require("react/jsx-runtime");
52280
+ var SelectInput = (0, import_react179.forwardRef)(
52281
+ ({
52282
+ label,
52283
+ id,
52284
+ name,
52285
+ methods,
52286
+ form,
52287
+ required,
52288
+ disabled,
52289
+ error,
52290
+ hint,
52291
+ topRight,
52292
+ icon,
52293
+ placeholder = "Select an option...",
52294
+ className = "",
52295
+ inputClassName = "",
52296
+ containerClassName = "",
52297
+ size = "md",
52298
+ options: options11 = [],
52299
+ value,
52300
+ onChange,
52301
+ isSearchable = false,
52302
+ isClearable = false,
52303
+ emptyText = "No options found"
52304
+ }, ref2) => {
52305
+ const activeForm = useFormInstance(methods, form);
52306
+ const inputId = id || name || (label ? String(label).toLowerCase().replace(/\s+/g, "-") : void 0);
52307
+ const errorMessage = getFormFieldError(name, activeForm, error);
52308
+ const hasError = Boolean(errorMessage);
52309
+ const renderSelect = (buttonRef, currentValue, onValueChange) => {
52310
+ const [isOpen, setIsOpen] = (0, import_react179.useState)(false);
52311
+ const [searchQuery, setSearchQuery] = (0, import_react179.useState)("");
52312
+ const dropdownRef = (0, import_react179.useRef)(null);
52313
+ const searchInputRef = (0, import_react179.useRef)(null);
52314
+ const selectedOption = (0, import_react179.useMemo)(() => {
52315
+ return options11.find((opt) => opt.value === currentValue);
52316
+ }, [currentValue, options11]);
52317
+ (0, import_react179.useEffect)(() => {
52318
+ const handleClickOutside = (event) => {
52319
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
52320
+ setIsOpen(false);
52321
+ }
52322
+ };
52323
+ if (isOpen) {
52324
+ document.addEventListener("mousedown", handleClickOutside);
52325
+ if (isSearchable) {
52326
+ setTimeout(() => searchInputRef.current?.focus(), 50);
52327
+ }
52328
+ }
52329
+ return () => {
52330
+ document.removeEventListener("mousedown", handleClickOutside);
52331
+ };
52332
+ }, [isOpen, isSearchable]);
52333
+ const filteredOptions = (0, import_react179.useMemo)(() => {
52334
+ if (!isSearchable || !searchQuery.trim()) return options11;
52335
+ const q = searchQuery.toLowerCase().trim();
52336
+ return options11.filter(
52337
+ (opt) => opt.label.toLowerCase().includes(q) || opt.sublabel && opt.sublabel.toLowerCase().includes(q)
52338
+ );
52339
+ }, [isSearchable, searchQuery, options11]);
52340
+ const sizeHeightClass = size === "sm" ? "h-8 text-xs" : size === "lg" ? "h-12 text-sm" : "h-10 text-xs";
52341
+ const handleSelect = (option) => {
52342
+ if (option.disabled || disabled) return;
52343
+ onValueChange(option.value, option);
52344
+ setIsOpen(false);
52345
+ setSearchQuery("");
52346
+ };
52347
+ const handleClear = (e) => {
52348
+ e.stopPropagation();
52349
+ onValueChange("", void 0);
52350
+ };
52351
+ return /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
52352
+ FormField_default,
52353
+ {
52354
+ label,
52355
+ id: inputId,
52356
+ required,
52357
+ error: errorMessage,
52358
+ hint,
52359
+ topRight,
52360
+ className,
52361
+ children: /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("div", { className: `relative ${containerClassName}`, ref: dropdownRef, children: [
52362
+ /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)(
52363
+ "button",
52364
+ {
52365
+ ref: buttonRef || ref2,
52366
+ id: inputId,
52367
+ type: "button",
52368
+ disabled,
52369
+ onClick: () => {
52370
+ if (!disabled) {
52371
+ setIsOpen(!isOpen);
52372
+ setSearchQuery("");
52373
+ }
52374
+ },
52375
+ className: `w-full rounded-xl border flex items-center justify-between text-left transition-all cursor-pointer select-none ${sizeHeightClass} ${icon ? "pl-9" : "pl-3"} pr-3 ${hasError ? "border-rose-400 dark:border-rose-800 bg-rose-50/20 dark:bg-rose-950/20 text-rose-900 dark:text-rose-200 focus:outline-none focus:ring-2 focus:ring-rose-500/20 focus:border-rose-500" : isOpen ? "border-emerald-500 ring-2 ring-emerald-500/20 bg-white dark:bg-zinc-850 text-zinc-900 dark:text-zinc-100" : "border-zinc-200 dark:border-zinc-700 bg-zinc-50/50 dark:bg-zinc-800/60 hover:bg-zinc-100/60 dark:hover:bg-zinc-800/90 text-zinc-900 dark:text-zinc-100"} ${disabled ? "opacity-60 cursor-not-allowed bg-zinc-100 dark:bg-zinc-800/40" : ""} ${inputClassName}`,
52376
+ children: [
52377
+ icon && /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-zinc-400", children: icon }),
52378
+ /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("div", { className: "flex items-center gap-2 min-w-0 flex-1 truncate", children: [
52379
+ selectedOption?.icon && /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("span", { className: "shrink-0 text-zinc-500", children: selectedOption.icon }),
52380
+ /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
52381
+ "span",
52382
+ {
52383
+ className: `truncate ${selectedOption ? "font-medium text-zinc-900 dark:text-zinc-100" : "text-zinc-400 dark:text-zinc-500 font-normal"}`,
52384
+ children: selectedOption ? selectedOption.label : placeholder
52385
+ }
52386
+ )
52387
+ ] }),
52388
+ /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("div", { className: "flex items-center gap-1 shrink-0 ml-2", children: [
52389
+ isClearable && selectedOption && !disabled && /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
52390
+ "span",
52391
+ {
52392
+ role: "button",
52393
+ tabIndex: 0,
52394
+ onClick: handleClear,
52395
+ onKeyDown: (e) => {
52396
+ if (e.key === "Enter" || e.key === " ") {
52397
+ handleClear(e);
52398
+ }
52399
+ },
52400
+ className: "p-1 rounded-md text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200 hover:bg-zinc-200/50 dark:hover:bg-zinc-700/50 cursor-pointer",
52401
+ title: "Clear selection",
52402
+ children: /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(import_lucide_react136.X, { size: 12 })
52403
+ }
52404
+ ),
52405
+ /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
52406
+ import_lucide_react136.ChevronDown,
52407
+ {
52408
+ size: 14,
52409
+ className: `text-zinc-400 transition-transform duration-200 ${isOpen ? "rotate-180 text-emerald-500" : ""}`
52410
+ }
52411
+ )
52412
+ ] })
52413
+ ]
52414
+ }
52415
+ ),
52416
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("div", { className: "absolute top-full left-0 mt-1.5 z-50 w-full min-w-48 bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-2xl shadow-xl overflow-hidden flex flex-col animate-in fade-in zoom-in-95 duration-150", children: [
52417
+ isSearchable && /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("div", { className: "p-2 border-b border-zinc-100 dark:border-zinc-800 bg-zinc-50/50 dark:bg-zinc-900/90 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("div", { className: "relative", children: [
52418
+ /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("div", { className: "absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none text-zinc-400", children: /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(import_lucide_react136.Search, { size: 13 }) }),
52419
+ /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
52420
+ "input",
52421
+ {
52422
+ ref: searchInputRef,
52423
+ type: "text",
52424
+ value: searchQuery,
52425
+ onChange: (e) => setSearchQuery(e.target.value),
52426
+ placeholder: "Search options...",
52427
+ className: "w-full h-8 pl-8 pr-7 text-xs rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 focus:outline-none focus:ring-1 focus:ring-emerald-500 placeholder:text-zinc-400"
52428
+ }
52429
+ ),
52430
+ searchQuery && /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
52431
+ "button",
52432
+ {
52433
+ type: "button",
52434
+ onClick: () => setSearchQuery(""),
52435
+ className: "absolute inset-y-0 right-0 pr-2 flex items-center text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-200 cursor-pointer",
52436
+ children: /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(import_lucide_react136.X, { size: 12 })
52437
+ }
52438
+ )
52439
+ ] }) }),
52440
+ /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("div", { className: "max-h-60 overflow-y-auto p-1 divide-y divide-zinc-50 dark:divide-zinc-850", children: filteredOptions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("div", { className: "p-4 text-center text-xs text-zinc-400", children: emptyText }) : filteredOptions.map((opt, idx) => {
52441
+ const isSelected = opt.value === currentValue;
52442
+ return /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)(
52443
+ "button",
52444
+ {
52445
+ type: "button",
52446
+ disabled: opt.disabled,
52447
+ onClick: () => handleSelect(opt),
52448
+ className: `w-full px-3 py-2 flex items-center justify-between text-xs rounded-lg transition-colors cursor-pointer text-left ${isSelected ? "bg-emerald-50 dark:bg-emerald-950/40 text-emerald-700 dark:text-emerald-300 font-semibold" : "hover:bg-zinc-100 dark:hover:bg-zinc-800 text-zinc-800 dark:text-zinc-200"} ${opt.disabled ? "opacity-50 cursor-not-allowed hover:bg-transparent" : ""}`,
52449
+ children: [
52450
+ /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("div", { className: "flex items-center gap-2 min-w-0 flex-1", children: [
52451
+ opt.icon && /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("span", { className: "shrink-0", children: opt.icon }),
52452
+ /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("div", { className: "min-w-0 flex-1", children: [
52453
+ /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("div", { className: "truncate", children: opt.label }),
52454
+ opt.sublabel && /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("div", { className: "text-[10px] text-zinc-400 font-normal truncate", children: opt.sublabel })
52455
+ ] })
52456
+ ] }),
52457
+ /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("div", { className: "flex items-center gap-1.5 shrink-0 ml-2", children: [
52458
+ opt.badge && /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("span", { className: "text-[10px] px-1.5 py-0.5 rounded-full bg-zinc-100 dark:bg-zinc-800 text-zinc-500 font-normal", children: opt.badge }),
52459
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
52460
+ import_lucide_react136.Check,
52461
+ {
52462
+ size: 13,
52463
+ className: "text-emerald-500 shrink-0"
52464
+ }
52465
+ )
52466
+ ] })
52467
+ ]
52468
+ },
52469
+ `${opt.value}-${idx}`
52470
+ );
52471
+ }) })
52472
+ ] })
52473
+ ] })
52474
+ }
52475
+ );
52476
+ };
52477
+ if (activeForm && name) {
52478
+ return /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
52479
+ import_react_hook_form85.Controller,
52480
+ {
52481
+ control: activeForm.control,
52482
+ name,
52483
+ render: ({
52484
+ field: {
52485
+ onChange: fieldOnChange,
52486
+ value: fieldValue,
52487
+ ref: fieldRef
52488
+ }
52489
+ }) => renderSelect(
52490
+ fieldRef,
52491
+ fieldValue !== void 0 ? fieldValue : value !== void 0 ? value : "",
52492
+ (val, opt) => {
52493
+ fieldOnChange(val);
52494
+ onChange?.(val, opt);
52495
+ }
52496
+ )
52497
+ }
52498
+ );
52499
+ }
52500
+ return renderSelect(
52501
+ ref2,
52502
+ value !== void 0 ? value : "",
52503
+ (val, opt) => {
52504
+ onChange?.(val, opt);
52505
+ }
52506
+ );
52507
+ }
52508
+ );
52509
+ SelectInput.displayName = "SelectInput";
52510
+
52511
+ // src/Antd/inputs/countryData.ts
52512
+ var COUNTRIES = [
52513
+ // Primary / Regional (East Africa & Horn of Africa)
52514
+ {
52515
+ code: "+254",
52516
+ dialCode: "254",
52517
+ country: "Kenya",
52518
+ flag: "\u{1F1F0}\u{1F1EA}",
52519
+ sample: "712 345 678",
52520
+ expectedLength: 9,
52521
+ minLength: 9,
52522
+ maxLength: 9,
52523
+ pattern: /^[17]\d{8}$/
52524
+ },
52525
+ {
52526
+ code: "+252",
52527
+ dialCode: "252",
52528
+ country: "Somalia",
52529
+ flag: "\u{1F1F8}\u{1F1F4}",
52530
+ sample: "61 234 5678",
52531
+ expectedLength: 9,
52532
+ minLength: 8,
52533
+ maxLength: 9,
52534
+ pattern: /^[679]\d{7,8}$/
52535
+ },
52536
+ {
52537
+ code: "+256",
52538
+ dialCode: "256",
52539
+ country: "Uganda",
52540
+ flag: "\u{1F1FA}\u{1F1EC}",
52541
+ sample: "712 345 678",
52542
+ expectedLength: 9,
52543
+ minLength: 9,
52544
+ maxLength: 9,
52545
+ pattern: /^[7]\d{8}$/
52546
+ },
52547
+ {
52548
+ code: "+255",
52549
+ dialCode: "255",
52550
+ country: "Tanzania",
52551
+ flag: "\u{1F1F9}\u{1F1FF}",
52552
+ sample: "712 345 678",
52553
+ expectedLength: 9,
52554
+ minLength: 9,
52555
+ maxLength: 9,
52556
+ pattern: /^[67]\d{8}$/
52557
+ },
52558
+ {
52559
+ code: "+251",
52560
+ dialCode: "251",
52561
+ country: "Ethiopia",
52562
+ flag: "\u{1F1EA}\u{1F1F9}",
52563
+ sample: "91 234 5678",
52564
+ expectedLength: 9,
52565
+ minLength: 9,
52566
+ maxLength: 9,
52567
+ pattern: /^[79]\d{8}$/
52568
+ },
52569
+ {
52570
+ code: "+253",
52571
+ dialCode: "253",
52572
+ country: "Djibouti",
52573
+ flag: "\u{1F1E9}\u{1F1EF}",
52574
+ sample: "77 12 34 56",
52575
+ expectedLength: 8,
52576
+ minLength: 8,
52577
+ maxLength: 8,
52578
+ pattern: /^[72]\d{7}$/
52579
+ },
52580
+ {
52581
+ code: "+211",
52582
+ dialCode: "211",
52583
+ country: "South Sudan",
52584
+ flag: "\u{1F1F8}\u{1F1F8}",
52585
+ sample: "912 345 678",
52586
+ expectedLength: 9,
52587
+ minLength: 9,
52588
+ maxLength: 9,
52589
+ pattern: /^[9]\d{8}$/
52590
+ },
52591
+ {
52592
+ code: "+250",
52593
+ dialCode: "250",
52594
+ country: "Rwanda",
52595
+ flag: "\u{1F1F7}\u{1F1FC}",
52596
+ sample: "788 123 456",
52597
+ expectedLength: 9,
52598
+ minLength: 9,
52599
+ maxLength: 9,
52600
+ pattern: /^[7]\d{8}$/
52601
+ },
52602
+ {
52603
+ code: "+257",
52604
+ dialCode: "257",
52605
+ country: "Burundi",
52606
+ flag: "\u{1F1E7}\u{1F1EE}",
52607
+ sample: "79 123 456",
52608
+ expectedLength: 8,
52609
+ minLength: 8,
52610
+ maxLength: 8,
52611
+ pattern: /^[76]\d{7}$/
52612
+ },
52613
+ {
52614
+ code: "+249",
52615
+ dialCode: "249",
52616
+ country: "Sudan",
52617
+ flag: "\u{1F1F8}\u{1F1E9}",
52618
+ sample: "91 234 5678",
52619
+ expectedLength: 9,
52620
+ minLength: 9,
52621
+ maxLength: 9,
52622
+ pattern: /^[91]\d{8}$/
52623
+ },
52624
+ // Middle East & Gulf
52625
+ {
52626
+ code: "+971",
52627
+ dialCode: "971",
52628
+ country: "United Arab Emirates",
52629
+ flag: "\u{1F1E6}\u{1F1EA}",
52630
+ sample: "50 123 4567",
52631
+ expectedLength: 9,
52632
+ minLength: 9,
52633
+ maxLength: 9,
52634
+ pattern: /^[5]\d{8}$/
52635
+ },
52636
+ {
52637
+ code: "+966",
52638
+ dialCode: "966",
52639
+ country: "Saudi Arabia",
52640
+ flag: "\u{1F1F8}\u{1F1E6}",
52641
+ sample: "50 123 4567",
52642
+ expectedLength: 9,
52643
+ minLength: 9,
52644
+ maxLength: 9,
52645
+ pattern: /^[5]\d{8}$/
52646
+ },
52647
+ {
52648
+ code: "+974",
52649
+ dialCode: "974",
52650
+ country: "Qatar",
52651
+ flag: "\u{1F1F6}\u{1F1E6}",
52652
+ sample: "3312 3456",
52653
+ expectedLength: 8,
52654
+ minLength: 8,
52655
+ maxLength: 8,
52656
+ pattern: /^[3567]\d{7}$/
52657
+ },
52658
+ {
52659
+ code: "+968",
52660
+ dialCode: "968",
52661
+ country: "Oman",
52662
+ flag: "\u{1F1F4}\u{1F1F2}",
52663
+ sample: "9123 4567",
52664
+ expectedLength: 8,
52665
+ minLength: 8,
52666
+ maxLength: 8,
52667
+ pattern: /^[79]\d{7}$/
52668
+ },
52669
+ {
52670
+ code: "+965",
52671
+ dialCode: "965",
52672
+ country: "Kuwait",
52673
+ flag: "\u{1F1F0}\u{1F1FC}",
52674
+ sample: "9123 4567",
52675
+ expectedLength: 8,
52676
+ minLength: 8,
52677
+ maxLength: 8,
52678
+ pattern: /^[569]\d{7}$/
52679
+ },
52680
+ {
52681
+ code: "+973",
52682
+ dialCode: "973",
52683
+ country: "Bahrain",
52684
+ flag: "\u{1F1E7}\u{1F1ED}",
52685
+ sample: "3912 3456",
52686
+ expectedLength: 8,
52687
+ minLength: 8,
52688
+ maxLength: 8,
52689
+ pattern: /^[36]\d{7}$/
52690
+ },
52691
+ {
52692
+ code: "+967",
52693
+ dialCode: "967",
52694
+ country: "Yemen",
52695
+ flag: "\u{1F1FE}\u{1F1EA}",
52696
+ sample: "71 234 567",
52697
+ expectedLength: 8,
52698
+ minLength: 8,
52699
+ maxLength: 9,
52700
+ pattern: /^[7]\d{7,8}$/
52701
+ },
52702
+ {
52703
+ code: "+20",
52704
+ dialCode: "20",
52705
+ country: "Egypt",
52706
+ flag: "\u{1F1EA}\u{1F1EC}",
52707
+ sample: "10 1234 5678",
52708
+ expectedLength: 10,
52709
+ minLength: 10,
52710
+ maxLength: 10,
52711
+ pattern: /^[1]\d{9}$/
52712
+ },
52713
+ {
52714
+ code: "+90",
52715
+ dialCode: "90",
52716
+ country: "Turkey",
52717
+ flag: "\u{1F1F9}\u{1F1F7}",
52718
+ sample: "512 345 6789",
52719
+ expectedLength: 10,
52720
+ minLength: 10,
52721
+ maxLength: 10,
52722
+ pattern: /^[5]\d{9}$/
52723
+ },
52724
+ // Europe & Americas
52725
+ {
52726
+ code: "+44",
52727
+ dialCode: "44",
52728
+ country: "United Kingdom",
52729
+ flag: "\u{1F1EC}\u{1F1E7}",
52730
+ sample: "7123 456789",
52731
+ expectedLength: 10,
52732
+ minLength: 10,
52733
+ maxLength: 10,
52734
+ pattern: /^[7]\d{9}$/
52735
+ },
52736
+ {
52737
+ code: "+1",
52738
+ dialCode: "1",
52739
+ country: "United States",
52740
+ flag: "\u{1F1FA}\u{1F1F8}",
52741
+ sample: "202 555 0123",
52742
+ expectedLength: 10,
52743
+ minLength: 10,
52744
+ maxLength: 10,
52745
+ pattern: /^[2-9]\d{9}$/
52746
+ },
52747
+ {
52748
+ code: "+1",
52749
+ dialCode: "1",
52750
+ country: "Canada",
52751
+ flag: "\u{1F1E8}\u{1F1E6}",
52752
+ sample: "416 555 0123",
52753
+ expectedLength: 10,
52754
+ minLength: 10,
52755
+ maxLength: 10,
52756
+ pattern: /^[2-9]\d{9}$/
52757
+ },
52758
+ {
52759
+ code: "+49",
52760
+ dialCode: "49",
52761
+ country: "Germany",
52762
+ flag: "\u{1F1E9}\u{1F1EA}",
52763
+ sample: "151 23456789",
52764
+ expectedLength: 10,
52765
+ minLength: 10,
52766
+ maxLength: 11,
52767
+ pattern: /^[1]\d{9,10}$/
52768
+ },
52769
+ {
52770
+ code: "+33",
52771
+ dialCode: "33",
52772
+ country: "France",
52773
+ flag: "\u{1F1EB}\u{1F1F7}",
52774
+ sample: "6 12 34 56 78",
52775
+ expectedLength: 9,
52776
+ minLength: 9,
52777
+ maxLength: 9,
52778
+ pattern: /^[67]\d{8}$/
52779
+ },
52780
+ {
52781
+ code: "+39",
52782
+ dialCode: "39",
52783
+ country: "Italy",
52784
+ flag: "\u{1F1EE}\u{1F1F9}",
52785
+ sample: "312 345 6789",
52786
+ expectedLength: 10,
52787
+ minLength: 9,
52788
+ maxLength: 10,
52789
+ pattern: /^[3]\d{8,9}$/
52790
+ },
52791
+ {
52792
+ code: "+34",
52793
+ dialCode: "34",
52794
+ country: "Spain",
52795
+ flag: "\u{1F1EA}\u{1F1F8}",
52796
+ sample: "612 34 56 78",
52797
+ expectedLength: 9,
52798
+ minLength: 9,
52799
+ maxLength: 9,
52800
+ pattern: /^[67]\d{8}$/
52801
+ },
52802
+ {
52803
+ code: "+31",
52804
+ dialCode: "31",
52805
+ country: "Netherlands",
52806
+ flag: "\u{1F1F3}\u{1F1F1}",
52807
+ sample: "6 12345678",
52808
+ expectedLength: 9,
52809
+ minLength: 9,
52810
+ maxLength: 9,
52811
+ pattern: /^[6]\d{8}$/
52812
+ },
52813
+ {
52814
+ code: "+46",
52815
+ dialCode: "46",
52816
+ country: "Sweden",
52817
+ flag: "\u{1F1F8}\u{1F1EA}",
52818
+ sample: "70 123 45 67",
52819
+ expectedLength: 9,
52820
+ minLength: 9,
52821
+ maxLength: 9,
52822
+ pattern: /^[7]\d{8}$/
52823
+ },
52824
+ {
52825
+ code: "+47",
52826
+ dialCode: "47",
52827
+ country: "Norway",
52828
+ flag: "\u{1F1F3}\u{1F1F4}",
52829
+ sample: "412 34 567",
52830
+ expectedLength: 8,
52831
+ minLength: 8,
52832
+ maxLength: 8,
52833
+ pattern: /^[49]\d{7}$/
52834
+ },
52835
+ {
52836
+ code: "+41",
52837
+ dialCode: "41",
52838
+ country: "Switzerland",
52839
+ flag: "\u{1F1E8}\u{1F1ED}",
52840
+ sample: "78 123 45 67",
52841
+ expectedLength: 9,
52842
+ minLength: 9,
52843
+ maxLength: 9,
52844
+ pattern: /^[7]\d{8}$/
52845
+ },
52846
+ // Asia & Africa
52847
+ {
52848
+ code: "+86",
52849
+ dialCode: "86",
52850
+ country: "China",
52851
+ flag: "\u{1F1E8}\u{1F1F3}",
52852
+ sample: "131 2345 6789",
52853
+ expectedLength: 11,
52854
+ minLength: 11,
52855
+ maxLength: 11,
52856
+ pattern: /^[1]\d{10}$/
52857
+ },
52858
+ {
52859
+ code: "+91",
52860
+ dialCode: "91",
52861
+ country: "India",
52862
+ flag: "\u{1F1EE}\u{1F1F3}",
52863
+ sample: "98765 43210",
52864
+ expectedLength: 10,
52865
+ minLength: 10,
52866
+ maxLength: 10,
52867
+ pattern: /^[6-9]\d{9}$/
52868
+ },
52869
+ {
52870
+ code: "+92",
52871
+ dialCode: "92",
52872
+ country: "Pakistan",
52873
+ flag: "\u{1F1F5}\u{1F1F0}",
52874
+ sample: "301 2345678",
52875
+ expectedLength: 10,
52876
+ minLength: 10,
52877
+ maxLength: 10,
52878
+ pattern: /^[3]\d{9}$/
52879
+ },
52880
+ {
52881
+ code: "+27",
52882
+ dialCode: "27",
52883
+ country: "South Africa",
52884
+ flag: "\u{1F1FF}\u{1F1E6}",
52885
+ sample: "71 234 5678",
52886
+ expectedLength: 9,
52887
+ minLength: 9,
52888
+ maxLength: 9,
52889
+ pattern: /^[6-8]\d{8}$/
52890
+ },
52891
+ {
52892
+ code: "+234",
52893
+ dialCode: "234",
52894
+ country: "Nigeria",
52895
+ flag: "\u{1F1F3}\u{1F1EC}",
52896
+ sample: "802 123 4567",
52897
+ expectedLength: 10,
52898
+ minLength: 10,
52899
+ maxLength: 10,
52900
+ pattern: /^[789]\d{9}$/
52901
+ },
52902
+ {
52903
+ code: "+233",
52904
+ dialCode: "233",
52905
+ country: "Ghana",
52906
+ flag: "\u{1F1EC}\u{1F1ED}",
52907
+ sample: "23 123 4567",
52908
+ expectedLength: 9,
52909
+ minLength: 9,
52910
+ maxLength: 9,
52911
+ pattern: /^[25]\d{8}$/
52912
+ },
52913
+ {
52914
+ code: "+61",
52915
+ dialCode: "61",
52916
+ country: "Australia",
52917
+ flag: "\u{1F1E6}\u{1F1FA}",
52918
+ sample: "412 345 678",
52919
+ expectedLength: 9,
52920
+ minLength: 9,
52921
+ maxLength: 9,
52922
+ pattern: /^[4]\d{8}$/
52923
+ },
52924
+ {
52925
+ code: "+60",
52926
+ dialCode: "60",
52927
+ country: "Malaysia",
52928
+ flag: "\u{1F1F2}\u{1F1FE}",
52929
+ sample: "12 345 6789",
52930
+ expectedLength: 9,
52931
+ minLength: 9,
52932
+ maxLength: 10,
52933
+ pattern: /^[1]\d{8,9}$/
52934
+ },
52935
+ {
52936
+ code: "+65",
52937
+ dialCode: "65",
52938
+ country: "Singapore",
52939
+ flag: "\u{1F1F8}\u{1F1EC}",
52940
+ sample: "8123 4567",
52941
+ expectedLength: 8,
52942
+ minLength: 8,
52943
+ maxLength: 8,
52944
+ pattern: /^[89]\d{7}$/
52945
+ }
52946
+ ];
52947
+ var DEFAULT_COUNTRY = COUNTRIES[0];
52948
+
52949
+ // src/Antd/inputs/index.ts
52950
+ var AntdFormInput = {
52951
+ Field: FormField,
52952
+ Text: TextInput,
52953
+ Email: EmailInput,
52954
+ Phone: PhoneInput2,
52955
+ Number: NumberInput,
52956
+ Amount: AmountInput,
52957
+ Select: SelectInput
51577
52958
  };
52959
+ var inputs_default = AntdFormInput;
51578
52960
  // Annotate the CommonJS export names for ESM import in node:
51579
52961
  0 && (module.exports = {
51580
52962
  AccountBalances,
@@ -51584,6 +52966,7 @@ var AntdInputs = {
51584
52966
  AccountStatements,
51585
52967
  Accounts,
51586
52968
  AdminProtectedRoute,
52969
+ AntdInputAntdFormInput,
51587
52970
  Badge,
51588
52971
  BrandField,
51589
52972
  BrandForm,