react-better-html 1.1.144 → 1.1.146

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;
@@ -735,6 +736,7 @@ type TableProps<DataItem> = {
735
736
  pageSize?: number;
736
737
  pageCount?: number;
737
738
  isInsideTableExpandRow?: boolean;
739
+ containsOverflowComponents?: boolean;
738
740
  getRowStyle?: (item: DataItem, index: number) => ComponentStyle;
739
741
  onClickRow?: (item: DataItem, index: number) => void;
740
742
  onClickAllCheckboxes?: (checked: boolean) => void;
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;
@@ -735,6 +736,7 @@ type TableProps<DataItem> = {
735
736
  pageSize?: number;
736
737
  pageCount?: number;
737
738
  isInsideTableExpandRow?: boolean;
739
+ containsOverflowComponents?: boolean;
738
740
  getRowStyle?: (item: DataItem, index: number) => ComponentStyle;
739
741
  onClickRow?: (item: DataItem, index: number) => void;
740
742
  onClickAllCheckboxes?: (checked: boolean) => void;
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,
@@ -7393,12 +7405,65 @@ var import_jsx_runtime23 = require("react/jsx-runtime");
7393
7405
  var defaultImageWidth = 160;
7394
7406
  var maximumVisiblePages = 11;
7395
7407
  var TableStyledComponent = import_styled_components12.default.table.withConfig({
7396
- shouldForwardProp: (prop) => !["isStriped", "withHover", "withStickyHeader", "colorTheme", "theme"].includes(prop)
7408
+ shouldForwardProp: (prop) => ![
7409
+ "isStriped",
7410
+ "withHover",
7411
+ "withStickyHeader",
7412
+ "colorTheme",
7413
+ "theme",
7414
+ "containsOverflowComponents",
7415
+ "withFooter"
7416
+ ].includes(prop)
7397
7417
  })`
7398
7418
  width: 100%;
7399
7419
  border-collapse: collapse;
7400
7420
  border-spacing: 0;
7401
7421
 
7422
+ thead {
7423
+ tr:first-child {
7424
+ border-top-left-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7425
+ border-top-right-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7426
+
7427
+ th:first-child {
7428
+ border-top-left-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7429
+ }
7430
+
7431
+ th:last-child {
7432
+ border-top-right-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7433
+ }
7434
+ }
7435
+ }
7436
+
7437
+ tbody {
7438
+ tr:last-child {
7439
+ border-bottom-left-radius: ${(props) => props.containsOverflowComponents && !props.withFooter ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7440
+ border-bottom-right-radius: ${(props) => props.containsOverflowComponents && !props.withFooter ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7441
+
7442
+ td:first-child {
7443
+ border-bottom-left-radius: ${(props) => props.containsOverflowComponents && !props.withFooter ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7444
+ }
7445
+
7446
+ td:last-child {
7447
+ border-bottom-right-radius: ${(props) => props.containsOverflowComponents && !props.withFooter ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7448
+ }
7449
+ }
7450
+ }
7451
+
7452
+ tfoot {
7453
+ tr:last-child {
7454
+ border-bottom-left-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7455
+ border-bottom-right-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7456
+
7457
+ td:first-child {
7458
+ border-bottom-left-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7459
+ }
7460
+
7461
+ td:last-child {
7462
+ border-bottom-right-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7463
+ }
7464
+ }
7465
+ }
7466
+
7402
7467
  tr {
7403
7468
  background-color: ${(props) => props.theme.colors.backgroundContent};
7404
7469
 
@@ -7491,6 +7556,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7491
7556
  pageSize,
7492
7557
  pageCount,
7493
7558
  isInsideTableExpandRow,
7559
+ containsOverflowComponents,
7494
7560
  getRowStyle,
7495
7561
  onClickRow,
7496
7562
  onClickAllCheckboxes,
@@ -7580,14 +7646,14 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7580
7646
  );
7581
7647
  }
7582
7648
  case "expand": {
7583
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7649
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Div_default, { isTabAccessed: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7584
7650
  Icon_default,
7585
7651
  {
7586
7652
  name: "chevronDown",
7587
7653
  transform: `rotate(${expandedRows[itemIndex] ? 180 : 0}deg)`,
7588
7654
  transition: theme2.styles.transition
7589
7655
  }
7590
- );
7656
+ ) });
7591
7657
  }
7592
7658
  default: {
7593
7659
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, {});
@@ -7861,6 +7927,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7861
7927
  },
7862
7928
  [currentPage, setCurrentPage, pageCountInternal, setCheckedItems]
7863
7929
  );
7930
+ const withFooter = pageSize !== void 0 && pageCountInternal > 1;
7864
7931
  const mobileFooterBreakingPoint = mediaQuery.size700 && pageCountInternal > maximumVisiblePages / 1.4;
7865
7932
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
7866
7933
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
@@ -7868,7 +7935,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7868
7935
  {
7869
7936
  border: `1px solid ${theme2.colors.border}`,
7870
7937
  borderRadius: theme2.styles.borderRadius * 2,
7871
- overflow: "auto",
7938
+ overflow: !containsOverflowComponents ? "auto" : void 0,
7872
7939
  ...props,
7873
7940
  children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
7874
7941
  TableStyledComponent,
@@ -7878,6 +7945,8 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7878
7945
  withStickyHeader,
7879
7946
  colorTheme,
7880
7947
  theme: theme2,
7948
+ containsOverflowComponents,
7949
+ withFooter,
7881
7950
  children: [
7882
7951
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "isHeader", children: columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7883
7952
  ThStyledComponent,
@@ -7939,7 +8008,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7939
8008
  ),
7940
8009
  expandedRows[rowIndex] && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "withoutHover isExpandRow", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { colSpan: columns.length, children: renderExpandedRow(item, rowIndex) }) })
7941
8010
  ] }, JSON.stringify(item) + rowIndex)) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "withoutHover", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
7942
- pageSize !== void 0 && pageCountInternal > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tfoot", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "isFooter", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
8011
+ withFooter && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tfoot", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "isFooter", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
7943
8012
  Div_default.column,
7944
8013
  {
7945
8014
  position: "relative",