react-better-html 1.1.145 → 1.1.147

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
@@ -736,6 +736,7 @@ type TableProps<DataItem> = {
736
736
  pageSize?: number;
737
737
  pageCount?: number;
738
738
  isInsideTableExpandRow?: boolean;
739
+ containsOverflowComponents?: boolean;
739
740
  getRowStyle?: (item: DataItem, index: number) => ComponentStyle;
740
741
  onClickRow?: (item: DataItem, index: number) => void;
741
742
  onClickAllCheckboxes?: (checked: boolean) => void;
package/dist/index.d.ts CHANGED
@@ -736,6 +736,7 @@ type TableProps<DataItem> = {
736
736
  pageSize?: number;
737
737
  pageCount?: number;
738
738
  isInsideTableExpandRow?: boolean;
739
+ containsOverflowComponents?: boolean;
739
740
  getRowStyle?: (item: DataItem, index: number) => ComponentStyle;
740
741
  onClickRow?: (item: DataItem, index: number) => void;
741
742
  onClickAllCheckboxes?: (checked: boolean) => void;
package/dist/index.js CHANGED
@@ -3909,7 +3909,7 @@ var Chip_default = Chip2;
3909
3909
 
3910
3910
  // src/components/InputField.tsx
3911
3911
  var import_react20 = require("react");
3912
- var import_styled_components10 = __toESM(require("styled-components"));
3912
+ var import_styled_components11 = __toESM(require("styled-components"));
3913
3913
 
3914
3914
  // src/constants/countries.ts
3915
3915
  var countries = [
@@ -5813,6 +5813,7 @@ var Dropdown_default = Dropdown2;
5813
5813
 
5814
5814
  // src/components/Calendar.tsx
5815
5815
  var import_react19 = require("react");
5816
+ var import_styled_components10 = __toESM(require("styled-components"));
5816
5817
  var import_jsx_runtime17 = require("react/jsx-runtime");
5817
5818
  var getMonthName = (month, short = false) => {
5818
5819
  return [
@@ -5842,6 +5843,16 @@ var getWeekDayName = (day, short = false) => {
5842
5843
  ][day];
5843
5844
  };
5844
5845
  var weekDaysIndex = [1, 2, 3, 4, 5, 6, 0];
5846
+ var yearsRange = Array.from({ length: 100 + 1 + 50 }, (_, index) => index + (/* @__PURE__ */ new Date()).getFullYear() - 100);
5847
+ var SelectComponent = import_styled_components10.default.select.withConfig({
5848
+ shouldForwardProp: (prop) => !["normalStyle", "hoverStyle"].includes(prop)
5849
+ })`
5850
+ position: absolute;
5851
+ top: 50%;
5852
+ right: 0;
5853
+ transform: translateY(-50%);
5854
+ opacity: 0;
5855
+ `;
5845
5856
  function Calendar({ value, minDate, maxDate, onChange }) {
5846
5857
  const theme2 = useTheme();
5847
5858
  const [currentDate, setCurrentDate] = (0, import_react19.useState)(value ? new Date(value) : void 0);
@@ -5882,6 +5893,9 @@ function Calendar({ value, minDate, maxDate, onChange }) {
5882
5893
  `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`
5883
5894
  );
5884
5895
  }, [onChange]);
5896
+ const onChangeYearSelect = (0, import_react19.useCallback)((event) => {
5897
+ setCurrentYear(parseInt(event.target.value));
5898
+ }, []);
5885
5899
  const firstDayOfMonth = (0, import_react19.useMemo)(() => {
5886
5900
  const day = new Date(currentYear, currentMonth, 1).getDay();
5887
5901
  return day === 0 ? 6 : day - 1;
@@ -5906,10 +5920,13 @@ function Calendar({ value, minDate, maxDate, onChange }) {
5906
5920
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.column, { width: "100%", maxWidth: 320, gap: theme2.styles.gap, padding: theme2.styles.space / 2, userSelect: "none", children: [
5907
5921
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
5908
5922
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button_default.icon, { icon: "chevronLeft", onClick: onClickPreviousMonthButton }),
5909
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text_default, { fontWeight: 700, children: [
5910
- getMonthName(currentMonth),
5911
- " ",
5912
- currentYear
5923
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { alignItems: "center", gap: 4, children: [
5924
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text_default, { fontWeight: 700, children: getMonthName(currentMonth) }),
5925
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { position: "relative", alignItems: "center", gap: 2, children: [
5926
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text_default, { fontWeight: 700, children: currentYear }),
5927
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon_default, { name: "chevronDown", size: 12 }),
5928
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectComponent, { theme: theme2, value: currentYear, onChange: onChangeYearSelect, children: yearsRange.map((year) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: year, children: year }, year)) })
5929
+ ] })
5913
5930
  ] }),
5914
5931
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button_default.icon, { icon: "chevronRight", onClick: onClickNextMonthButton })
5915
5932
  ] }),
