@ssplib/react-components 0.0.256 → 0.0.258
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 React from 'react';
|
|
2
|
-
export declare function Input({ type, numberMask, xs, sm, inputMinLength, inputMaxLength, defaultValue, md,
|
|
2
|
+
export declare function Input({ type, numberMask, xs, sm, inputMinLength, inputMaxLength, defaultValue, md, disabled, watchValue, ...props }: {
|
|
3
3
|
type: 'cnpj' | 'cpf' | 'input' | 'email' | 'cpf_cnpj' | 'phone' | 'input' | 'number' | 'rg' | 'password' | 'cep' | 'sei';
|
|
4
4
|
name: string;
|
|
5
5
|
watchValue?: string;
|
|
@@ -44,10 +44,11 @@ const react_1 = __importStar(require("react"));
|
|
|
44
44
|
const MaskInput_1 = __importDefault(require("./MaskInput"));
|
|
45
45
|
const form_1 = require("../../../context/form");
|
|
46
46
|
function Input(_a) {
|
|
47
|
-
var { type = 'input', numberMask = '000000000000000', xs = 12, sm, inputMinLength = 1, inputMaxLength = 255, defaultValue = '', md,
|
|
47
|
+
var { type = 'input', numberMask = '000000000000000', xs = 12, sm, inputMinLength = 1, inputMaxLength = 255, defaultValue = '', md, disabled = false, watchValue } = _a, props = __rest(_a, ["type", "numberMask", "xs", "sm", "inputMinLength", "inputMaxLength", "defaultValue", "md", "disabled", "watchValue"]);
|
|
48
48
|
const context = (0, react_1.useContext)(form_1.FormContext);
|
|
49
49
|
(0, react_1.useEffect)(() => {
|
|
50
|
-
|
|
50
|
+
if (!watchValue === undefined)
|
|
51
|
+
context.formSetValue(props.name, watchValue);
|
|
51
52
|
}, [watchValue]);
|
|
52
53
|
const chooseInput = () => {
|
|
53
54
|
const inputConfig = {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const cookieName = "nextauth.token";
|
|
3
|
-
export declare function KeycloakAuthProvider({ url, realm, clientId, children, type, resource_name, }: {
|
|
3
|
+
export declare function KeycloakAuthProvider({ url, realm, clientId, children, type, resource_name, redirectUri, }: {
|
|
4
4
|
url: string;
|
|
5
5
|
realm: string;
|
|
6
6
|
clientId: string;
|
|
7
7
|
children: JSX.Element | JSX.Element[];
|
|
8
8
|
type?: 'govbr' | 'ad';
|
|
9
9
|
resource_name?: string;
|
|
10
|
+
redirectUri?: string;
|
|
10
11
|
}): JSX.Element;
|
|
@@ -33,11 +33,10 @@ const auth_1 = require("../../context/auth");
|
|
|
33
33
|
const keycloak_js_1 = __importDefault(require("keycloak-js"));
|
|
34
34
|
exports.cookieName = 'nextauth.token';
|
|
35
35
|
const userImgName = 'user-data.img';
|
|
36
|
-
function KeycloakAuthProvider({ url, realm, clientId, children, type = 'ad', resource_name = 'eventos-front', }) {
|
|
36
|
+
function KeycloakAuthProvider({ url, realm, clientId, children, type = 'ad', resource_name = 'eventos-front', redirectUri = '', }) {
|
|
37
37
|
const [user, setUser] = (0, react_1.useState)();
|
|
38
38
|
const [userLoaded, setUserLoaded] = (0, react_1.useState)(false);
|
|
39
39
|
const [kc, setKc] = (0, react_1.useState)(null);
|
|
40
|
-
const [token, setToken] = (0, react_1.useState)(undefined);
|
|
41
40
|
const router = (0, router_1.useRouter)();
|
|
42
41
|
const isAuth = !!user;
|
|
43
42
|
(0, react_1.useEffect)(() => {
|
|
@@ -87,7 +86,7 @@ function KeycloakAuthProvider({ url, realm, clientId, children, type = 'ad', res
|
|
|
87
86
|
logado: kc === null || kc === void 0 ? void 0 : kc.authenticated,
|
|
88
87
|
client_id: kc === null || kc === void 0 ? void 0 : kc.clientId,
|
|
89
88
|
});
|
|
90
|
-
kc === null || kc === void 0 ? void 0 : kc.login();
|
|
89
|
+
kc === null || kc === void 0 ? void 0 : kc.login({ redirectUri });
|
|
91
90
|
}
|
|
92
91
|
function logout() {
|
|
93
92
|
setUserLoaded(false);
|