pge-front-common 14.2.34 → 14.2.35
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/lib/index.d.ts +10 -5
- package/lib/index.esm.js +36 -7
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +36 -7
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -296,7 +296,12 @@ type OptionsProps$2 = {
|
|
|
296
296
|
|
|
297
297
|
declare const SelectMult: ({ name, optionsSelect, value, placeholder, label, handleChange, isMulti, disabled, fetchOptions, required, textError, hasError, message, Icon, isSearchable, isClearable, isCheckedAll, maxMenuHeight, }: SelectMultProps) => React__default.JSX.Element;
|
|
298
298
|
|
|
299
|
-
interface
|
|
299
|
+
interface ReactSelectMenuPortalProps {
|
|
300
|
+
usarMenuPortal?: boolean;
|
|
301
|
+
zIndexMenuPortal?: number;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
interface SelectDefaultProps$1 extends ReactSelectMenuPortalProps {
|
|
300
305
|
name: string;
|
|
301
306
|
optionsSelect: OptionsProps$1[];
|
|
302
307
|
value: any;
|
|
@@ -316,7 +321,7 @@ type OptionsProps$1 = {
|
|
|
316
321
|
value: string;
|
|
317
322
|
};
|
|
318
323
|
|
|
319
|
-
declare const BasicSelect: ({ name, optionsSelect, placeholder, isDisabled, label, hasError, handleChange, isRequired, value, isClearable, }: SelectDefaultProps$1) => React$1.JSX.Element;
|
|
324
|
+
declare const BasicSelect: ({ name, optionsSelect, placeholder, isDisabled, label, hasError, handleChange, isRequired, value, isClearable, usarMenuPortal, zIndexMenuPortal, }: SelectDefaultProps$1) => React$1.JSX.Element;
|
|
320
325
|
|
|
321
326
|
interface Props {
|
|
322
327
|
isOpen: boolean;
|
|
@@ -460,10 +465,10 @@ interface TimeInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "ty
|
|
|
460
465
|
|
|
461
466
|
declare const TimeInput: ({ restrictionMessage, label, onChange, isError, valueTime, disabled, placeholder, required, minutesStep, hoursRange: hoursRangeProp, textoCancelar, textoConfirmar, ...inputProps }: TimeInputProps) => React__default.JSX.Element;
|
|
462
467
|
|
|
463
|
-
interface SelectDefaultProps {
|
|
468
|
+
interface SelectDefaultProps extends ReactSelectMenuPortalProps {
|
|
464
469
|
name: string;
|
|
465
470
|
optionsSelect: OptionsProps[];
|
|
466
|
-
value
|
|
471
|
+
value?: any;
|
|
467
472
|
placeholder?: string;
|
|
468
473
|
className?: string;
|
|
469
474
|
label?: string;
|
|
@@ -485,7 +490,7 @@ type OptionsProps = {
|
|
|
485
490
|
isDisabled?: boolean;
|
|
486
491
|
};
|
|
487
492
|
|
|
488
|
-
declare const SelectDefault: ({ name, control, optionsSelect, placeholder, isDisabled, label, hasError, handleChange, isRequired, value, handleInputChange, formatOptionLabel, isClearable, maxMenuHeight, noOptionsMessage, }: SelectDefaultProps) => React$1.JSX.Element;
|
|
493
|
+
declare const SelectDefault: ({ name, control, optionsSelect, placeholder, isDisabled, label, hasError, handleChange, isRequired, value, handleInputChange, formatOptionLabel, isClearable, maxMenuHeight, noOptionsMessage, usarMenuPortal, zIndexMenuPortal, }: SelectDefaultProps) => React$1.JSX.Element;
|
|
489
494
|
|
|
490
495
|
interface ModalProps$1 {
|
|
491
496
|
isModalOpen: boolean;
|
package/lib/index.esm.js
CHANGED
|
@@ -8895,6 +8895,29 @@ var css_248z$n = ".styles-module__selectContainer___uFP2d {\r\n width: 100%;\r\
|
|
|
8895
8895
|
var styles$m = {"selectContainer":"styles-module__selectContainer___uFP2d","errorText":"styles-module__errorText___grCcq","errorRequired":"styles-module__errorRequired___PNeLN","contentIcon":"styles-module__contentIcon___SAMFM","iconChefron":"styles-module__iconChefron___Cp81j"};
|
|
8896
8896
|
styleInject(css_248z$n);
|
|
8897
8897
|
|
|
8898
|
+
var Z_INDEX_MENU_PORTAL_PADRAO = 9999;
|
|
8899
|
+
function obterConfigMenuPortal(usarMenuPortal, zIndex) {
|
|
8900
|
+
if (zIndex === void 0) { zIndex = Z_INDEX_MENU_PORTAL_PADRAO; }
|
|
8901
|
+
if (!usarMenuPortal) {
|
|
8902
|
+
return {
|
|
8903
|
+
menuPortalTarget: undefined,
|
|
8904
|
+
menuPosition: "absolute",
|
|
8905
|
+
estiloMenuPortal: undefined,
|
|
8906
|
+
};
|
|
8907
|
+
}
|
|
8908
|
+
return {
|
|
8909
|
+
menuPortalTarget: typeof document !== "undefined" ? document.body : undefined,
|
|
8910
|
+
menuPosition: "fixed",
|
|
8911
|
+
estiloMenuPortal: function (base) { return (__assign(__assign({}, base), { zIndex: zIndex })); },
|
|
8912
|
+
};
|
|
8913
|
+
}
|
|
8914
|
+
function mesclarEstilosComPortal(estilos, estiloMenuPortal) {
|
|
8915
|
+
if (!estiloMenuPortal) {
|
|
8916
|
+
return estilos;
|
|
8917
|
+
}
|
|
8918
|
+
return __assign(__assign({}, estilos), { menuPortal: estiloMenuPortal });
|
|
8919
|
+
}
|
|
8920
|
+
|
|
8898
8921
|
var selectColourStyles$1 = function (isInvalid, isDarkMode, isMobile) { return ({
|
|
8899
8922
|
control: function (styles, _a) {
|
|
8900
8923
|
var isFocused = _a.isFocused, isDisabled = _a.isDisabled;
|
|
@@ -8938,9 +8961,12 @@ var selectColourStyles$1 = function (isInvalid, isDarkMode, isMobile) { return (
|
|
|
8938
8961
|
menuList: function (base) { return (__assign(__assign({}, base), { backgroundColor: isDarkMode ? "#4B4B4C" : "#fff", padding: "0.5rem 0", borderRadius: "8px" })); },
|
|
8939
8962
|
}); };
|
|
8940
8963
|
var BasicSelect = function (_a) {
|
|
8941
|
-
var name = _a.name, optionsSelect = _a.optionsSelect, placeholder = _a.placeholder, _b = _a.isDisabled, isDisabled = _b === void 0 ? false : _b, label = _a.label, _c = _a.hasError, hasError = _c === void 0 ? false : _c, handleChange = _a.handleChange, isRequired = _a.isRequired, value = _a.value, _d = _a.isClearable, isClearable = _d === void 0 ? true : _d;
|
|
8964
|
+
var name = _a.name, optionsSelect = _a.optionsSelect, placeholder = _a.placeholder, _b = _a.isDisabled, isDisabled = _b === void 0 ? false : _b, label = _a.label, _c = _a.hasError, hasError = _c === void 0 ? false : _c, handleChange = _a.handleChange, isRequired = _a.isRequired, value = _a.value, _d = _a.isClearable, isClearable = _d === void 0 ? true : _d, _e = _a.usarMenuPortal, usarMenuPortal = _e === void 0 ? false : _e, _f = _a.zIndexMenuPortal, zIndexMenuPortal = _f === void 0 ? Z_INDEX_MENU_PORTAL_PADRAO : _f;
|
|
8942
8965
|
var isDarkMode = useDarkMode();
|
|
8943
8966
|
useIsMobile();
|
|
8967
|
+
var _g = obterConfigMenuPortal(usarMenuPortal, zIndexMenuPortal), menuPortalTarget = _g.menuPortalTarget, menuPosition = _g.menuPosition, estiloMenuPortal = _g.estiloMenuPortal;
|
|
8968
|
+
var estilos = selectColourStyles$1(hasError, isDarkMode);
|
|
8969
|
+
var estilosComPortal = mesclarEstilosComPortal(estilos, estiloMenuPortal);
|
|
8944
8970
|
var CustomDropdownIndicator = function () { return (React.createElement("div", { className: styles$m.contentIcon },
|
|
8945
8971
|
React.createElement(IconTriangleRecall, { className: styles$m.iconChefron }))); };
|
|
8946
8972
|
return (React.createElement("div", { className: "".concat(styles$m.selectContainer) },
|
|
@@ -8948,10 +8974,10 @@ var BasicSelect = function (_a) {
|
|
|
8948
8974
|
label,
|
|
8949
8975
|
isRequired ? React.createElement("span", { className: styles$m.errorRequired }, "*") : null)),
|
|
8950
8976
|
React.createElement("div", { className: styles$m.selectElement },
|
|
8951
|
-
React.createElement(StateManagedSelect$1, { inputId: name, isMulti: false, isDisabled: isDisabled, options: optionsSelect, value: optionsSelect.find(function (opt) { return opt.value === value; }) || value, onChange: handleChange, placeholder: placeholder, styles:
|
|
8977
|
+
React.createElement(StateManagedSelect$1, { inputId: name, isMulti: false, isDisabled: isDisabled, options: optionsSelect, value: optionsSelect.find(function (opt) { return opt.value === value; }) || value, onChange: handleChange, placeholder: placeholder, styles: estilosComPortal, isSearchable: true, isClearable: isClearable, noOptionsMessage: function () { return "Nenhuma opção disponível"; }, components: {
|
|
8952
8978
|
DropdownIndicator: CustomDropdownIndicator,
|
|
8953
8979
|
ClearIndicator: CustomClearIndicator,
|
|
8954
|
-
}, "aria-label": typeof label === "string"
|
|
8980
|
+
}, menuPortalTarget: menuPortalTarget, menuPosition: menuPosition, "aria-label": typeof label === "string"
|
|
8955
8981
|
? label
|
|
8956
8982
|
: placeholder || "Campo para seleção" })),
|
|
8957
8983
|
hasError && (React.createElement("span", { className: styles$m.errorText }, "Campo obrigat\u00F3rio ou inv\u00E1lido"))));
|
|
@@ -22401,9 +22427,9 @@ var selectColourStyles = function (isInvalid, isMobile, maxMenuHeight) { return
|
|
|
22401
22427
|
menuList: function (styles) { return (__assign(__assign({}, styles), { maxHeight: maxMenuHeight ? "".concat(maxMenuHeight, "px") : "300px" })); },
|
|
22402
22428
|
}); };
|
|
22403
22429
|
var SelectDefault = function (_a) {
|
|
22404
|
-
var name = _a.name, control = _a.control, optionsSelect = _a.optionsSelect, placeholder = _a.placeholder, _b = _a.isDisabled, isDisabled = _b === void 0 ? false : _b, label = _a.label, _c = _a.hasError, hasError = _c === void 0 ? false : _c, handleChange = _a.handleChange, isRequired = _a.isRequired, value = _a.value, handleInputChange = _a.handleInputChange, formatOptionLabel = _a.formatOptionLabel, _d = _a.isClearable, isClearable = _d === void 0 ? true : _d, maxMenuHeight = _a.maxMenuHeight, _e = _a.noOptionsMessage, noOptionsMessage = _e === void 0 ? "Nenhuma opção disponível" : _e;
|
|
22405
|
-
var
|
|
22406
|
-
var
|
|
22430
|
+
var name = _a.name, control = _a.control, optionsSelect = _a.optionsSelect, placeholder = _a.placeholder, _b = _a.isDisabled, isDisabled = _b === void 0 ? false : _b, label = _a.label, _c = _a.hasError, hasError = _c === void 0 ? false : _c, handleChange = _a.handleChange, isRequired = _a.isRequired, value = _a.value, handleInputChange = _a.handleInputChange, formatOptionLabel = _a.formatOptionLabel, _d = _a.isClearable, isClearable = _d === void 0 ? true : _d, maxMenuHeight = _a.maxMenuHeight, _e = _a.noOptionsMessage, noOptionsMessage = _e === void 0 ? "Nenhuma opção disponível" : _e, _f = _a.usarMenuPortal, usarMenuPortal = _f === void 0 ? false : _f, _g = _a.zIndexMenuPortal, zIndexMenuPortal = _g === void 0 ? Z_INDEX_MENU_PORTAL_PADRAO : _g;
|
|
22431
|
+
var _h = useController({ name: name, control: control }), _j = _h.field; _j.onChange; _j.value; var rest = __rest(_j, ["onChange", "value"]), error = _h.fieldState.error;
|
|
22432
|
+
var _k = React.useState(typeof window !== "undefined" && window.innerWidth <= 768), isMobile = _k[0], setIsMobile = _k[1];
|
|
22407
22433
|
var CustomDropdownIndicator = function () {
|
|
22408
22434
|
return (React.createElement("div", { className: styles$c.contentIcon },
|
|
22409
22435
|
React.createElement(IconTriangleRecall, { className: styles$c.iconChefron })));
|
|
@@ -22415,6 +22441,9 @@ var SelectDefault = function (_a) {
|
|
|
22415
22441
|
window.addEventListener("resize", onResize);
|
|
22416
22442
|
return function () { return window.removeEventListener("resize", onResize); };
|
|
22417
22443
|
}, []);
|
|
22444
|
+
var _l = obterConfigMenuPortal(usarMenuPortal, zIndexMenuPortal), menuPortalTarget = _l.menuPortalTarget, menuPosition = _l.menuPosition, estiloMenuPortal = _l.estiloMenuPortal;
|
|
22445
|
+
var estilos = selectColourStyles(hasError || !!error, isMobile, maxMenuHeight);
|
|
22446
|
+
var estilosComPortal = mesclarEstilosComPortal(estilos, estiloMenuPortal);
|
|
22418
22447
|
return (React.createElement("div", { className: "".concat(styles$c.selectContainer) },
|
|
22419
22448
|
label && (React.createElement("label", null,
|
|
22420
22449
|
label,
|
|
@@ -22425,7 +22454,7 @@ var SelectDefault = function (_a) {
|
|
|
22425
22454
|
if (inputValue) {
|
|
22426
22455
|
handleInputChange === null || handleInputChange === void 0 ? void 0 : handleInputChange(inputValue);
|
|
22427
22456
|
}
|
|
22428
|
-
}, placeholder: placeholder, styles:
|
|
22457
|
+
}, placeholder: placeholder, styles: estilosComPortal, isClearable: isClearable, isSearchable: true, formatOptionLabel: formatOptionLabel, noOptionsMessage: function () { return noOptionsMessage || "Nenhuma opção disponível"; }, components: { DropdownIndicator: CustomDropdownIndicator }, menuPortalTarget: menuPortalTarget, menuPosition: menuPosition, "aria-label": label || placeholder || "Campo para seleção", inputId: "".concat(name, "-input") }, rest))),
|
|
22429
22458
|
error && React.createElement("span", { className: styles$c.errorText }, error.message)));
|
|
22430
22459
|
};
|
|
22431
22460
|
|