warqadui 0.0.303 → 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.js CHANGED
@@ -20858,13 +20858,23 @@ function PackForm() {
20858
20858
  {
20859
20859
  className: "hover:bg-gray-50/50 dark:hover:bg-gray-800/50 transition-colors",
20860
20860
  children: [
20861
- /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("td", { className: "px-3 py-2", children: [
20862
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: field.productData?.name || "Product" }),
20863
- field.productData?.sku && /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("p", { className: "text-[10px] text-gray-500", children: [
20864
- "SKU: ",
20865
- 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
+ ] })
20866
20876
  ] })
20867
- ] }),
20877
+ ] }) }),
20868
20878
  /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("td", { className: "px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
20869
20879
  Fields_default.Input,
20870
20880
  {
@@ -20906,7 +20916,7 @@ function PackForm() {
20906
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." }) }) })
20907
20917
  ] })
20908
20918
  ] }) }),
20909
- /* @__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: [
20910
20920
  /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
20911
20921
  /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Lines" }),
20912
20922
  /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("p", { className: "text-lg font-bold text-blue-600", children: watch("products")?.length || 0 })
@@ -20917,31 +20927,36 @@ function PackForm() {
20917
20927
  (acc, curr) => acc + (Number(curr.quantity) || 0),
20918
20928
  0
20919
20929
  ) })
20920
- ] }),
20921
- /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
20922
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Cost" }),
20923
- /* @__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(
20924
20938
  watch("products")?.reduce(
20925
20939
  (acc, curr) => acc + (Number(curr.quantity) || 0) * (Number(curr.cost) || 0),
20926
20940
  0
20927
- ).toLocaleString(),
20928
- " ",
20929
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("span", { className: "text-[10px] font-normal text-gray-400", children: "USD" })
20930
- ] })
20941
+ ) || 0,
20942
+ false
20943
+ ),
20944
+ " ",
20945
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("span", { className: "text-[10px] font-normal text-gray-400", children: "USD" })
20931
20946
  ] })
20932
- ] })
20933
- ] }),
20934
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("footer", { className: "flex justify-end mt-8", children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
20935
- Button,
20936
- {
20937
- isLoading,
20938
- disabled: isLoading,
20939
- type: "submit",
20940
- className: "min-w-[120px]",
20941
- variant: !isEdit ? "primary" : "warning",
20942
- children: isEdit ? "Update Pack" : "Create Pack"
20943
- }
20944
- ) })
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
+ ] })
20945
20960
  ]
20946
20961
  }
20947
20962
  ) })
@@ -51986,6 +52001,7 @@ var NumberInput = (0, import_react177.forwardRef)(
51986
52001
  formatSeparators = false,
51987
52002
  ...rest
51988
52003
  }, ref2) => {
52004
+ const [editingText, setEditingText] = (0, import_react177.useState)(null);
51989
52005
  const activeForm = useFormInstance(methods, form);
51990
52006
  const inputId = id || name || (label ? String(label).toLowerCase().replace(/\s+/g, "-") : void 0);
51991
52007
  const errorMessage = getFormFieldError(name, activeForm, error);
@@ -52001,10 +52017,11 @@ var NumberInput = (0, import_react177.forwardRef)(
52001
52017
  return String(val);
52002
52018
  };
52003
52019
  const renderInput = (inputRef, currentValue, onValueChange, onInputBlur) => {
52004
- const displayVal = formatDisplay(currentValue);
52020
+ const displayVal = editingText !== null ? editingText : formatDisplay(currentValue);
52005
52021
  const handleChange = (e) => {
52006
52022
  const rawVal = e.target.value.replace(/,/g, "").trim();
52007
52023
  if (rawVal === "" || rawVal === "-") {
52024
+ setEditingText(rawVal);
52008
52025
  onValueChange(void 0, rawVal);
52009
52026
  return;
52010
52027
  }
@@ -52012,9 +52029,14 @@ var NumberInput = (0, import_react177.forwardRef)(
52012
52029
  if (!regex.test(rawVal)) {
52013
52030
  return;
52014
52031
  }
52032
+ setEditingText(rawVal);
52015
52033
  const parsed = allowDecimals ? parseFloat(rawVal) : parseInt(rawVal, 10);
52016
52034
  onValueChange(isNaN(parsed) ? void 0 : parsed, rawVal);
52017
52035
  };
52036
+ const handleBlur = () => {
52037
+ setEditingText(null);
52038
+ onInputBlur?.();
52039
+ };
52018
52040
  const handleStep = (delta) => {
52019
52041
  if (disabled || readOnly) return;
52020
52042
  const current = typeof currentValue === "number" ? currentValue : parseFloat(String(currentValue || 0).replace(/,/g, "")) || 0;
@@ -52022,6 +52044,7 @@ var NumberInput = (0, import_react177.forwardRef)(
52022
52044
  if (min !== void 0 && nextVal < min) nextVal = min;
52023
52045
  if (max !== void 0 && nextVal > max) nextVal = max;
52024
52046
  const rounded = allowDecimals ? parseFloat(nextVal.toFixed(6)) : Math.round(nextVal);
52047
+ setEditingText(null);
52025
52048
  onValueChange(rounded, String(rounded));
52026
52049
  };
52027
52050
  return /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
@@ -52047,7 +52070,7 @@ var NumberInput = (0, import_react177.forwardRef)(
52047
52070
  inputMode: allowDecimals ? "decimal" : "numeric",
52048
52071
  value: displayVal,
52049
52072
  onChange: handleChange,
52050
- onBlur: onInputBlur,
52073
+ onBlur: handleBlur,
52051
52074
  disabled,
52052
52075
  readOnly,
52053
52076
  placeholder,
package/dist/index.mjs CHANGED
@@ -20943,13 +20943,23 @@ function PackForm() {
20943
20943
  {
20944
20944
  className: "hover:bg-gray-50/50 dark:hover:bg-gray-800/50 transition-colors",
20945
20945
  children: [
20946
- /* @__PURE__ */ jsxs98("td", { className: "px-3 py-2", children: [
20947
- /* @__PURE__ */ jsx118("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: field.productData?.name || "Product" }),
20948
- field.productData?.sku && /* @__PURE__ */ jsxs98("p", { className: "text-[10px] text-gray-500", children: [
20949
- "SKU: ",
20950
- 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
+ ] })
20951
20961
  ] })
20952
- ] }),
20962
+ ] }) }),
20953
20963
  /* @__PURE__ */ jsx118("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx118(
20954
20964
  Fields_default.Input,
20955
20965
  {
@@ -20991,7 +21001,7 @@ function PackForm() {
20991
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." }) }) })
20992
21002
  ] })
