componenteshospitais 3.0.5 → 3.0.6
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 +36 -91
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +36 -91
- package/dist/esm/index.js.map +1 -1
- package/dist/types/components/InputField.d.ts +2 -1
- package/dist/types/stories/InputField.stories.d.ts +3 -3
- package/package.json +1 -1
- package/src/components/InputField.tsx +7 -58
package/dist/cjs/index.js
CHANGED
|
@@ -126,49 +126,6 @@ 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
|
-
|
|
172
129
|
var DefaultContext = {
|
|
173
130
|
color: undefined,
|
|
174
131
|
size: undefined,
|
|
@@ -240,66 +197,22 @@ function FaDownload (props) {
|
|
|
240
197
|
}
|
|
241
198
|
|
|
242
199
|
var InputField = function (_a) {
|
|
243
|
-
var type = _a.type, id = _a.id,
|
|
200
|
+
var type = _a.type, id = _a.id, name = _a.name, // Accept name prop here
|
|
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;
|
|
244
202
|
var _b = React.useState(false), isPasswordVisible = _b[0], setIsPasswordVisible = _b[1];
|
|
245
203
|
var togglePasswordVisibility = function () {
|
|
246
204
|
setIsPasswordVisible(!isPasswordVisible);
|
|
247
205
|
};
|
|
248
206
|
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
|
-
};
|
|
291
207
|
var handleChange = function (e) {
|
|
292
|
-
var value = e.target.value;
|
|
293
|
-
var maskedValue = applyMask(maskType, value);
|
|
294
208
|
if (onChange) {
|
|
295
|
-
|
|
296
|
-
onChange(event_1);
|
|
209
|
+
onChange(e); // Ensure the onChange prop is called with the correct event
|
|
297
210
|
}
|
|
298
211
|
};
|
|
299
212
|
return (React.createElement(React.Fragment, null,
|
|
300
213
|
label && React.createElement("label", { htmlFor: id, style: { color: corLabel ? corLabel : '' } }, label),
|
|
301
214
|
React.createElement("div", { className: styles$5.inputWrapper },
|
|
302
|
-
React.createElement("input", { type: type === 'password' && isPasswordVisible ? 'text' : type, id: id, name:
|
|
215
|
+
React.createElement("input", { type: type === 'password' && isPasswordVisible ? 'text' : type, id: id, name: name, value: value, placeholder: placeholder, onChange: handleChange, className: styles$5.inputPadrao, style: {
|
|
303
216
|
width: largura ? "".concat(largura) : '',
|
|
304
217
|
backgroundColor: disabled ? '#e5e5e5' : (corFundo ? corFundo : ''),
|
|
305
218
|
borderRadius: borderRadius ? "".concat(borderRadius, "px") : '',
|
|
@@ -450,6 +363,38 @@ var Busca = function (_a) {
|
|
|
450
363
|
} }, filteredOptions.map(function (option, index) { return (React.createElement("li", { key: index, onClick: function () { return handleOptionClick(option); }, style: { padding: '5px', cursor: 'pointer' } }, option.description)); })))));
|
|
451
364
|
};
|
|
452
365
|
|
|
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
|
+
|
|
453
398
|
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}";
|
|
454
399
|
var styles$1 = {"checkboxGroup":"checkboxGroup-module_checkboxGroup__JFRoY","title":"checkboxGroup-module_title__238QG","checkboxLabel":"checkboxGroup-module_checkboxLabel__tIciT"};
|
|
455
400
|
styleInject(css_248z$1);
|