pge-front-common 14.1.3 → 14.1.5

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.js CHANGED
@@ -923,8 +923,8 @@ var DropDown = function (_a) {
923
923
  })));
924
924
  };
925
925
 
926
- var css_248z$q = ".menu-module__iconMenu___hsJkY {\r\n width: 48px;\r\n height: 49px;\r\n color: var(--header-menu-icon-color);\r\n}\r\n\r\n@media (max-width: 480px) {\r\n .menu-module__iconMenu___hsJkY {\r\n width: 31px;\r\n height: 49px;\r\n }\r\n}\r\n";
927
- var styles$n = {"iconMenu":"menu-module__iconMenu___hsJkY"};
926
+ var css_248z$q = ".menu-module__iconMenu___hsJkY {\r\n width: 48px;\r\n height: 49px;\r\n color: var(--header-menu-icon-color);\r\n}\r\n\r\n.menu-module__menuButton___BV-Rs {\r\n background: none;\r\n border: none;\r\n padding: 0;\r\n margin: 0;\r\n cursor: pointer;\r\n}\r\n\r\n@media (max-width: 480px) {\r\n .menu-module__iconMenu___hsJkY {\r\n width: 31px;\r\n height: 49px;\r\n }\r\n}\r\n";
927
+ var styles$n = {"iconMenu":"menu-module__iconMenu___hsJkY","menuButton":"menu-module__menuButton___BV-Rs"};
928
928
  styleInject(css_248z$q);
929
929
 
930
930
  var Menu$2 = function (_a) {
@@ -952,7 +952,7 @@ var Menu$2 = function (_a) {
952
952
  document.removeEventListener("click", handleClickOutside);
953
953
  };
954
954
  }, [showDropDown]);
955
- return (React.createElement("button", { ref: buttonRef, style: { all: "unset", cursor: "pointer" }, className: showDropDown ? "active" : undefined, onClick: toggleDropDown, "aria-expanded": showDropDown, "aria-label": "Abrir menu" },
955
+ return (React.createElement("button", { ref: buttonRef, className: "".concat(styles$n.menuButton, " ").concat(showDropDown ? styles$n.active : ""), onClick: toggleDropDown, "aria-expanded": showDropDown, "aria-label": "Abrir menu" },
956
956
  React.createElement(MenuIcon, { className: styles$n.iconMenu }),
957
957
  showDropDown && (React.createElement(DropDown, { options: options, showDropDown: showDropDown, toggleDropDown: toggleDropDown, optionSelection: handleSelectOption }))));
958
958
  };
@@ -8670,11 +8670,19 @@ var selectColourStyles$1 = function (isInvalid, isDarkMode, isMobile) { return (
8670
8670
  option: function (styles, _a) {
8671
8671
  var isDisabled = _a.isDisabled, isFocused = _a.isFocused;
8672
8672
  return (__assign(__assign({}, styles), { cursor: isDisabled ? "not-allowed" : "default", color: isDisabled ? "white" : isDarkMode ? "#fff" : "#303030CC", backgroundColor: isDarkMode
8673
- ? isFocused ? "#303030" : "#4B4B4C"
8674
- : isFocused ? "#005A921A" : "#fff", fontSize: "inherit", ":hover": {
8673
+ ? isFocused
8674
+ ? "#303030"
8675
+ : "#4B4B4C"
8676
+ : isFocused
8677
+ ? "#005A921A"
8678
+ : "#fff", fontSize: "inherit", ":hover": {
8675
8679
  backgroundColor: isDarkMode
8676
- ? isFocused ? "#303030" : "#4B4B4C"
8677
- : isFocused ? "#005A921A" : "#fff",
8680
+ ? isFocused
8681
+ ? "#303030"
8682
+ : "#4B4B4C"
8683
+ : isFocused
8684
+ ? "#005A921A"
8685
+ : "#fff",
8678
8686
  } }));
8679
8687
  },
8680
8688
  multiValue: function (styles) { return (__assign(__assign({}, styles), { backgroundColor: "#005a921a", borderRadius: "9px" })); },
@@ -8703,9 +8711,26 @@ var BasicSelect = function (_a) {
8703
8711
  label,
8704
8712
  isRequired ? React__namespace.createElement("span", { className: styles$f.errorRequired }, "*") : null)),
8705
8713
  React__namespace.createElement("div", { className: styles$f.selectElement },
8706
- 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: selectColourStyles$1(hasError, isDarkMode), isClearable: true, isSearchable: true, noOptionsMessage: function () { return "Nenhuma opção disponível"; }, components: { DropdownIndicator: CustomDropdownIndicator }, "aria-label": typeof label === 'string' ? label : (placeholder || "Campo para seleção") })),
8714
+ 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: selectColourStyles$1(hasError, isDarkMode), isSearchable: true, isClearable: true, noOptionsMessage: function () { return "Nenhuma opção disponível"; }, components: {
8715
+ DropdownIndicator: CustomDropdownIndicator,
8716
+ ClearIndicator: CustomClearIndicator,
8717
+ }, "aria-label": typeof label === "string"
8718
+ ? label
8719
+ : placeholder || "Campo para seleção" })),
8707
8720
  hasError && (React__namespace.createElement("span", { className: styles$f.errorText }, "Campo obrigat\u00F3rio ou inv\u00E1lido"))));
