@eclass/ui-kit 1.54.4 → 1.54.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.
@@ -108,6 +108,7 @@ const overlay = {
108
108
  };
109
109
  const dialog = {
110
110
  boxShadow: shadows.lg,
111
+ bg: colors.neutral.white,
111
112
  borderRadius: radii.big
112
113
  };
113
114
  const theme = extendTheme({
@@ -4116,55 +4117,8 @@ const useFlashNotification = ({ state, message }) => {
4116
4117
  }
4117
4118
  };
4118
4119
  };
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
- };
4120
+ const uiKitModalIsDesktop = 641;
4163
4121
  const Modal = ({
4164
- buttons,
4165
- buttonsCenter,
4166
- buttonsColumn = true,
4167
- buttonsInside,
4168
4122
  children,
4169
4123
  closeOnOverlayClick = true,
4170
4124
  fixedSubtitle,
@@ -4172,38 +4126,48 @@ const Modal = ({
4172
4126
  onClose,
4173
4127
  title,
4174
4128
  withoutMargin = false,
4175
- scrollBehavior = "outside"
4129
+ scrollBehavior = "outside",
4130
+ fixedButtons = false
4176
4131
  }) => {
4177
4132
  const py = "32px";
4178
4133
  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";
4134
+ const [isDesktop] = useMediaQuery(`(min-width: ${uiKitModalIsDesktop}px)`);
4135
+ const isInside = scrollBehavior === "inside" || fixedButtons;
4187
4136
  return /* @__PURE__ */ jsx(Fragment, {
4188
4137
  children: /* @__PURE__ */ jsxs(Modal$1, {
4189
- closeOnOverlayClick: hasLoading ? false : closeOnOverlayClick,
4138
+ closeOnOverlayClick,
4139
+ closeOnEsc: closeOnOverlayClick,
4190
4140
  isOpen,
4191
4141
  motionPreset: "scale",
4192
- onClose: handleClose,
4193
- scrollBehavior,
4142
+ onClose,
4143
+ scrollBehavior: isInside ? "inside" : "outside",
4194
4144
  children: [/* @__PURE__ */ jsx(ModalOverlay, {}), /* @__PURE__ */ jsxs(ModalContent, {
4195
4145
  maxH: isInside ? "100dvh" : "auto",
4196
- minH: "300px",
4146
+ minH: isDesktop ? "300px" : "100dvh",
4197
4147
  padding: 0,
4198
4148
  width: "100%",
4199
4149
  sx: {
4150
+ bgColor: vars("colors-neutral-white"),
4200
4151
  borderRadius: isDesktop ? "8px" : 0,
4201
- height: isDesktop ? "auto" : "100dvh",
4202
4152
  mt: isDesktop ? "48px" : 0,
4203
4153
  marginX: isDesktop ? "auto" : 0,
4204
4154
  mb: 0,
4205
4155
  maxH: isInside ? "calc(100dvh - 96px)" : "auto",
4206
- maxWidth: isDesktop ? "600px" : "100%"
4156
+ maxWidth: isDesktop ? "600px" : "100%",
4157
+ ...fixedButtons && {
4158
+ ".uikit-modalContent": {
4159
+ pb: 0
4160
+ },
4161
+ ".uikit-modalButtons": {
4162
+ py
4163
+ }
4164
+ },
4165
+ ...withoutMargin && {
4166
+ ".uikit-modalContent": {
4167
+ pt: 0,
4168
+ px: 0
4169
+ }
4170
+ }
4207
4171
  },
4208
4172
  children: [/* @__PURE__ */ jsx(ModalHeader, {
4209
4173
  bg: vars("colors-main-deepSkyBlue"),
@@ -4235,27 +4199,7 @@ const Modal = ({
4235
4199
  textAlign: "center",
4236
4200
  px,
4237
4201
  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
- })]
4202
+ }), children]
4259
4203
  })]
4260
4204
  })
4261
4205
  });
@@ -4306,9 +4250,9 @@ const ModalAlertNew = ({
4306
4250
  type,
4307
4251
  isOpen,
4308
4252
  onClose,
4253
+ children,
4309
4254
  title,
4310
4255
  description,
4311
- buttons,
4312
4256
  status
4313
4257
  }) => {
4314
4258
  const [isDesktop] = useMediaQuery("(min-width: 641px)");
@@ -4350,30 +4294,7 @@ const ModalAlertNew = ({
4350
4294
  lineHeight: "24px",
4351
4295
  children: description
4352
4296
  })]
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
- })]
4297
+ }), type !== "loading" && children ? children : /* @__PURE__ */ jsx(Fragment, {})]
4377
4298
  })]
4378
4299
  })
4379
4300
  });