20993
21003
  ] }) }),
20994
- /* @__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: [
20995
21005
  /* @__PURE__ */ jsxs98("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
20996
21006
  /* @__PURE__ */ jsx118("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Lines" }),
20997
21007
  /* @__PURE__ */ jsx118("p", { className: "text-lg font-bold text-blue-600", children: watch("products")?.length || 0 })
@@ -21002,31 +21012,36 @@ function PackForm() {
21002
21012
  (acc, curr) => acc + (Number(curr.quantity) || 0),
21003
21013
  0
21004
21014
  ) })
21005
- ] }),
21006
- /* @__PURE__ */ jsxs98("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
21007
- /* @__PURE__ */ jsx118("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Cost" }),
21008
- /* @__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(
21009
21023
  watch("products")?.reduce(
21010
21024
  (acc, curr) => acc + (Number(curr.quantity) || 0) * (Number(curr.cost) || 0),
21011
21025
  0
21012
- ).toLocaleString(),
21013
- " ",
21014
- /* @__PURE__ */ jsx118("span", { className: "text-[10px] font-normal text-gray-400", children: "USD" })
21015
- ] })
21026
+ ) || 0,
21027
+ false
21028
+ ),
21029
+ " ",
21030
+ /* @__PURE__ */ jsx118("span", { className: "text-[10px] font-normal text-gray-400", children: "USD" })
21016
21031
  ] })
21017
- ] })
21018
- ] }),
21019
- /* @__PURE__ */ jsx118("footer", { className: "flex justify-end mt-8", children: /* @__PURE__ */ jsx118(
21020
- Button,
21021
- {
21022
- isLoading,
21023
- disabled: isLoading,
21024
- type: "submit",
21025
- className: "min-w-[120px]",
21026
- variant: !isEdit ? "primary" : "warning",
21027
- children: isEdit ? "Update Pack" : "Create Pack"
21028
- }
21029
- ) })
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
+ ] })
21030
21045
  ]
21031
21046
  }
21032
21047
  ) })
