componentes-sinco 1.3.0 → 1.3.2

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 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: "bottom",
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,
@@ -3241,7 +3251,7 @@ var AttachmentMobile = ({
3241
3251
  ),
3242
3252
  /* @__PURE__ */ import_react23.default.createElement(import_material16.Typography, { variant: "body2", color: "text.secondary" }, option.label)
3243
3253
  ))))
3244
- ), abrirCamara && /* @__PURE__ */ import_react23.default.createElement(import_react23.default.Fragment, null, /* @__PURE__ */ import_react23.default.createElement(import_CancelOutlined.default, { onClick: closeCam, sx: { borderRadius: "50px", height: "35px", width: "35px", zIndex: 1700, background: "white", position: "absolute", left: `calc(100% - 50px)`, bottom: `calc(100% - 50px)` } }), /* @__PURE__ */ import_react23.default.createElement(import_material16.Stack, { className: "camras" }, /* @__PURE__ */ import_react23.default.createElement(
3254
+ ), abrirCamara && /* @__PURE__ */ import_react23.default.createElement(import_react23.default.Fragment, null, /* @__PURE__ */ import_react23.default.createElement(import_CancelOutlined.default, { onClick: closeCam, sx: { borderRadius: "50px", height: "35px", width: "35px", zIndex: 2e3, background: "white", position: "absolute", left: `calc(100% - 50px)`, bottom: `calc(100% - 50px)` } }), /* @__PURE__ */ import_react23.default.createElement(import_material16.Stack, { className: "camras" }, /* @__PURE__ */ import_react23.default.createElement(
3245
3255
  import_react_webcam.default,
3246
3256
  {
3247
3257
  audio: false,
@@ -3261,7 +3271,7 @@ var AttachmentMobile = ({
3261
3271
  left: 0,
3262
3272
  objectFit: "cover",
3263
3273
  backgroundColor: "black",
3264
- zIndex: 1600
3274
+ zIndex: 2e3
3265
3275
  // Encima de todo
3266
3276
  }
3267
3277
  }
@@ -3276,7 +3286,7 @@ var AttachmentMobile = ({
3276
3286
  backgroundColor: "white",
3277
3287
  color: "#1E62A1",
3278
3288
  borderRadius: "50px",
3279
- zIndex: 1700,
3289
+ zIndex: 2100,
3280
3290
  position: "absolute",
3281
3291
  bottom: "10px",
3282
3292
  left: "50%"
@@ -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,