jclib-ui 1.0.293 → 1.0.295
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/jclib-ui.css +1 -1
- package/dist/jclib-ui.es.js +112 -50
- package/dist/jclib-ui.es.js.map +1 -1
- package/dist/jclib-ui.umd.js +38 -38
- package/dist/jclib-ui.umd.js.map +1 -1
- package/dist/src/lib/context/libContext.d.ts +3 -1
- package/dist/src/lib/hooks/useTitleBadge.d.ts +10 -0
- package/dist/src/lib/index.d.ts +3 -1
- package/dist/src/lib/inputOff/inputOff.d.ts +9 -0
- package/package.json +1 -1
package/dist/jclib-ui.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import React__default, { createContext, useContext, useState, useCallback,
|
|
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,25 @@ if (process.env.NODE_ENV === "production") {
|
|
|
3895
3895
|
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
3896
3896
|
}
|
|
3897
3897
|
var jsxRuntimeExports = jsxRuntime.exports;
|
|
3898
|
+
const MARCADOR_LOCALHOST = " 🔴 ";
|
|
3899
|
+
const MARCADOR_TESTE = " 🟢 ";
|
|
3900
|
+
function useLocalhostBadge() {
|
|
3901
|
+
useEffect(() => {
|
|
3902
|
+
const inLocalhost = window.location.hostname == "localhost" || window.location.hostname == "127.0.0.1" || window.location.hostname == "[::1]" || window.location.hostname.startsWith("192.168.");
|
|
3903
|
+
if (inLocalhost && !document.title.includes(MARCADOR_LOCALHOST)) {
|
|
3904
|
+
document.title = `${MARCADOR_LOCALHOST}${document.title}`;
|
|
3905
|
+
}
|
|
3906
|
+
}, []);
|
|
3907
|
+
}
|
|
3908
|
+
function useTestDomainBadge(testDomain) {
|
|
3909
|
+
useEffect(() => {
|
|
3910
|
+
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)) {
|
|
3913
|
+
document.title = `${MARCADOR_TESTE}${document.title}`;
|
|
3914
|
+
}
|
|
3915
|
+
}, [testDomain]);
|
|
3916
|
+
}
|
|
3898
3917
|
const LibContext = createContext({
|
|
3899
3918
|
modalList: [],
|
|
3900
3919
|
theme: "light",
|
|
@@ -3919,7 +3938,7 @@ const LibContext = createContext({
|
|
|
3919
3938
|
}
|
|
3920
3939
|
});
|
|
3921
3940
|
const cTheme = "sys/theme";
|
|
3922
|
-
const LibProvider = ({ apiConfig, children, versionApp, useTheme }) => {
|
|
3941
|
+
const LibProvider = ({ apiConfig, children, versionApp, useTheme, testDomain }) => {
|
|
3923
3942
|
const canChangeTheme = typeof useTheme == "boolean" ? useTheme : false;
|
|
3924
3943
|
const [theme, setTheme] = useState(() => {
|
|
3925
3944
|
let result = "";
|
|
@@ -3972,18 +3991,8 @@ const LibProvider = ({ apiConfig, children, versionApp, useTheme }) => {
|
|
|
3972
3991
|
},
|
|
3973
3992
|
[modalList]
|
|
3974
3993
|
);
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
const inLocalhost = window.location.hostname == "localhost" || window.location.hostname == "127.0.0.1" || window.location.hostname == "[::1]" || window.location.hostname.startsWith("192.168.");
|
|
3978
|
-
if (inLocalhost && !document.title.includes(MARCADOR)) {
|
|
3979
|
-
document.title = `${MARCADOR}${document.title}`;
|
|
3980
|
-
}
|
|
3981
|
-
const MARCADOR2 = " 🟢 ";
|
|
3982
|
-
const inServerTest = window.location.hostname.includes("test.") || window.location.hostname.includes("test-");
|
|
3983
|
-
if (inServerTest && !document.title.includes(MARCADOR2)) {
|
|
3984
|
-
document.title = `${MARCADOR2}${document.title}`;
|
|
3985
|
-
}
|
|
3986
|
-
}, []);
|
|
3994
|
+
useLocalhostBadge();
|
|
3995
|
+
useTestDomainBadge(testDomain);
|
|
3987
3996
|
useEffect(() => {
|
|
3988
3997
|
if (canChangeTheme) {
|
|
3989
3998
|
localStorage.setItem(cTheme, theme);
|
|
@@ -21471,41 +21480,6 @@ function Input({
|
|
|
21471
21480
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "form-control", onClick: handleClick, ...props });
|
|
21472
21481
|
}
|
|
21473
21482
|
}
|
|
21474
|
-
const Container$3 = styled.div`
|
|
21475
|
-
display: inline-block;
|
|
21476
|
-
`;
|
|
21477
|
-
const Label = styled.span`
|
|
21478
|
-
color: ${(props) => props.disabled ? "silver" : "#333"};
|
|
21479
|
-
display: flex;
|
|
21480
|
-
align-items: center;
|
|
21481
|
-
margin: 0px 0 0;
|
|
21482
|
-
cursor: ${(props) => props.disabled ? "default" : "pointer"};
|
|
21483
|
-
|
|
21484
|
-
span {
|
|
21485
|
-
font-size: 20px;
|
|
21486
|
-
}
|
|
21487
|
-
`;
|
|
21488
|
-
const InputCheckBox = ({ disabled, children, name, checked, onChange }) => {
|
|
21489
|
-
function handleClick() {
|
|
21490
|
-
if (!disabled && onChange) {
|
|
21491
|
-
const event = {
|
|
21492
|
-
target: {
|
|
21493
|
-
name,
|
|
21494
|
-
checked: !checked
|
|
21495
|
-
}
|
|
21496
|
-
};
|
|
21497
|
-
onChange(event);
|
|
21498
|
-
}
|
|
21499
|
-
}
|
|
21500
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Container$3, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Label, { disabled, onClick: handleClick, children: [
|
|
21501
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
21502
|
-
checked && /* @__PURE__ */ jsxRuntimeExports.jsx(IconToggleOn, { color: disabled && "silver" }),
|
|
21503
|
-
!checked && /* @__PURE__ */ jsxRuntimeExports.jsx(IconToggleOff, { color: disabled && "silver" })
|
|
21504
|
-
] }),
|
|
21505
|
-
" ",
|
|
21506
|
-
children
|
|
21507
|
-
] }) });
|
|
21508
|
-
};
|
|
21509
21483
|
const InputPasswordContainer = styled.div`
|
|
21510
21484
|
position: relative;
|
|
21511
21485
|
|
|
@@ -21572,6 +21546,91 @@ function InputPassword({ disabled, autoSelect, ...rest }) {
|
|
|
21572
21546
|
function InputBox({ children }) {
|
|
21573
21547
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "jclib-ui-input-box", children });
|
|
21574
21548
|
}
|
|
21549
|
+
const Container$3 = styled.div`
|
|
21550
|
+
display: inline-block;
|
|
21551
|
+
`;
|
|
21552
|
+
const Label = styled.span`
|
|
21553
|
+
color: ${(props) => props.disabled ? "silver" : "#333"};
|
|
21554
|
+
display: flex;
|
|
21555
|
+
align-items: center;
|
|
21556
|
+
margin: 0px 0 0;
|
|
21557
|
+
cursor: ${(props) => props.disabled ? "default" : "pointer"};
|
|
21558
|
+
|
|
21559
|
+
span {
|
|
21560
|
+
font-size: 20px;
|
|
21561
|
+
}
|
|
21562
|
+
`;
|
|
21563
|
+
const InputCheckBox = ({ disabled, children, name, checked, onChange }) => {
|
|
21564
|
+
function handleClick() {
|
|
21565
|
+
if (!disabled && onChange) {
|
|
21566
|
+
const event = {
|
|
21567
|
+
target: {
|
|
21568
|
+
name,
|
|
21569
|
+
checked: !checked
|
|
21570
|
+
}
|
|
21571
|
+
};
|
|
21572
|
+
onChange(event);
|
|
21573
|
+
}
|
|
21574
|
+
}
|
|
21575
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Container$3, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Label, { disabled, onClick: handleClick, children: [
|
|
21576
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
21577
|
+
checked && /* @__PURE__ */ jsxRuntimeExports.jsx(IconToggleOn, { color: disabled && "silver" }),
|
|
21578
|
+
!checked && /* @__PURE__ */ jsxRuntimeExports.jsx(IconToggleOff, { color: disabled && "silver" })
|
|
21579
|
+
] }),
|
|
21580
|
+
" ",
|
|
21581
|
+
children
|
|
21582
|
+
] }) });
|
|
21583
|
+
};
|
|
21584
|
+
function InputOff({
|
|
21585
|
+
campo,
|
|
21586
|
+
dados,
|
|
21587
|
+
setDados,
|
|
21588
|
+
type,
|
|
21589
|
+
className,
|
|
21590
|
+
disabled,
|
|
21591
|
+
...rest
|
|
21592
|
+
}) {
|
|
21593
|
+
const nameDom = useMemo(
|
|
21594
|
+
() => `${campo}_${Math.random().toString(36).slice(2, 8)}`,
|
|
21595
|
+
[campo]
|
|
21596
|
+
);
|
|
21597
|
+
const [readOnly, setReadOnly] = useState(true);
|
|
21598
|
+
const [showPass, setShowPass] = useState(false);
|
|
21599
|
+
const isPass = type == "password";
|
|
21600
|
+
useEffect(() => {
|
|
21601
|
+
setShowPass(false);
|
|
21602
|
+
}, [disabled]);
|
|
21603
|
+
const handleShowPass = () => {
|
|
21604
|
+
if (!disabled) {
|
|
21605
|
+
setShowPass(!showPass);
|
|
21606
|
+
}
|
|
21607
|
+
};
|
|
21608
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "input-off", children: [
|
|
21609
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
21610
|
+
"input",
|
|
21611
|
+
{
|
|
21612
|
+
className: `form-control ${className} ${isPass && !showPass ? "input-off-senha" : ""}`,
|
|
21613
|
+
type: "text",
|
|
21614
|
+
name: nameDom,
|
|
21615
|
+
value: dados[campo] ?? "",
|
|
21616
|
+
onChange: (e) => setDados({ ...dados, [campo]: e.target.value }),
|
|
21617
|
+
autoComplete: "off",
|
|
21618
|
+
onFocus: () => setReadOnly(false),
|
|
21619
|
+
readOnly,
|
|
21620
|
+
disabled,
|
|
21621
|
+
...rest
|
|
21622
|
+
}
|
|
21623
|
+
),
|
|
21624
|
+
type == "password" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
21625
|
+
"div",
|
|
21626
|
+
{
|
|
21627
|
+
className: `icone ${disabled ? "disabled" : ""}`,
|
|
21628
|
+
onClick: handleShowPass,
|
|
21629
|
+
children: showPass ? /* @__PURE__ */ jsxRuntimeExports.jsx("i", { className: "fa-solid fa-eye-slash" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("i", { className: "fa-solid fa-eye" })
|
|
21630
|
+
}
|
|
21631
|
+
)
|
|
21632
|
+
] });
|
|
21633
|
+
}
|
|
21575
21634
|
function LabelHint({ label, hint }) {
|
|
21576
21635
|
const hintTitle = "Ajuda";
|
|
21577
21636
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "label-hint--container", children: [
|
|
@@ -25748,6 +25807,7 @@ export {
|
|
|
25748
25807
|
InputFinder$1 as InputFinder,
|
|
25749
25808
|
InputFone,
|
|
25750
25809
|
InputHora,
|
|
25810
|
+
InputOff,
|
|
25751
25811
|
InputPassword,
|
|
25752
25812
|
InputPercent,
|
|
25753
25813
|
InputPesquisa,
|
|
@@ -25802,8 +25862,10 @@ export {
|
|
|
25802
25862
|
useLibContext,
|
|
25803
25863
|
useLocalForage,
|
|
25804
25864
|
useLocalStorage,
|
|
25865
|
+
useLocalhostBadge,
|
|
25805
25866
|
useParamId,
|
|
25806
25867
|
useQuery,
|
|
25807
|
-
useSessionStorage
|
|
25868
|
+
useSessionStorage,
|
|
25869
|
+
useTestDomainBadge
|
|
25808
25870
|
};
|
|
25809
25871
|
//# sourceMappingURL=jclib-ui.es.js.map
|