jclib-ui 1.0.294 → 1.0.296

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.
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import React__default, { useEffect, createContext, useContext, useState, useCallback, useRef, useLayoutEffect, useImperativeHandle, useMemo } from "react";
2
+ import React__default, { useEffect, createContext, useContext, useState, useCallback, useRef, useMemo, useLayoutEffect, useImperativeHandle } from "react";
3
3
  import { isDarkMode, random, isMobile, formatData, formatDataHora, formatValor, isDesktop, getDateTimeStr, getHash, validarCNPJ, validarCPF } from "jcinfo-utils";
4
4
  import { useDragControls, motion } from "framer-motion";
5
5
  import styled from "styled-components";
@@ -3895,6 +3895,18 @@ if (process.env.NODE_ENV === "production") {
3895
3895
  jsxRuntime.exports = requireReactJsxRuntime_development();
3896
3896
  }
3897
3897
  var jsxRuntimeExports = jsxRuntime.exports;
3898
+ const BorderTestServer = styled.div`
3899
+ position: fixed;
3900
+ top: 0;
3901
+ right: 0;
3902
+ width: 15px;
3903
+ aspect-ratio: 1/1;
3904
+ box-sizing: border-box;
3905
+ background-color: #b92c2c;
3906
+ border-radius: 99px;
3907
+ pointer-events: none;
3908
+ z-index: 9999999;
3909
+ `;
3898
3910
  const MARCADOR_LOCALHOST = " 🔴 ";
3899
3911
  const MARCADOR_TESTE = " 🟢 ";
3900
3912
  function useLocalhostBadge() {
@@ -3906,13 +3918,18 @@ function useLocalhostBadge() {
3906
3918
  }, []);
3907
3919
  }
