warqadui 0.0.105 → 0.0.106

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
@@ -2587,7 +2587,16 @@ var useSearchApiContext = () => {
2587
2587
  };
2588
2588
  var SearchApi = (0, import_react16.forwardRef)(
2589
2589
  (props, _) => {
2590
- const { form, name, onChange, onSelect, onClear, value, children, ...restProps } = props;
2590
+ const {
2591
+ form,
2592
+ name,
2593
+ onChange,
2594
+ onSelect,
2595
+ onClear,
2596
+ value,
2597
+ children,
2598
+ ...restProps
2599
+ } = props;
2591
2600
  (0, import_react16.useEffect)(() => {
2592
2601
  if (form && name && value !== void 0 && value !== null && value !== "") {
2593
2602
  const currentFormValue = form.getValues(name);
@@ -2794,7 +2803,7 @@ var SearchApiRoot = ({
2794
2803
  }, [fieldInternalProps]);
2795
2804
  const getDisplayValue = () => {
2796
2805
  if (selectedObject) return selectedObject[labelKey];
2797
- if (options3.length > 0 && (currentValue !== void 0 && currentValue !== null && currentValue !== "")) {
2806
+ if (options3.length > 0 && currentValue !== void 0 && currentValue !== null && currentValue !== "") {
2798
2807
  const found = options3.find((o) => getOptionValue(o) === currentValue);
2799
2808
  if (found) return found[labelKey];
2800
2809
  }
@@ -3057,7 +3066,7 @@ var SearchApiInput = (0, import_react16.forwardRef)(
3057
3066
  }
3058
3067
  };
3059
3068
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
3060
- !isOpen && (selectedValue !== void 0 && selectedValue !== null && selectedValue !== "") && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute inset-0 flex items-center ms-1 truncate select-none", children: getDisplayValue() }),
3069
+ !isOpen && selectedValue !== void 0 && selectedValue !== null && selectedValue !== "" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute inset-0 flex items-center ms-1 truncate select-none", children: getDisplayValue() }),
3061
3070
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3062
3071
  "input",
3063
3072
  {
@@ -3097,12 +3106,15 @@ var SearchApiInput = (0, import_react16.forwardRef)(
3097
3106
  props.onFocus?.(e);
3098
3107
  },
3099
3108
  onBlur: (e) => {
3100
- if (!dropdownContentRef.current?.contains(e.relatedTarget) && !containerRef.current?.contains(e.relatedTarget)) {
3101
- setIsFocused(false);
3102
- setIsOpen(false);
3103
- setSearchTerm("");
3104
- fieldInternalProps?.onBlur?.();
3105
- }
3109
+ const relatedTarget = e.relatedTarget;
3110
+ setTimeout(() => {
3111
+ if (!dropdownContentRef.current?.contains(relatedTarget) && !containerRef.current?.contains(relatedTarget)) {
3112
+ setIsFocused(false);
3113
+ setIsOpen(false);
3114
+ setSearchTerm("");
3115
+ fieldInternalProps?.onBlur?.();
3116
+ }
3117
+ }, 150);
3106
3118
  props.onBlur?.(e);
3107
3119
  }
3108
3120
  }
@@ -3128,16 +3140,12 @@ var SearchApiContent = (0, import_react16.forwardRef)(
3128
3140
  if (dropdownAnchorRef.current) {
3129
3141
  const rect = dropdownAnchorRef.current.getBoundingClientRect();
3130
3142
  const newStyle = {
3131
- position: "fixed",
3132
- top: `${rect.bottom + 4}px`,
3133
- left: `${rect.left}px`,
3143
+ position: "absolute",
3144
+ top: `${rect.bottom + window.scrollY + 4}px`,
3145
+ left: `${rect.left + window.scrollX}px`,
3134
3146
  width: `${rect.width}px`,
3135
3147
  zIndex: 999999
3136
3148
  };
3137
- if (rect.bottom + 240 > window.innerHeight) {
3138
- newStyle.top = "auto";
3139
- newStyle.bottom = `${window.innerHeight - rect.top + 4}px`;
3140
- }
3141
3149
  setDropdownStyle(newStyle);
3142
3150
  }
3143
3151
  };
@@ -3207,7 +3215,7 @@ var SearchApiItem = (0, import_react16.forwardRef)(
3207
3215
  color: primaryColor
3208
3216
  } : void 0,
3209
3217
  onMouseDown: (e) => e.stopPropagation(),
3210
- onClick: (e) => {
3218
+ onPointerDown: (e) => {
3211
3219
  e.stopPropagation();
3212
3220
  e.preventDefault();
3213
3221
  handleSelect(option);
package/dist/index.mjs CHANGED
@@ -2454,7 +2454,16 @@ var useSearchApiContext = () => {
2454
2454
  };
2455
2455
  var SearchApi = forwardRef5(
2456
2456
  (props, _) => {
2457
- const { form, name, onChange, onSelect, onClear, value, children, ...restProps } = props;
2457
+ const {
2458
+ form,
2459
+ name,
2460
+ onChange,
2461
+ onSelect,
2462
+ onClear,
2463
+ value,
2464
+ children,
2465
+ ...restProps
2466
+ } = props;
2458
2467
  useEffect10(() => {
2459
2468
  if (form && name && value !== void 0 && value !== null && value !== "") {
2460
2469
  const currentFormValue = form.getValues(name);
@@ -2661,7 +2670,7 @@ var SearchApiRoot = ({
2661
2670
  }, [fieldInternalProps]);
2662
2671
  const getDisplayValue = () => {
2663
2672
  if (selectedObject) return selectedObject[labelKey];
2664
- if (options3.length > 0 && (currentValue !== void 0 && currentValue !== null && currentValue !== "")) {
2673
+ if (options3.length > 0 && currentValue !== void 0 && currentValue !== null && currentValue !== "") {
2665
2674
  const found = options3.find((o) => getOptionValue(o) === currentValue);
2666
2675
  if (found) return found[labelKey];
2667
2676
  }
@@ -2924,7 +2933,7 @@ var SearchApiInput = forwardRef5(
2924
2933
  }
2925
2934
  };
2926
2935
  return /* @__PURE__ */ jsxs18(Fragment5, { children: [
2927
- !isOpen && (selectedValue !== void 0 && selectedValue !== null && selectedValue !== "") && /* @__PURE__ */ jsx23("div", { className: "absolute inset-0 flex items-center ms-1 truncate select-none", children: getDisplayValue() }),
2936
+ !isOpen && selectedValue !== void 0 && selectedValue !== null && selectedValue !== "" && /* @__PURE__ */ jsx23("div", { className: "absolute inset-0 flex items-center ms-1 truncate select-none", children: getDisplayValue() }),
2928
2937
  /* @__PURE__ */ jsx23(
2929
2938
  "input",
2930
2939
  {
@@ -2964,12 +2973,15 @@ var SearchApiInput = forwardRef5(
2964
2973
  props.onFocus?.(e);
2965
2974
  },
2966
2975
  onBlur: (e) => {
2967
- if (!dropdownContentRef.current?.contains(e.relatedTarget) && !containerRef.current?.contains(e.relatedTarget)) {
2968
- setIsFocused(false);
2969
- setIsOpen(false);
2970
- setSearchTerm("");
2971
- fieldInternalProps?.onBlur?.();
2972
- }
2976
+ const relatedTarget = e.relatedTarget;
2977
+ setTimeout(() => {
2978
+ if (!dropdownContentRef.current?.contains(relatedTarget) && !containerRef.current?.contains(relatedTarget)) {
2979
+ setIsFocused(false);
2980
+ setIsOpen(false);
2981
+ setSearchTerm("");
2982
+ fieldInternalProps?.onBlur?.();
2983
+ }
2984
+ }, 150);
2973
2985
  props.onBlur?.(e);
2974
2986
  }
2975
2987
  }
@@ -2995,16 +3007,12 @@ var SearchApiContent = forwardRef5(
2995
3007
  if (dropdownAnchorRef.current) {
2996
3008
  const rect = dropdownAnchorRef.current.getBoundingClientRect();
2997
3009
  const newStyle = {
2998
- position: "fixed",
2999
- top: `${rect.bottom + 4}px`,
3000
- left: `${rect.left}px`,
3010
+ position: "absolute",
3011
+ top: `${rect.bottom + window.scrollY + 4}px`,
3012
+ left: `${rect.left + window.scrollX}px`,
3001
3013
  width: `${rect.width}px`,
3002
3014
  zIndex: 999999
3003
3015
  };
3004
- if (rect.bottom + 240 > window.innerHeight) {
3005
- newStyle.top = "auto";
3006
- newStyle.bottom = `${window.innerHeight - rect.top + 4}px`;
3007
- }
3008
3016
  setDropdownStyle(newStyle);
3009
3017
  }
3010
3018
  };
@@ -3074,7 +3082,7 @@ var SearchApiItem = forwardRef5(
3074
3082
  color: primaryColor
3075
3083
  } : void 0,
3076
3084
  onMouseDown: (e) => e.stopPropagation(),
3077
- onClick: (e) => {
3085
+ onPointerDown: (e) => {
3078
3086
  e.stopPropagation();
3079
3087
  e.preventDefault();
3080
3088
  handleSelect(option);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warqadui",
3
- "version": "0.0.105",
3
+ "version": "0.0.106",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",