warqadui 0.0.302 → 0.0.304

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -447,6 +447,7 @@ type EnumsConfig = {
447
447
  };
448
448
  interface WarqadConfig {
449
449
  api?: string;
450
+ apiHeaders?: Record<string, any>;
450
451
  socketUrl?: string;
451
452
  apiConfig?: apiConfig;
452
453
  theme?: ThemeConfig;
@@ -481,6 +482,7 @@ interface WarqadConfig {
481
482
  interface WarqadConfigContextType {
482
483
  config: WarqadConfig & {
483
484
  api: string;
485
+ apiHeaders?: Record<string, any>;
484
486
  apiConfig: Required<apiConfig>;
485
487
  theme: Required<ThemeConfig>;
486
488
  store: Required<StoreConfig>;
@@ -496,6 +498,7 @@ interface WarqadConfigContextType {
496
498
  */
497
499
  declare const useWarqadConfig: () => WarqadConfig & {
498
500
  api: string;
501
+ apiHeaders?: Record<string, any>;
499
502
  apiConfig: Required<apiConfig>;
500
503
  theme: Required<ThemeConfig>;
501
504
  store: Required<StoreConfig>;
package/dist/index.d.ts CHANGED
@@ -447,6 +447,7 @@ type EnumsConfig = {
447
447
  };
448
448
  interface WarqadConfig {
449
449
  api?: string;
450
+ apiHeaders?: Record<string, any>;
450
451
  socketUrl?: string;
451
452
  apiConfig?: apiConfig;
452
453
  theme?: ThemeConfig;
@@ -481,6 +482,7 @@ interface WarqadConfig {
481
482
  interface WarqadConfigContextType {
482
483
  config: WarqadConfig & {
483
484
  api: string;
485
+ apiHeaders?: Record<string, any>;
484
486
  apiConfig: Required<apiConfig>;
485
487
  theme: Required<ThemeConfig>;
486
488
  store: Required<StoreConfig>;
@@ -496,6 +498,7 @@ interface WarqadConfigContextType {
496
498
  */
497
499
  declare const useWarqadConfig: () => WarqadConfig & {
498
500
  api: string;
501
+ apiHeaders?: Record<string, any>;
499
502
  apiConfig: Required<apiConfig>;
500
503
  theme: Required<ThemeConfig>;
501
504
  store: Required<StoreConfig>;
package/dist/index.js CHANGED
@@ -415,6 +415,7 @@ var WarqadProvider = ({ children, config }) => {
415
415
  const mergedConfig = (0, import_react2.useMemo)(
416
416
  () => ({
417
417
  api: config?.api || DEFAULT_API,
418
+ apiHeaders: config?.apiHeaders,
418
419
  socketUrl: config?.socketUrl,
419
420
  apiConfig: {
420
421
  ...DEFAULT_API_CONFIG,
@@ -733,7 +734,7 @@ var getToken = () => {
733
734
  return localStorage.getItem("token");
734
735
  };
735
736
  var useApi = () => {
736
- const { api: configApi } = useWarqadConfig();
737
+ const { api: configApi, apiHeaders } = useWarqadConfig();
737
738
  const api = (0, import_react5.useMemo)(() => {
738
739
  const baseURL = configApi || "/api";
739
740
  return import_axios.default.create({
@@ -752,7 +753,11 @@ var useApi = () => {
752
753
  const prefix = v === 0 ? "" : `/v${v}`;
753
754
  const response = await api.get(`${prefix}${url}`, {
754
755
  params,
755
- headers: { Authorization: `Bearer ${getToken()}`, ...headers }
756
+ headers: {
757
+ Authorization: `Bearer ${getToken()}`,
758
+ ...apiHeaders,
759
+ ...headers
760
+ }
756
761
  });
757
762
  setData(response.data);
758
763
  setError(null);
@@ -801,13 +806,18 @@ var useApi = () => {
801
806
  headers: {
802
807
  "Content-Type": "multipart/form-data",
803
808
  Authorization: `Bearer ${getToken()}`,
809
+ ...apiHeaders,
804
810
  ...headers
805
811
  }
806
812
  });
807
813
  } else {
808
814
  const prefix = v === 0 ? "" : `/v${v}`;
809
815
  response = await api.post(`${prefix}${url}`, body, {
810
- headers: { Authorization: `Bearer ${getToken()}`, ...headers }
816
+ headers: {
817
+ Authorization: `Bearer ${getToken()}`,
818
+ ...apiHeaders,
819
+ ...headers
820
+ }
811
821
  });
812
822
  }
813
823
  setData(response.data);
@@ -835,7 +845,11 @@ var useApi = () => {
835
845
  try {
836
846
  const prefix = v === 0 ? "" : `/v${v}`;
837
847
  const response = await api.put(`${prefix}${url}`, body, {
838
- headers: { Authorization: `Bearer ${getToken()}`, ...headers }
848
+ headers: {
849
+ Authorization: `Bearer ${getToken()}`,
850
+ ...apiHeaders,
851
+ ...headers
852
+ }
839
853
  });
840
854
  setData(response.data);
841
855
  return response.data;
@@ -853,7 +867,11 @@ var useApi = () => {
853
867
  const prefix = v === 0 ? "" : `/v${v}`;
854
868
  const response = await api.delete(`${prefix}${url}`, {
855
869
  params,
856
- headers: { Authorization: `Bearer ${getToken()}`, ...headers }
870
+ headers: {
871
+ Authorization: `Bearer ${getToken()}`,
872
+ ...apiHeaders,
873
+ ...headers
874
+ }
857
875
  });
858
876
  setData(response.data);
859
877
  setError(null);
@@ -881,7 +899,11 @@ var useApi = () => {
881
899
  method,
882
900
  data: body,
883
901
  responseType: "blob",
884
- headers: { Authorization: `Bearer ${getToken()}`, ...headers }
902
+ headers: {
903
+ Authorization: `Bearer ${getToken()}`,
904
+ ...apiHeaders,
905
+ ...headers
906
+ }
885
907
  });
886
908
  if (!response.data || response.data.size === 0) {
887
909
  return { ok: false, message: "Received empty PDF file", errors: [] };
@@ -20836,13 +20858,23 @@ function PackForm() {
20836
20858
  {
20837
20859
  className: "hover:bg-gray-50/50 dark:hover:bg-gray-800/50 transition-colors",
20838
20860
  children: [
20839
- /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("td", { className: "px-3 py-2", children: [
20840
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: field.productData?.name || "Product" }),
20841
- field.productData?.sku && /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("p", { className: "text-[10px] text-gray-500", children: [
20842
- "SKU: ",
20843
- field.productData?.sku
20861
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("td", { className: "px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "flex items-center gap-3", children: [
20862
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
20863
+ ProductImage_default,
20864
+ {
20865
+ src: field.productData?.image,
20866
+ width: 28,
20867
+ height: 28
20868
+ }
20869
+ ),
20870
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { children: [
20871
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: field.productData?.name || "Product" }),
20872
+ field.productData?.sku && /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("p", { className: "text-[10px] text-gray-500", children: [
20873
+ "SKU: ",
20874
+ field.productData?.sku
20875
+ ] })
20844
20876
  ] })
20845
- ] }),
20877
+ ] }) }),
20846
20878
  /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("td", { className: "px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
20847
20879
  Fields_default.Input,
20848
20880
  {
@@ -20884,7 +20916,7 @@ function PackForm() {
20884
20916
  fields.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("td", { colSpan: 5, className: "text-center py-10", children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("p", { className: "text-sm text-gray-500", children: "No products added yet. Use the search above to add products." }) }) })
20885
20917
  ] })
20886
20918
  ] }) }),
20887
- /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "mt-6 pt-6 border-t grid grid-cols-1 sm:grid-cols-3 gap-3", children: [
20919
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "mt-6 pt-6 border-t grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
20888
20920
  /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
20889
20921
  /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Lines" }),
20890
20922
  /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("p", { className: "text-lg font-bold text-blue-600", children: watch("products")?.length || 0 })
@@ -20895,31 +20927,36 @@ function PackForm() {
20895
20927
  (acc, curr) => acc + (Number(curr.quantity) || 0),
20896
20928
  0
20897
20929
  ) })
20898
- ] }),
20899
- /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
20900
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Cost" }),
20901
- /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("p", { className: "text-lg font-bold text-emerald-600", children: [
20930
+ ] })
20931
+ ] })
20932
+ ] }),
20933
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("footer", { className: "flex items-center justify-between mt-8", children: [
20934
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { children: [
20935
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Cost" }),
20936
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("p", { className: "text-xl font-bold text-emerald-600", children: [
20937
+ Formats_default.Amount(
20902
20938
  watch("products")?.reduce(
20903
20939
  (acc, curr) => acc + (Number(curr.quantity) || 0) * (Number(curr.cost) || 0),
20904
20940
  0
20905
- ).toLocaleString(),
20906
- " ",
20907
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("span", { className: "text-[10px] font-normal text-gray-400", children: "USD" })
20908
- ] })
20941
+ ) || 0,
20942
+ false
20943
+ ),
20944
+ " ",
20945
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("span", { className: "text-[10px] font-normal text-gray-400", children: "USD" })
20909
20946
  ] })
20910
- ] })
20911
- ] }),
20912
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("footer", { className: "flex justify-end mt-8", children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
20913
- Button,
20914
- {
20915
- isLoading,
20916
- disabled: isLoading,
20917
- type: "submit",
20918
- className: "min-w-[120px]",
20919
- variant: !isEdit ? "primary" : "warning",
20920
- children: isEdit ? "Update Pack" : "Create Pack"
20921
- }
20922
- ) })
20947
+ ] }),
20948
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
20949
+ Button,
20950
+ {
20951
+ isLoading,
20952
+ disabled: isLoading,
20953
+ type: "submit",
20954
+ className: "min-w-[120px]",
20955
+ variant: !isEdit ? "primary" : "warning",
20956
+ children: isEdit ? "Update Pack" : "Create Pack"
20957
+ }
20958
+ )
20959
+ ] })
20923
20960
  ]
