react-better-html 1.1.91 → 1.1.93

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
@@ -1803,7 +1803,7 @@ function useComponentInputFieldDateProps(props, holderRef, disabled) {
1803
1803
  }, [isOpen]);
1804
1804
  useEffect2(() => {
1805
1805
  const handleClickOutside = (event) => {
1806
- if (holderRef.current && !holderRef.current.contains(event.target)) {
1806
+ if (holderRef && holderRef.current && !holderRef.current.contains(event.target)) {
1807
1807
  setIsOpen.setFalse();
1808
1808
  }
1809
1809
  };
@@ -2477,7 +2477,7 @@ Image.profileImage = forwardRef4(function ProfileImage({ size = 40, letters, bac
2477
2477
  justifyContent: "center",
2478
2478
  ref,
2479
2479
  ...props,
2480
- children: /* @__PURE__ */ jsx6(Text_default, { fontWeight: 700, children: letters.toUpperCase().slice(0, 2) })
2480
+ children: /* @__PURE__ */ jsx6(Text_default, { fontSize: size / 2.5, fontWeight: 700, children: letters.toUpperCase().slice(0, 2) })
2481
2481
  }
2482
2482
  ) : /* @__PURE__ */ jsx6(Image, { width: size, height: size, borderRadius: 999, objectFit: "cover", ref, ...props });
2483
2483
  });
@@ -4846,6 +4846,7 @@ function Label({ text, required, isError, color, htmlFor }) {
4846
4846
  Text_default,
4847
4847
  {
4848
4848
  as: "label",
4849
+ width: "fit-content",
4849
4850
  height: 16,
4850
4851
  fontSize: 14,
4851
4852
  color: isError ? theme2.colors.error : color ?? theme2.colors.textSecondary,
@@ -5148,7 +5149,39 @@ var DropdownComponent = forwardRef7(function Dropdown({
5148
5149
  )
5149
5150
  ] }) });
5150
5151
  });
5152
+ DropdownComponent.countries = forwardRef7(function Countries({ ...props }, ref) {
5153
+ const theme2 = useTheme();
5154
+ const renderOption = useCallback6(
5155
+ (option, index, isSelected) => /* @__PURE__ */ jsxs8(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
5156
+ /* @__PURE__ */ jsx13(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
5157
+ /* @__PURE__ */ jsx13(Text_default, { children: option.label })
5158
+ ] }),
5159
+ []
5160
+ );
5161
+ const options = useMemo3(
5162
+ () => countries.map(
5163
+ (country) => ({
5164
+ value: country.code,
5165
+ label: country.name,
5166
+ data: country,
5167
+ searchValues: [country.code]
5168
+ })
5169
+ ),
5170
+ []
5171
+ );
5172
+ return /* @__PURE__ */ jsx13(
5173
+ DropdownComponent,
5174
+ {
5175
+ placeholder: "Select a country",
5176
+ options,
5177
+ renderOption,
5178
+ ref,
5179
+ ...props
5180
+ }
5181
+ );
5182
+ });
5151
5183
  var Dropdown2 = memo14(DropdownComponent);
5184
+ Dropdown2.countries = DropdownComponent.countries;
5152
5185
  var Dropdown_default = Dropdown2;
5153
5186
 
5154
5187
  // src/components/Calendar.tsx
@@ -5333,6 +5366,9 @@ var Calendar_default = memo15(Calendar);
5333
5366
  // src/components/InputField.tsx
5334
5367
  import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
5335
5368
  var buttonWidth = 50;
5369
+ var colorPickerSpacing = 4;
5370
+ var colorPickerColorWidth = 12 + 27 + colorPickerSpacing;
5371
+ var colorPickerValueWidth = 12 + 74 + colorPickerSpacing;
5336
5372
  var InputElement = styled8.input.withConfig({
5337
5373
  shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
5338
5374
  })`
@@ -5381,6 +5417,17 @@ var InputElement = styled8.input.withConfig({
5381
5417
  }
5382
5418
  }
5383
5419
 
5420
+ &[type="color"] {
5421
+ --color-spacing: ${(props) => (props.theme.styles.space + props.theme.styles.gap) / 2}px;
5422
+
5423
+ width: calc(var(--color-spacing) + 27px + ${colorPickerValueWidth}px);
5424
+ height: 48px;
5425
+ padding: 0px;
5426
+ padding-block: calc(var(--color-spacing) - 3px);
5427
+ padding-left: var(--color-spacing);
5428
+ padding-right: ${colorPickerValueWidth}px;
5429
+ }
5430
+
5384
5431
  &.react-better-html-phone-number-holder {
5385
5432
  border-right: none;
5386
5433
  border-top-right-radius: 0px;
@@ -6093,6 +6140,41 @@ InputFieldComponent.time = forwardRef8(function Time({ ...props }, ref) {
6093
6140
  }
6094
6141
  );
6095
6142
  });
6143
+ InputFieldComponent.color = forwardRef8(function Color2({ value, onChangeValue, ...props }, ref) {
6144
+ const [inputFieldValue, setInputFieldValue] = useState6(value ?? "#000000");
6145
+ const onChangeValueElement = useCallback8(
6146
+ (value2) => {
6147
+ setInputFieldValue(value2);
6148
+ onChangeValue?.(value2);
6149
+ },
6150
+ [onChangeValue]
6151
+ );
6152
+ return /* @__PURE__ */ jsx15(
6153
+ InputFieldComponent,
6154
+ {
6155
+ type: "color",
6156
+ insideInputFieldComponent: /* @__PURE__ */ jsx15(
6157
+ Div_default.row,
6158
+ {
6159
+ position: "absolute",
6160
+ width: "100%",
6161
+ height: "100%",
6162
+ top: 0,
6163
+ left: colorPickerSpacing,
6164
+ alignItems: "center",
6165
+ pointerEvents: "none",
6166
+ userSelect: "none",
6167
+ paddingLeft: colorPickerColorWidth,
6168
+ children: /* @__PURE__ */ jsx15(Text_default, { children: inputFieldValue })
6169
+ }
6170
+ ),
6171
+ value: inputFieldValue,
6172
+ onChangeValue: onChangeValueElement,
6173
+ ref,
6174
+ ...props
6175
+ }
6176
+ );
6177
+ });
6096
6178
  var InputField2 = memo16(InputFieldComponent);
6097
6179
  InputField2.multiline = InputFieldComponent.multiline;
6098
6180
  InputField2.email = InputFieldComponent.email;
@@ -6102,6 +6184,7 @@ InputField2.phoneNumber = InputFieldComponent.phoneNumber;
6102
6184
  InputField2.date = InputFieldComponent.date;
6103
6185
  InputField2.dateTime = InputFieldComponent.dateTime;
6104
6186
  InputField2.time = InputFieldComponent.time;
6187
+ InputField2.color = InputFieldComponent.color;
6105
6188
  var InputField_default = InputField2;
6106
6189
 
6107
6190
  // src/components/ToggleInput.tsx