react-better-html 1.1.92 → 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
  };
@@ -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,
@@ -5365,6 +5366,9 @@ var Calendar_default = memo15(Calendar);
5365
5366
  // src/components/InputField.tsx
5366
5367
  import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
5367
5368
  var buttonWidth = 50;
5369
+ var colorPickerSpacing = 4;
5370
+ var colorPickerColorWidth = 12 + 27 + colorPickerSpacing;
5371
+ var colorPickerValueWidth = 12 + 74 + colorPickerSpacing;
5368
5372
  var InputElement = styled8.input.withConfig({
5369
5373
  shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
5370
5374
  })`
@@ -5413,6 +5417,17 @@ var InputElement = styled8.input.withConfig({
5413
5417
  }
5414
5418
  }
5415
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
+
5416
5431
  &.react-better-html-phone-number-holder {
5417
5432
  border-right: none;
5418
5433
  border-top-right-radius: 0px;
@@ -6125,6 +6140,41 @@ InputFieldComponent.time = forwardRef8(function Time({ ...props }, ref) {
6125
6140
  }
6126
6141
  );
6127
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
+ });
6128
6178
  var InputField2 = memo16(InputFieldComponent);
6129
6179
  InputField2.multiline = InputFieldComponent.multiline;
6130
6180
  InputField2.email = InputFieldComponent.email;
@@ -6134,6 +6184,7 @@ InputField2.phoneNumber = InputFieldComponent.phoneNumber;
6134
6184
  InputField2.date = InputFieldComponent.date;
6135
6185
  InputField2.dateTime = InputFieldComponent.dateTime;
6136
6186
  InputField2.time = InputFieldComponent.time;
6187
+ InputField2.color = InputFieldComponent.color;
6137
6188
  var InputField_default = InputField2;
6138
6189
 
6139
6190
  // src/components/ToggleInput.tsx