20924
20961
  }
20925
20962
  ) })
@@ -51964,6 +52001,7 @@ var NumberInput = (0, import_react177.forwardRef)(
51964
52001
  formatSeparators = false,
51965
52002
  ...rest
51966
52003
  }, ref2) => {
52004
+ const [editingText, setEditingText] = (0, import_react177.useState)(null);
51967
52005
  const activeForm = useFormInstance(methods, form);
51968
52006
  const inputId = id || name || (label ? String(label).toLowerCase().replace(/\s+/g, "-") : void 0);
51969
52007
  const errorMessage = getFormFieldError(name, activeForm, error);
@@ -51979,10 +52017,11 @@ var NumberInput = (0, import_react177.forwardRef)(
51979
52017
  return String(val);
51980
52018
  };
51981
52019
  const renderInput = (inputRef, currentValue, onValueChange, onInputBlur) => {
51982
- const displayVal = formatDisplay(currentValue);
52020
+ const displayVal = editingText !== null ? editingText : formatDisplay(currentValue);
51983
52021
  const handleChange = (e) => {
51984
52022
  const rawVal = e.target.value.replace(/,/g, "").trim();
51985
52023
  if (rawVal === "" || rawVal === "-") {
52024
+ setEditingText(rawVal);
51986
52025
  onValueChange(void 0, rawVal);
51987
52026
  return;
51988
52027
  }
@@ -51990,9 +52029,14 @@ var NumberInput = (0, import_react177.forwardRef)(
51990
52029
  if (!regex.test(rawVal)) {
51991
52030
  return;
51992
52031
  }
52032
+ setEditingText(rawVal);
51993
52033
  const parsed = allowDecimals ? parseFloat(rawVal) : parseInt(rawVal, 10);
51994
52034
  onValueChange(isNaN(parsed) ? void 0 : parsed, rawVal);
51995
52035
  };
52036
+ const handleBlur = () => {
52037
+ setEditingText(null);
52038
+ onInputBlur?.();
52039
+ };
51996
52040
  const handleStep = (delta) => {
51997
52041
  if (disabled || readOnly) return;
51998
52042
  const current = typeof currentValue === "number" ? currentValue : parseFloat(String(currentValue || 0).replace(/,/g, "")) || 0;
@@ -52000,6 +52044,7 @@ var NumberInput = (0, import_react177.forwardRef)(
52000
52044
  if (min !== void 0 && nextVal < min) nextVal = min;
52001
52045
  if (max !== void 0 && nextVal > max) nextVal = max;
52002
52046
  const rounded = allowDecimals ? parseFloat(nextVal.toFixed(6)) : Math.round(nextVal);
52047
+ setEditingText(null);
52003
52048
  onValueChange(rounded, String(rounded));
52004
52049
  };
52005
52050
  return /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
@@ -52025,7 +52070,7 @@ var NumberInput = (0, import_react177.forwardRef)(
52025
52070
  inputMode: allowDecimals ? "decimal" : "numeric",
52026
52071
  value: displayVal,
52027
52072
  onChange: handleChange,
52028
- onBlur: onInputBlur,
52073
+ onBlur: handleBlur,
52029
52074
  disabled,
52030
52075
  readOnly,
52031
52076
  placeholder,
package/dist/index.mjs CHANGED
@@ -196,6 +196,7 @@ var WarqadProvider = ({ children, config }) => {
196
196
  const mergedConfig = useMemo(
197
197
  () => ({
198
198
  api: config?.api || DEFAULT_API,
199
+ apiHeaders: config?.apiHeaders,
199
200
  socketUrl: config?.socketUrl,
200
201
  apiConfig: {
201
202
  ...DEFAULT_API_CONFIG,
@@ -514,7 +515,7 @@ var getToken = () => {
514
515
  return localStorage.getItem("token");
515
516
  };
516
517
  var useApi = () => {
517
- const { api: configApi } = useWarqadConfig();
518
+ const { api: configApi, apiHeaders } = useWarqadConfig();
518
519
  const api = useMemo2(() => {
519
520
  const baseURL = configApi || "/api";
520
521
  return axios.create({
@@ -533,7 +534,11 @@ var useApi = () => {
533
534
  const prefix = v === 0 ? "" : `/v${v}`;
534
535
  const response = await api.get(`${prefix}${url}`, {
535
536
  params,
536
- headers: { Authorization: `Bearer ${getToken()}`, ...headers }
537
+ headers: {
538
+ Authorization: `Bearer ${getToken()}`,
539
+ ...apiHeaders,
540
+ ...headers
541
+ }
537
542
  });
538
543
  setData(response.data);
539
544
  setError(null);
@@ -582,13 +587,18 @@ var useApi = () => {
582
587
  headers: {
583
588
  "Content-Type": "multipart/form-data",
584
589
  Authorization: `Bearer ${getToken()}`,
590
+ ...apiHeaders,
585
591
  ...headers
586
592
  }
587
593
  });
588
594
  } else {
589
595
  const prefix = v === 0 ? "" : `/v${v}`;
590
596
  response = await api.post(`${prefix}${url}`, body, {
591
- headers: { Authorization: `Bearer ${getToken()}`, ...headers }
597
+ headers: {
598
+ Authorization: `Bearer ${getToken()}`,
599
+ ...apiHeaders,
600
+ ...headers
601
+ }
592
602
  });
593
603
  }
594
604
  setData(response.data);
@@ -616,7 +626,11 @@ var useApi = () => {
616
626
  try {
617
627
  const prefix = v === 0 ? "" : `/v${v}`;
618
628
  const response = await api.put(`${prefix}${url}`, body, {
619
- headers: { Authorization: `Bearer ${getToken()}`, ...headers }
629
+ headers: {
630
+ Authorization: `Bearer ${getToken()}`,
631
+ ...apiHeaders,
632
+ ...headers
633
+ }
620
634
  });
621
635
  setData(response.data);
622
636
  return response.data;
@@ -634,7 +648,11 @@ var useApi = () => {
634
648
  const prefix = v === 0 ? "" : `/v${v}`;
635
649
  const response = await api.delete(`${prefix}${url}`, {
636
650
  params,
637
- headers: { Authorization: `Bearer ${getToken()}`, ...headers }
651
+ headers: {
652
+ Authorization: `Bearer ${getToken()}`,
653
+ ...apiHeaders,
654
+ ...headers
655
+ }
638
656
  });
639
657
  setData(response.data);
640
658
  setError(null);
@@ -662,7 +680,11 @@ var useApi = () => {
662
680
  method,
663
681
  data: body,
664
682
  responseType: "blob",
665
- headers: { Authorization: `Bearer ${getToken()}`, ...headers }
683
+ headers: {
684
+ Authorization: `Bearer ${getToken()}`,
685
+ ...apiHeaders,
686
+ ...headers
687
+ }
666
688
  });
667
689
  if (!response.data || response.data.size === 0) {
668
690
  return { ok: false, message: "Received empty PDF file", errors: [] };
@@ -20921,13 +20943,23 @@ function PackForm() {
20921
20943
  {
20922
20944
  className: "hover:bg-gray-50/50 dark:hover:bg-gray-800/50 transition-colors",
20923
20945
  children: [
20924
- /* @__PURE__ */ jsxs98("td", { className: "px-3 py-2", children: [
20925
- /* @__PURE__ */ jsx118("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: field.productData?.name || "Product" }),
20926
- field.productData?.sku && /* @__PURE__ */ jsxs98("p", { className: "text-[10px] text-gray-500", children: [
20927
- "SKU: ",
20928
- field.productData?.sku
20946
+ /* @__PURE__ */ jsx118("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsxs98("div", { className: "flex items-center gap-3", children: [
20947
+ /* @__PURE__ */ jsx118(
20948
+ ProductImage_default,
20949
+ {
20950
+ src: field.productData?.image,
20951
+ width: 28,
20952
+ height: 28
20953
+ }
20954
+ ),
20955
+ /* @__PURE__ */ jsxs98("div", { children: [
20956
+ /* @__PURE__ */ jsx118("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: field.productData?.name || "Product" }),
20957
+ field.productData?.sku && /* @__PURE__ */ jsxs98("p", { className: "text-[10px] text-gray-500", children: [
20958
+ "SKU: ",
20959
+ field.productData?.sku
20960
+ ] })
20929
20961
  ] })
20930
- ] }),
20962
+ ] }) }),
20931
20963
  /* @__PURE__ */ jsx118("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx118(
20932
20964
  Fields_default.Input,
20933
20965
  {
@@ -20969,7 +21001,7 @@ function PackForm() {
20969
21001
  fields.length === 0 && /* @__PURE__ */ jsx118("tr", { children: /* @__PURE__ */ jsx118("td", { colSpan: 5, className: "text-center py-10", children: /* @__PURE__ */ jsx118("p", { className: "text-sm text-gray-500", children: "No products added yet. Use the search above to add products." }) }) })
20970
21002
  ] })
20971
21003
  ] }) }),
20972
- /* @__PURE__ */ jsxs98("div", { className: "mt-6 pt-6 border-t grid grid-cols-1 sm:grid-cols-3 gap-3", children: [
21004
+ /* @__PURE__ */ jsxs98("div", { className: "mt-6 pt-6 border-t grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
20973
21005
  /* @__PURE__ */ jsxs98("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
20974
21006
  /* @__PURE__ */ jsx118("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Lines" }),
20975
21007
  /* @__PURE__ */ jsx118("p", { className: "text-lg font-bold text-blue-600", children: watch("products")?.length || 0 })
@@ -20980,31 +21012,36 @@ function PackForm() {
20980
21012
  (acc, curr) => acc + (Number(curr.quantity) || 0),
20981
21013
  0
20982
21014
  ) })
20983
- ] }),
20984
- /* @__PURE__ */ jsxs98("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
20985
- /* @__PURE__ */ jsx118("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Cost" }),
20986
- /* @__PURE__ */ jsxs98("p", { className: "text-lg font-bold text-emerald-600", children: [
21015
+ ] })
21016
+ ] })
21017
+ ] }),
21018
+ /* @__PURE__ */ jsxs98("footer", { className: "flex items-center justify-between mt-8", children: [
21019
+ /* @__PURE__ */ jsxs98("div", { children: [
21020
+ /* @__PURE__ */ jsx118("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Cost" }),
21021
+ /* @__PURE__ */ jsxs98("p", { className: "text-xl font-bold text-emerald-600", children: [
21022
+ Formats_default.Amount(
20987
21023
  watch("products")?.reduce(
20988
21024
  (acc, curr) => acc + (Number(curr.quantity) || 0) * (Number(curr.cost) || 0),
20989
21025
  0
20990
- ).toLocaleString(),
20991
- " ",
20992
- /* @__PURE__ */ jsx118("span", { className: "text-[10px] font-normal text-gray-400", children: "USD" })
20993
- ] })
21026
+ ) || 0,
21027
+ false
21028
+ ),
21029
+ " ",
21030
+ /* @__PURE__ */ jsx118("span", { className: "text-[10px] font-normal text-gray-400", children: "USD" })
20994
21031
  ] })
20995
- ] })
20996
- ] }),
20997
- /* @__PURE__ */ jsx118("footer", { className: "flex justify-end mt-8", children: /* @__PURE__ */ jsx118(
20998
- Button,
20999
- {
21000
- isLoading,
21001
- disabled: isLoading,
21002
- type: "submit",
21003
- className: "min-w-[120px]",
21004
- variant: !isEdit ? "primary" : "warning",
21005
- children: isEdit ? "Update Pack" : "Create Pack"
21006
- }
21007
- ) })
21032
+ ] }),
21033
+ /* @__PURE__ */ jsx118(
21034
+ Button,
21035
+ {
21036
+ isLoading,
21037
+ disabled: isLoading,
21038
+ type: "submit",
21039
+ className: "min-w-[120px]",
21040
+ variant: !isEdit ? "primary" : "warning",
21041
+ children: isEdit ? "Update Pack" : "Create Pack"
21042
+ }
21043
+ )
21044
+ ] })
21008
21045
  ]
