@gustavo-valsechi/client 1.4.363 → 1.4.365
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/src/components/types/form/types/select/index.js +10 -6
- package/dist/src/components/types/form/types/select/index.mjs +10 -6
- package/dist/src/components/types/form/types/select/options/index.js +1 -4
- package/dist/src/components/types/form/types/select/options/index.mjs +1 -4
- package/dist/src/components/types/form/types/select/options/option/index.js +4 -2
- package/dist/src/components/types/form/types/select/options/option/index.mjs +4 -2
- package/package.json +2 -2
|
@@ -64,19 +64,24 @@ function InputSelect(props) {
|
|
|
64
64
|
...props,
|
|
65
65
|
inputRef,
|
|
66
66
|
register,
|
|
67
|
-
width: ((_a2 = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a2.offsetWidth) -
|
|
67
|
+
width: ((_a2 = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a2.offsetWidth) - 2 || 0,
|
|
68
68
|
value: inputValue
|
|
69
69
|
}
|
|
70
70
|
)
|
|
71
71
|
});
|
|
72
72
|
}, [containerRef, inputRef, props.options, inputValue]);
|
|
73
|
+
(0, import_react.useEffect)(() => {
|
|
74
|
+
if (focus) return;
|
|
75
|
+
setTimeout(() => {
|
|
76
|
+
setFilter("");
|
|
77
|
+
const optionsElement = document.getElementById(`input[${props.name}-options]`);
|
|
78
|
+
if (!optionsElement) return;
|
|
79
|
+
optionsElement.setAttribute("value", "");
|
|
80
|
+
}, 100);
|
|
81
|
+
}, [focus]);
|
|
73
82
|
const onBlur = (event) => {
|
|
74
83
|
setFocus(false);
|
|
75
|
-
setFilter("");
|
|
76
84
|
if (props.onBlur) props.onBlur(event);
|
|
77
|
-
const optionsElement = document.getElementById(`input[${props.name}-options]`);
|
|
78
|
-
if (!optionsElement) return;
|
|
79
|
-
optionsElement.setAttribute("value", "");
|
|
80
85
|
};
|
|
81
86
|
const onFocus = (event) => {
|
|
82
87
|
setFocus(true);
|
|
@@ -86,7 +91,6 @@ function InputSelect(props) {
|
|
|
86
91
|
const value = event.target.value || "";
|
|
87
92
|
setFilter(value);
|
|
88
93
|
if (props.onFilter) props.onFilter(value);
|
|
89
|
-
if (register.onChange) register.onChange(event);
|
|
90
94
|
const optionsElement = document.getElementById(`input[${props.name}-options]`);
|
|
91
95
|
if (!optionsElement) return;
|
|
92
96
|
optionsElement.setAttribute("value", value);
|
|
@@ -31,19 +31,24 @@ function InputSelect(props) {
|
|
|
31
31
|
...props,
|
|
32
32
|
inputRef,
|
|
33
33
|
register,
|
|
34
|
-
width: ((_a2 = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a2.offsetWidth) -
|
|
34
|
+
width: ((_a2 = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a2.offsetWidth) - 2 || 0,
|
|
35
35
|
value: inputValue
|
|
36
36
|
}
|
|
37
37
|
)
|
|
38
38
|
});
|
|
39
39
|
}, [containerRef, inputRef, props.options, inputValue]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (focus) return;
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
setFilter("");
|
|
44
|
+
const optionsElement = document.getElementById(`input[${props.name}-options]`);
|
|
45
|
+
if (!optionsElement) return;
|
|
46
|
+
optionsElement.setAttribute("value", "");
|
|
47
|
+
}, 100);
|
|
48
|
+
}, [focus]);
|
|
40
49
|
const onBlur = (event) => {
|
|
41
50
|
setFocus(false);
|
|
42
|
-
setFilter("");
|
|
43
51
|
if (props.onBlur) props.onBlur(event);
|
|
44
|
-
const optionsElement = document.getElementById(`input[${props.name}-options]`);
|
|
45
|
-
if (!optionsElement) return;
|
|
46
|
-
optionsElement.setAttribute("value", "");
|
|
47
52
|
};
|
|
48
53
|
const onFocus = (event) => {
|
|
49
54
|
setFocus(true);
|
|
@@ -53,7 +58,6 @@ function InputSelect(props) {
|
|
|
53
58
|
const value = event.target.value || "";
|
|
54
59
|
setFilter(value);
|
|
55
60
|
if (props.onFilter) props.onFilter(value);
|
|
56
|
-
if (register.onChange) register.onChange(event);
|
|
57
61
|
const optionsElement = document.getElementById(`input[${props.name}-options]`);
|
|
58
62
|
if (!optionsElement) return;
|
|
59
63
|
optionsElement.setAttribute("value", value);
|
|
@@ -94,9 +94,6 @@ function InputSelectOptions(props) {
|
|
|
94
94
|
setTimeout(() => target.close(props.inputRef), 10);
|
|
95
95
|
(_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
|
|
96
96
|
if (props.onChange) props.onChange(value);
|
|
97
|
-
const optionsElement = document.getElementById(`input[${props.name}-options]`);
|
|
98
|
-
if (!optionsElement) return;
|
|
99
|
-
optionsElement.setAttribute("value", "");
|
|
100
97
|
const content = document.getElementById(`input[${props.name}-options-content]`);
|
|
101
98
|
if (!content) return;
|
|
102
99
|
content.scrollTop = 0;
|
|
@@ -124,7 +121,7 @@ function InputSelectOptions(props) {
|
|
|
124
121
|
"div",
|
|
125
122
|
{
|
|
126
123
|
className: "input-option",
|
|
127
|
-
|
|
124
|
+
onMouseDown: () => onSelect(value),
|
|
128
125
|
"data-string": import_lodash.default.isString(data),
|
|
129
126
|
"data-selected": value === props.value,
|
|
130
127
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_option.default, { content: data })
|
|
@@ -61,9 +61,6 @@ function InputSelectOptions(props) {
|
|
|
61
61
|
setTimeout(() => target.close(props.inputRef), 10);
|
|
62
62
|
(_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
|
|
63
63
|
if (props.onChange) props.onChange(value);
|
|
64
|
-
const optionsElement = document.getElementById(`input[${props.name}-options]`);
|
|
65
|
-
if (!optionsElement) return;
|
|
66
|
-
optionsElement.setAttribute("value", "");
|
|
67
64
|
const content = document.getElementById(`input[${props.name}-options-content]`);
|
|
68
65
|
if (!content) return;
|
|
69
66
|
content.scrollTop = 0;
|
|
@@ -91,7 +88,7 @@ function InputSelectOptions(props) {
|
|
|
91
88
|
"div",
|
|
92
89
|
{
|
|
93
90
|
className: "input-option",
|
|
94
|
-
|
|
91
|
+
onMouseDown: () => onSelect(value),
|
|
95
92
|
"data-string": _.isString(data),
|
|
96
93
|
"data-selected": value === props.value,
|
|
97
94
|
children: /* @__PURE__ */ jsx(InputSelectOption, { content: data })
|
|
@@ -34,6 +34,7 @@ __export(option_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(option_exports);
|
|
36
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_react = __toESM(require("react"));
|
|
37
38
|
var import_styles = require("./styles");
|
|
38
39
|
var import_lodash = __toESM(require("lodash"));
|
|
39
40
|
function InputSelectOption(props) {
|
|
@@ -41,12 +42,13 @@ function InputSelectOption(props) {
|
|
|
41
42
|
if (import_lodash.default.isArray(props.content)) return "";
|
|
42
43
|
if (!!((_a = props.content) == null ? void 0 : _a.icon) || !!((_b = props.content) == null ? void 0 : _b.img)) {
|
|
43
44
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Container, { color: (_c = props.content) == null ? void 0 : _c.color, img: (_d = props.content) == null ? void 0 : _d.img, children: [
|
|
44
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "select-option-identifier", children: [
|
|
45
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "select-option-identifier", children: [
|
|
45
46
|
!!((_e = props.content) == null ? void 0 : _e.icon) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: (_f = props.content) == null ? void 0 : _f.icon }),
|
|
46
47
|
!!((_g = props.content) == null ? void 0 : _g.img) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "select-option-img" })
|
|
47
|
-
] }),
|
|
48
|
+
] }) }),
|
|
48
49
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "select-option-label-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "select-option-label", children: (_h = props.content) == null ? void 0 : _h.label }) })
|
|
49
50
|
] });
|
|
50
51
|
}
|
|
52
|
+
if (!import_react.default.isValidElement(props.content) && !(props.content instanceof HTMLElement)) return "";
|
|
51
53
|
return props.content || "";
|
|
52
54
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import React from "react";
|
|
4
5
|
import { Container } from "./styles";
|
|
5
6
|
import _ from "lodash";
|
|
6
7
|
function InputSelectOption(props) {
|
|
@@ -8,13 +9,14 @@ function InputSelectOption(props) {
|
|
|
8
9
|
if (_.isArray(props.content)) return "";
|
|
9
10
|
if (!!((_a = props.content) == null ? void 0 : _a.icon) || !!((_b = props.content) == null ? void 0 : _b.img)) {
|
|
10
11
|
return /* @__PURE__ */ jsxs(Container, { color: (_c = props.content) == null ? void 0 : _c.color, img: (_d = props.content) == null ? void 0 : _d.img, children: [
|
|
11
|
-
/* @__PURE__ */ jsxs("div", { className: "select-option-identifier", children: [
|
|
12
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: "select-option-identifier", children: [
|
|
12
13
|
!!((_e = props.content) == null ? void 0 : _e.icon) && /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: (_f = props.content) == null ? void 0 : _f.icon }),
|
|
13
14
|
!!((_g = props.content) == null ? void 0 : _g.img) && /* @__PURE__ */ jsx("div", { className: "select-option-img" })
|
|
14
|
-
] }),
|
|
15
|
+
] }) }),
|
|
15
16
|
/* @__PURE__ */ jsx("div", { className: "select-option-label-container", children: /* @__PURE__ */ jsx("div", { className: "select-option-label", children: (_h = props.content) == null ? void 0 : _h.label }) })
|
|
16
17
|
] });
|
|
17
18
|
}
|
|
19
|
+
if (!React.isValidElement(props.content) && !(props.content instanceof HTMLElement)) return "";
|
|
18
20
|
return props.content || "";
|
|
19
21
|
}
|
|
20
22
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gustavo-valsechi/client",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.365",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@emotion/react": "11.14.0",
|
|
29
29
|
"@emotion/styled": "11.14.1",
|
|
30
30
|
"@gustavo-valsechi/server": "1.0.13",
|
|
31
|
-
"@gustavo-valsechi/utils": "1.0.
|
|
31
|
+
"@gustavo-valsechi/utils": "1.0.23",
|
|
32
32
|
"@hookform/resolvers": "5.2.2",
|
|
33
33
|
"@mui/material": "7.3.7",
|
|
34
34
|
"@mui/x-date-pickers": "8.24.0",
|