@eclass/ui-kit 1.54.2 → 1.54.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.
@@ -1,4 +1,4 @@
1
- import { extendTheme, Box, CircularProgress, Icon, Button, useMediaQuery, Tooltip, Flex, Stack, Center, Image, Text, HStack, Heading, List, ListItem, Link, Modal, ModalContent, ModalHeader, ModalCloseButton, ModalBody, ModalFooter, ModalOverlay, useDisclosure, LinkBox, LinkOverlay, MenuButton, MenuGroup, Menu, MenuList } from "@chakra-ui/react";
1
+ import { extendTheme, Box, CircularProgress, Icon, Button, useMediaQuery, Tooltip, Flex, Stack, Center, Image, Text, HStack, Heading, List, ListItem, Link, Modal as Modal$1, ModalContent, ModalHeader, ModalCloseButton, ModalBody, ModalFooter, ModalOverlay, useDisclosure, LinkBox, LinkOverlay, MenuButton, MenuGroup, Menu, MenuList } from "@chakra-ui/react";
2
2
  import * as React from "react";
3
3
  import React__default, { useEffect, useCallback, useState } from "react";
4
4
  const main = {
@@ -1870,6 +1870,7 @@ const NavBarButton = ({
1870
1870
  id: isAccessibility ? "UserWayButton" : "",
1871
1871
  onClick: isAccessibility ? triggerWidget : onClick,
1872
1872
  sx: {
1873
+ alignItems: "center",
1873
1874
  background: "none !important",
1874
1875
  border: "1px transparent !important",
1875
1876
  cursor: "pointer",
@@ -3193,7 +3194,7 @@ function PaymentModal({
3193
3194
  setOverlay(/* @__PURE__ */ jsx(OverlayTwo, {}));
3194
3195
  }
3195
3196
  }, [showOverlay]);
3196
- return /* @__PURE__ */ jsxs(Modal, {
3197
+ return /* @__PURE__ */ jsxs(Modal$1, {
3197
3198
  isCentered: true,
3198
3199
  isOpen,
3199
3200
  onClose,
@@ -3247,7 +3248,7 @@ function PaymentModal({
3247
3248
  })]
3248
3249
  });
3249
3250
  }
3250
- Modal.displayName = "Modal";
3251
+ Modal$1.displayName = "Modal";
3251
3252
  function Footer({
3252
3253
  modalPaymentText
3253
3254
  }) {
@@ -4115,6 +4116,268 @@ const useFlashNotification = ({ state, message }) => {
4115
4116
  }
4116
4117
  };
4117
4118
  };
4119
+ const StyledModalFooter = ModalFooter;
4120
+ const ModalButtons = ({
4121
+ buttons,
4122
+ buttonsCenter,
4123
+ buttonsColumn,
4124
+ buttonsInside,
4125
+ isDesktop,
4126
+ px,
4127
+ py
4128
+ }) => {
4129
+ if (!buttons || buttons && buttons.length === 0) {
4130
+ return /* @__PURE__ */ jsx(Fragment, {});
4131
+ }
4132
+ const buttonFull = !isDesktop && buttonsColumn;
4133
+ const hasLoading = buttons.some((button) => button.isLoading);
4134
+ return /* @__PURE__ */ jsx(StyledModalFooter, {
4135
+ as: "footer",
4136
+ flexDirection: buttonFull ? "column" : "row",
4137
+ gap: "24px",
4138
+ justifyContent: buttonsCenter ? "center" : "flex-start",
4139
+ pb: buttonsInside ? 0 : py,
4140
+ pt: py,
4141
+ px: buttonsInside ? 0 : px,
4142
+ children: buttons.map((button, index2) => {
4143
+ var _a, _b;
4144
+ if ((button == null ? void 0 : button.type) === "secondary") {
4145
+ return /* @__PURE__ */ jsx(BtnSecondary, {
4146
+ onClick: () => button.action(),
4147
+ isFullWidth: buttonFull,
4148
+ isLoading: button.isLoading,
4149
+ disabled: (_a = button.isDisabled) != null ? _a : hasLoading,
4150
+ children: button.text
4151
+ }, index2);
4152
+ }
4153
+ return /* @__PURE__ */ jsx(BtnPrimary, {
4154
+ onClick: () => button.action(),
4155
+ isFullWidth: buttonFull,
4156
+ isLoading: button.isLoading,
4157
+ disabled: (_b = button.isDisabled) != null ? _b : hasLoading,
4158
+ children: button.text
4159
+ }, index2);
4160
+ })
4161
+ });
4162
+ };
4163
+ const Modal = ({
4164
+ buttons,
4165
+ buttonsCenter,
4166
+ buttonsColumn = true,
4167
+ buttonsInside,
4168
+ children,
4169
+ closeOnOverlayClick = true,
4170
+ fixedSubtitle,
4171
+ isOpen,
4172
+ onClose,
4173
+ title,
4174
+ withoutMargin = false,
4175
+ scrollBehavior = "outside"
4176
+ }) => {
4177
+ const py = "32px";
4178
+ const px = "24px";
4179
+ const [isDesktop] = useMediaQuery("(min-width: 641px)");
4180
+ const hasLoading = (buttons == null ? void 0 : buttons.length) && buttons.some((button) => button.isLoading);
4181
+ const handleClose = () => {
4182
+ if (hasLoading)
4183
+ return;
4184
+ return onClose();
4185
+ };
4186
+ const isInside = scrollBehavior === "inside";
4187
+ return /* @__PURE__ */ jsx(Fragment, {
4188
+ children: /* @__PURE__ */ jsxs(Modal$1, {
4189
+ closeOnOverlayClick: hasLoading ? false : closeOnOverlayClick,
4190
+ isOpen,
4191
+ motionPreset: "scale",
4192
+ onClose: handleClose,
4193
+ scrollBehavior,
4194
+ children: [/* @__PURE__ */ jsx(ModalOverlay, {}), /* @__PURE__ */ jsxs(ModalContent, {
4195
+ maxH: isInside ? "100dvh" : "auto",
4196
+ minH: "300px",
4197
+ padding: 0,
4198
+ width: "100%",
4199
+ sx: {
4200
+ borderRadius: isDesktop ? "8px" : 0,
4201
+ height: isDesktop ? "auto" : "100dvh",
4202
+ mt: isDesktop ? "48px" : 0,
4203
+ marginX: isDesktop ? "auto" : 0,
4204
+ mb: 0,
4205
+ maxH: isInside ? "calc(100dvh - 96px)" : "auto",
4206
+ maxWidth: isDesktop ? "600px" : "100%"
4207
+ },
4208
+ children: [/* @__PURE__ */ jsx(ModalHeader, {
4209
+ bg: vars("colors-main-deepSkyBlue"),
4210
+ borderTopRadius: isDesktop ? "8px" : 0,
4211
+ color: vars("colors-neutral-white"),
4212
+ fontFamily: "Roboto",
4213
+ fontSize: isDesktop ? "20px" : "18px",
4214
+ fontWeight: 700,
4215
+ lineHeight: 1,
4216
+ mb: withoutMargin ? 0 : "32px",
4217
+ paddingY: px,
4218
+ textAlign: "center",
4219
+ children: title
4220
+ }), closeOnOverlayClick && /* @__PURE__ */ jsx(ModalCloseButton, {
4221
+ color: vars("colors-neutral-white"),
4222
+ h: "12px",
4223
+ p: "22px",
4224
+ right: 0,
4225
+ top: 0,
4226
+ w: "12px",
4227
+ _focus: {
4228
+ boxShadow: "none"
4229
+ }
4230
+ }), (fixedSubtitle == null ? void 0 : fixedSubtitle.trim()) && /* @__PURE__ */ jsx(Box, {
4231
+ as: "p",
4232
+ fontSize: "14px",
4233
+ lineHeight: "19px",
4234
+ mb: py,
4235
+ textAlign: "center",
4236
+ px,
4237
+ children: fixedSubtitle
4238
+ }), children && /* @__PURE__ */ jsxs(ModalBody, {
4239
+ px: withoutMargin ? 0 : px,
4240
+ py: 0,
4241
+ mb: (buttons == null ? void 0 : buttons.length) === 0 ? py : buttonsInside ? py : 0,
4242
+ children: [children, buttonsInside && buttons && buttons.length > 0 && /* @__PURE__ */ jsx(ModalButtons, {
4243
+ buttons,
4244
+ buttonsCenter,
4245
+ buttonsColumn,
4246
+ buttonsInside: true,
4247
+ isDesktop,
4248
+ px,
4249
+ py
4250
+ })]
4251
+ }), !buttonsInside && /* @__PURE__ */ jsx(ModalButtons, {
4252
+ buttons,
4253
+ buttonsCenter,
4254
+ buttonsColumn,
4255
+ isDesktop,
4256
+ px,
4257
+ py
4258
+ })]
4259
+ })]
4260
+ })
4261
+ });
4262
+ };
4263
+ const Loading$1 = ({
4264
+ fill = vars("colors-main-deepSkyBlue")
4265
+ }) => {
4266
+ return /* @__PURE__ */ jsxs("svg", {
4267
+ "data-testid": "loading-svg",
4268
+ id: "prefix__eXySq0EBKm11",
4269
+ xmlns: "http://www.w3.org/2000/svg",
4270
+ viewBox: "0 0 38 20",
4271
+ shapeRendering: "geometricPrecision",
4272
+ textRendering: "geometricPrecision",
4273
+ width: 50,
4274
+ height: 35,
4275
+ children: [/* @__PURE__ */ jsx("style", {
4276
+ dangerouslySetInnerHTML: {
4277
+ __html: "@keyframes eXySq0EBKm12_f_o{0%,33.333333%,to{fill-opacity:.4}66.666667%{fill-opacity:1;animation-timing-function:cubic-bezier(.42,0,.58,1)}}@keyframes eXySq0EBKm13_f_o{0%,66.666667%,to{fill-opacity:.4}33.333333%{fill-opacity:1;animation-timing-function:cubic-bezier(.42,0,.58,1)}}@keyframes eXySq0EBKm14_f_o{0%{fill-opacity:1;animation-timing-function:cubic-bezier(.42,0,.58,1)}33.333333%,66.666667%{fill-opacity:.4}to{fill-opacity:1}}"
4278
+ }
4279
+ }), /* @__PURE__ */ jsx("circle", {
4280
+ r: 2.502,
4281
+ transform: "translate(29.526 10)",
4282
+ fill,
4283
+ fillOpacity: 0.4,
4284
+ style: {
4285
+ animation: "eXySq0EBKm12_f_o 600ms linear infinite normal forwards"
4286
+ }
4287
+ }), /* @__PURE__ */ jsx("circle", {
4288
+ r: 2.502,
4289
+ transform: "translate(19 10)",
4290
+ fill,
4291
+ fillOpacity: 0.4,
4292
+ style: {
4293
+ animation: "eXySq0EBKm13_f_o 600ms linear infinite normal forwards"
4294
+ }
4295
+ }), /* @__PURE__ */ jsx("circle", {
4296
+ r: 2.053,
4297
+ transform: "matrix(1.21764 0 0 1.21764 8.562 10.002)",
4298
+ fill,
4299
+ style: {
4300
+ animation: "eXySq0EBKm14_f_o 600ms linear infinite normal forwards"
4301
+ }
4302
+ })]
4303
+ });
4304
+ };
4305
+ const ModalAlertNew = ({
4306
+ type,
4307
+ isOpen,
4308
+ onClose,
4309
+ title,
4310
+ description,
4311
+ buttons,
4312
+ status
4313
+ }) => {
4314
+ const [isDesktop] = useMediaQuery("(min-width: 641px)");
4315
+ return /* @__PURE__ */ jsx(Fragment, {
4316
+ children: /* @__PURE__ */ jsxs(Modal$1, {
4317
+ closeOnOverlayClick: false,
4318
+ isOpen,
4319
+ motionPreset: "scale",
4320
+ onClose,
4321
+ closeOnEsc: type !== "loading",
4322
+ children: [/* @__PURE__ */ jsx(ModalOverlay, {}), /* @__PURE__ */ jsxs(ModalContent, {
4323
+ borderRadius: "8px",
4324
+ p: 0,
4325
+ m: "10vh auto 0",
4326
+ sx: {
4327
+ maxWidth: isDesktop ? "589px" : "343px"
4328
+ },
4329
+ children: [/* @__PURE__ */ jsxs(ModalBody, {
4330
+ p: "32px",
4331
+ display: "flex",
4332
+ flexDirection: "column",
4333
+ alignItems: "center",
4334
+ textAlign: "center",
4335
+ gap: "16px",
4336
+ fontFamily: "Roboto",
4337
+ children: [type === "loading" ? /* @__PURE__ */ jsx(Loading$1, {}) : /* @__PURE__ */ jsx(Box, {
4338
+ display: "flex",
4339
+ justifyContent: "center",
4340
+ children: alertColorStates[status != null ? status : "info"].icon
4341
+ }), title && /* @__PURE__ */ jsx(Box, {
4342
+ as: "p",
4343
+ fontWeight: "700",
4344
+ fontSize: isDesktop ? "20px" : "18px",
4345
+ lineHeight: "24px",
4346
+ children: title
4347
+ }), description && /* @__PURE__ */ jsx(Box, {
4348
+ as: "p",
4349
+ fontSize: "16px",
4350
+ lineHeight: "24px",
4351
+ children: description
4352
+ })]
4353
+ }), type === "info" && (buttons == null ? void 0 : buttons.length) && /* @__PURE__ */ jsx(Box, {
4354
+ display: "flex",
4355
+ borderTop: `1px solid ${vars("colors-neutral-platinum")}`,
4356
+ sx: {
4357
+ button: {
4358
+ borderRight: `1px solid ${vars("colors-neutral-platinum")}`,
4359
+ fontFamily: "Roboto",
4360
+ fontSize: "16px",
4361
+ fontWeight: 500,
4362
+ lineHeight: "21px",
4363
+ p: "16px",
4364
+ textDecor: "none",
4365
+ width: "100%",
4366
+ "&:last-child": {
4367
+ borderRight: "none"
4368
+ }
4369
+ }
4370
+ },
4371
+ children: buttons.map((button, index2) => /* @__PURE__ */ jsx(BtnLink, {
4372
+ as: "button",
4373
+ onClick: () => button.action(),
4374
+ children: button.text
4375
+ }, index2))
4376
+ })]
4377
+ })]
4378
+ })
4379
+ });
4380
+ };
4118
4381
  function ModalAlert({
4119
4382
  showModal,
4120
4383
  typeAlert,
@@ -4130,7 +4393,7 @@ function ModalAlert({
4130
4393
  }
4131
4394
  };
4132
4395
  const showBorder = optionsButton.length > 1;
4133
- return /* @__PURE__ */ jsxs(Modal, {
4396
+ return /* @__PURE__ */ jsxs(Modal$1, {
4134
4397
  id: "modal-alert",
4135
4398
  isOpen: showModal,
4136
4399
  onClose: () => {
@@ -6567,5 +6830,5 @@ const EventsList = ({
6567
6830
  })]
6568
6831
  });
6569
6832
  };
6570
- export { Alert, Btn, BtnLink, BtnPrimary, BtnSecondary, BtnTertiary, CalendarDropdown, CourseList, CourseStatus, Eventos, EventsList, FlashNotification, index as Icons, Label, ModalAlert, NavBarButton, NewTooltip, Progress, Resources, Ripples, TinyAlert, UserWay, UserWayCookie, dataFake, maxWidthCoursesList, theme, useFlashNotification, vars };
6833
+ export { Alert, Btn, BtnLink, BtnPrimary, BtnSecondary, BtnTertiary, CalendarDropdown, CourseList, CourseStatus, Eventos, EventsList, FlashNotification, index as Icons, Label, Modal, ModalAlert, ModalAlertNew, NavBarButton, NewTooltip, Progress, Resources, Ripples, TinyAlert, UserWay, UserWayCookie, dataFake, maxWidthCoursesList, theme, useFlashNotification, vars };
6571
6834
  //# sourceMappingURL=eclass-ui-kit.es.js.map