@@ -5996,7 +6013,7 @@ var buttonWidth = 50;
5996
6013
  var colorPickerSpacing = 4;
5997
6014
  var colorPickerColorWidth = 12 + 27 + colorPickerSpacing;
5998
6015
  var colorPickerValueWidth = 12 + 74 + colorPickerSpacing;
5999
- var InputElement = import_styled_components10.default.input.withConfig({
6016
+ var InputElement = import_styled_components11.default.input.withConfig({
6000
6017
  shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
6001
6018
  })`
6002
6019
  position: relative;
@@ -6040,6 +6057,7 @@ var InputElement = import_styled_components10.default.input.withConfig({
6040
6057
  &[type="date"],
6041
6058
  &[type="datetime-local"],
6042
6059
  &[type="time"] {
6060
+ min-height: 48px;
6043
6061
  -webkit-appearance: none;
6044
6062
  -moz-appearance: textfield;
6045
6063
 
@@ -6103,7 +6121,7 @@ var InputElement = import_styled_components10.default.input.withConfig({
6103
6121
  ${(props) => props.hoverStyle}
6104
6122
  }
6105
6123
  `;
6106
- var TextareaElement = import_styled_components10.default.textarea.withConfig({
6124
+ var TextareaElement = import_styled_components11.default.textarea.withConfig({
6107
6125
  shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
6108
6126
  })`
6109
6127
  width: 100%;
@@ -6869,12 +6887,12 @@ var InputField_default = InputField2;
6869
6887
 
6870
6888
  // src/components/ToggleInput.tsx
6871
6889
  var import_react21 = require("react");
6872
- var import_styled_components11 = __toESM(require("styled-components"));
6890
+ var import_styled_components12 = __toESM(require("styled-components"));
6873
6891
  var import_jsx_runtime19 = require("react/jsx-runtime");
6874
6892
  var componentSize = 26;
6875
6893
  var switchComponentBallGap = 3;
6876
6894
  var switchComponentMouseDownDifference = 4;
6877
- var InputElement2 = import_styled_components11.default.input.withConfig({
6895
+ var InputElement2 = import_styled_components12.default.input.withConfig({
6878
6896
  shouldForwardProp: (prop) => !["theme", "normalStyle", "hoverStyle"].includes(prop)
6879
6897
  })`
6880
6898
  position: relative;
@@ -6910,7 +6928,7 @@ var InputElement2 = import_styled_components11.default.input.withConfig({
6910
6928
  ${(props) => props.hoverStyle}
6911
6929
  }
6912
6930
  `;
6913
- var SwitchElement = import_styled_components11.default.div.withConfig({
6931
+ var SwitchElement = import_styled_components12.default.div.withConfig({
6914
6932
  shouldForwardProp: (prop) => !["theme", "checked", "disabled", "isMouseDown", "normalStyle", "hoverStyle"].includes(prop)
6915
6933
  })`
6916
6934
  --width: ${(props) => componentSize * 2 - props.theme.styles.gap / 2}px;
@@ -7112,7 +7130,9 @@ var ToggleInput_default = {
7112
7130
  {
7113
7131
  alignItems: "center",
7114
7132
  gap: theme2.styles.gap,
7133
+ borderRadius: 999,
7115
7134
  isTabAccessed: true,
7135
+ onClick: onClickElement,
7116
7136
  onMouseDown: setIsMouseDown.setTrue,
7117
7137
  onMouseUp: setIsMouseDown.setFalse,
7118
7138
  onMouseOut: setIsMouseDown.setFalse,
@@ -7126,7 +7146,6 @@ var ToggleInput_default = {
7126
7146
  checked,
7127
7147
  disabled: disabled ?? false,
7128
7148
  isMouseDown,
7129
- onClick: onClickElement,
7130
7149
  id: readyId,
7131
7150
  role: "switch",
7132
7151
  "aria-checked": checked,
@@ -7400,17 +7419,70 @@ var ColorThemeSwitch_default = ColorThemeSwitch2;
7400
7419
 
7401
7420
  // src/components/Table.tsx
7402
7421
  var import_react25 = require("react");
7403
- var import_styled_components12 = __toESM(require("styled-components"));
7422
+ var import_styled_components13 = __toESM(require("styled-components"));
7404
7423
  var import_jsx_runtime23 = require("react/jsx-runtime");
7405
7424
  var defaultImageWidth = 160;
7406
7425
  var maximumVisiblePages = 11;
7407
- var TableStyledComponent = import_styled_components12.default.table.withConfig({
7408
- shouldForwardProp: (prop) => !["isStriped", "withHover", "withStickyHeader", "colorTheme", "theme"].includes(prop)
7426
+ var TableStyledComponent = import_styled_components13.default.table.withConfig({
7427
+ shouldForwardProp: (prop) => ![
7428
+ "isStriped",
7429
+ "withHover",
7430
+ "withStickyHeader",
7431
+ "colorTheme",
7432
+ "theme",
7433
+ "containsOverflowComponents",
7434
+ "withFooter"
7435
+ ].includes(prop)
7409
7436
  })`
7410
7437
  width: 100%;
7411
7438
  border-collapse: collapse;
7412
7439
  border-spacing: 0;
7413
7440
 
7441
+ thead {
7442
+ tr:first-child {
7443
+ border-top-left-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7444
+ border-top-right-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7445
+
7446
+ th:first-child {
7447
+ border-top-left-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7448
+ }
7449
+
7450
+ th:last-child {
7451
+ border-top-right-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7452
+ }
7453
+ }
7454
+ }
7455
+
7456
+ tbody {
7457
+ tr:last-child {
7458
+ border-bottom-left-radius: ${(props) => props.containsOverflowComponents && !props.withFooter ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7459
+ border-bottom-right-radius: ${(props) => props.containsOverflowComponents && !props.withFooter ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7460
+
7461
+ td:first-child {
7462
+ border-bottom-left-radius: ${(props) => props.containsOverflowComponents && !props.withFooter ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7463
+ }
7464
+
7465
+ td:last-child {
7466
+ border-bottom-right-radius: ${(props) => props.containsOverflowComponents && !props.withFooter ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7467
+ }
7468
+ }
7469
+ }
7470
+
7471
+ tfoot {
7472
+ tr:last-child {
7473
+ border-bottom-left-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7474
+ border-bottom-right-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7475
+
7476
+ td:first-child {
7477
+ border-bottom-left-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7478
+ }
7479
+
7480
+ td:last-child {
7481
+ border-bottom-right-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7482
+ }
7483
+ }
7484
+ }
7485
+
7414
7486
  tr {
7415
7487
  background-color: ${(props) => props.theme.colors.backgroundContent};
7416
7488
 
@@ -7431,13 +7503,13 @@ var TableStyledComponent = import_styled_components12.default.table.withConfig({
7431
7503
  }
7432
7504
  }
7433
7505
 
7434
- ${(props) => props.isStriped ? import_styled_components12.css`
7506
+ ${(props) => props.isStriped ? import_styled_components13.css`
7435
7507
  &:nth-child(even) {
7436
7508
  background-color: ${props.theme.colors.backgroundSecondary};
7437
7509
  }
7438
7510
  ` : ""}
7439
7511
 
7440
- ${(props) => props.withHover ? import_styled_components12.css`
7512
+ ${(props) => props.withHover ? import_styled_components13.css`
7441
7513
  transition: ${props.theme.styles.transition};
7442
7514
 
7443
7515
  &:not(.isHeader):not(.isFooter):not(.withoutHover):hover {
@@ -7466,7 +7538,7 @@ var TableStyledComponent = import_styled_components12.default.table.withConfig({
7466
7538
  }
7467
7539
  }
7468
7540
  `;
7469
- var ThStyledComponent = import_styled_components12.default.th.withConfig({
7541
+ var ThStyledComponent = import_styled_components13.default.th.withConfig({
7470
7542
  shouldForwardProp: (prop) => !["width", "minWidth", "maxWidth", "textAlign"].includes(prop)
7471
7543
  })`
7472
7544
  ${(props) => props.width ? `width: ${props.width}px;` : ""}
@@ -7474,7 +7546,7 @@ var ThStyledComponent = import_styled_components12.default.th.withConfig({
7474
7546
  ${(props) => props.maxWidth ? `max-width: ${props.maxWidth}px;` : ""}
7475
7547
  ${(props) => props.textAlign ? `text-align: ${props.textAlign} !important;` : ""}
7476
7548
  `;
7477
- var TdStyledComponent = import_styled_components12.default.td.withConfig({
7549
+ var TdStyledComponent = import_styled_components13.default.td.withConfig({
7478
7550
  shouldForwardProp: (prop) => !["width", "textAlign"].includes(prop)
7479
7551
  })`
7480
7552
  ${(props) => props.textAlign ? `text-align: ${props.textAlign} !important;` : ""}
@@ -7503,6 +7575,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7503
7575
  pageSize,
7504
7576
  pageCount,
7505
7577
  isInsideTableExpandRow,
7578
+ containsOverflowComponents,
7506
7579
  getRowStyle,
7507
7580
  onClickRow,
7508
7581
  onClickAllCheckboxes,
@@ -7873,6 +7946,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7873
7946
  },
7874
7947
  [currentPage, setCurrentPage, pageCountInternal, setCheckedItems]
7875
7948
  );
7949
+ const withFooter = pageSize !== void 0 && pageCountInternal > 1;
7876
7950
  const mobileFooterBreakingPoint = mediaQuery.size700 && pageCountInternal > maximumVisiblePages / 1.4;
7877
7951
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
7878
7952
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
@@ -7880,7 +7954,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7880
7954
  {
7881
7955
  border: `1px solid ${theme2.colors.border}`,
7882
7956
  borderRadius: theme2.styles.borderRadius * 2,
7883
- overflow: "auto",
7957
+ overflow: !containsOverflowComponents ? "auto" : void 0,
7884
7958
  ...props,
7885
7959
  children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
7886
7960
  TableStyledComponent,
@@ -7890,6 +7964,8 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7890
7964
  withStickyHeader,
7891
7965
  colorTheme,
7892
7966
  theme: theme2,
7967
+ containsOverflowComponents,
7968
+ withFooter,
7893
7969
  children: [
7894
7970
  /* @__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)(
7895
7971
  ThStyledComponent,
@@ -7951,7 +8027,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7951
8027
  ),
7952
8028
  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) }) })
7953
8029
  ] }, 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 }) }) }) }),
7954
- 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)(
8030
+ 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)(
7955
8031
  Div_default.column,
7956
8032
  {
7957
8033
  position: "relative",
@@ -8180,61 +8256,61 @@ var Table_default = Table2;
8180
8256
 
8181
8257
  // src/components/Tooltip.tsx
8182
8258
  var import_react26 = require("react");
8183
- var import_styled_components13 = __toESM(require("styled-components"));
8259
+ var import_styled_components14 = __toESM(require("styled-components"));
8184
8260
  var import_jsx_runtime24 = require("react/jsx-runtime");
8185
8261
  var tooltipContainerStyle = (props) => ({
8186
- top: import_styled_components13.css`
8262
+ top: import_styled_components14.css`
8187
8263
  bottom: calc(100% + ${props.gap}px + ${props.arrowSize}px);
8188
8264
  ${props.align === "center" ? "left: 50%;" : props.align === "left" ? "left: 0;" : "right: 0;"}
8189
8265
  `,
8190
- bottom: import_styled_components13.css`
8266
+ bottom: import_styled_components14.css`
8191
8267
  top: calc(100% + ${props.gap}px + ${props.arrowSize}px);
8192
8268
  ${props.align === "center" ? "left: 50%;" : props.align === "left" ? "left: 0;" : "right: 0;"};
8193
8269
  `,
8194
- left: import_styled_components13.css`
8270
+ left: import_styled_components14.css`
8195
8271
  ${props.align === "center" ? "top: 50%;" : props.align === "top" ? "top: 0;" : "bottom: 0;"};
8196
8272
  right: calc(100% + ${props.gap}px + ${props.arrowSize}px);
8197
8273
  `,
8198
- right: import_styled_components13.css`
8274
+ right: import_styled_components14.css`
8199
8275
  ${props.align === "center" ? "top: 50%;" : props.align === "top" ? "top: 0;" : "bottom: 0;"};
8200
8276
  left: calc(100% + ${props.gap}px + ${props.arrowSize}px);
8201
8277
  `
8202
8278
  });
8203
8279
  var tooltipPositionStyle = (props) => ({
8204
8280
  top: {
8205
- opened: import_styled_components13.css`
8281
+ opened: import_styled_components14.css`
8206
8282
  transform: translateX(${props.align === "center" ? "-50%" : "0"});
8207
8283
  `,
8208
- closed: import_styled_components13.css`
8284
+ closed: import_styled_components14.css`
8209
8285
  transform: translateX(${props.align === "center" ? "-50%" : "0"}) translateY(${props.theme.styles.gap}px);
8210
8286
  `
8211
8287
  },
8212
8288
  bottom: {
8213
- opened: import_styled_components13.css`
8289
+ opened: import_styled_components14.css`
8214
8290
  transform: translateX(${props.align === "center" ? "-50%" : "0"});
8215
8291
  `,
8216
- closed: import_styled_components13.css`
8292
+ closed: import_styled_components14.css`
8217
8293
  transform: translateX(${props.align === "center" ? "-50%" : "0"}) translateY(-${props.theme.styles.gap}px);
8218
8294
  `
8219
8295
  },
8220
8296
  left: {
8221
- opened: import_styled_components13.css`
8297
+ opened: import_styled_components14.css`
8222
8298
  transform: translateY(${props.align === "center" ? "-50%" : "0"});
8223
8299
  `,
8224
- closed: import_styled_components13.css`
8300
+ closed: import_styled_components14.css`
8225
8301
  transform: translateX(${props.theme.styles.gap}px) translateY(${props.align === "center" ? "-50%" : "0"});
8226
8302
  `
8227
8303
  },
8228
8304
  right: {
8229
- opened: import_styled_components13.css`
8305
+ opened: import_styled_components14.css`
8230
8306
  transform: translateY(${props.align === "center" ? "-50%" : "0"});
8231
8307
  `,
8232
- closed: import_styled_components13.css`
8308
+ closed: import_styled_components14.css`
8233
8309
  transform: translateX(-${props.theme.styles.gap}px) translateY(${props.align === "center" ? "-50%" : "0"});
8234
8310
  `
8235
8311
  }
8236
8312
  });
8237
- var TooltipContainer = import_styled_components13.default.div.withConfig({
8313
+ var TooltipContainer = import_styled_components14.default.div.withConfig({
8238
8314
  shouldForwardProp: (prop) => !["theme", "position", "align", "withArrow", "arrowSize", "isOpen", "gap"].includes(prop)
8239
8315
  })`
8240
8316
  position: absolute;