react-better-html 1.1.146 → 1.1.148

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;
@@ -6881,6 +6899,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
6881
6899
  label,
6882
6900
  labelColor,
6883
6901
  text,
6902
+ textAdvanced,
6884
6903
  errorText,
6885
6904
  infoText,
6886
6905
  value,
@@ -6962,13 +6981,19 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
6962
6981
  }
6963
6982
  ) : void 0
6964
6983
  ] }),
6965
- text && /* @__PURE__ */ jsxs13(Text_default, { color, userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
6984
+ text ? /* @__PURE__ */ jsxs13(Text_default, { color, userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
6966
6985
  text,
6967
6986
  required && !label && /* @__PURE__ */ jsxs13(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
6968
6987
  " ",
6969
6988
  "*"
6970
6989
  ] })
6971
- ] })
6990
+ ] }) : textAdvanced ? /* @__PURE__ */ jsxs13(Div_default.row, { userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
6991
+ textAdvanced,
6992
+ required && !label && /* @__PURE__ */ jsxs13(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, marginLeft: 4, children: [
6993
+ " ",
6994
+ "*"
6995
+ ] })
6996
+ ] }) : void 0
6972
6997
  ] }),
6973
6998
  (errorText || infoText) && /* @__PURE__ */ jsx18(
6974
6999
  Text_default,
@@ -7026,7 +7051,9 @@ var ToggleInput_default = {
7026
7051
  {
7027
7052
  alignItems: "center",
7028
7053
  gap: theme2.styles.gap,
7054
+ borderRadius: 999,
7029
7055
  isTabAccessed: true,
7056
+ onClick: onClickElement,
7030
7057
  onMouseDown: setIsMouseDown.setTrue,
7031
7058
  onMouseUp: setIsMouseDown.setFalse,
7032
7059
  onMouseOut: setIsMouseDown.setFalse,
@@ -7040,7 +7067,6 @@ var ToggleInput_default = {
7040
7067
  checked,
7041
7068
  disabled: disabled ?? false,
7042
7069
  isMouseDown,
7043
- onClick: onClickElement,
7044
7070
  id: readyId,
7045
7071
  role: "switch",
7046
7072
  "aria-checked": checked,
@@ -7324,11 +7350,11 @@ import {
7324
7350
  useEffect as useEffect10,
7325
7351
  Fragment as Fragment5
7326
7352
  } from "react";
7327
- import styled11, { css as css2 } from "styled-components";
7353
+ import styled12, { css as css2 } from "styled-components";
7328
7354
  import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
7329
7355
  var defaultImageWidth = 160;
7330
7356
  var maximumVisiblePages = 11;
7331
- var TableStyledComponent = styled11.table.withConfig({
7357
+ var TableStyledComponent = styled12.table.withConfig({
7332
7358
  shouldForwardProp: (prop) => ![
7333
7359
  "isStriped",
7334
7360
  "withHover",
@@ -7443,7 +7469,7 @@ var TableStyledComponent = styled11.table.withConfig({
7443
7469
  }
7444
7470
  }
7445
7471
  `;
7446
- var ThStyledComponent = styled11.th.withConfig({
7472
+ var ThStyledComponent = styled12.th.withConfig({
7447
7473
  shouldForwardProp: (prop) => !["width", "minWidth", "maxWidth", "textAlign"].includes(prop)
7448
7474
  })`
7449
7475
  ${(props) => props.width ? `width: ${props.width}px;` : ""}
@@ -7451,7 +7477,7 @@ var ThStyledComponent = styled11.th.withConfig({
7451
7477
  ${(props) => props.maxWidth ? `max-width: ${props.maxWidth}px;` : ""}
7452
7478
  ${(props) => props.textAlign ? `text-align: ${props.textAlign} !important;` : ""}
7453
7479
  `;
7454
- var TdStyledComponent = styled11.td.withConfig({
7480
+ var TdStyledComponent = styled12.td.withConfig({
7455
7481
  shouldForwardProp: (prop) => !["width", "textAlign"].includes(prop)
7456
7482
  })`
7457
7483
  ${(props) => props.textAlign ? `text-align: ${props.textAlign} !important;` : ""}
@@ -8161,7 +8187,7 @@ var Table_default = Table2;
8161
8187
 
8162
8188
  // src/components/Tooltip.tsx
8163
8189
  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";
8164
- import styled12, { css as css3 } from "styled-components";
8190
+ import styled13, { css as css3 } from "styled-components";
8165
8191
  import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
8166
8192
  var tooltipContainerStyle = (props) => ({
8167
8193
  top: css3`
@@ -8215,7 +8241,7 @@ var tooltipPositionStyle = (props) => ({
8215
8241
  `
8216
8242
  }
8217
8243
  });
8218
- var TooltipContainer = styled12.div.withConfig({
8244
+ var TooltipContainer = styled13.div.withConfig({
8219
8245
  shouldForwardProp: (prop) => !["theme", "position", "align", "withArrow", "arrowSize", "isOpen", "gap"].includes(prop)
8220
8246
  })`
8221
8247
  position: absolute;