componentes-sinco 1.3.0 → 1.3.1
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.cjs +17 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +17 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1851,6 +1851,8 @@ function SCSelect({
|
|
|
1851
1851
|
const labelContent = `<span style="color: red;">* </span>` + label;
|
|
1852
1852
|
const [prevData, setPrevData] = import_react16.default.useState(data);
|
|
1853
1853
|
const [error, setError] = import_react16.default.useState(false);
|
|
1854
|
+
const [placement, setPlacement] = import_react16.default.useState("bottom");
|
|
1855
|
+
const containerRef = import_react16.default.useRef(null);
|
|
1854
1856
|
(0, import_react16.useEffect)(() => {
|
|
1855
1857
|
if (error) {
|
|
1856
1858
|
setTimeout(() => {
|
|
@@ -1879,6 +1881,14 @@ function SCSelect({
|
|
|
1879
1881
|
const isError = !currentValue && !!required;
|
|
1880
1882
|
setError(Boolean(isError));
|
|
1881
1883
|
};
|
|
1884
|
+
const handleOpen = () => {
|
|
1885
|
+
if (containerRef.current) {
|
|
1886
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
1887
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
1888
|
+
const estimatedMenuHeight = Math.min(300, data.length * 36 + 16);
|
|
1889
|
+
setPlacement(spaceBelow < estimatedMenuHeight ? "top" : "bottom");
|
|
1890
|
+
}
|
|
1891
|
+
};
|
|
1882
1892
|
const handleChange = (event2) => {
|
|
1883
1893
|
const selectedValue = event2.target.value;
|
|
1884
1894
|
if (selectedValue) {
|
|
@@ -1892,7 +1902,7 @@ function SCSelect({
|
|
|
1892
1902
|
}
|
|
1893
1903
|
}
|
|
1894
1904
|
};
|
|
1895
|
-
return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, data && /* @__PURE__ */ import_react16.default.createElement(import_material9.Box, { sx: { width } }, /* @__PURE__ */ import_react16.default.createElement(
|
|
1905
|
+
return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, data && /* @__PURE__ */ import_react16.default.createElement(import_material9.Box, { ref: containerRef, sx: { width } }, /* @__PURE__ */ import_react16.default.createElement(
|
|
1896
1906
|
import_material9.FormControl,
|
|
1897
1907
|
{
|
|
1898
1908
|
fullWidth: true,
|
|
@@ -1914,6 +1924,7 @@ function SCSelect({
|
|
|
1914
1924
|
label: required ? /* @__PURE__ */ import_react16.default.createElement("span", { dangerouslySetInnerHTML: { __html: labelContent } }) : label,
|
|
1915
1925
|
onChange: handleChange,
|
|
1916
1926
|
onBlur: handleBlur,
|
|
1927
|
+
onOpen: handleOpen,
|
|
1917
1928
|
variant,
|
|
1918
1929
|
disabled: disabled || false,
|
|
1919
1930
|
error,
|
|
@@ -1921,7 +1932,6 @@ function SCSelect({
|
|
|
1921
1932
|
MenuProps: {
|
|
1922
1933
|
sx: {
|
|
1923
1934
|
zIndex: 1400
|
|
1924
|
-
// muy alto para que quede encima
|
|
1925
1935
|
},
|
|
1926
1936
|
PaperProps: {
|
|
1927
1937
|
sx: {
|
|
@@ -1930,11 +1940,11 @@ function SCSelect({
|
|
|
1930
1940
|
}
|
|
1931
1941
|
},
|
|
1932
1942
|
anchorOrigin: {
|
|
1933
|
-
vertical:
|
|
1943
|
+
vertical: placement,
|
|
1934
1944
|
horizontal: "left"
|
|
1935
1945
|
},
|
|
1936
1946
|
transformOrigin: {
|
|
1937
|
-
vertical: "top",
|
|
1947
|
+
vertical: placement === "bottom" ? "top" : "bottom",
|
|
1938
1948
|
horizontal: "left"
|
|
1939
1949
|
},
|
|
1940
1950
|
disableAutoFocusItem: true,
|
|
@@ -4332,13 +4342,14 @@ var FooterAction = ({
|
|
|
4332
4342
|
leftContent,
|
|
4333
4343
|
rightContent,
|
|
4334
4344
|
label,
|
|
4335
|
-
variant
|
|
4345
|
+
variant,
|
|
4346
|
+
width
|
|
4336
4347
|
}) => {
|
|
4337
4348
|
return /* @__PURE__ */ import_react38.default.createElement(
|
|
4338
4349
|
import_material25.AppBar,
|
|
4339
4350
|
{
|
|
4340
4351
|
color: "inherit",
|
|
4341
|
-
sx: { position: variant == "float" ? "relative" : "fixed", left: 0, right: "auto", width: "100%", top: "auto", bottom: 0 }
|
|
4352
|
+
sx: { position: variant == "float" ? "relative" : "fixed", left: variant == "float" ? "auto" : "50%", transform: variant == "float" ? "none" : "translateX(-50%)", margin: variant == "float" ? "0 auto" : void 0, right: "auto", width: width != null ? width : "100%", top: "auto", bottom: 0 }
|
|
4342
4353
|
},
|
|
4343
4354
|
/* @__PURE__ */ import_react38.default.createElement(
|
|
4344
4355
|
import_material25.Toolbar,
|