@eclass/ui-kit 1.54.2 → 1.54.3

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