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.js +16 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4750,7 +4750,7 @@ var DropdownComponent = (0, import_react16.forwardRef)(function Dropdown({
|
|
|
4750
4750
|
...props
|
|
4751
4751
|
}, ref) {
|
|
4752
4752
|
const theme2 = useTheme();
|
|
4753
|
-
const
|
|
4753
|
+
const inputFieldHolderRef = (0, import_react16.useRef)(null);
|
|
4754
4754
|
const inputRef = (0, import_react16.useRef)(null);
|
|
4755
4755
|
const [isOpen, setIsOpen] = useBooleanState();
|
|
4756
4756
|
const [isOpenLate, setIsOpenLate] = useBooleanState();
|
|
@@ -4861,7 +4861,7 @@ var DropdownComponent = (0, import_react16.forwardRef)(function Dropdown({
|
|
|
4861
4861
|
}, [filteredOptions]);
|
|
4862
4862
|
(0, import_react16.useEffect)(() => {
|
|
4863
4863
|
const handleClickOutside = (event) => {
|
|
4864
|
-
if (
|
|
4864
|
+
if (inputFieldHolderRef.current && !inputFieldHolderRef.current.contains(event.target)) {
|
|
4865
4865
|
setIsOpen.setFalse();
|
|
4866
4866
|
setSearchQuery("");
|
|
4867
4867
|
setFocusedOptionIndex(void 0);
|
|
@@ -4881,7 +4881,7 @@ var DropdownComponent = (0, import_react16.forwardRef)(function Dropdown({
|
|
|
4881
4881
|
const displayValue = withSearch && isFocused ? searchQuery : selectedOption?.label ?? "";
|
|
4882
4882
|
const withClearButton = isOpen && selectedOption;
|
|
4883
4883
|
const readyPlaceholder = placeholder ? placeholder : `Select an ${label?.toLowerCase() ?? "option"}`;
|
|
4884
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Div_default.column, { width: "100%", position: "relative", userSelect: "none", ...props,
|
|
4884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Div_default.column, { width: "100%", position: "relative", userSelect: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Div_default.row, { position: "relative", width: "100%", children: [
|
|
4885
4885
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4886
4886
|
InputField_default,
|
|
4887
4887
|
{
|
|
@@ -4901,6 +4901,7 @@ var DropdownComponent = (0, import_react16.forwardRef)(function Dropdown({
|
|
|
4901
4901
|
onFocus: setIsFocused.setTrue,
|
|
4902
4902
|
onBlur: setIsFocused.setFalse,
|
|
4903
4903
|
onKeyDown: onKeyDownInputField,
|
|
4904
|
+
holderRef: inputFieldHolderRef,
|
|
4904
4905
|
onChangeValue: withSearch ? onChangeValue : void 0,
|
|
4905
4906
|
insideInputFieldComponent: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4906
4907
|
Div_default,
|
|
@@ -4962,7 +4963,7 @@ var DropdownComponent = (0, import_react16.forwardRef)(function Dropdown({
|
|
|
4962
4963
|
Div_default.row,
|
|
4963
4964
|
{
|
|
4964
4965
|
position: "absolute",
|
|
4965
|
-
top: 46 / 2 + (label ? 16 + theme2.styles.gap
|
|
4966
|
+
top: 46 / 2 + (label ? 16 + theme2.styles.gap : 0),
|
|
4966
4967
|
right: theme2.styles.space + 1,
|
|
4967
4968
|
alignItems: "center",
|
|
4968
4969
|
gap: theme2.styles.gap,
|
|
@@ -5221,7 +5222,7 @@ var InputElement = import_styled_components9.default.input.withConfig({
|
|
|
5221
5222
|
&[type="date"],
|
|
5222
5223
|
&[type="datetime-local"],
|
|
5223
5224
|
&[type="time"] {
|
|
5224
|
-
min-height:
|
|
5225
|
+
// min-height: 46px;
|
|
5225
5226
|
-webkit-appearance: none;
|
|
5226
5227
|
|
|
5227
5228
|
&::-webkit-calendar-picker-indicator {
|
|
@@ -5350,23 +5351,29 @@ var InputFieldComponent = (0, import_react18.forwardRef)(function InputField({
|
|
|
5350
5351
|
},
|
|
5351
5352
|
[onChange, onChangeValue, withDebounce]
|
|
5352
5353
|
);
|
|
5354
|
+
const leftIconZIndex = (0, import_react18.useMemo)(
|
|
5355
|
+
() => ["react-better-html-dropdown-open-late", "react-better-html-inputField-dateTime-opened-late"].some(
|
|
5356
|
+
(classNameItem) => props.className?.includes(classNameItem)
|
|
5357
|
+
) ? 1002 : 1,
|
|
5358
|
+
[props.className]
|
|
5359
|
+
);
|
|
5353
5360
|
(0, import_react18.useEffect)(() => {
|
|
5354
5361
|
if (!withDebounce) return;
|
|
5355
5362
|
onChangeValue?.(debouncedValue);
|
|
5356
5363
|
}, [withDebounce, onChangeValue, debouncedValue]);
|
|
5357
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded,
|
|
5364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, children: [
|
|
5358
5365
|
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText }),
|
|
5359
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { position: "relative", width: "100%", children: [
|
|
5366
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { position: "relative", width: "100%", ref: holderRef, children: [
|
|
5360
5367
|
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5361
5368
|
Icon_default,
|
|
5362
5369
|
{
|
|
5363
5370
|
name: leftIcon,
|
|
5364
5371
|
position: "absolute",
|
|
5365
|
-
top: 46 / 2,
|
|
5372
|
+
top: (props.type === "date" || props.type === "time" || props.type === "datetime-local" ? 48 : 46) / 2,
|
|
5366
5373
|
left: theme2.styles.space + 1,
|
|
5367
5374
|
transform: "translateY(-50%)",
|
|
5368
5375
|
pointerEvents: "none",
|
|
5369
|
-
zIndex:
|
|
5376
|
+
zIndex: leftIconZIndex
|
|
5370
5377
|
}
|
|
5371
5378
|
),
|
|
5372
5379
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|