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.mjs CHANGED
@@ -3823,7 +3823,7 @@ var Chip_default = Chip2;
3823
3823
 
3824
3824
  // src/components/InputField.tsx
3825
3825
  import { forwardRef as forwardRef11, memo as memo18, useCallback as useCallback9, useState as useState7, useEffect as useEffect8, useMemo as useMemo6, useRef as useRef5, useId } from "react";
3826
- import styled9 from "styled-components";
3826
+ import styled10 from "styled-components";
3827
3827
 
3828
3828
  // src/constants/countries.ts
3829
3829
  var countries = [
@@ -5727,6 +5727,7 @@ var Dropdown_default = Dropdown2;
5727
5727
 
5728
5728
  // src/components/Calendar.tsx
5729
5729
  import { useCallback as useCallback8, useMemo as useMemo5, useState as useState6, memo as memo17, useEffect as useEffect7 } from "react";
5730
+ import styled9 from "styled-components";
5730
5731
  import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
5731
5732
  var getMonthName = (month, short = false) => {
5732
5733
  return [
@@ -5756,6 +5757,16 @@ var getWeekDayName = (day, short = false) => {
5756
5757
  ][day];
5757
5758
  };
5758
5759
  var weekDaysIndex = [1, 2, 3, 4, 5, 6, 0];
5760
+ var yearsRange = Array.from({ length: 100 + 1 + 50 }, (_, index) => index + (/* @__PURE__ */ new Date()).getFullYear() - 100);
5761
+ var SelectComponent = styled9.select.withConfig({
5762
+ shouldForwardProp: (prop) => !["normalStyle", "hoverStyle"].includes(prop)
5763
+ })`
5764
+ position: absolute;
5765
+ top: 50%;
5766
+ right: 0;
5767
+ transform: translateY(-50%);
5768
+ opacity: 0;
5769
+ `;
5759
5770
  function Calendar({ value, minDate, maxDate, onChange }) {
5760
5771
  const theme2 = useTheme();
5761
5772
  const [currentDate, setCurrentDate] = useState6(value ? new Date(value) : void 0);
@@ -5796,6 +5807,9 @@ function Calendar({ value, minDate, maxDate, onChange }) {
5796
5807
  `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`
5797
5808
  );
5798
5809
  }, [onChange]);
5810
+ const onChangeYearSelect = useCallback8((event) => {
5811
+ setCurrentYear(parseInt(event.target.value));
5812
+ }, []);
5799
5813
  const firstDayOfMonth = useMemo5(() => {
5800
5814
  const day = new Date(currentYear, currentMonth, 1).getDay();
5801
5815
  return day === 0 ? 6 : day - 1;
@@ -5820,10 +5834,13 @@ function Calendar({ value, minDate, maxDate, onChange }) {
5820
5834
  return /* @__PURE__ */ jsxs11(Div_default.column, { width: "100%", maxWidth: 320, gap: theme2.styles.gap, padding: theme2.styles.space / 2, userSelect: "none", children: [
5821
5835
  /* @__PURE__ */ jsxs11(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
5822
5836
  /* @__PURE__ */ jsx16(Button_default.icon, { icon: "chevronLeft", onClick: onClickPreviousMonthButton }),
5823
- /* @__PURE__ */ jsxs11(Text_default, { fontWeight: 700, children: [
5824
- getMonthName(currentMonth),
5825
- " ",
5826
- currentYear
5837
+ /* @__PURE__ */ jsxs11(Div_default.row, { alignItems: "center", gap: 4, children: [
5838
+ /* @__PURE__ */ jsx16(Text_default, { fontWeight: 700, children: getMonthName(currentMonth) }),
5839
+ /* @__PURE__ */ jsxs11(Div_default.row, { position: "relative", alignItems: "center", gap: 2, children: [
5840
+ /* @__PURE__ */ jsx16(Text_default, { fontWeight: 700, children: currentYear }),
5841
+ /* @__PURE__ */ jsx16(Icon_default, { name: "chevronDown", size: 12 }),
5842
+ /* @__PURE__ */ jsx16(SelectComponent, { theme: theme2, value: currentYear, onChange: onChangeYearSelect, children: yearsRange.map((year) => /* @__PURE__ */ jsx16("option", { value: year, children: year }, year)) })
5843
+ ] })
5827
5844
  ] }),
5828
5845
  /* @__PURE__ */ jsx16(Button_default.icon, { icon: "chevronRight", onClick: onClickNextMonthButton })
5829
5846
  ] }),
@@ -5910,7 +5927,7 @@ var buttonWidth = 50;
5910
5927
  var colorPickerSpacing = 4;
5911
5928
  var colorPickerColorWidth = 12 + 27 + colorPickerSpacing;
5912
5929
  var colorPickerValueWidth = 12 + 74 + colorPickerSpacing;
5913
- var InputElement = styled9.input.withConfig({
5930
+ var InputElement = styled10.input.withConfig({
5914
5931
  shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
5915
5932
  })`
5916
5933
  position: relative;
@@ -5954,6 +5971,7 @@ var InputElement = styled9.input.withConfig({
5954
5971
  &[type="date"],
5955
5972
  &[type="datetime-local"],
5956
5973
  &[type="time"] {
5974
+ min-height: 48px;
5957
5975
  -webkit-appearance: none;
5958
5976
  -moz-appearance: textfield;
5959
5977
 
@@ -6017,7 +6035,7 @@ var InputElement = styled9.input.withConfig({
6017
6035
  ${(props) => props.hoverStyle}
6018
6036
  }
6019
6037
  `;
6020
- var TextareaElement = styled9.textarea.withConfig({
6038
+ var TextareaElement = styled10.textarea.withConfig({
6021
6039
  shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
6022
6040
  })`
6023
6041
  width: 100%;
@@ -6783,12 +6801,12 @@ var InputField_default = InputField2;
6783
6801
 
6784
6802
  // src/components/ToggleInput.tsx
6785
6803
  import { forwardRef as forwardRef12, useCallback as useCallback10, useId as useId2, useState as useState8 } from "react";
6786
- import styled10 from "styled-components";
6804
+ import styled11 from "styled-components";
6787
6805
  import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
6788
6806
  var componentSize = 26;
6789
6807
  var switchComponentBallGap = 3;
6790
6808
  var switchComponentMouseDownDifference = 4;
6791
- var InputElement2 = styled10.input.withConfig({
6809
+ var InputElement2 = styled11.input.withConfig({
6792
6810
  shouldForwardProp: (prop) => !["theme", "normalStyle", "hoverStyle"].includes(prop)
6793
6811
  })`
6794
6812
  position: relative;
@@ -6824,7 +6842,7 @@ var InputElement2 = styled10.input.withConfig({
6824
6842
  ${(props) => props.hoverStyle}
6825
6843
  }
6826
6844
  `;
6827
- var SwitchElement = styled10.div.withConfig({
6845
+ var SwitchElement = styled11.div.withConfig({
6828
6846
  shouldForwardProp: (prop) => !["theme", "checked", "disabled", "isMouseDown", "normalStyle", "hoverStyle"].includes(prop)
6829
6847
  })`
6830
6848
  --width: ${(props) => componentSize * 2 - props.theme.styles.gap / 2}px;
@@ -7026,7 +7044,9 @@ var ToggleInput_default = {
7026
7044
  {
7027
7045
  alignItems: "center",
7028
7046
  gap: theme2.styles.gap,
7047
+ borderRadius: 999,
7029
7048
  isTabAccessed: true,
7049
+ onClick: onClickElement,
7030
7050
  onMouseDown: setIsMouseDown.setTrue,
7031
7051
  onMouseUp: setIsMouseDown.setFalse,
7032
7052
  onMouseOut: setIsMouseDown.setFalse,
@@ -7040,7 +7060,6 @@ var ToggleInput_default = {
7040
7060
  checked,
7041
7061
  disabled: disabled ?? false,
7042
7062
  isMouseDown,
7043
- onClick: onClickElement,
7044
7063
  id: readyId,
7045
7064
  role: "switch",
7046
7065
  "aria-checked": checked,
@@ -7324,17 +7343,70 @@ import {
7324
7343
  useEffect as useEffect10,
7325
7344
  Fragment as Fragment5
7326
7345
  } from "react";
7327
- import styled11, { css as css2 } from "styled-components";
7346
+ import styled12, { css as css2 } from "styled-components";
7328
7347
  import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
7329
7348
  var defaultImageWidth = 160;
7330
7349
  var maximumVisiblePages = 11;
7331
- var TableStyledComponent = styled11.table.withConfig({
7332
- shouldForwardProp: (prop) => !["isStriped", "withHover", "withStickyHeader", "colorTheme", "theme"].includes(prop)
7350
+ var TableStyledComponent = styled12.table.withConfig({
7351
+ shouldForwardProp: (prop) => ![
7352
+ "isStriped",
7353
+ "withHover",
7354
+ "withStickyHeader",
7355
+ "colorTheme",
7356
+ "theme",
7357
+ "containsOverflowComponents",
7358
+ "withFooter"
7359
+ ].includes(prop)
7333
7360
  })`
7334
7361
  width: 100%;
7335
7362
  border-collapse: collapse;
7336
7363
  border-spacing: 0;
7337
7364
 
7365
+ thead {
7366
+ tr:first-child {
7367
+ border-top-left-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7368
+ border-top-right-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7369
+
7370
+ th:first-child {
7371
+ border-top-left-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7372
+ }
7373
+
7374
+ th:last-child {
7375
+ border-top-right-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7376
+ }
7377
+ }
7378
+ }
7379
+
7380
+ tbody {
7381
+ tr:last-child {
7382
+ border-bottom-left-radius: ${(props) => props.containsOverflowComponents && !props.withFooter ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7383
+ border-bottom-right-radius: ${(props) => props.containsOverflowComponents && !props.withFooter ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7384
+
7385
+ td:first-child {
7386
+ border-bottom-left-radius: ${(props) => props.containsOverflowComponents && !props.withFooter ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7387
+ }
7388
+
7389
+ td:last-child {
7390
+ border-bottom-right-radius: ${(props) => props.containsOverflowComponents && !props.withFooter ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7391
+ }
7392
+ }
7393
+ }
7394
+
7395
+ tfoot {
7396
+ tr:last-child {
7397
+ border-bottom-left-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7398
+ border-bottom-right-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7399
+
7400
+ td:first-child {
7401
+ border-bottom-left-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7402
+ }
7403
+
7404
+ td:last-child {
7405
+ border-bottom-right-radius: ${(props) => props.containsOverflowComponents ? `${props.theme.styles.borderRadius * 2 - 1}px` : void 0};
7406
+ }
7407
+ }
7408
+ }
7409
+
7338
7410
  tr {
7339
7411
  background-color: ${(props) => props.theme.colors.backgroundContent};
7340
7412
 
@@ -7390,7 +7462,7 @@ var TableStyledComponent = styled11.table.withConfig({
7390
7462
  }
7391
7463
  }
7392
7464
  `;
7393
- var ThStyledComponent = styled11.th.withConfig({
7465
+ var ThStyledComponent = styled12.th.withConfig({
7394
7466
  shouldForwardProp: (prop) => !["width", "minWidth", "maxWidth", "textAlign"].includes(prop)
7395
7467
  })`
7396
7468
  ${(props) => props.width ? `width: ${props.width}px;` : ""}
@@ -7398,7 +7470,7 @@ var ThStyledComponent = styled11.th.withConfig({
7398
7470
  ${(props) => props.maxWidth ? `max-width: ${props.maxWidth}px;` : ""}
7399
7471
  ${(props) => props.textAlign ? `text-align: ${props.textAlign} !important;` : ""}
7400
7472
  `;
7401
- var TdStyledComponent = styled11.td.withConfig({
7473
+ var TdStyledComponent = styled12.td.withConfig({
7402
7474
  shouldForwardProp: (prop) => !["width", "textAlign"].includes(prop)
7403
7475
  })`
7404
7476
  ${(props) => props.textAlign ? `text-align: ${props.textAlign} !important;` : ""}
@@ -7427,6 +7499,7 @@ var TableComponent = forwardRef15(function Table({
7427
7499
  pageSize,
7428
7500
  pageCount,
7429
7501
  isInsideTableExpandRow,
7502
+ containsOverflowComponents,
7430
7503
  getRowStyle,
7431
7504
  onClickRow,
7432
7505
  onClickAllCheckboxes,
@@ -7797,6 +7870,7 @@ var TableComponent = forwardRef15(function Table({
7797
7870
  },
7798
7871
  [currentPage, setCurrentPage, pageCountInternal, setCheckedItems]
7799
7872
  );
7873
+ const withFooter = pageSize !== void 0 && pageCountInternal > 1;
7800
7874
  const mobileFooterBreakingPoint = mediaQuery.size700 && pageCountInternal > maximumVisiblePages / 1.4;
7801
7875
  return /* @__PURE__ */ jsxs17(Fragment6, { children: [
7802
7876
  /* @__PURE__ */ jsx22(
@@ -7804,7 +7878,7 @@ var TableComponent = forwardRef15(function Table({
7804
7878
  {
7805
7879
  border: `1px solid ${theme2.colors.border}`,
7806
7880
  borderRadius: theme2.styles.borderRadius * 2,
7807
- overflow: "auto",
7881
+ overflow: !containsOverflowComponents ? "auto" : void 0,
7808
7882
  ...props,
7809
7883
  children: /* @__PURE__ */ jsxs17(
7810
7884
  TableStyledComponent,
@@ -7814,6 +7888,8 @@ var TableComponent = forwardRef15(function Table({
7814
7888
  withStickyHeader,
7815
7889
  colorTheme,
7816
7890
  theme: theme2,
7891
+ containsOverflowComponents,
7892
+ withFooter,
7817
7893
  children: [
7818
7894
  /* @__PURE__ */ jsx22("thead", { children: /* @__PURE__ */ jsx22("tr", { className: "isHeader", children: columns.map((column, index) => /* @__PURE__ */ jsx22(
7819
7895
  ThStyledComponent,
@@ -7875,7 +7951,7 @@ var TableComponent = forwardRef15(function Table({
7875
7951
  ),
7876
7952
  expandedRows[rowIndex] && /* @__PURE__ */ jsx22("tr", { className: "withoutHover isExpandRow", children: /* @__PURE__ */ jsx22("td", { colSpan: columns.length, children: renderExpandedRow(item, rowIndex) }) })
7877
7953
  ] }, JSON.stringify(item) + rowIndex)) : /* @__PURE__ */ jsx22("tr", { className: "withoutHover", children: /* @__PURE__ */ jsx22("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx22(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
7878
- pageSize !== void 0 && pageCountInternal > 1 && /* @__PURE__ */ jsx22("tfoot", { children: /* @__PURE__ */ jsx22("tr", { className: "isFooter", children: /* @__PURE__ */ jsx22("td", { colSpan: columns.length, children: /* @__PURE__ */ jsxs17(
7954
+ withFooter && /* @__PURE__ */ jsx22("tfoot", { children: /* @__PURE__ */ jsx22("tr", { className: "isFooter", children: /* @__PURE__ */ jsx22("td", { colSpan: columns.length, children: /* @__PURE__ */ jsxs17(
7879
7955
  Div_default.column,
7880
7956
  {
7881
7957
  position: "relative",
@@ -8104,7 +8180,7 @@ var Table_default = Table2;
8104
8180
 
8105
8181
  // src/components/Tooltip.tsx
8106
8182
  import { memo as memo23, useCallback as useCallback12, useRef as useRef7, useState as useState10, useEffect as useEffect11, forwardRef as forwardRef16, useImperativeHandle as useImperativeHandle3, useMemo as useMemo9 } from "react";
8107
- import styled12, { css as css3 } from "styled-components";
8183
+ import styled13, { css as css3 } from "styled-components";
8108
8184
  import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
8109
8185
  var tooltipContainerStyle = (props) => ({
8110
8186
  top: css3`
@@ -8158,7 +8234,7 @@ var tooltipPositionStyle = (props) => ({
8158
8234
  `
8159
8235
  }
8160
8236
  });
8161
- var TooltipContainer = styled12.div.withConfig({
8237
+ var TooltipContainer = styled13.div.withConfig({
8162
8238
  shouldForwardProp: (prop) => !["theme", "position", "align", "withArrow", "arrowSize", "isOpen", "gap"].includes(prop)
8163
8239
  })`
8164
8240
  position: absolute;