3908
3920
  function useTestDomainBadge(testDomain) {
3909
- useEffect(() => {
3921
+ function inTestServer() {
3910
3922
  const domains = testDomain ? [].concat(testDomain) : ["test.", "test-"];
3911
- const inTestServer = domains.some((domain) => window.location.hostname.includes(domain));
3912
- if (inTestServer && !document.title.includes(MARCADOR_TESTE)) {
3923
+ return Boolean(
3924
+ domains.some((domain) => window.location.hostname.includes(domain))
3925
+ );
3926
+ }
3927
+ useEffect(() => {
3928
+ if (inTestServer() && !document.title.includes(MARCADOR_TESTE)) {
3913
3929
  document.title = `${MARCADOR_TESTE}${document.title}`;
3914
3930
  }
3915
3931
  }, [testDomain]);
3932
+ return inTestServer() && /* @__PURE__ */ jsxRuntimeExports.jsx(BorderTestServer, {});
3916
3933
  }
3917
3934
  const LibContext = createContext({
3918
3935
  modalList: [],
@@ -3992,7 +4009,7 @@ const LibProvider = ({ apiConfig, children, versionApp, useTheme, testDomain })
3992
4009
  [modalList]
3993
4010
  );
3994
4011
  useLocalhostBadge();
3995
- useTestDomainBadge(testDomain);
4012
+ const borderTestServer = useTestDomainBadge(testDomain);
3996
4013
  useEffect(() => {
3997
4014
  if (canChangeTheme) {
3998
4015
  localStorage.setItem(cTheme, theme);
@@ -4003,7 +4020,7 @@ const LibProvider = ({ apiConfig, children, versionApp, useTheme, testDomain })
4003
4020
  window.addEventListener("keydown", handleKeyDown, false);
4004
4021
  return () => window.removeEventListener("keydown", handleKeyDown, false);
4005
4022
  }, [modalList]);
4006
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
4023
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
4007
4024
  LibContext.Provider,
4008
4025
  {
4009
4026
  value: {
@@ -4021,7 +4038,10 @@ const LibProvider = ({ apiConfig, children, versionApp, useTheme, testDomain })
4021
4038
  reportType,
4022
4039
  setReportType
4023
4040
  },
4024
- children
4041
+ children: [
4042
+ borderTestServer,
4043
+ children
4044
+ ]
4025
4045
  }
4026
4046
  );
4027
4047
  };
@@ -21480,41 +21500,6 @@ function Input({
21480
21500
  return /* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "form-control", onClick: handleClick, ...props });
21481
21501
  }
21482
21502
  }
21483
- const Container$3 = styled.div`
21484
- display: inline-block;
21485
- `;
21486
- const Label = styled.span`
21487
- color: ${(props) => props.disabled ? "silver" : "#333"};
21488
- display: flex;
21489
- align-items: center;
21490
- margin: 0px 0 0;
21491
- cursor: ${(props) => props.disabled ? "default" : "pointer"};
21492
-
21493
- span {
21494
- font-size: 20px;
21495
- }
21496
- `;
21497
- const InputCheckBox = ({ disabled, children, name, checked, onChange }) => {
21498
- function handleClick() {
21499
- if (!disabled && onChange) {
21500
- const event = {
21501
- target: {
21502
- name,
21503
- checked: !checked
21504
- }
21505
- };
21506
- onChange(event);
21507
- }
21508
- }
21509
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Container$3, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Label, { disabled, onClick: handleClick, children: [
21510
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
21511
- checked && /* @__PURE__ */ jsxRuntimeExports.jsx(IconToggleOn, { color: disabled && "silver" }),
21512
- !checked && /* @__PURE__ */ jsxRuntimeExports.jsx(IconToggleOff, { color: disabled && "silver" })
21513
- ] }),
21514
- " ",
21515
- children
21516
- ] }) });
21517
- };
21518
21503
  const InputPasswordContainer = styled.div`
21519
21504
  position: relative;
21520
21505
 
@@ -21581,6 +21566,91 @@ function InputPassword({ disabled, autoSelect, ...rest }) {
21581
21566
  function InputBox({ children }) {
21582
21567
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "jclib-ui-input-box", children });
21583
21568
  }
21569
+ const Container$3 = styled.div`
21570
+ display: inline-block;
21571
+ `;
21572
+ const Label = styled.span`
21573
+ color: ${(props) => props.disabled ? "silver" : "#333"};
21574
+ display: flex;
21575
+ align-items: center;
21576
+ margin: 0px 0 0;
21577
+ cursor: ${(props) => props.disabled ? "default" : "pointer"};
21578
+
21579
+ span {
21580
+ font-size: 20px;
21581
+ }
21582
+ `;
21583
+ const InputCheckBox = ({ disabled, children, name, checked, onChange }) => {
21584
+ function handleClick() {
21585
+ if (!disabled && onChange) {
21586
+ const event = {
21587
+ target: {
21588
+ name,
21589
+ checked: !checked
21590
+ }
21591
+ };
21592
+ onChange(event);
21593
+ }
21594
+ }
21595
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Container$3, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Label, { disabled, onClick: handleClick, children: [
21596
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
21597
+ checked && /* @__PURE__ */ jsxRuntimeExports.jsx(IconToggleOn, { color: disabled && "silver" }),
21598
+ !checked && /* @__PURE__ */ jsxRuntimeExports.jsx(IconToggleOff, { color: disabled && "silver" })
21599
+ ] }),
21600
+ " ",
21601
+ children
21602
+ ] }) });
21603
+ };
21604
+ function InputOff({
21605
+ campo,
21606
+ dados,
21607
+ setDados,
21608
+ type,
21609
+ className,
21610
+ disabled,
21611
+ ...rest
21612
+ }) {
21613
+ const nameDom = useMemo(
21614
+ () => `${campo}_${Math.random().toString(36).slice(2, 8)}`,
21615
+ [campo]
21616
+ );
21617
+ const [readOnly, setReadOnly] = useState(true);
21618
+ const [showPass, setShowPass] = useState(false);
21619
+ const isPass = type == "password";
21620
+ useEffect(() => {
21621
+ setShowPass(false);
21622
+ }, [disabled]);
21623
+ const handleShowPass = () => {
21624
+ if (!disabled) {
21625
+ setShowPass(!showPass);
21626
+ }
21627
+ };
21628
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "input-off", children: [
21629
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
21630
+ "input",
21631
+ {
21632
+ className: `form-control ${className} ${isPass && !showPass ? "input-off-senha" : ""}`,
21633
+ type: "text",
21634
+ name: nameDom,
21635
+ value: dados[campo] ?? "",
21636
+ onChange: (e) => setDados({ ...dados, [campo]: e.target.value }),
21637
+ autoComplete: "off",
21638
+ onFocus: () => setReadOnly(false),
21639
+ readOnly,
21640
+ disabled,
21641
+ ...rest
21642
+ }
21643
+ ),
21644
+ type == "password" && /* @__PURE__ */ jsxRuntimeExports.jsx(
21645
+ "div",
21646
+ {
21647
+ className: `icone ${disabled ? "disabled" : ""}`,
21648
+ onClick: handleShowPass,
21649
+ children: showPass ? /* @__PURE__ */ jsxRuntimeExports.jsx("i", { className: "fa-solid fa-eye-slash" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("i", { className: "fa-solid fa-eye" })
21650
+ }
21651
+ )
21652
+ ] });
21653
+ }
21584
21654
  function LabelHint({ label, hint }) {
21585
21655
  const hintTitle = "Ajuda";
21586
21656
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "label-hint--container", children: [
@@ -25757,6 +25827,7 @@ export {
25757
25827
  InputFinder$1 as InputFinder,
25758
25828
  InputFone,
25759
25829
  InputHora,
25830
+ InputOff,
25760
25831
  InputPassword,
25761
25832
  InputPercent,
25762
25833
  InputPesquisa,