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.d.mts CHANGED
@@ -381,6 +381,7 @@ type InputFieldComponentType = {
381
381
  maxDate?: Date;
382
382
  }>) => React.ReactElement;
383
383
  time: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
384
+ color: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
384
385
  };
385
386
  declare const InputFieldComponent: InputFieldComponentType;
386
387
  declare const InputField: typeof InputFieldComponent & {
@@ -392,6 +393,7 @@ declare const InputField: typeof InputFieldComponent & {
392
393
  date: typeof InputFieldComponent.date;
393
394
  dateTime: typeof InputFieldComponent.dateTime;
394
395
  time: typeof InputFieldComponent.time;
396
+ color: typeof InputFieldComponent.color;
395
397
  };
396
398
 
397
399
  type Country = {
package/dist/index.d.ts CHANGED
@@ -381,6 +381,7 @@ type InputFieldComponentType = {
381
381
  maxDate?: Date;
382
382
  }>) => React.ReactElement;
383
383
  time: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
384
+ color: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
384
385
  };
385
386
  declare const InputFieldComponent: InputFieldComponentType;
386
387
  declare const InputField: typeof InputFieldComponent & {
@@ -392,6 +393,7 @@ declare const InputField: typeof InputFieldComponent & {
392
393
  date: typeof InputFieldComponent.date;
393
394
  dateTime: typeof InputFieldComponent.dateTime;
394
395
  time: typeof InputFieldComponent.time;
396
+ color: typeof InputFieldComponent.color;
395
397
  };
396
398
 
397
399
  type Country = {
package/dist/index.js CHANGED
@@ -1882,7 +1882,7 @@ function useComponentInputFieldDateProps(props, holderRef, disabled) {
1882
1882
  }, [isOpen]);
1883
1883
  (0, import_react2.useEffect)(() => {
1884
1884
  const handleClickOutside = (event) => {
1885
- if (holderRef.current && !holderRef.current.contains(event.target)) {
1885
+ if (holderRef && holderRef.current && !holderRef.current.contains(event.target)) {
1886
1886
  setIsOpen.setFalse();
1887
1887
  }
1888
1888
  };
@@ -4925,6 +4925,7 @@ function Label({ text, required, isError, color, htmlFor }) {
4925
4925
  Text_default,
4926
4926
  {
4927
4927
  as: "label",
4928
+ width: "fit-content",
4928
4929
  height: 16,
4929
4930
  fontSize: 14,
4930
4931
  color: isError ? theme2.colors.error : color ?? theme2.colors.textSecondary,
@@ -5444,6 +5445,9 @@ var Calendar_default = (0, import_react17.memo)(Calendar);
5444
5445
  // src/components/InputField.tsx
5445
5446
  var import_jsx_runtime16 = require("react/jsx-runtime");
5446
5447
  var buttonWidth = 50;
5448
+ var colorPickerSpacing = 4;
5449
+ var colorPickerColorWidth = 12 + 27 + colorPickerSpacing;
5450
+ var colorPickerValueWidth = 12 + 74 + colorPickerSpacing;
5447
5451
  var InputElement = import_styled_components9.default.input.withConfig({
5448
5452
  shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
5449
5453
  })`
@@ -5492,6 +5496,17 @@ var InputElement = import_styled_components9.default.input.withConfig({
5492
5496
  }
5493
5497
  }
5494
5498
 
5499
+ &[type="color"] {
5500
+ --color-spacing: ${(props) => (props.theme.styles.space + props.theme.styles.gap) / 2}px;
5501
+
5502
+ width: calc(var(--color-spacing) + 27px + ${colorPickerValueWidth}px);
5503
+ height: 48px;
5504
+ padding: 0px;
5505
+ padding-block: calc(var(--color-spacing) - 3px);
5506
+ padding-left: var(--color-spacing);
5507
+ padding-right: ${colorPickerValueWidth}px;
5508
+ }
5509
+
5495
5510
  &.react-better-html-phone-number-holder {
5496
5511
  border-right: none;
5497
5512
  border-top-right-radius: 0px;
@@ -6204,6 +6219,41 @@ InputFieldComponent.time = (0, import_react18.forwardRef)(function Time({ ...pro
6204
6219
  }
6205
6220
  );
6206
6221
  });
6222
+ InputFieldComponent.color = (0, import_react18.forwardRef)(function Color2({ value, onChangeValue, ...props }, ref) {
6223
+ const [inputFieldValue, setInputFieldValue] = (0, import_react18.useState)(value ?? "#000000");
6224
+ const onChangeValueElement = (0, import_react18.useCallback)(
6225
+ (value2) => {
6226
+ setInputFieldValue(value2);
6227
+ onChangeValue?.(value2);
6228
+ },
6229
+ [onChangeValue]
6230
+ );
6231
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6232
+ InputFieldComponent,
6233
+ {
6234
+ type: "color",
6235
+ insideInputFieldComponent: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6236
+ Div_default.row,
6237
+ {
6238
+ position: "absolute",
6239
+ width: "100%",
6240
+ height: "100%",
6241
+ top: 0,
6242
+ left: colorPickerSpacing,
6243
+ alignItems: "center",
6244
+ pointerEvents: "none",
6245
+ userSelect: "none",
6246
+ paddingLeft: colorPickerColorWidth,
6247
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { children: inputFieldValue })
6248
+ }
6249
+ ),
6250
+ value: inputFieldValue,
6251
+ onChangeValue: onChangeValueElement,
6252
+ ref,
6253
+ ...props
6254
+ }
6255
+ );
6256
+ });
6207
6257
  var InputField2 = (0, import_react18.memo)(InputFieldComponent);
6208
6258
  InputField2.multiline = InputFieldComponent.multiline;
6209
6259
  InputField2.email = InputFieldComponent.email;
@@ -6213,6 +6263,7 @@ InputField2.phoneNumber = InputFieldComponent.phoneNumber;
6213
6263
  InputField2.date = InputFieldComponent.date;
6214
6264
  InputField2.dateTime = InputFieldComponent.dateTime;
6215
6265
  InputField2.time = InputFieldComponent.time;
6266
+ InputField2.color = InputFieldComponent.color;
6216
6267
  var InputField_default = InputField2;
6217
6268
 
6218
6269
  // src/components/ToggleInput.tsx