componenteshospitais 3.0.6 → 3.0.7
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/cjs/index.js +90 -35
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +90 -35
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/InputField.tsx +58 -5
package/dist/cjs/index.js
CHANGED
|
@@ -126,6 +126,49 @@ var Button = function (_a) {
|
|
|
126
126
|
return (React.createElement("div", { className: "".concat(empresaClass) }, type === 'submit' ? (React.createElement("input", { type: "submit", className: styles$5.inputSubmit, style: { width: largura ? "".concat(largura) : '', borderRadius: borderRadius ? "".concat(borderRadius, "px") : '' }, value: texto, disabled: disabled })) : (React.createElement("button", { type: "button", className: styles$5.inputSubmit, onClick: onClick, style: { width: largura ? "".concat(largura) : '', borderRadius: borderRadius ? "".concat(borderRadius, "px") : '' }, dangerouslySetInnerHTML: { __html: texto }, disabled: disabled }))));
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
+
/******************************************************************************
|
|
130
|
+
Copyright (c) Microsoft Corporation.
|
|
131
|
+
|
|
132
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
133
|
+
purpose with or without fee is hereby granted.
|
|
134
|
+
|
|
135
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
136
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
137
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
138
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
139
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
140
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
141
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
142
|
+
***************************************************************************** */
|
|
143
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
var __assign = function() {
|
|
147
|
+
__assign = Object.assign || function __assign(t) {
|
|
148
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
149
|
+
s = arguments[i];
|
|
150
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
151
|
+
}
|
|
152
|
+
return t;
|
|
153
|
+
};
|
|
154
|
+
return __assign.apply(this, arguments);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
function __spreadArray(to, from, pack) {
|
|
158
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
159
|
+
if (ar || !(i in from)) {
|
|
160
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
161
|
+
ar[i] = from[i];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
168
|
+
var e = new Error(message);
|
|
169
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
170
|
+
};
|
|
171
|
+
|
|
129
172
|
var DefaultContext = {
|
|
130
173
|
color: undefined,
|
|
131
174
|
size: undefined,
|
|
@@ -197,16 +240,60 @@ function FaDownload (props) {
|
|
|
197
240
|
}
|
|
198
241
|
|
|
199
242
|
var InputField = function (_a) {
|
|
200
|
-
var type = _a.type, id = _a.id, name = _a.name,
|
|
201
|
-
placeholder = _a.placeholder, onChange = _a.onChange, value = _a.value, label = _a.label, largura = _a.largura, readonly = _a.readonly, disabled = _a.disabled, required = _a.required, checked = _a.checked, maxLength = _a.maxLength; _a.maskType; var onKeyPress = _a.onKeyPress, onBlur = _a.onBlur, corFundo = _a.corFundo, corLabel = _a.corLabel, borderRadius = _a.borderRadius, colorIcon = _a.colorIcon, border = _a.border;
|
|
243
|
+
var type = _a.type, id = _a.id, name = _a.name, placeholder = _a.placeholder, onChange = _a.onChange, value = _a.value, label = _a.label, largura = _a.largura, readonly = _a.readonly, disabled = _a.disabled, required = _a.required, checked = _a.checked, maxLength = _a.maxLength, maskType = _a.maskType, onKeyPress = _a.onKeyPress, onBlur = _a.onBlur, corFundo = _a.corFundo, corLabel = _a.corLabel, borderRadius = _a.borderRadius, colorIcon = _a.colorIcon, border = _a.border;
|
|
202
244
|
var _b = React.useState(false), isPasswordVisible = _b[0], setIsPasswordVisible = _b[1];
|
|
203
245
|
var togglePasswordVisibility = function () {
|
|
204
246
|
setIsPasswordVisible(!isPasswordVisible);
|
|
205
247
|
};
|
|
206
248
|
var appliedMaxLength = maxLength !== undefined ? maxLength : 524288;
|
|
249
|
+
// Helper function to apply masks
|
|
250
|
+
var applyMask = function (maskType, value) {
|
|
251
|
+
switch (maskType) {
|
|
252
|
+
case 'cpf':
|
|
253
|
+
return value
|
|
254
|
+
.replace(/\D/g, '') // Remove all non-digits
|
|
255
|
+
.replace(/(\d{3})(\d)/, '$1.$2') // Add dots and hyphen
|
|
256
|
+
.replace(/(\d{3})(\d)/, '$1.$2')
|
|
257
|
+
.replace(/(\d{3})(\d{1,2})$/, '$1-$2')
|
|
258
|
+
.slice(0, 14); // Limit length
|
|
259
|
+
case 'phone':
|
|
260
|
+
return value
|
|
261
|
+
.replace(/\D/g, '')
|
|
262
|
+
.replace(/(\d{2})(\d)/, '($1) $2') // Add parentheses and space
|
|
263
|
+
.replace(/(\d{5})(\d)/, '$1-$2') // Add hyphen
|
|
264
|
+
.slice(0, 15); // Limit length
|
|
265
|
+
case 'telefone':
|
|
266
|
+
return value
|
|
267
|
+
.replace(/\D/g, '')
|
|
268
|
+
.replace(/(\d{2})(\d)/, '($1) $2') // Add parentheses and space
|
|
269
|
+
.replace(/(\d{4})(\d)/, '$1-$2') // Add hyphen
|
|
270
|
+
.slice(0, 14); // Limit length
|
|
271
|
+
case 'cep':
|
|
272
|
+
return value
|
|
273
|
+
.replace(/\D/g, '')
|
|
274
|
+
.replace(/(\d{5})(\d)/, '$1-$2') // Add hyphen
|
|
275
|
+
.slice(0, 9); // Limit length
|
|
276
|
+
case 'date':
|
|
277
|
+
return value
|
|
278
|
+
.replace(/\D/g, '')
|
|
279
|
+
.replace(/(\d{2})(\d)/, '$1/$2')
|
|
280
|
+
.replace(/(\d{2})(\d)/, '$1/$2')
|
|
281
|
+
.slice(0, 10); // Limit length
|
|
282
|
+
case 'time':
|
|
283
|
+
return value
|
|
284
|
+
.replace(/\D/g, '')
|
|
285
|
+
.replace(/(\d{2})(\d)/, '$1:$2')
|
|
286
|
+
.slice(0, 5); // Limit length
|
|
287
|
+
default:
|
|
288
|
+
return value; // No mask applied
|
|
289
|
+
}
|
|
290
|
+
};
|
|
207
291
|
var handleChange = function (e) {
|
|
292
|
+
var value = e.target.value;
|
|
293
|
+
var maskedValue = applyMask(maskType, value);
|
|
208
294
|
if (onChange) {
|
|
209
|
-
|
|
295
|
+
var event_1 = __assign(__assign({}, e), { target: __assign(__assign({}, e.target), { value: maskedValue }) }); // Create a new event with the masked value
|
|
296
|
+
onChange(event_1);
|
|
210
297
|
}
|
|
211
298
|
};
|
|
212
299
|
return (React.createElement(React.Fragment, null,
|
|
@@ -363,38 +450,6 @@ var Busca = function (_a) {
|
|
|
363
450
|
} }, filteredOptions.map(function (option, index) { return (React.createElement("li", { key: index, onClick: function () { return handleOptionClick(option); }, style: { padding: '5px', cursor: 'pointer' } }, option.description)); })))));
|
|
364
451
|
};
|
|
365
452
|
|
|
366
|
-
/******************************************************************************
|
|
367
|
-
Copyright (c) Microsoft Corporation.
|
|
368
|
-
|
|
369
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
370
|
-
purpose with or without fee is hereby granted.
|
|
371
|
-
|
|
372
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
373
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
374
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
375
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
376
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
377
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
378
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
379
|
-
***************************************************************************** */
|
|
380
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
function __spreadArray(to, from, pack) {
|
|
384
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
385
|
-
if (ar || !(i in from)) {
|
|
386
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
387
|
-
ar[i] = from[i];
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
394
|
-
var e = new Error(message);
|
|
395
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
396
|
-
};
|
|
397
|
-
|
|
398
453
|
var css_248z$1 = ".checkboxGroup-module_checkboxGroup__JFRoY{border:1px solid #ccc;border-radius:.5rem;box-sizing:border-box;display:grid;font-style:italic;gap:.5rem;grid-auto-rows:auto;grid-template-columns:repeat(auto-fill,minmax(275px,1fr));padding:.8rem 0 .8rem 1rem;width:100%}.checkboxGroup-module_title__238QG{margin-bottom:10px}.checkboxGroup-module_checkboxLabel__tIciT{align-items:center;cursor:pointer;display:flex;font-style:italic}.checkboxGroup-module_checkboxLabel__tIciT input[type=checkbox]{cursor:pointer;margin-right:.5rem}.checkboxGroup-module_checkboxLabel__tIciT input[type=checkbox]:focus{outline:none}";
|
|
399
454
|
var styles$1 = {"checkboxGroup":"checkboxGroup-module_checkboxGroup__JFRoY","title":"checkboxGroup-module_title__238QG","checkboxLabel":"checkboxGroup-module_checkboxLabel__tIciT"};
|
|
400
455
|
styleInject(css_248z$1);
|