@votodigital-onpeui/react 0.1.29 → 0.1.31
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/{ModalConfirm-DsE7awHb.d.mts → ModalConfirm-CZJCfya3.d.mts} +17 -3
- package/dist/{ModalConfirm-DsE7awHb.d.ts → ModalConfirm-CZJCfya3.d.ts} +17 -3
- package/dist/{chunk-EZQGWVW2.mjs → chunk-4XHWFUHC.mjs} +14 -8
- package/dist/chunk-4XHWFUHC.mjs.map +1 -0
- package/dist/{chunk-QHN5HB7P.mjs → chunk-6RNDTVIJ.mjs} +3 -3
- package/dist/{chunk-QHN5HB7P.mjs.map → chunk-6RNDTVIJ.mjs.map} +1 -1
- package/dist/{chunk-SS5NPQU6.mjs → chunk-MFNWIYOJ.mjs} +3 -3
- package/dist/{chunk-SS5NPQU6.mjs.map → chunk-MFNWIYOJ.mjs.map} +1 -1
- package/dist/{chunk-PAX7TKG5.mjs → chunk-UGIZ3K3S.mjs} +47 -29
- package/dist/chunk-UGIZ3K3S.mjs.map +1 -0
- package/dist/components.d.mts +13 -3
- package/dist/components.d.ts +13 -3
- package/dist/components.js +55 -31
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +3 -3
- package/dist/hooks.js +12 -6
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +55 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/modal.d.mts +28 -5
- package/dist/modal.d.ts +28 -5
- package/dist/modal.js +84 -40
- package/dist/modal.js.map +1 -1
- package/dist/modal.mjs +31 -11
- package/dist/modal.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-EZQGWVW2.mjs.map +0 -1
- package/dist/chunk-PAX7TKG5.mjs.map +0 -1
package/dist/components.js
CHANGED
|
@@ -443,6 +443,9 @@ var Modal = ({
|
|
|
443
443
|
existTabIndex = true,
|
|
444
444
|
zIndexLevel = 100,
|
|
445
445
|
onCloseComplete,
|
|
446
|
+
alignTop = false,
|
|
447
|
+
animated = true,
|
|
448
|
+
preventBodyScroll = true,
|
|
446
449
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- overlayColor reservado para uso futuro
|
|
447
450
|
overlayColor: _overlayColor = "blue",
|
|
448
451
|
...props
|
|
@@ -476,6 +479,7 @@ var Modal = ({
|
|
|
476
479
|
}
|
|
477
480
|
}, [isOpen, onCloseComplete]);
|
|
478
481
|
react.useEffect(() => {
|
|
482
|
+
if (!preventBodyScroll) return;
|
|
479
483
|
if (isOpen) {
|
|
480
484
|
document.body.style.overflow = "hidden";
|
|
481
485
|
} else {
|
|
@@ -484,7 +488,7 @@ var Modal = ({
|
|
|
484
488
|
return () => {
|
|
485
489
|
document.body.style.overflow = "";
|
|
486
490
|
};
|
|
487
|
-
}, [isOpen]);
|
|
491
|
+
}, [isOpen, preventBodyScroll]);
|
|
488
492
|
react.useEffect(() => {
|
|
489
493
|
if (!isOpen) return;
|
|
490
494
|
const resetScroll = () => {
|
|
@@ -696,8 +700,9 @@ var Modal = ({
|
|
|
696
700
|
{
|
|
697
701
|
style: { zIndex: zIndexLevel },
|
|
698
702
|
className: [
|
|
699
|
-
"fixed inset-0 bg-onpe-blue
|
|
700
|
-
|
|
703
|
+
"fixed inset-0 bg-onpe-blue",
|
|
704
|
+
animated ? "transition-opacity duration-200" : "",
|
|
705
|
+
animated ? visible ? "opacity-80" : "opacity-0" : "opacity-80"
|
|
701
706
|
].join(" "),
|
|
702
707
|
onClick: onClose
|
|
703
708
|
}
|
|
@@ -707,9 +712,10 @@ var Modal = ({
|
|
|
707
712
|
{
|
|
708
713
|
style: { zIndex: zIndexLevel + 10 },
|
|
709
714
|
className: [
|
|
710
|
-
"fixed top-0 w-full h-screen grid
|
|
711
|
-
"
|
|
712
|
-
|
|
715
|
+
"fixed top-0 w-full h-screen grid",
|
|
716
|
+
alignTop ? "place-items-start pt-8" : "place-items-center",
|
|
717
|
+
animated ? "transition-all duration-200" : "",
|
|
718
|
+
animated ? visible ? "opacity-100 scale-100 translate-y-0" : "opacity-[0.2] scale-95 -translate-y-5" : "opacity-100 scale-100 translate-y-0"
|
|
713
719
|
].join(" "),
|
|
714
720
|
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative grid place-items-center", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
715
721
|
"div",
|
|
@@ -1183,17 +1189,25 @@ var ModalConfirm = ({
|
|
|
1183
1189
|
},
|
|
1184
1190
|
onCancel = () => {
|
|
1185
1191
|
},
|
|
1186
|
-
textButtonConfirm
|
|
1187
|
-
textButtonCancel
|
|
1192
|
+
textButtonConfirm,
|
|
1193
|
+
textButtonCancel,
|
|
1188
1194
|
className = "",
|
|
1189
1195
|
zIndexLevel = 100,
|
|
1190
|
-
disableFocus = false
|
|
1196
|
+
disableFocus = false,
|
|
1197
|
+
closeButton = false,
|
|
1198
|
+
alignJustify = false,
|
|
1199
|
+
alignTop = false,
|
|
1200
|
+
animated = true,
|
|
1201
|
+
preventBodyScroll = true
|
|
1191
1202
|
}) => {
|
|
1192
1203
|
const titleId = "modal-confirm-title";
|
|
1193
1204
|
const messageId = "modal-confirm-message";
|
|
1194
1205
|
const effectiveMessage = message ?? content;
|
|
1195
1206
|
const effectiveColorClass = color ? colorOverrideMap[color] ?? "text-onpe-skyblue" : "text-onpe-skyblue";
|
|
1196
|
-
const
|
|
1207
|
+
const isConfirmMode = buttonMode === "confirm";
|
|
1208
|
+
const showTwoButtons = buttonMode === "double" || isConfirmMode;
|
|
1209
|
+
const confirmLabel = textButtonConfirm ?? (isConfirmMode ? "S\xED" : "Confirmar");
|
|
1210
|
+
const cancelLabel = textButtonCancel ?? (isConfirmMode ? "No" : "Cancelar");
|
|
1197
1211
|
const handleConfirm = async () => {
|
|
1198
1212
|
try {
|
|
1199
1213
|
await onConfirm();
|
|
@@ -1213,12 +1227,15 @@ var ModalConfirm = ({
|
|
|
1213
1227
|
isOpen,
|
|
1214
1228
|
onClose,
|
|
1215
1229
|
className: `max-w-[719px]! pt-[30px]! pb-[30px]! px-[30px]! ${className}`,
|
|
1216
|
-
closeButton
|
|
1230
|
+
closeButton,
|
|
1217
1231
|
closeDisabled,
|
|
1218
1232
|
zIndexLevel,
|
|
1219
1233
|
"aria-labelledby": titleId,
|
|
1220
1234
|
"aria-describedby": messageId,
|
|
1221
1235
|
disableFocus,
|
|
1236
|
+
alignTop,
|
|
1237
|
+
animated,
|
|
1238
|
+
preventBodyScroll,
|
|
1222
1239
|
children: [
|
|
1223
1240
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: renderIcon(type, effectiveColorClass) }),
|
|
1224
1241
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1236,7 +1253,7 @@ var ModalConfirm = ({
|
|
|
1236
1253
|
"div",
|
|
1237
1254
|
{
|
|
1238
1255
|
id: messageId,
|
|
1239
|
-
className:
|
|
1256
|
+
className: `mt-7 text-sm md:text-lg max-w-full text-black ${alignJustify ? "text-justify" : "text-center"}`,
|
|
1240
1257
|
children: effectiveMessage
|
|
1241
1258
|
}
|
|
1242
1259
|
),
|
|
@@ -1246,7 +1263,7 @@ var ModalConfirm = ({
|
|
|
1246
1263
|
{
|
|
1247
1264
|
className: "w-full max-w-[200px]",
|
|
1248
1265
|
color: "red",
|
|
1249
|
-
title:
|
|
1266
|
+
title: confirmLabel,
|
|
1250
1267
|
onClick: handleConfirm,
|
|
1251
1268
|
disabled: disabledConfirmButton
|
|
1252
1269
|
}
|
|
@@ -1256,7 +1273,7 @@ var ModalConfirm = ({
|
|
|
1256
1273
|
{
|
|
1257
1274
|
className: "w-full max-w-[200px]",
|
|
1258
1275
|
color: "skyblue",
|
|
1259
|
-
title:
|
|
1276
|
+
title: cancelLabel,
|
|
1260
1277
|
onClick: handleCancel
|
|
1261
1278
|
}
|
|
1262
1279
|
)
|
|
@@ -1267,7 +1284,7 @@ var ModalConfirm = ({
|
|
|
1267
1284
|
{
|
|
1268
1285
|
className: "w-[200px]",
|
|
1269
1286
|
color: "skyblue",
|
|
1270
|
-
title:
|
|
1287
|
+
title: cancelLabel,
|
|
1271
1288
|
onClick: handleCancel
|
|
1272
1289
|
}
|
|
1273
1290
|
),
|
|
@@ -1276,7 +1293,7 @@ var ModalConfirm = ({
|
|
|
1276
1293
|
{
|
|
1277
1294
|
className: "w-[200px]",
|
|
1278
1295
|
color: "red",
|
|
1279
|
-
title:
|
|
1296
|
+
title: confirmLabel,
|
|
1280
1297
|
onClick: handleConfirm,
|
|
1281
1298
|
disabled: disabledConfirmButton
|
|
1282
1299
|
}
|
|
@@ -1292,7 +1309,10 @@ var ModalLoading = ({
|
|
|
1292
1309
|
},
|
|
1293
1310
|
message = "Cargando...",
|
|
1294
1311
|
className = "",
|
|
1295
|
-
zIndexLevel = 100
|
|
1312
|
+
zIndexLevel = 100,
|
|
1313
|
+
animated = true,
|
|
1314
|
+
preventBodyScroll = true,
|
|
1315
|
+
spinner
|
|
1296
1316
|
}) => {
|
|
1297
1317
|
const [announceMessage, setAnnounceMessage] = react.useState("");
|
|
1298
1318
|
react.useEffect(() => {
|
|
@@ -1318,22 +1338,26 @@ var ModalLoading = ({
|
|
|
1318
1338
|
className,
|
|
1319
1339
|
closeDisabled: true,
|
|
1320
1340
|
whitoutBackground: true,
|
|
1341
|
+
animated,
|
|
1342
|
+
preventBodyScroll,
|
|
1321
1343
|
children: [
|
|
1322
1344
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sr-only", "aria-live": "assertive", "aria-atomic": "true", children: announceMessage }),
|
|
1323
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1345
|
+
spinner ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1346
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1347
|
+
IconSpinnerDesktop,
|
|
1348
|
+
{
|
|
1349
|
+
className: "hidden md:block text-white animate-spin",
|
|
1350
|
+
"aria-hidden": "true"
|
|
1351
|
+
}
|
|
1352
|
+
),
|
|
1353
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1354
|
+
IconSpinnerMobile,
|
|
1355
|
+
{
|
|
1356
|
+
className: "block md:hidden text-white animate-spin",
|
|
1357
|
+
"aria-hidden": "true"
|
|
1358
|
+
}
|
|
1359
|
+
)
|
|
1360
|
+
] }),
|
|
1337
1361
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-white leading-normal text-2xl md:text-[64px] text-center mt-10 md:mt-20", children: message })
|
|
1338
1362
|
]
|
|
1339
1363
|
}
|