21009
21046
  }
21010
21047
  ) })
@@ -52154,7 +52191,7 @@ var PhoneInput2 = forwardRef12(
52154
52191
  PhoneInput2.displayName = "PhoneInput";
52155
52192
 
52156
52193
  // src/Antd/inputs/NumberInput.tsx
52157
- import { forwardRef as forwardRef13 } from "react";
52194
+ import { forwardRef as forwardRef13, useState as useState124 } from "react";
52158
52195
  import { ChevronUp as ChevronUp2, ChevronDown as ChevronDown7 } from "lucide-react";
52159
52196
  import { Controller as Controller9 } from "react-hook-form";
52160
52197
  import { jsx as jsx285, jsxs as jsxs253 } from "react/jsx-runtime";
@@ -52190,6 +52227,7 @@ var NumberInput = forwardRef13(
52190
52227
  formatSeparators = false,
52191
52228
  ...rest
52192
52229
  }, ref2) => {
52230
+ const [editingText, setEditingText] = useState124(null);
52193
52231
  const activeForm = useFormInstance(methods, form);
52194
52232
  const inputId = id || name || (label ? String(label).toLowerCase().replace(/\s+/g, "-") : void 0);
52195
52233
  const errorMessage = getFormFieldError(name, activeForm, error);
@@ -52205,10 +52243,11 @@ var NumberInput = forwardRef13(
52205
52243
  return String(val);
52206
52244
  };
52207
52245
  const renderInput = (inputRef, currentValue, onValueChange, onInputBlur) => {
52208
- const displayVal = formatDisplay(currentValue);
52246
+ const displayVal = editingText !== null ? editingText : formatDisplay(currentValue);
52209
52247
  const handleChange = (e) => {
52210
52248
  const rawVal = e.target.value.replace(/,/g, "").trim();
52211
52249
  if (rawVal === "" || rawVal === "-") {
52250
+ setEditingText(rawVal);
52212
52251
  onValueChange(void 0, rawVal);
52213
52252
  return;
52214
52253
  }
@@ -52216,9 +52255,14 @@ var NumberInput = forwardRef13(
52216
52255
  if (!regex.test(rawVal)) {
52217
52256
  return;
52218
52257
  }
52258
+ setEditingText(rawVal);
52219
52259
  const parsed = allowDecimals ? parseFloat(rawVal) : parseInt(rawVal, 10);
52220
52260
  onValueChange(isNaN(parsed) ? void 0 : parsed, rawVal);
52221
52261
  };
52262
+ const handleBlur = () => {
52263
+ setEditingText(null);
52264
+ onInputBlur?.();
52265
+ };
52222
52266
  const handleStep = (delta) => {
52223
52267
  if (disabled || readOnly) return;
52224
52268
  const current = typeof currentValue === "number" ? currentValue : parseFloat(String(currentValue || 0).replace(/,/g, "")) || 0;
@@ -52226,6 +52270,7 @@ var NumberInput = forwardRef13(
52226
52270
  if (min !== void 0 && nextVal < min) nextVal = min;
52227
52271
  if (max !== void 0 && nextVal > max) nextVal = max;
52228
52272
  const rounded = allowDecimals ? parseFloat(nextVal.toFixed(6)) : Math.round(nextVal);
52273
+ setEditingText(null);
52229
52274
  onValueChange(rounded, String(rounded));
52230
52275
  };
52231
52276
  return /* @__PURE__ */ jsx285(
@@ -52251,7 +52296,7 @@ var NumberInput = forwardRef13(
52251
52296
  inputMode: allowDecimals ? "decimal" : "numeric",
52252
52297
  value: displayVal,
52253
52298
  onChange: handleChange,
52254
- onBlur: onInputBlur,
52299
+ onBlur: handleBlur,
52255
52300
  disabled,
52256
52301
  readOnly,
52257
52302
  placeholder,
@@ -52324,7 +52369,7 @@ var NumberInput = forwardRef13(
52324
52369
  NumberInput.displayName = "NumberInput";
52325
52370
 
52326
52371
  // src/Antd/inputs/AmountInput.tsx
52327
- import { forwardRef as forwardRef14, useState as useState124, useEffect as useEffect121 } from "react";
52372
+ import { forwardRef as forwardRef14, useState as useState125, useEffect as useEffect121 } from "react";
52328
52373
  import { Controller as Controller10 } from "react-hook-form";
52329
52374
  import { jsx as jsx286, jsxs as jsxs254 } from "react/jsx-runtime";
52330
52375
  var AmountInput = forwardRef14(
@@ -52378,8 +52423,8 @@ var AmountInput = forwardRef14(
52378
52423
  const sizeHeightClass = size === "sm" ? "h-8 text-xs" : size === "lg" ? "h-12 text-sm" : "h-10 text-xs";
52379
52424
  const currencyBadge = currency ? /* @__PURE__ */ jsx286("span", { className: "font-semibold text-zinc-600 dark:text-zinc-300 font-mono text-[11px] tracking-wide", children: currency }) : null;
52380
52425
  const renderInput = (inputRef, currentValue, onValueChange, onInputBlur) => {
52381
- const [isFocused, setIsFocused] = useState124(false);
52382
- const [displayValue, setDisplayValue] = useState124(
52426
+ const [isFocused, setIsFocused] = useState125(false);
52427
+ const [displayValue, setDisplayValue] = useState125(
52383
52428
  () => formatNumber(currentValue)
52384
52429
  );
52385
52430
  useEffect121(() => {
@@ -52502,7 +52547,7 @@ var AmountInput = forwardRef14(
52502
52547
  AmountInput.displayName = "AmountInput";
52503
52548
 
52504
52549
  // src/Antd/inputs/SelectInput.tsx
52505
- import { useState as useState125, useRef as useRef14, useEffect as useEffect122, useMemo as useMemo59, forwardRef as forwardRef15 } from "react";
52550
+ import { useState as useState126, useRef as useRef14, useEffect as useEffect122, useMemo as useMemo59, forwardRef as forwardRef15 } from "react";
52506
52551
  import { ChevronDown as ChevronDown8, Check as Check7, Search as Search4, X as X10 } from "lucide-react";
52507
52552
  import { Controller as Controller11 } from "react-hook-form";
52508
52553
  import { jsx as jsx287, jsxs as jsxs255 } from "react/jsx-runtime";
@@ -52536,8 +52581,8 @@ var SelectInput = forwardRef15(
52536
52581
  const errorMessage = getFormFieldError(name, activeForm, error);
52537
52582
  const hasError = Boolean(errorMessage);
52538
52583
  const renderSelect = (buttonRef, currentValue, onValueChange) => {
52539
- const [isOpen, setIsOpen] = useState125(false);
52540
- const [searchQuery, setSearchQuery] = useState125("");
52584
+ const [isOpen, setIsOpen] = useState126(false);
52585
+ const [searchQuery, setSearchQuery] = useState126("");
52541
52586
  const dropdownRef = useRef14(null);
52542
52587
  const searchInputRef = useRef14(null);
52543
52588
  const selectedOption = useMemo59(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warqadui",
3
- "version": "0.0.302",
3
+ "version": "0.0.304",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",