react-better-html 1.1.77 → 1.1.79

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.mjs CHANGED
@@ -4677,7 +4677,7 @@ var DropdownComponent = forwardRef7(function Dropdown({
4677
4677
  ...props
4678
4678
  }, ref) {
4679
4679
  const theme2 = useTheme();
4680
- const dropdownHolderRef = useRef3(null);
4680
+ const inputFieldHolderRef = useRef3(null);
4681
4681
  const inputRef = useRef3(null);
4682
4682
  const [isOpen, setIsOpen] = useBooleanState();
4683
4683
  const [isOpenLate, setIsOpenLate] = useBooleanState();
@@ -4788,7 +4788,7 @@ var DropdownComponent = forwardRef7(function Dropdown({
4788
4788
  }, [filteredOptions]);
4789
4789
  useEffect5(() => {
4790
4790
  const handleClickOutside = (event) => {
4791
- if (dropdownHolderRef.current && !dropdownHolderRef.current.contains(event.target)) {
4791
+ if (inputFieldHolderRef.current && !inputFieldHolderRef.current.contains(event.target)) {
4792
4792
  setIsOpen.setFalse();
4793
4793
  setSearchQuery("");
4794
4794
  setFocusedOptionIndex(void 0);
@@ -4808,7 +4808,7 @@ var DropdownComponent = forwardRef7(function Dropdown({
4808
4808
  const displayValue = withSearch && isFocused ? searchQuery : selectedOption?.label ?? "";
4809
4809
  const withClearButton = isOpen && selectedOption;
4810
4810
  const readyPlaceholder = placeholder ? placeholder : `Select an ${label?.toLowerCase() ?? "option"}`;
4811
- return /* @__PURE__ */ jsx13(Div_default.column, { width: "100%", position: "relative", userSelect: "none", ...props, ref: dropdownHolderRef, children: /* @__PURE__ */ jsxs8(Div_default.row, { position: "relative", width: "100%", children: [
4811
+ return /* @__PURE__ */ jsx13(Div_default.column, { width: "100%", position: "relative", userSelect: "none", ...props, children: /* @__PURE__ */ jsxs8(Div_default.row, { position: "relative", width: "100%", children: [
4812
4812
  /* @__PURE__ */ jsx13(
4813
4813
  InputField_default,
4814
4814
  {
@@ -4828,6 +4828,7 @@ var DropdownComponent = forwardRef7(function Dropdown({
4828
4828
  onFocus: setIsFocused.setTrue,
4829
4829
  onBlur: setIsFocused.setFalse,
4830
4830
  onKeyDown: onKeyDownInputField,
4831
+ holderRef: inputFieldHolderRef,
4831
4832
  onChangeValue: withSearch ? onChangeValue : void 0,
4832
4833
  insideInputFieldComponent: /* @__PURE__ */ jsx13(
4833
4834
  Div_default,
@@ -4889,7 +4890,7 @@ var DropdownComponent = forwardRef7(function Dropdown({
4889
4890
  Div_default.row,
4890
4891
  {
4891
4892
  position: "absolute",
4892
- top: 46 / 2 + (label ? 16 + theme2.styles.gap / 2 : 0),
4893
+ top: 46 / 2 + (label ? 16 + theme2.styles.gap : 0),
4893
4894
  right: theme2.styles.space + 1,
4894
4895
  alignItems: "center",
4895
4896
  gap: theme2.styles.gap,
@@ -5148,7 +5149,7 @@ var InputElement = styled8.input.withConfig({
5148
5149
  &[type="date"],
5149
5150
  &[type="datetime-local"],
5150
5151
  &[type="time"] {
5151
- min-height: 48px;
5152
+ // min-height: 46px;
5152
5153
  -webkit-appearance: none;
5153
5154
 
5154
5155
  &::-webkit-calendar-picker-indicator {
@@ -5277,23 +5278,29 @@ var InputFieldComponent = forwardRef8(function InputField({
5277
5278
  },
5278
5279
  [onChange, onChangeValue, withDebounce]
5279
5280
  );
5281
+ const leftIconZIndex = useMemo5(
5282
+ () => ["react-better-html-dropdown-open-late", "react-better-html-inputField-dateTime-opened-late"].some(
5283
+ (classNameItem) => props.className?.includes(classNameItem)
5284
+ ) ? 1002 : 1,
5285
+ [props.className]
5286
+ );
5280
5287
  useEffect7(() => {
5281
5288
  if (!withDebounce) return;
5282
5289
  onChangeValue?.(debouncedValue);
5283
5290
  }, [withDebounce, onChangeValue, debouncedValue]);
5284
- return /* @__PURE__ */ jsxs10(Div_default.column, { width: "100%", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, ref: holderRef, children: [
5291
+ return /* @__PURE__ */ jsxs10(Div_default.column, { width: "100%", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, children: [
5285
5292
  label && /* @__PURE__ */ jsx15(Label_default, { text: label, color: labelColor, required, isError: !!errorText }),
5286
- /* @__PURE__ */ jsxs10(Div_default, { position: "relative", width: "100%", children: [
5293
+ /* @__PURE__ */ jsxs10(Div_default, { position: "relative", width: "100%", ref: holderRef, children: [
5287
5294
  leftIcon && /* @__PURE__ */ jsx15(
5288
5295
  Icon_default,
5289
5296
  {
5290
5297
  name: leftIcon,
5291
5298
  position: "absolute",
5292
- top: 46 / 2,
5299
+ top: (props.type === "date" || props.type === "time" || props.type === "datetime-local" ? 48 : 46) / 2,
5293
5300
  left: theme2.styles.space + 1,
5294
5301
  transform: "translateY(-50%)",
5295
5302
  pointerEvents: "none",
5296
- zIndex: props.className?.includes("react-better-html-dropdown-open-late") ? 1002 : 1
5303
+ zIndex: leftIconZIndex
5297
5304
  }
5298
5305
  ),
5299
5306
  /* @__PURE__ */ jsx15(