8708
8721
  };
8722
+ var CustomClearIndicator = function (props) {
8723
+ var _a = props.innerProps, onClick = _a.onClick, onMouseDown = _a.onMouseDown, onTouchEnd = _a.onTouchEnd, restInner = __rest(_a, ["onClick", "onMouseDown", "onTouchEnd"]), clearValue = props.clearValue, innerProps = props.innerProps;
8724
+ var handleKeyDown = function (e) {
8725
+ var _a;
8726
+ if (e.key === "Enter") {
8727
+ e.preventDefault();
8728
+ clearValue();
8729
+ }
8730
+ (_a = innerProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(innerProps, e);
8731
+ };
8732
+ return (React__namespace.createElement(components.ClearIndicator, __assign({}, props, { innerProps: __assign(__assign({}, restInner), { onClick: onClick, onMouseDown: onMouseDown, onTouchEnd: onTouchEnd, tabIndex: 0, role: "button", "aria-label": "Limpar opção selecionada", onKeyDown: handleKeyDown }) })));
8733
+ };
8709
8734
 
8710
8735
  var css_248z$e = ".header-module__separator_background___Sicie {\r\n background-color: rgb(188, 157, 50);\r\n width: 100%;\r\n height: 4px;\r\n opacity: 1;\r\n}\r\n\r\n.header-module__headerContentWrapper___3CWPS {\r\n height: 100%;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n width: 100%;\r\n max-width: 1440px;\r\n padding: 0px 72px;\r\n}\r\n\r\n@media (max-width: 600px) {\r\n .header-module__headerContentWrapper___3CWPS {\r\n padding: 0px 4px;\r\n }\r\n}\r\n\r\n.header-module__container___pv1f6 {\r\n height: 100%;\r\n width: 100%;\r\n display: flex;\r\n align-items: center;\r\n justify-content: space-between;\r\n padding: 28px 0px;\r\n min-width: 1024px;\r\n\r\n @media (max-width: 1024px) {\r\n padding: 22px 16px;\r\n min-width: 100%;\r\n }\r\n}\r\n\r\n.header-module__wrapperMenu___qgf2- {\r\n display: flex;\r\n gap: 24px;\r\n align-items: center;\r\n\r\n @media (max-width: 1024px) {\r\n gap: 8px;\r\n }\r\n}\r\n\r\n.header-module__iconLogo___Sr8Ih {\r\n @media (max-width: 1024px) {\r\n width: 100px;\r\n }\r\n}\r\n\r\n@media (max-width: 768px) {\r\n .header-module__iconLogo___Sr8Ih {\r\n width: 64px;\r\n height: 25px;\r\n }\r\n}\r\n\r\n.header-module__verticalDivider___j6I1p {\r\n content: \"\";\r\n display: inline-block;\r\n height: 50px;\r\n width: 1px;\r\n background-color: #ccc;\r\n margin: 0px 0px 0px 0px;\r\n}\r\n\r\n.header-module__containerHeaderIndex___6ddUY {\r\n display: flex;\r\n flex-direction: column;\r\n justify-content: center;\r\n align-items: center;\r\n width: 100%;\r\n max-height: 6rem;\r\n font-size: 2rem;\r\n box-shadow: 0px 15px 10px -15px rgba(0, 0, 0, 0.19);\r\n background-color: var(--header-bg-main-color);\r\n}\r\n\r\n.header-module__set_shadow___Wwh0E {\r\n border-radius: 0px 0px 16px 16px;\r\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.25);\r\n}\r\n\r\n.header-module__limitedWidth___PhM7B {\r\n max-width: 1440px;\r\n margin: 0 auto;\r\n}\r\n\r\n@media (min-width: 640px) {\r\n .header-module__containerHeaderIndex___6ddUY {\r\n max-height: 6rem;\r\n }\r\n}\r\n\r\n@media (min-width: 768px) {\r\n .header-module__containerHeaderIndex___6ddUY {\r\n max-height: 13rem;\r\n }\r\n}\r\n\r\n.header-module__iconLogoCASC___HX7YL {\r\n height: 65px;\r\n width: auto;\r\n}\r\n\r\n.header-module__iconLogoPGE___II1i2 {\r\n margin-right: 20px;\r\n}\r\n\r\n@media (max-width: 1024px) {\r\n .header-module__iconLogoCASC___HX7YL {\r\n height: 45px;\r\n width: auto;\r\n }\r\n}\r\n\r\n.header-module__responsiveCASC___nqE60 {\r\n @media (max-width: 1024px) {\r\n .header-module__iconLogoCASC___HX7YL {\r\n height: 45px;\r\n width: auto;\r\n }\r\n }\r\n\r\n @media (max-width: 600px) {\r\n .header-module__iconLogoCASC___HX7YL {\r\n height: 40px;\r\n width: auto;\r\n }\r\n }\r\n}\r\n\r\n.header-module__dividaAtivaLogoContainer___k6PDu {\r\n display: flex;\r\n flex-direction: row;\r\n justify-content: space-between;\r\n align-items: center;\r\n gap: 4px;\r\n}\r\n\r\n.header-module__IconMenu___guscJ {\r\n display: flex;\r\n max-height: 48px;\r\n}\r\n";
8711
8736
  var styles$e = {"separator_background":"header-module__separator_background___Sicie","headerContentWrapper":"header-module__headerContentWrapper___3CWPS","container":"header-module__container___pv1f6","wrapperMenu":"header-module__wrapperMenu___qgf2-","iconLogo":"header-module__iconLogo___Sr8Ih","verticalDivider":"header-module__verticalDivider___j6I1p","containerHeaderIndex":"header-module__containerHeaderIndex___6ddUY","set_shadow":"header-module__set_shadow___Wwh0E","limitedWidth":"header-module__limitedWidth___PhM7B","iconLogoCASC":"header-module__iconLogoCASC___HX7YL","iconLogoPGE":"header-module__iconLogoPGE___II1i2","responsiveCASC":"header-module__responsiveCASC___nqE60","dividaAtivaLogoContainer":"header-module__dividaAtivaLogoContainer___k6PDu","IconMenu":"header-module__IconMenu___guscJ"};
@@ -23778,26 +23803,39 @@ var css_248z$6 = "@keyframes styles-module__fadeIn___09YGY {\r\n from {\r\n
23778
23803
  var style = {"modalOverlay":"styles-module__modalOverlay___zIq-T","fadeIn":"styles-module__fadeIn___09YGY","modal":"styles-module__modal___4vuMK","modalHeader":"styles-module__modalHeader___P-TK7","modalHeaderContent":"styles-module__modalHeaderContent___i6CzG","closeButton":"styles-module__closeButton___F4c5B","modalBody":"styles-module__modalBody___jzSq1","modalFooter":"styles-module__modalFooter___keSWl"};
23779
23804
  styleInject(css_248z$6);
23780
23805
 
23781
- var Modal = function (_a) {
23806
+ var ELEMENTOS_COM_FOCO = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex="0"]';
23807
+ function Modal(_a) {
23782
23808
  var isOpen = _a.isOpen, onClose = _a.onClose, children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b;
23783
- var _c = React.useState(isOpen), isVisible = _c[0], setIsVisible = _c[1];
23809
+ var contentRef = React.useRef(null);
23810
+ var openerRef = React.useRef(null);
23784
23811
  React.useEffect(function () {
23812
+ var _a, _b;
23785
23813
  if (isOpen) {
23786
- setIsVisible(true);
23814
+ openerRef.current = document.activeElement;
23815
+ (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.focus();
23816
+ }
23817
+ else {
23818
+ (_b = openerRef.current) === null || _b === void 0 ? void 0 : _b.focus();
23787
23819
  }
23788
23820
  }, [isOpen]);
23789
- if (!isOpen) {
23821
+ if (!isOpen)
23790
23822
  return null;
23791
- }
23792
- var handleClose = function () {
23793
- setIsVisible(false);
23794
- onClose();
23823
+ var moveToFirst = function () {
23824
+ var els = contentRef.current.querySelectorAll(ELEMENTOS_COM_FOCO);
23825
+ els.length && els[0].focus();
23795
23826
  };
23796
- if (!isVisible && !isOpen)
23797
- return null;
23798
- return (React.createElement("div", { className: "".concat(style.modalOverlay), onClick: handleClose },
23799
- React.createElement("div", { className: "".concat(style.modal, " ").concat(className || ""), onClick: function (e) { return e.stopPropagation(); } }, children)));
23800
- };
23827
+ var moveToLast = function () {
23828
+ var els = contentRef.current.querySelectorAll(ELEMENTOS_COM_FOCO);
23829
+ els.length && els[els.length - 1].focus();
23830
+ };
23831
+ return (React.createElement("div", { className: style.modalOverlay, onClick: onClose, role: "presentation" },
23832
+ React.createElement("div", { tabIndex: 0, onFocus: moveToLast, "aria-hidden": "true" }),
23833
+ React.createElement("div", { ref: contentRef, className: "".concat(style.modal, " ").concat(className), role: "dialog", "aria-modal": "true", tabIndex: -1, onClick: function (e) { return e.stopPropagation(); }, onKeyDown: function (e) {
23834
+ if (e.key === "Escape")
23835
+ onClose();
23836
+ } }, children),
23837
+ React.createElement("div", { tabIndex: 0, onFocus: moveToFirst, "aria-hidden": "true" })));
23838
+ }
23801
23839
 
23802
23840
  var ModalFooter = function (_a) {
23803
23841
  var children = _a.children, className = _a.className;
@@ -23808,7 +23846,10 @@ var ModalHeader = function (_a) {
23808
23846
  var children = _a.children, onClose = _a.onClose, className = _a.className;
23809
23847
  return (React.createElement("header", { className: "".concat(style.modalHeader, " ").concat(className || "") },
23810
23848
  React.createElement("div", { className: style.modalHeaderContent }, children),
23811
- React.createElement(IconCLose, { className: style.closeButton, onClick: onClose })));
23849
+ React.createElement(IconCLose, { role: "button", tabIndex: 0, className: style.closeButton, onClick: onClose, "aria-label": "Fechar modal", onKeyDown: function (e) {
23850
+ if (e.key === "Enter" || e.key === " ")
23851
+ onClose();
23852
+ } })));
23812
23853
  };
23813
23854
 
23814
23855
  var ModalBody = function (_a) {