react-better-html 1.1.290 → 1.1.291

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
@@ -3863,6 +3863,8 @@ var DropdownComponent = forwardRef10(function Dropdown(dropdownProps, ref) {
3863
3863
  withMultiselect,
3864
3864
  id,
3865
3865
  textAlign,
3866
+ backgroundColor,
3867
+ borderRadius,
3866
3868
  ...props
3867
3869
  } = useComponentsPropsMerger(
3868
3870
  betterHtmlContextInternal.components.dropdown?.style?.default,
@@ -4088,6 +4090,8 @@ var DropdownComponent = forwardRef10(function Dropdown(dropdownProps, ref) {
4088
4090
  infoTextColor,
4089
4091
  required: withMultiselect ? (Array.isArray(value) ? value.length > 0 : value !== void 0) ? false : required : required,
4090
4092
  textAlign,
4093
+ backgroundColor,
4094
+ borderRadius,
4091
4095
  name,
4092
4096
  disabled,
4093
4097
  readOnly: !withSearch,
@@ -5800,13 +5804,24 @@ var componentSize = 26;
5800
5804
  var switchComponentBallGap = 3;
5801
5805
  var switchComponentMouseDownDifference = 4;
5802
5806
  var InputElement2 = styled11.input.withConfig({
5803
- shouldForwardProp: (prop) => !["theme", "colorTheme", "style", "hoverStyle", "size", "withNoBorder"].includes(prop)
5807
+ shouldForwardProp: (prop) => ![
5808
+ "theme",
5809
+ "colorTheme",
5810
+ "style",
5811
+ "hoverStyle",
5812
+ "size",
5813
+ "withNoBorder",
5814
+ "inactiveColor",
5815
+ "activeColor",
5816
+ "inactiveBackgroundColor",
5817
+ "activeBackgroundColor"
5818
+ ].includes(prop)
5804
5819
  })`
5805
5820
  position: relative;
5806
5821
  appearance: none;
5807
5822
  width: ${(props) => props.size ?? componentSize}px;
5808
5823
  height: ${(props) => props.size ?? componentSize}px;
5809
- background-color: ${(props) => props.theme.colors.backgroundContent};
5824
+ background-color: ${(props) => props.inactiveBackgroundColor ?? props.theme.colors.backgroundContent};
5810
5825
  border: ${(props) => props.theme.styles.borderWidth}px solid ${(props) => props.theme.colors.border};
5811
5826
  border-radius: ${(props) => props.theme.styles.borderRadius / 2}px;
5812
5827
  cursor: pointer;
@@ -5818,8 +5833,8 @@ var InputElement2 = styled11.input.withConfig({
5818
5833
  }
5819
5834
 
5820
5835
  &:checked {
5821
- background-color: ${(props) => props.theme.colors.primary};
5822
- border-color: ${(props) => props.theme.colors.primary};
5836
+ background-color: ${(props) => props.activeBackgroundColor ?? props.theme.colors.primary};
5837
+ border-color: ${(props) => props.activeBackgroundColor ?? props.theme.colors.primary};
5823
5838
  }
5824
5839
 
5825
5840
  &:disabled {
@@ -5840,7 +5855,18 @@ var InputElement2 = styled11.input.withConfig({
5840
5855
  }
5841
5856
  `;
5842
5857
  var SwitchElement = styled11.div.withConfig({
5843
- shouldForwardProp: (prop) => !["theme", "checked", "disabled", "isMouseDown", "style", "hoverStyle"].includes(prop)
5858
+ shouldForwardProp: (prop) => ![
5859
+ "theme",
5860
+ "checked",
5861
+ "disabled",
5862
+ "isMouseDown",
5863
+ "style",
5864
+ "hoverStyle",
5865
+ "activeColor",
5866
+ "inactiveColor",
5867
+ "inactiveBackgroundColor",
5868
+ "activeBackgroundColor"
5869
+ ].includes(prop)
5844
5870
  })`
5845
5871
  --width: ${(props) => componentSize * 2 - props.theme.styles.gap / 2}px;
5846
5872
  --ball-size: ${componentSize - switchComponentBallGap * 2}px;
@@ -5848,7 +5874,7 @@ var SwitchElement = styled11.div.withConfig({
5848
5874
  position: relative;
5849
5875
  width: var(--width);
5850
5876
  height: ${componentSize}px;
5851
- background-color: ${(props) => props.checked ? props.theme.colors.primary : props.theme.colors.border};
5877
+ background-color: ${(props) => props.checked ? props.activeBackgroundColor ?? props.theme.colors.primary : props.inactiveBackgroundColor ?? props.theme.colors.border};
5852
5878
  border-radius: 999px;
5853
5879
  cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
5854
5880
  opacity: ${(props) => props.disabled ? 0.5 : 1};
@@ -5859,7 +5885,7 @@ var SwitchElement = styled11.div.withConfig({
5859
5885
  position: absolute;
5860
5886
  width: ${(props) => componentSize - switchComponentBallGap * 2 + (props.isMouseDown ? switchComponentMouseDownDifference : 0)}px;
5861
5887
  height: ${componentSize - switchComponentBallGap * 2}px;
5862
- background-color: ${(props) => props.theme.colors.base};
5888
+ background-color: ${(props) => props.checked ? props.activeColor ?? props.theme.colors.base : props.inactiveColor ?? props.theme.colors.base};
5863
5889
  border-radius: 999px;
5864
5890
  top: ${switchComponentBallGap}px;
5865
5891
  left: ${switchComponentBallGap}px;
@@ -5875,7 +5901,7 @@ var SwitchElement = styled11.div.withConfig({
5875
5901
  position: absolute;
5876
5902
  width: ${(props) => componentSize - switchComponentBallGap * 2 + (props.isMouseDown ? switchComponentMouseDownDifference : 0)}px;
5877
5903
  height: ${componentSize - switchComponentBallGap * 2}px;
5878
- background-color: ${(props) => props.checked ? props.theme.colors.primary : "transparent"};
5904
+ background-color: ${(props) => props.checked ? props.activeBackgroundColor ?? props.theme.colors.primary : "transparent"};
5879
5905
  border-radius: 999px;
5880
5906
  top: ${switchComponentBallGap}px;
5881
5907
  left: ${switchComponentBallGap}px;
@@ -5909,6 +5935,10 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
5909
5935
  errorText,
5910
5936
  infoText,
5911
5937
  infoTextColor,
5938
+ inactiveColor,
5939
+ activeColor,
5940
+ inactiveBackgroundColor,
5941
+ activeBackgroundColor,
5912
5942
  size = componentSize,
5913
5943
  value,
5914
5944
  onChange,
@@ -5964,6 +5994,10 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
5964
5994
  colorTheme,
5965
5995
  size,
5966
5996
  withNoBorder: theme2.styles.borderWidth === 0,
5997
+ inactiveColor,
5998
+ activeColor,
5999
+ inactiveBackgroundColor,
6000
+ activeBackgroundColor,
5967
6001
  type: props.type ?? "checkbox",
5968
6002
  checked,
5969
6003
  onChange: onChangeElement,
@@ -5982,7 +6016,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
5982
6016
  position: "absolute",
5983
6017
  top: "50%",
5984
6018
  left: "50%",
5985
- color: theme2.colors.base,
6019
+ color: activeColor ?? theme2.colors.base,
5986
6020
  size: size / 1.8,
5987
6021
  transform: `translate(-50%, -50%)${checked ? "" : " scale(0.4)"}`,
5988
6022
  opacity: checked ? 1 : 0,
@@ -5997,7 +6031,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
5997
6031
  height: size / 2,
5998
6032
  top: "50%",
5999
6033
  left: "50%",
6000
- backgroundColor: theme2.colors.base,
6034
+ backgroundColor: activeColor ?? theme2.colors.base,
6001
6035
  borderRadius: 999,
6002
6036
  transform: `translate(-50%, -50%)${checked ? "" : " scale(0.4)"}`,
6003
6037
  opacity: checked ? 1 : 0,