@@ -52176,7 +52191,7 @@ var PhoneInput2 = forwardRef12(
52176
52191
  PhoneInput2.displayName = "PhoneInput";
52177
52192
 
52178
52193
  // src/Antd/inputs/NumberInput.tsx
52179
- import { forwardRef as forwardRef13 } from "react";
52194
+ import { forwardRef as forwardRef13, useState as useState124 } from "react";
52180
52195
  import { ChevronUp as ChevronUp2, ChevronDown as ChevronDown7 } from "lucide-react";
52181
52196
  import { Controller as Controller9 } from "react-hook-form";
52182
52197
  import { jsx as jsx285, jsxs as jsxs253 } from "react/jsx-runtime";
@@ -52212,6 +52227,7 @@ var NumberInput = forwardRef13(
52212
52227
  formatSeparators = false,
52213
52228
  ...rest
52214
52229
  }, ref2) => {
52230
+ const [editingText, setEditingText] = useState124(null);
52215
52231
  const activeForm = useFormInstance(methods, form);
52216
52232
  const inputId = id || name || (label ? String(label).toLowerCase().replace(/\s+/g, "-") : void 0);
52217
52233
  const errorMessage = getFormFieldError(name, activeForm, error);
@@ -52227,10 +52243,11 @@ var NumberInput = forwardRef13(
52227
52243
  return String(val);
52228
52244
  };
52229
52245
  const renderInput = (inputRef, currentValue, onValueChange, onInputBlur) => {
52230
- const displayVal = formatDisplay(currentValue);
52246
+ const displayVal = editingText !== null ? editingText : formatDisplay(currentValue);
52231
52247
  const handleChange = (e) => {
52232
52248
  const rawVal = e.target.value.replace(/,/g, "").trim();
52233
52249
  if (rawVal === "" || rawVal === "-") {
52250
+ setEditingText(rawVal);
52234
52251
  onValueChange(void 0, rawVal);
52235
52252
  return;
52236
52253
  }
@@ -52238,9 +52255,14 @@ var NumberInput = forwardRef13(
52238
52255
  if (!regex.test(rawVal)) {
52239
52256
  return;
52240
52257
  }
52258
+ setEditingText(rawVal);
52241
52259
  const parsed = allowDecimals ? parseFloat(rawVal) : parseInt(rawVal, 10);
52242
52260
  onValueChange(isNaN(parsed) ? void 0 : parsed, rawVal);
52243
52261
  };
52262
+ const handleBlur = () => {
52263
+ setEditingText(null);
52264
+ onInputBlur?.();
52265
+ };
52244
52266
  const handleStep = (delta) => {
52245
52267
  if (disabled || readOnly) return;
52246
52268
  const current = typeof currentValue === "number" ? currentValue : parseFloat(String(currentValue || 0).replace(/,/g, "")) || 0;
@@ -52248,6 +52270,7 @@ var NumberInput = forwardRef13(
52248
52270
  if (min !== void 0 && nextVal < min) nextVal = min;
52249
52271
  if (max !== void 0 && nextVal > max) nextVal = max;
52250
52272
  const rounded = allowDecimals ? parseFloat(nextVal.toFixed(6)) : Math.round(nextVal);
52273
+ setEditingText(null);
52251
52274
  onValueChange(rounded, String(rounded));
52252
52275
  };
52253
52276
  return /* @__PURE__ */ jsx285(
@@ -52273,7 +52296,7 @@ var NumberInput = forwardRef13(
52273
52296
  inputMode: allowDecimals ? "decimal" : "numeric",
52274
52297
  value: displayVal,
52275
52298
  onChange: handleChange,
52276
- onBlur: onInputBlur,
52299
+ onBlur: handleBlur,
52277
52300
  disabled,
52278
52301
  readOnly,
52279
52302
  placeholder,
@@ -52346,7 +52369,7 @@ var NumberInput = forwardRef13(
52346
52369
  NumberInput.displayName = "NumberInput";
52347
52370
 
52348
52371
  // src/Antd/inputs/AmountInput.tsx
52349
- 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";
52350
52373
  import { Controller as Controller10 } from "react-hook-form";
52351
52374
  import { jsx as jsx286, jsxs as jsxs254 } from "react/jsx-runtime";
52352
52375
  var AmountInput = forwardRef14(
@@ -52400,8 +52423,8 @@ var AmountInput = forwardRef14(
52400
52423
  const sizeHeightClass = size === "sm" ? "h-8 text-xs" : size === "lg" ? "h-12 text-sm" : "h-10 text-xs";
52401
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;
52402
52425
  const renderInput = (inputRef, currentValue, onValueChange, onInputBlur) => {
52403
- const [isFocused, setIsFocused] = useState124(false);
52404
- const [displayValue, setDisplayValue] = useState124(
52426
+ const [isFocused, setIsFocused] = useState125(false);
52427
+ const [displayValue, setDisplayValue] = useState125(
52405
52428
  () => formatNumber(currentValue)
52406
52429
  );
52407
52430
  useEffect121(() => {
@@ -52524,7 +52547,7 @@ var AmountInput = forwardRef14(
52524
52547
  AmountInput.displayName = "AmountInput";
52525
52548
 
52526
52549
  // src/Antd/inputs/SelectInput.tsx
52527
- 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";
52528
52551
  import { ChevronDown as ChevronDown8, Check as Check7, Search as Search4, X as X10 } from "lucide-react";
52529
52552
  import { Controller as Controller11 } from "react-hook-form";
52530
52553
  import { jsx as jsx287, jsxs as jsxs255 } from "react/jsx-runtime";
@@ -52558,8 +52581,8 @@ var SelectInput = forwardRef15(
52558
52581
  const errorMessage = getFormFieldError(name, activeForm, error);
52559
52582
  const hasError = Boolean(errorMessage);
52560
52583
  const renderSelect = (buttonRef, currentValue, onValueChange) => {
52561
- const [isOpen, setIsOpen] = useState125(false);
52562
- const [searchQuery, setSearchQuery] = useState125("");
52584
+ const [isOpen, setIsOpen] = useState126(false);
52585
+ const [searchQuery, setSearchQuery] = useState126("");
52563
52586
  const dropdownRef = useRef14(null);
52564
52587
  const searchInputRef = useRef14(null);
52565
52588
  const selectedOption = useMemo59(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warqadui",
3
- "version": "0.0.303",
3
+ "version": "0.0.304",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",