react-better-html 1.1.157 → 1.1.158

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
@@ -2637,12 +2637,17 @@ function useStyledComponentStyles(props, theme2, excludeProps) {
2637
2637
  haveHover = true;
2638
2638
  const normalKey = key.slice(0, -5);
2639
2639
  hoverStyle[normalKey] = props[key];
2640
+ if (normalKey === "transition") hoverStyle.WebkitTransition = hoverStyle.transition;
2640
2641
  } else {
2641
2642
  if (!cssProps[key.toLowerCase()]) continue;
2642
2643
  normalStyle[key] = props[key];
2644
+ if (key === "transition") normalStyle.WebkitTransition = normalStyle.transition;
2643
2645
  }
2644
2646
  }
2645
- if (haveHover) normalStyle.transition = theme2?.styles.transition ?? "";
2647
+ if (haveHover) {
2648
+ normalStyle.transition = theme2?.styles.transition ?? "";
2649
+ normalStyle.WebkitTransition = normalStyle.transition;
2650
+ }
2646
2651
  return {
2647
2652
  normalStyle,
2648
2653
  hoverStyle
@@ -3848,7 +3853,7 @@ Chip2.colored = ChipComponent.colored;
3848
3853
  var Chip_default = Chip2;
3849
3854
 
3850
3855
  // src/components/InputField.tsx
3851
- 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";
3856
+ import { forwardRef as forwardRef11, memo as memo18, useCallback as useCallback9, useState as useState7, useEffect as useEffect8, useMemo as useMemo6, useRef as useRef5, useId as useId2 } from "react";
3852
3857
  import styled10 from "styled-components";
3853
3858
 
3854
3859
  // src/constants/countries.ts
@@ -4307,13 +4312,15 @@ var countries = [
4307
4312
  name: "Finland",
4308
4313
  code: "FI",
4309
4314
  timeZone: "Europe/Helsinki",
4310
- phoneNumberExtension: "358"
4315
+ phoneNumberExtension: "358",
4316
+ phoneNumberFormat: "XX XXX XX XX"
4311
4317
  },
4312
4318
  {
4313
4319
  name: "France",
4314
4320
  code: "FR",
4315
4321
  timeZone: "Europe/Paris",
4316
- phoneNumberExtension: "33"
4322
+ phoneNumberExtension: "33",
4323
+ phoneNumberFormat: "X XX XX XX XX"
4317
4324
  },
4318
4325
  {
4319
4326
  name: "French Guiana",
@@ -4356,7 +4363,7 @@ var countries = [
4356
4363
  code: "DE",
4357
4364
  timeZone: "Europe/Berlin",
4358
4365
  phoneNumberExtension: "49",
4359
- phoneNumberFormat: "XXXX XXXXXX"
4366
+ phoneNumberFormat: "XXXX XXXXXXX"
4360
4367
  },
4361
4368
  {
4362
4369
  name: "Ghana",
@@ -5773,7 +5780,7 @@ Dropdown2.countries = DropdownComponent.countries;
5773
5780
  var Dropdown_default = Dropdown2;
5774
5781
 
5775
5782
  // src/components/Calendar.tsx
5776
- import { useCallback as useCallback8, useMemo as useMemo5, useState as useState6, memo as memo17, useEffect as useEffect7 } from "react";
5783
+ import { useCallback as useCallback8, useMemo as useMemo5, useState as useState6, memo as memo17, useEffect as useEffect7, useId } from "react";
5777
5784
  import styled9 from "styled-components";
5778
5785
  import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
5779
5786
  var getMonthName = (month, short = false) => {
@@ -5805,8 +5812,18 @@ var getWeekDayName = (day, short = false) => {
5805
5812
  };
5806
5813
  var weekDaysIndex = [1, 2, 3, 4, 5, 6, 0];
5807
5814
  var yearsRange = Array.from({ length: 100 + 1 + 50 }, (_, index) => index + (/* @__PURE__ */ new Date()).getFullYear() - 100);
5815
+ var SelectWrapperComponent = styled9.div.withConfig({
5816
+ shouldForwardProp: (prop) => !["theme"].includes(prop)
5817
+ })`
5818
+ &:has(select:focus) {
5819
+ outline: auto;
5820
+ outline-color: -webkit-focus-ring-color;
5821
+ outline-style: auto;
5822
+ outline-offset: 2px;
5823
+ }
5824
+ `;
5808
5825
  var SelectComponent = styled9.select.withConfig({
5809
- shouldForwardProp: (prop) => !["normalStyle", "hoverStyle"].includes(prop)
5826
+ shouldForwardProp: (prop) => !["theme"].includes(prop)
5810
5827
  })`
5811
5828
  position: absolute;
5812
5829
  top: 50%;
@@ -5816,6 +5833,7 @@ var SelectComponent = styled9.select.withConfig({
5816
5833
  `;
5817
5834
  function Calendar({ value, minDate, maxDate, onChange }) {
5818
5835
  const theme2 = useTheme();
5836
+ const internalYearSelectId = useId();
5819
5837
  const [currentDate, setCurrentDate] = useState6(value ? new Date(value) : void 0);
5820
5838
  const [currentMonth, setCurrentMonth] = useState6(currentDate?.getMonth() ?? (/* @__PURE__ */ new Date()).getMonth());
5821
5839
  const [currentYear, setCurrentYear] = useState6(currentDate?.getFullYear() ?? (/* @__PURE__ */ new Date()).getFullYear());
@@ -5883,11 +5901,20 @@ function Calendar({ value, minDate, maxDate, onChange }) {
5883
5901
  /* @__PURE__ */ jsx16(Button_default.icon, { icon: "chevronLeft", onClick: onClickPreviousMonthButton }),
5884
5902
  /* @__PURE__ */ jsxs11(Div_default.row, { alignItems: "center", gap: 4, children: [
5885
5903
  /* @__PURE__ */ jsx16(Text_default, { fontWeight: 700, children: getMonthName(currentMonth) }),
5886
- /* @__PURE__ */ jsxs11(Div_default.row, { position: "relative", alignItems: "center", gap: 2, children: [
5904
+ /* @__PURE__ */ jsx16(SelectWrapperComponent, { children: /* @__PURE__ */ jsxs11(Div_default.row, { position: "relative", alignItems: "center", gap: 2, children: [
5887
5905
  /* @__PURE__ */ jsx16(Text_default, { fontWeight: 700, children: currentYear }),
5888
5906
  /* @__PURE__ */ jsx16(Icon_default, { name: "chevronDown", size: 12 }),
5889
- /* @__PURE__ */ jsx16(SelectComponent, { theme: theme2, value: currentYear, onChange: onChangeYearSelect, children: yearsRange.map((year) => /* @__PURE__ */ jsx16("option", { value: year, children: year }, year)) })
5890
- ] })
5907
+ /* @__PURE__ */ jsx16(
5908
+ SelectComponent,
5909
+ {
5910
+ theme: theme2,
5911
+ value: currentYear,
5912
+ onChange: onChangeYearSelect,
5913
+ id: internalYearSelectId,
5914
+ children: yearsRange.map((year) => /* @__PURE__ */ jsx16("option", { value: year, children: year }, year))
5915
+ }
5916
+ )
5917
+ ] }) })
5891
5918
  ] }),
5892
5919
  /* @__PURE__ */ jsx16(Button_default.icon, { icon: "chevronRight", onClick: onClickNextMonthButton })
5893
5920
  ] }),
@@ -6011,6 +6038,10 @@ var InputElement = styled10.input.withConfig({
6011
6038
  cursor: not-allowed;
6012
6039
  }
6013
6040
 
6041
+ &:read-only {
6042
+ caret-color: transparent;
6043
+ }
6044
+
6014
6045
  &::-webkit-outer-spin-button,
6015
6046
  &::-webkit-inner-spin-button {
6016
6047
  -webkit-appearance: none;
@@ -6148,7 +6179,7 @@ var InputFieldComponent = forwardRef11(function InputField({
6148
6179
  ...props
6149
6180
  }, ref) {
6150
6181
  const theme2 = useTheme();
6151
- const internalId = useId();
6182
+ const internalId = useId2();
6152
6183
  const { colorTheme } = useBetterHtmlContextInternal();
6153
6184
  const [_, debouncedValue, setDebouncedValue] = useDebounceState(
6154
6185
  props.value?.toString() ?? "",
@@ -6297,7 +6328,7 @@ InputFieldComponent.multiline = forwardRef11(function Multiline({
6297
6328
  ...props
6298
6329
  }, ref) {
6299
6330
  const theme2 = useTheme();
6300
- const internalId = useId();
6331
+ const internalId = useId2();
6301
6332
  const styledComponentStyles = useStyledComponentStyles(props, theme2);
6302
6333
  const dataProps = useComponentPropsWithPrefix(props, "data");
6303
6334
  const ariaProps = useComponentPropsWithPrefix(props, "aria");
@@ -6452,7 +6483,7 @@ InputFieldComponent.search = forwardRef11(function Search({ value, onChangeValue
6452
6483
  });
6453
6484
  InputFieldComponent.phoneNumber = forwardRef11(function PhoneNumber({ label, value, onChangeValue, labelColor, id, ...props }, ref) {
6454
6485
  const theme2 = useTheme();
6455
- const internalId = useId();
6486
+ const internalId = useId2();
6456
6487
  const [dropdownValue, setDropdownValue] = useState7();
6457
6488
  const [inputFieldValue, setInputFieldValue] = useState7(value?.toString() ?? "");
6458
6489
  const renderOption = useCallback9(
@@ -6667,6 +6698,7 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate
6667
6698
  width: buttonWidth,
6668
6699
  height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
6669
6700
  overflowY: "auto",
6701
+ tabIndex: -1,
6670
6702
  children: hours.map((hour) => {
6671
6703
  const isSelected = hour.toString() === valueHour;
6672
6704
  return /* @__PURE__ */ jsx17(
@@ -6700,6 +6732,7 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate
6700
6732
  width: buttonWidth,
6701
6733
  height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
6702
6734
  overflowY: "auto",
6735
+ tabIndex: -1,
6703
6736
  children: minutes.map((minute) => {
6704
6737
  const isSelected = minute.toString() === valueMinute;
6705
6738
  return /* @__PURE__ */ jsx17(
@@ -6788,46 +6821,66 @@ InputFieldComponent.time = forwardRef11(function Time({ ...props }, ref) {
6788
6821
  userSelect: "none",
6789
6822
  ...insideInputFieldComponentProps,
6790
6823
  children: /* @__PURE__ */ jsxs12(Div_default.row, { height: "100%", children: [
6791
- /* @__PURE__ */ jsx17(Div_default, { className: "react-better-html-no-scrollbar", width: buttonWidth, height: "100%", overflowY: "auto", children: hours.map((hour) => {
6792
- const isSelected = hour.toString() === valueHour;
6793
- return /* @__PURE__ */ jsx17(
6794
- Div_default.row,
6795
- {
6796
- alignItems: "center",
6797
- justifyContent: "center",
6798
- color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
6799
- backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
6800
- filterHover: "brightness(0.9)",
6801
- cursor: "pointer",
6802
- padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
6803
- value: hour,
6804
- onClickWithValue: onClickHour,
6805
- ref: isSelected ? selectedHourRef : void 0,
6806
- children: /* @__PURE__ */ jsx17(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
6807
- },
6808
- hour
6809
- );
6810
- }) }),
6811
- /* @__PURE__ */ jsx17(Div_default, { className: "react-better-html-no-scrollbar", width: buttonWidth, height: "100%", overflowY: "auto", children: minutes.map((minute) => {
6812
- const isSelected = minute.toString() === valueMinute;
6813
- return /* @__PURE__ */ jsx17(
6814
- Div_default.row,
6815
- {
6816
- alignItems: "center",
6817
- justifyContent: "center",
6818
- color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
6819
- backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
6820
- filterHover: "brightness(0.9)",
6821
- cursor: "pointer",
6822
- padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
6823
- value: minute,
6824
- onClickWithValue: onClickMinute,
6825
- ref: isSelected ? selectedMinuteRef : void 0,
6826
- children: /* @__PURE__ */ jsx17(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
6827
- },
6828
- minute
6829
- );
6830
- }) })
6824
+ /* @__PURE__ */ jsx17(
6825
+ Div_default,
6826
+ {
6827
+ className: "react-better-html-no-scrollbar",
6828
+ width: buttonWidth,
6829
+ height: "100%",
6830
+ overflowY: "auto",
6831
+ tabIndex: -1,
6832
+ children: hours.map((hour) => {
6833
+ const isSelected = hour.toString() === valueHour;
6834
+ return /* @__PURE__ */ jsx17(
6835
+ Div_default.row,
6836
+ {
6837
+ alignItems: "center",
6838
+ justifyContent: "center",
6839
+ color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
6840
+ backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
6841
+ filterHover: "brightness(0.9)",
6842
+ cursor: "pointer",
6843
+ padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
6844
+ value: hour,
6845
+ onClickWithValue: onClickHour,
6846
+ ref: isSelected ? selectedHourRef : void 0,
6847
+ children: /* @__PURE__ */ jsx17(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
6848
+ },
6849
+ hour
6850
+ );
6851
+ })
6852
+ }
6853
+ ),
6854
+ /* @__PURE__ */ jsx17(
6855
+ Div_default,
6856
+ {
6857
+ className: "react-better-html-no-scrollbar",
6858
+ width: buttonWidth,
6859
+ height: "100%",
6860
+ overflowY: "auto",
6861
+ tabIndex: -1,
6862
+ children: minutes.map((minute) => {
6863
+ const isSelected = minute.toString() === valueMinute;
6864
+ return /* @__PURE__ */ jsx17(
6865
+ Div_default.row,
6866
+ {
6867
+ alignItems: "center",
6868
+ justifyContent: "center",
6869
+ color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
6870
+ backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
6871
+ filterHover: "brightness(0.9)",
6872
+ cursor: "pointer",
6873
+ padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
6874
+ value: minute,
6875
+ onClickWithValue: onClickMinute,
6876
+ ref: isSelected ? selectedMinuteRef : void 0,
6877
+ children: /* @__PURE__ */ jsx17(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
6878
+ },
6879
+ minute
6880
+ );
6881
+ })
6882
+ }
6883
+ )
6831
6884
  ] })
6832
6885
  }
6833
6886
  ) : void 0,
@@ -6890,7 +6943,7 @@ InputField2.color = InputFieldComponent.color;
6890
6943
  var InputField_default = InputField2;
6891
6944
 
6892
6945
  // src/components/ToggleInput.tsx
6893
- import { forwardRef as forwardRef12, useCallback as useCallback10, useId as useId2, useState as useState8 } from "react";
6946
+ import { forwardRef as forwardRef12, useCallback as useCallback10, useId as useId3, useState as useState8 } from "react";
6894
6947
  import styled11 from "styled-components";
6895
6948
  import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
6896
6949
  var componentSize = 26;
@@ -7001,7 +7054,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
7001
7054
  ...props
7002
7055
  }, ref) {
7003
7056
  const theme2 = useTheme();
7004
- const internalId = useId2();
7057
+ const internalId = useId3();
7005
7058
  const styledComponentStyles = useStyledComponentStyles(props, theme2, true);
7006
7059
  const styledComponentStylesWithExcluded = useComponentPropsWithExcludedStyle(props);
7007
7060
  const dataProps = useComponentPropsWithPrefix(props, "data");
@@ -7118,7 +7171,7 @@ var ToggleInput_default = {
7118
7171
  ...props
7119
7172
  }, ref) {
7120
7173
  const theme2 = useTheme();
7121
- const internalId = useId2();
7174
+ const internalId = useId3();
7122
7175
  const styledComponentStyles = useStyledComponentStyles(props, theme2, true);
7123
7176
  const styledComponentStylesWithExcluded = useComponentPropsWithExcludedStyle(props);
7124
7177
  const dataProps = useComponentPropsWithPrefix(props, "data");