pge-front-common 14.1.2 → 14.1.4
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/components/modal/Modal.d.ts +1 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.esm.js +32 -16
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +32 -16
- package/lib/index.js.map +1 -1
- package/package.json +2 -1
package/lib/index.js
CHANGED
|
@@ -125,14 +125,14 @@ styleInject(css_248z$B);
|
|
|
125
125
|
|
|
126
126
|
var InputBase = function (_a) {
|
|
127
127
|
var _b;
|
|
128
|
-
var customClass = _a.customClass, restrictionMessage = _a.restrictionMessage, label = _a.label, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, onRightIconClick = _a.onRightIconClick, style = _a.style, required = _a.required
|
|
128
|
+
var customClass = _a.customClass, restrictionMessage = _a.restrictionMessage, label = _a.label, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, onRightIconClick = _a.onRightIconClick, style = _a.style, required = _a.required, error = _a.error; _a.helperText; var disabled = _a.disabled; _a.readOnly; _a.className; var showCounter = _a.showCounter, value = _a.value, props = __rest(_a, ["customClass", "restrictionMessage", "label", "leftIcon", "rightIcon", "onRightIconClick", "style", "required", "error", "helperText", "disabled", "readOnly", "className", "showCounter", "value"]);
|
|
129
129
|
var characterCount = (value === null || value === void 0 ? void 0 : value.toString().length) || 0;
|
|
130
130
|
return (React.createElement("div", { className: styles$y.inputContainer },
|
|
131
131
|
label && (React.createElement("label", { tabIndex: disabled ? -1 : 0, htmlFor: props.name, className: "".concat(styles$y.labelInput, " ").concat(required ? styles$y.labelRequired : "") }, label)),
|
|
132
132
|
React.createElement("div", { className: styles$y.inputContent },
|
|
133
133
|
leftIcon && React.createElement("div", { className: styles$y.iconWrapperLeft }, leftIcon),
|
|
134
134
|
React.createElement("input", __assign({ className: clsx(styles$y.textInput, customClass, (_b = {},
|
|
135
|
-
_b[styles$y.textInputDanger] = restrictionMessage,
|
|
135
|
+
_b[styles$y.textInputDanger] = restrictionMessage || error,
|
|
136
136
|
_b)), style: __assign({ paddingLeft: leftIcon ? "36px" : "8px", paddingRight: rightIcon ? "36px" : "8px" }, style), id: props.name, value: value }, props, { disabled: disabled })),
|
|
137
137
|
rightIcon && (React.createElement("button", { tabIndex: -1, type: "button", className: styles$y.iconWrapperRight, onClick: function () { return onRightIconClick === null || onRightIconClick === void 0 ? void 0 : onRightIconClick(); }, "aria-label": "A\u00E7\u00E3o ao clicar no \u00EDcone ao lado direito" }, rightIcon))),
|
|
138
138
|
(restrictionMessage || showCounter) && (React.createElement("div", { className: styles$y.messageContainer },
|
|
@@ -23778,26 +23778,39 @@ var css_248z$6 = "@keyframes styles-module__fadeIn___09YGY {\r\n from {\r\n
|
|
|
23778
23778
|
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
23779
|
styleInject(css_248z$6);
|
|
23780
23780
|
|
|
23781
|
-
var
|
|
23781
|
+
var ELEMENTOS_COM_FOCO = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex="0"]';
|
|
23782
|
+
function Modal(_a) {
|
|
23782
23783
|
var isOpen = _a.isOpen, onClose = _a.onClose, children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
23783
|
-
var
|
|
23784
|
+
var contentRef = React.useRef(null);
|
|
23785
|
+
var openerRef = React.useRef(null);
|
|
23784
23786
|
React.useEffect(function () {
|
|
23787
|
+
var _a, _b;
|
|
23785
23788
|
if (isOpen) {
|
|
23786
|
-
|
|
23789
|
+
openerRef.current = document.activeElement;
|
|
23790
|
+
(_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
23791
|
+
}
|
|
23792
|
+
else {
|
|
23793
|
+
(_b = openerRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
23787
23794
|
}
|
|
23788
23795
|
}, [isOpen]);
|
|
23789
|
-
if (!isOpen)
|
|
23796
|
+
if (!isOpen)
|
|
23790
23797
|
return null;
|
|
23791
|
-
|
|
23792
|
-
|
|
23793
|
-
|
|
23794
|
-
onClose();
|
|
23798
|
+
var moveToFirst = function () {
|
|
23799
|
+
var els = contentRef.current.querySelectorAll(ELEMENTOS_COM_FOCO);
|
|
23800
|
+
els.length && els[0].focus();
|
|
23795
23801
|
};
|
|
23796
|
-
|
|
23797
|
-
|
|
23798
|
-
|
|
23799
|
-
|
|
23800
|
-
}
|
|
23802
|
+
var moveToLast = function () {
|
|
23803
|
+
var els = contentRef.current.querySelectorAll(ELEMENTOS_COM_FOCO);
|
|
23804
|
+
els.length && els[els.length - 1].focus();
|
|
23805
|
+
};
|
|
23806
|
+
return (React.createElement("div", { className: style.modalOverlay, onClick: onClose, role: "presentation" },
|
|
23807
|
+
React.createElement("div", { tabIndex: 0, onFocus: moveToLast, "aria-hidden": "true" }),
|
|
23808
|
+
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) {
|
|
23809
|
+
if (e.key === "Escape")
|
|
23810
|
+
onClose();
|
|
23811
|
+
} }, children),
|
|
23812
|
+
React.createElement("div", { tabIndex: 0, onFocus: moveToFirst, "aria-hidden": "true" })));
|
|
23813
|
+
}
|
|
23801
23814
|
|
|
23802
23815
|
var ModalFooter = function (_a) {
|
|
23803
23816
|
var children = _a.children, className = _a.className;
|
|
@@ -23808,7 +23821,10 @@ var ModalHeader = function (_a) {
|
|
|
23808
23821
|
var children = _a.children, onClose = _a.onClose, className = _a.className;
|
|
23809
23822
|
return (React.createElement("header", { className: "".concat(style.modalHeader, " ").concat(className || "") },
|
|
23810
23823
|
React.createElement("div", { className: style.modalHeaderContent }, children),
|
|
23811
|
-
React.createElement(IconCLose, { className: style.closeButton, onClick: onClose
|
|
23824
|
+
React.createElement(IconCLose, { role: "button", tabIndex: 0, className: style.closeButton, onClick: onClose, "aria-label": "Fechar modal", onKeyDown: function (e) {
|
|
23825
|
+
if (e.key === "Enter" || e.key === " ")
|
|
23826
|
+
onClose();
|
|
23827
|
+
} })));
|
|
23812
23828
|
};
|
|
23813
23829
|
|
|
23814
23830
|
var ModalBody = function (_a) {
|