jclib-ui 1.0.279 → 1.0.280

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.
@@ -3920,7 +3920,7 @@ const LibContext = createContext({
3920
3920
  });
3921
3921
  const cTheme = "sys/theme";
3922
3922
  const LibProvider = ({ apiConfig, children, versionApp, useTheme }) => {
3923
- const canChangeTheme = useTheme && typeof useTheme == "boolean" ? useTheme : false;
3923
+ const canChangeTheme = typeof useTheme == "boolean" ? useTheme : false;
3924
3924
  const [theme, setTheme] = useState(() => {
3925
3925
  let result = "";
3926
3926
  if (canChangeTheme) {
@@ -3933,6 +3933,7 @@ const LibProvider = ({ apiConfig, children, versionApp, useTheme }) => {
3933
3933
  }
3934
3934
  return result;
3935
3935
  });
3936
+ const toggleTheme = () => setTheme(theme == "dark" ? "light" : "dark");
3936
3937
  const [reportType, setReportType] = useLocalStorage("sys/reportType", 0);
3937
3938
  const [modalList, setModalList] = useState([]);
3938
3939
  const [showBtnTop, setShowBtnTop] = useState(false);
@@ -3971,7 +3972,6 @@ const LibProvider = ({ apiConfig, children, versionApp, useTheme }) => {
3971
3972
  },
3972
3973
  [modalList]
3973
3974
  );
3974
- const toggleTheme = () => setTheme(theme == "dark" ? "light" : "dark");
3975
3975
  useEffect(() => {
3976
3976
  const MARCADOR = " 🔴 ";
3977
3977
  const inLocalhost = window.location.hostname == "localhost" || window.location.hostname == "127.0.0.1" || window.location.hostname == "[::1]" || window.location.hostname.startsWith("192.168.");
@@ -6161,23 +6161,21 @@ function Modal({
6161
6161
  }) {
6162
6162
  const { addModal, removeModal } = useLibContext();
6163
6163
  const [modalId] = useState(id || "modal-" + random());
6164
+ function closeModal() {
6165
+ removeModal(modalId);
6166
+ if (hideScrollBar) {
6167
+ document.body.classList.remove(CLASS);
6168
+ }
6169
+ }
6164
6170
  useEffect(() => {
6165
6171
  if (visible) {
6166
6172
  if (hideScrollBar) {
6167
6173
  document.body.classList.add(CLASS);
6168
6174
  }
6169
6175
  } else {
6170
- removeModal(modalId);
6171
- if (hideScrollBar) {
6172
- document.body.classList.remove(CLASS);
6173
- }
6176
+ closeModal();
6174
6177
  }
6175
- return () => {
6176
- removeModal(modalId);
6177
- if (hideScrollBar) {
6178
- document.body.classList.remove(CLASS);
6179
- }
6180
- };
6178
+ return () => closeModal();
6181
6179
  }, [visible, hideScrollBar]);
6182
6180
  useEffect(() => {
6183
6181
  addModal(modalId, setVisible);