react-better-html 1.1.143 → 1.1.145

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/index.d.mts CHANGED
@@ -283,6 +283,7 @@ type ModalProps = {
283
283
  /** @requires ReactRouterDomPlugin */
284
284
  name?: string;
285
285
  overflow?: React.CSSProperties["overflow"];
286
+ withoutCloseButton?: boolean;
286
287
  onOpen?: () => void;
287
288
  onClose?: () => void;
288
289
  children?: React.ReactNode;
@@ -695,6 +696,8 @@ type ExpandColumn<DataItem> = {
695
696
  type: "expand";
696
697
  onlyOneExpanded?: boolean;
697
698
  render?: (item: DataItem, index: number) => ReactNode;
699
+ onExpand?: (item: DataItem, index: number) => void;
700
+ onCollapse?: (item: DataItem, index: number) => void;
698
701
  };
699
702
  type NumberFilter<DataItem> = {
700
703
  filter?: "number";
package/dist/index.d.ts CHANGED
@@ -283,6 +283,7 @@ type ModalProps = {
283
283
  /** @requires ReactRouterDomPlugin */
284
284
  name?: string;
285
285
  overflow?: React.CSSProperties["overflow"];
286
+ withoutCloseButton?: boolean;
286
287
  onOpen?: () => void;
287
288
  onClose?: () => void;
288
289
  children?: React.ReactNode;
@@ -695,6 +696,8 @@ type ExpandColumn<DataItem> = {
695
696
  type: "expand";
696
697
  onlyOneExpanded?: boolean;
697
698
  render?: (item: DataItem, index: number) => ReactNode;
699
+ onExpand?: (item: DataItem, index: number) => void;
700
+ onCollapse?: (item: DataItem, index: number) => void;
698
701
  };
699
702
  type NumberFilter<DataItem> = {
700
703
  filter?: "number";
package/dist/index.js CHANGED
@@ -3352,6 +3352,7 @@ var ModalComponent = (0, import_react13.forwardRef)(function Modal({
3352
3352
  headerBackgroundColor,
3353
3353
  name,
3354
3354
  overflow,
3355
+ withoutCloseButton,
3355
3356
  onOpen,
3356
3357
  onClose,
3357
3358
  children
@@ -3386,6 +3387,15 @@ var ModalComponent = (0, import_react13.forwardRef)(function Modal({
3386
3387
  setIsOpenedLate(false);
3387
3388
  }, 0.2 * 1e3);
3388
3389
  }, [onClose, urlQuery, name]);
3390
+ const onKeyDown = (0, import_react13.useCallback)(
3391
+ (event) => {
3392
+ if (event.key === "Escape") {
3393
+ if (!withoutCloseButton) return;
3394
+ event.preventDefault();
3395
+ }
3396
+ },
3397
+ [withoutCloseButton]
3398
+ );
3389
3399
  (0, import_react13.useImperativeHandle)(
3390
3400
  ref,
3391
3401
  () => {
@@ -3405,6 +3415,7 @@ var ModalComponent = (0, import_react13.forwardRef)(function Modal({
3405
3415
  colorTheme,
3406
3416
  opacity: !isOpened ? 0 : 1,
3407
3417
  onClose: onClickClose,
3418
+ onKeyDown,
3408
3419
  ref: dialogRef,
3409
3420
  children: isOpenedLate ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3410
3421
  Div_default.column,
@@ -3464,7 +3475,7 @@ var ModalComponent = (0, import_react13.forwardRef)(function Modal({
3464
3475
  }
3465
3476
  )
3466
3477
  ] }),
3467
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3478
+ !withoutCloseButton && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3468
3479
  Button_default.icon,
3469
3480
  {
3470
3481
  icon: "XMark",
@@ -3478,7 +3489,7 @@ var ModalComponent = (0, import_react13.forwardRef)(function Modal({
3478
3489
  }
3479
3490
  ),
3480
3491
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Divider_default.horizontal, {})
3481
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Div_default, { position: "absolute", top: theme2.styles.space, right: theme2.styles.space, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button_default.icon, { icon: "XMark", onClick: onClickClose }) }),
3492
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: !withoutCloseButton && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Div_default, { position: "absolute", top: theme2.styles.space, right: theme2.styles.space, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button_default.icon, { icon: "XMark", onClick: onClickClose }) }) }),
3482
3493
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3483
3494
  Div_default,
3484
3495
  {
@@ -7101,6 +7112,7 @@ var ToggleInput_default = {
7101
7112
  {
7102
7113
  alignItems: "center",
7103
7114
  gap: theme2.styles.gap,
7115
+ isTabAccessed: true,
7104
7116
  onMouseDown: setIsMouseDown.setTrue,
7105
7117
  onMouseUp: setIsMouseDown.setFalse,
7106
7118
  onMouseOut: setIsMouseDown.setFalse,
@@ -7580,14 +7592,14 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7580
7592
  );
7581
7593
  }
7582
7594
  case "expand": {
7583
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7595
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Div_default, { isTabAccessed: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7584
7596
  Icon_default,
7585
7597
  {
7586
7598
  name: "chevronDown",
7587
7599
  transform: `rotate(${expandedRows[itemIndex] ? 180 : 0}deg)`,
7588
7600
  transition: theme2.styles.transition
7589
7601
  }
7590
- );
7602
+ ) });
7591
7603
  }
7592
7604
  default: {
7593
7605
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, {});
@@ -7603,8 +7615,10 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7603
7615
  if (oldValue[index] === void 0) {
7604
7616
  const newValue = expandColumn.onlyOneExpanded ? [] : [...oldValue];
7605
7617
  newValue[index] = true;
7618
+ expandColumn.onExpand?.(item, index);
7606
7619
  return newValue;
7607
7620
  }
7621
+ expandColumn.onCollapse?.(item, index);
7608
7622
  return oldValue.map((isExpanded, internalIndex) => internalIndex === index ? !isExpanded : isExpanded);
7609
7623
  });
7610
7624
  } else onClickRow?.(item, index);