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.d.cts CHANGED
@@ -271,9 +271,10 @@ interface FooterActionsProperties {
271
271
  leftContent?: React.ReactNode;
272
272
  rightContent?: React.ReactNode;
273
273
  variant?: 'standard' | 'float';
274
+ width?: string;
274
275
  }
275
276
 
276
- declare const FooterAction: ({ leftContent, rightContent, label, variant, }: FooterActionsProperties) => React__default.JSX.Element;
277
+ declare const FooterAction: ({ leftContent, rightContent, label, variant, width, }: FooterActionsProperties) => React__default.JSX.Element;
277
278
 
278
279
  interface BasicMenuProps {
279
280
  open?: boolean;
package/dist/index.d.ts CHANGED
@@ -271,9 +271,10 @@ interface FooterActionsProperties {
271
271
  leftContent?: React.ReactNode;
272
272
  rightContent?: React.ReactNode;
273
273
  variant?: 'standard' | 'float';
274
+ width?: string;
274
275
  }
275
276
 
276
- declare const FooterAction: ({ leftContent, rightContent, label, variant, }: FooterActionsProperties) => React__default.JSX.Element;
277
+ declare const FooterAction: ({ leftContent, rightContent, label, variant, width, }: FooterActionsProperties) => React__default.JSX.Element;
277
278
 
278
279
  interface BasicMenuProps {
279
280
  open?: boolean;
package/dist/index.js CHANGED
@@ -1765,6 +1765,8 @@ function SCSelect({
1765
1765
  const labelContent = `<span style="color: red;">* </span>` + label;
1766
1766
  const [prevData, setPrevData] = React12.useState(data);
1767
1767
  const [error, setError] = React12.useState(false);
1768
+ const [placement, setPlacement] = React12.useState("bottom");
1769
+ const containerRef = React12.useRef(null);
1768
1770
  useEffect9(() => {
1769
1771
  if (error) {
1770
1772
  setTimeout(() => {
@@ -1793,6 +1795,14 @@ function SCSelect({
1793
1795
  const isError = !currentValue && !!required;
1794
1796
  setError(Boolean(isError));
1795
1797
  };
1798
+ const handleOpen = () => {
1799
+ if (containerRef.current) {
1800
+ const rect = containerRef.current.getBoundingClientRect();
1801
+ const spaceBelow = window.innerHeight - rect.bottom;
1802
+ const estimatedMenuHeight = Math.min(300, data.length * 36 + 16);
1803
+ setPlacement(spaceBelow < estimatedMenuHeight ? "top" : "bottom");
1804
+ }
1805
+ };
1796
1806
  const handleChange = (event2) => {
1797
1807
  const selectedValue = event2.target.value;
1798
1808
  if (selectedValue) {
@@ -1806,7 +1816,7 @@ function SCSelect({
1806
1816
  }
1807
1817
  }
1808
1818
  };
1809
- return /* @__PURE__ */ React12.createElement(React12.Fragment, null, data && /* @__PURE__ */ React12.createElement(Box7, { sx: { width } }, /* @__PURE__ */ React12.createElement(
1819
+ return /* @__PURE__ */ React12.createElement(React12.Fragment, null, data && /* @__PURE__ */ React12.createElement(Box7, { ref: containerRef, sx: { width } }, /* @__PURE__ */ React12.createElement(
1810
1820
  FormControl2,
1811
1821
  {
1812
1822
  fullWidth: true,
@@ -1828,6 +1838,7 @@ function SCSelect({
1828
1838
  label: required ? /* @__PURE__ */ React12.createElement("span", { dangerouslySetInnerHTML: { __html: labelContent } }) : label,
1829
1839
  onChange: handleChange,
1830
1840
  onBlur: handleBlur,
1841
+ onOpen: handleOpen,
1831
1842
  variant,
1832
1843
  disabled: disabled || false,
1833
1844
  error,
@@ -1835,7 +1846,6 @@ function SCSelect({
1835
1846
  MenuProps: {
1836
1847
  sx: {
1837
1848
  zIndex: 1400
1838
- // muy alto para que quede encima
1839
1849
  },
1840
1850
  PaperProps: {
1841
1851
  sx: {
@@ -1844,11 +1854,11 @@ function SCSelect({
1844
1854
  }
1845
1855
  },
1846
1856
  anchorOrigin: {
1847
- vertical: "bottom",
1857
+ vertical: placement,
1848
1858
  horizontal: "left"
1849
1859
  },
1850
1860
  transformOrigin: {
1851
- vertical: "top",
1861
+ vertical: placement === "bottom" ? "top" : "bottom",
1852
1862
  horizontal: "left"
1853
1863
  },
1854
1864
  disableAutoFocusItem: true,
@@ -4246,13 +4256,14 @@ var FooterAction = ({
4246
4256
  leftContent,
4247
4257
  rightContent,
4248
4258
  label,
4249
- variant
4259
+ variant,
4260
+ width
4250
4261
  }) => {
4251
4262
  return /* @__PURE__ */ React33.createElement(
4252
4263
  AppBar,
4253
4264
  {
4254
4265
  color: "inherit",
4255
- sx: { position: variant == "float" ? "relative" : "fixed", left: 0, right: "auto", width: "100%", top: "auto", bottom: 0 }
4266
+ 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 }
4256
4267
  },
4257
4268
  /* @__PURE__ */ React33.createElement(
4258
4269
  Toolbar,