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.js
CHANGED
|
@@ -8915,6 +8915,29 @@ var css_248z$n = ".styles-module__selectContainer___uFP2d {\r\n width: 100%;\r\
|
|
|
8915
8915
|
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"};
|
|
8916
8916
|
styleInject(css_248z$n);
|
|
8917
8917
|
|
|
8918
|
+
var Z_INDEX_MENU_PORTAL_PADRAO = 9999;
|
|
8919
|
+
function obterConfigMenuPortal(usarMenuPortal, zIndex) {
|
|
8920
|
+
if (zIndex === void 0) { zIndex = Z_INDEX_MENU_PORTAL_PADRAO; }
|
|
8921
|
+
if (!usarMenuPortal) {
|
|
8922
|
+
return {
|
|
8923
|
+
menuPortalTarget: undefined,
|
|
8924
|
+
menuPosition: "absolute",
|
|
8925
|
+
estiloMenuPortal: undefined,
|
|
8926
|
+
};
|
|
8927
|
+
}
|
|
8928
|
+
return {
|
|
8929
|
+
menuPortalTarget: typeof document !== "undefined" ? document.body : undefined,
|
|
8930
|
+
menuPosition: "fixed",
|
|
8931
|
+
estiloMenuPortal: function (base) { return (__assign(__assign({}, base), { zIndex: zIndex })); },
|
|
8932
|
+
};
|
|
8933
|
+
}
|
|
8934
|
+
function mesclarEstilosComPortal(estilos, estiloMenuPortal) {
|
|
8935
|
+
if (!estiloMenuPortal) {
|
|
8936
|
+
return estilos;
|
|
8937
|
+
}
|
|
8938
|
+
return __assign(__assign({}, estilos), { menuPortal: estiloMenuPortal });
|
|
8939
|
+
}
|
|
8940
|
+
|
|
8918
8941
|
var selectColourStyles$1 = function (isInvalid, isDarkMode, isMobile) { return ({
|
|
8919
8942
|
control: function (styles, _a) {
|
|
8920
8943
|
var isFocused = _a.isFocused, isDisabled = _a.isDisabled;
|
|
@@ -8958,9 +8981,12 @@ var selectColourStyles$1 = function (isInvalid, isDarkMode, isMobile) { return (
|
|
|
8958
8981
|
menuList: function (base) { return (__assign(__assign({}, base), { backgroundColor: isDarkMode ? "#4B4B4C" : "#fff", padding: "0.5rem 0", borderRadius: "8px" })); },
|
|
8959
8982
|
}); };
|
|
8960
8983
|
var BasicSelect = function (_a) {
|
|
8961
|
-
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;
|
|
8984
|
+
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;
|
|
8962
8985
|
var isDarkMode = useDarkMode();
|
|
8963
8986
|
useIsMobile();
|
|
8987
|
+
var _g = obterConfigMenuPortal(usarMenuPortal, zIndexMenuPortal), menuPortalTarget = _g.menuPortalTarget, menuPosition = _g.menuPosition, estiloMenuPortal = _g.estiloMenuPortal;
|
|
8988
|
+
var estilos = selectColourStyles$1(hasError, isDarkMode);
|
|
8989
|
+
var estilosComPortal = mesclarEstilosComPortal(estilos, estiloMenuPortal);
|
|
8964
8990
|
var CustomDropdownIndicator = function () { return (React__namespace.createElement("div", { className: styles$m.contentIcon },
|
|
8965
8991
|
React__namespace.createElement(IconTriangleRecall, { className: styles$m.iconChefron }))); };
|
|
8966
8992
|
return (React__namespace.createElement("div", { className: "".concat(styles$m.selectContainer) },
|
|
@@ -8968,10 +8994,10 @@ var BasicSelect = function (_a) {
|
|
|
8968
8994
|
label,
|
|
8969
8995
|
isRequired ? React__namespace.createElement("span", { className: styles$m.errorRequired }, "*") : null)),
|
|
8970
8996
|
React__namespace.createElement("div", { className: styles$m.selectElement },
|
|
8971
|
-
React__namespace.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:
|
|
8997
|
+
React__namespace.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: {
|
|
8972
8998
|
DropdownIndicator: CustomDropdownIndicator,
|
|
8973
8999
|
ClearIndicator: CustomClearIndicator,
|
|
8974
|
-
}, "aria-label": typeof label === "string"
|
|
9000
|
+
}, menuPortalTarget: menuPortalTarget, menuPosition: menuPosition, "aria-label": typeof label === "string"
|
|
8975
9001
|
? label
|
|
8976
9002
|
: placeholder || "Campo para seleção" })),
|
|
8977
9003
|
hasError && (React__namespace.createElement("span", { className: styles$m.errorText }, "Campo obrigat\u00F3rio ou inv\u00E1lido"))));
|
|
@@ -22421,9 +22447,9 @@ var selectColourStyles = function (isInvalid, isMobile, maxMenuHeight) { return
|
|
|
22421
22447
|
menuList: function (styles) { return (__assign(__assign({}, styles), { maxHeight: maxMenuHeight ? "".concat(maxMenuHeight, "px") : "300px" })); },
|
|
22422
22448
|
}); };
|
|
22423
22449
|
var SelectDefault = function (_a) {
|
|
22424
|
-
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;
|
|
22425
|
-
var
|
|
22426
|
-
var
|
|
22450
|
+
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;
|
|
22451
|
+
var _h = useController({ name: name, control: control }), _j = _h.field; _j.onChange; _j.value; var rest = __rest(_j, ["onChange", "value"]), error = _h.fieldState.error;
|
|
22452
|
+
var _k = React__namespace.useState(typeof window !== "undefined" && window.innerWidth <= 768), isMobile = _k[0], setIsMobile = _k[1];
|
|
22427
22453
|
var CustomDropdownIndicator = function () {
|
|
22428
22454
|
return (React__namespace.createElement("div", { className: styles$c.contentIcon },
|
|
22429
22455
|
React__namespace.createElement(IconTriangleRecall, { className: styles$c.iconChefron })));
|
|
@@ -22435,6 +22461,9 @@ var SelectDefault = function (_a) {
|
|
|
22435
22461
|
window.addEventListener("resize", onResize);
|
|
22436
22462
|
return function () { return window.removeEventListener("resize", onResize); };
|
|
22437
22463
|
}, []);
|
|
22464
|
+
var _l = obterConfigMenuPortal(usarMenuPortal, zIndexMenuPortal), menuPortalTarget = _l.menuPortalTarget, menuPosition = _l.menuPosition, estiloMenuPortal = _l.estiloMenuPortal;
|
|
22465
|
+
var estilos = selectColourStyles(hasError || !!error, isMobile, maxMenuHeight);
|
|
22466
|
+
var estilosComPortal = mesclarEstilosComPortal(estilos, estiloMenuPortal);
|
|
22438
22467
|
return (React__namespace.createElement("div", { className: "".concat(styles$c.selectContainer) },
|
|
22439
22468
|
label && (React__namespace.createElement("label", null,
|
|
22440
22469
|
label,
|
|
@@ -22445,7 +22474,7 @@ var SelectDefault = function (_a) {
|
|
|
22445
22474
|
if (inputValue) {
|
|
22446
22475
|
handleInputChange === null || handleInputChange === void 0 ? void 0 : handleInputChange(inputValue);
|
|
22447
22476
|
}
|
|
22448
|
-
}, placeholder: placeholder, styles:
|
|
22477
|
+
}, 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))),
|
|
22449
22478
|
error && React__namespace.createElement("span", { className: styles$c.errorText }, error.message)));
|
|
22450
22479
|
};
|
|
22451
22480
|
|