react-better-html 1.1.153 → 1.1.154

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
@@ -44,8 +44,9 @@ type DivProps<Value = unknown> = {
44
44
  as?: WebTarget;
45
45
  /** @default false */
46
46
  isTabAccessed?: boolean;
47
+ htmlContentTranslate?: React.ComponentProps<"div">["translate"];
47
48
  onClickWithValue?: (value: Value) => void;
48
- } & OmitProps<React.ComponentProps<"div">, "style" | "defaultValue"> & ComponentStyle & ComponentHoverStyle;
49
+ } & OmitProps<React.ComponentProps<"div">, "style" | "defaultValue" | "translate"> & ComponentStyle & ComponentHoverStyle;
49
50
  type DivComponentType = {
50
51
  <Value>(props: ComponentPropWithRef<HTMLDivElement, DivProps<Value>>): React.ReactElement;
51
52
  row: <Value>(props: ComponentPropWithRef<HTMLDivElement, OmitProps<DivProps<Value>, "display" | "flexDirection"> & {
@@ -386,6 +387,8 @@ type InputFieldProps = {
386
387
  infoText?: string;
387
388
  leftIcon?: IconName | AnyOtherString;
388
389
  rightIcon?: IconName | AnyOtherString;
390
+ prefix?: React.ReactNode;
391
+ suffix?: React.ReactNode;
389
392
  insideInputFieldComponent?: React.ReactNode;
390
393
  /** @default false */
391
394
  withDebounce?: boolean;
@@ -394,7 +397,7 @@ type InputFieldProps = {
394
397
  onChangeValue?: (value: string) => void;
395
398
  onClickRightIcon?: () => void;
396
399
  holderRef?: React.ForwardedRef<HTMLDivElement>;
397
- } & OmitProps<React.ComponentProps<"input">, "style" | "ref"> & ComponentStyle & ComponentHoverStyle;
400
+ } & OmitProps<React.ComponentProps<"input">, "style" | "ref" | "prefix"> & ComponentStyle & ComponentHoverStyle;
398
401
  type TextareaFieldProps = OmitProps<InputFieldProps, "type"> & OmitProps<React.ComponentProps<"textarea">, "style" | "ref">;
399
402
  type InputFieldComponentType = {
400
403
  (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>): React.ReactElement;
@@ -402,7 +405,7 @@ type InputFieldComponentType = {
402
405
  email: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
403
406
  password: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
404
407
  search: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
405
- phoneNumber: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, "type">>) => React.ReactElement;
408
+ phoneNumber: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, "type" | "prefix">>) => React.ReactElement;
406
409
  date: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps & {
407
410
  minDate?: Date;
408
411
  maxDate?: Date;
package/dist/index.d.ts CHANGED
@@ -44,8 +44,9 @@ type DivProps<Value = unknown> = {
44
44
  as?: WebTarget;
45
45
  /** @default false */
46
46
  isTabAccessed?: boolean;
47
+ htmlContentTranslate?: React.ComponentProps<"div">["translate"];
47
48
  onClickWithValue?: (value: Value) => void;
48
- } & OmitProps<React.ComponentProps<"div">, "style" | "defaultValue"> & ComponentStyle & ComponentHoverStyle;
49
+ } & OmitProps<React.ComponentProps<"div">, "style" | "defaultValue" | "translate"> & ComponentStyle & ComponentHoverStyle;
49
50
  type DivComponentType = {
50
51
  <Value>(props: ComponentPropWithRef<HTMLDivElement, DivProps<Value>>): React.ReactElement;
51
52
  row: <Value>(props: ComponentPropWithRef<HTMLDivElement, OmitProps<DivProps<Value>, "display" | "flexDirection"> & {
@@ -386,6 +387,8 @@ type InputFieldProps = {
386
387
  infoText?: string;
387
388
  leftIcon?: IconName | AnyOtherString;
388
389
  rightIcon?: IconName | AnyOtherString;
390
+ prefix?: React.ReactNode;
391
+ suffix?: React.ReactNode;
389
392
  insideInputFieldComponent?: React.ReactNode;
390
393
  /** @default false */
391
394
  withDebounce?: boolean;
@@ -394,7 +397,7 @@ type InputFieldProps = {
394
397
  onChangeValue?: (value: string) => void;
395
398
  onClickRightIcon?: () => void;
396
399
  holderRef?: React.ForwardedRef<HTMLDivElement>;
397
- } & OmitProps<React.ComponentProps<"input">, "style" | "ref"> & ComponentStyle & ComponentHoverStyle;
400
+ } & OmitProps<React.ComponentProps<"input">, "style" | "ref" | "prefix"> & ComponentStyle & ComponentHoverStyle;
398
401
  type TextareaFieldProps = OmitProps<InputFieldProps, "type"> & OmitProps<React.ComponentProps<"textarea">, "style" | "ref">;
399
402
  type InputFieldComponentType = {
400
403
  (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>): React.ReactElement;
@@ -402,7 +405,7 @@ type InputFieldComponentType = {
402
405
  email: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
403
406
  password: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
404
407
  search: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
405
- phoneNumber: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, "type">>) => React.ReactElement;
408
+ phoneNumber: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, "type" | "prefix">>) => React.ReactElement;
406
409
  date: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps & {
407
410
  minDate?: Date;
408
411
  maxDate?: Date;
package/dist/index.js CHANGED
@@ -3170,6 +3170,7 @@ var DivComponent = (0, import_react11.forwardRef)(function Div({
3170
3170
  as = "div",
3171
3171
  value,
3172
3172
  isTabAccessed,
3173
+ htmlContentTranslate,
3173
3174
  onClickWithValue,
3174
3175
  role,
3175
3176
  onClick,
@@ -3205,6 +3206,7 @@ var DivComponent = (0, import_react11.forwardRef)(function Div({
3205
3206
  {
3206
3207
  as,
3207
3208
  tabIndex: isTabAccessed && !isMobileDevice ? 0 : void 0,
3209
+ translate: htmlContentTranslate,
3208
3210
  role: role ?? (onClick ? "button" : void 0),
3209
3211
  onClick: onClickElement,
3210
3212
  onKeyDown: onKeyDownElement,
@@ -6030,7 +6032,9 @@ var colorPickerSpacing = 4;
6030
6032
  var colorPickerColorWidth = 12 + 27 + colorPickerSpacing;
6031
6033
  var colorPickerValueWidth = 12 + 74 + colorPickerSpacing;
6032
6034
  var InputElement = import_styled_components11.default.input.withConfig({
6033
- shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
6035
+ shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "withPrefix", "withSuffix", "normalStyle", "hoverStyle"].includes(
6036
+ prop
6037
+ )
6034
6038
  })`
6035
6039
  position: relative;
6036
6040
  width: 100%;
@@ -6041,10 +6045,14 @@ var InputElement = import_styled_components11.default.input.withConfig({
6041
6045
  background: ${(props) => props.theme.colors.backgroundContent};
6042
6046
  border: 1px solid ${(props) => props.theme.colors.border};
6043
6047
  border-radius: ${(props) => props.theme.styles.borderRadius}px;
6048
+ border-top-left-radius: ${(props) => props.withPrefix ? 0 : void 0};
6049
+ border-bottom-left-radius: ${(props) => props.withPrefix ? 0 : void 0};
6050
+ border-top-right-radius: ${(props) => props.withSuffix ? 0 : void 0};
6051
+ border-bottom-right-radius: ${(props) => props.withSuffix ? 0 : void 0};
6044
6052
  outline: none;
6045
- padding: ${(props) => `${(props.theme.styles.space + props.theme.styles.gap) / 2}px ${props.theme.styles.space + props.theme.styles.gap}px`};
6046
- padding-left: ${(props) => props.withLeftIcon ? `${props.theme.styles.space + 16 + props.theme.styles.space - 1}px` : void 0};
6047
- padding-right: ${(props) => props.withRightIcon ? `${props.theme.styles.space + 16 + props.theme.styles.space - 1}px` : void 0};
6053
+ padding: ${(props) => `${(props.theme.styles.space + props.theme.styles.gap) / 2}px ${props.theme.styles.space}px`};
6054
+ padding-left: ${(props) => props.withLeftIcon ? `${props.theme.styles.space + 16 + props.theme.styles.space - 1}px` : props.withPrefix ? `${props.theme.styles.space}px` : void 0};
6055
+ padding-right: ${(props) => props.withRightIcon ? `${props.theme.styles.space + 16 + props.theme.styles.space - 1}px` : props.withSuffix ? `${props.theme.styles.space}px` : void 0};
6048
6056
  transition: ${(props) => props.theme.styles.transition};
6049
6057
 
6050
6058
  &::placeholder {
@@ -6151,7 +6159,7 @@ var TextareaElement = import_styled_components11.default.textarea.withConfig({
6151
6159
  border: 1px solid ${(props) => props.theme.colors.border};
6152
6160
  border-radius: ${(props) => props.theme.styles.borderRadius}px;
6153
6161
  outline: none;
6154
- padding: ${(props) => `${(props.theme.styles.gap + props.theme.styles.space) / 2}px ${props.theme.styles.space + props.theme.styles.gap}px`};
6162
+ padding: ${(props) => `${(props.theme.styles.gap + props.theme.styles.space) / 2}px ${props.theme.styles.space}px`};
6155
6163
  padding-left: ${(props) => props.withLeftIcon ? `${props.theme.styles.space + 16 + props.theme.styles.space - 1}px` : void 0};
6156
6164
  padding-right: ${(props) => props.withRightIcon ? `${props.theme.styles.space + 16 + props.theme.styles.space - 1}px` : void 0};
6157
6165
  resize: vertical;
@@ -6180,6 +6188,8 @@ var InputFieldComponent = (0, import_react20.forwardRef)(function InputField({
6180
6188
  infoText,
6181
6189
  leftIcon,
6182
6190
  rightIcon,
6191
+ prefix,
6192
+ suffix,
6183
6193
  insideInputFieldComponent,
6184
6194
  withDebounce,
6185
6195
  debounceDelay = 0.5,
@@ -6229,58 +6239,90 @@ var InputFieldComponent = (0, import_react20.forwardRef)(function InputField({
6229
6239
  const readyId = id ?? internalId;
6230
6240
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, ...styledComponentStylesWithExcluded, children: [
6231
6241
  label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
6232
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default, { position: "relative", width: "100%", ref: holderRef, children: [
6233
- leftIcon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6234
- Icon_default,
6235
- {
6236
- name: leftIcon,
6237
- position: "absolute",
6238
- top: (props.type === "date" || props.type === "time" || props.type === "datetime-local" ? 48 : 46) / 2,
6239
- left: theme2.styles.space + 1,
6240
- transform: "translateY(-50%)",
6241
- pointerEvents: "none",
6242
- zIndex: leftIconZIndex
6243
- }
6244
- ),
6245
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6246
- InputElement,
6242
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { alignItems: "stretch", width: "100%", children: [
6243
+ prefix && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6244
+ Div_default.row,
6247
6245
  {
6248
- theme: theme2,
6249
- withLeftIcon: leftIcon !== void 0,
6250
- withRightIcon: rightIcon !== void 0,
6251
- required,
6252
- placeholder: placeholder ?? label,
6253
- id: readyId,
6254
- onChange: onChangeElement,
6255
- ...styledComponentStylesWithoutExcluded,
6256
- ...dataProps,
6257
- ...ariaProps,
6258
- ...restProps,
6259
- ref
6246
+ alignItems: "center",
6247
+ justifyContent: "center",
6248
+ border: `1px solid ${theme2.colors.border}`,
6249
+ borderRight: "none",
6250
+ backgroundColor: lightenColor(theme2.colors.border, 0.8),
6251
+ borderTopLeftRadius: theme2.styles.borderRadius,
6252
+ borderBottomLeftRadius: theme2.styles.borderRadius,
6253
+ paddingInline: theme2.styles.space,
6254
+ children: prefix
6260
6255
  }
6261
6256
  ),
6262
- rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6263
- Button_default.icon,
6264
- {
6265
- icon: rightIcon,
6266
- position: "absolute",
6267
- top: 46 / 2,
6268
- right: theme2.styles.space + 1 - theme2.styles.space / 2,
6269
- transform: "translateY(-50%)",
6270
- onClick: onClickRightIcon
6271
- }
6272
- ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6273
- Icon_default,
6257
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default, { position: "relative", width: "100%", height: "fit-content", ref: holderRef, children: [
6258
+ leftIcon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6259
+ Icon_default,
6260
+ {
6261
+ name: leftIcon,
6262
+ position: "absolute",
6263
+ top: (props.type === "date" || props.type === "time" || props.type === "datetime-local" ? 48 : 46) / 2,
6264
+ left: theme2.styles.space + 1,
6265
+ transform: "translateY(-50%)",
6266
+ pointerEvents: "none",
6267
+ zIndex: leftIconZIndex
6268
+ }
6269
+ ),
6270
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6271
+ InputElement,
6272
+ {
6273
+ theme: theme2,
6274
+ withLeftIcon: leftIcon !== void 0,
6275
+ withRightIcon: rightIcon !== void 0,
6276
+ withPrefix: prefix !== void 0,
6277
+ withSuffix: suffix !== void 0,
6278
+ required,
6279
+ placeholder: placeholder ?? label,
6280
+ id: readyId,
6281
+ onChange: onChangeElement,
6282
+ ...styledComponentStylesWithoutExcluded,
6283
+ ...dataProps,
6284
+ ...ariaProps,
6285
+ ...restProps,
6286
+ ref
6287
+ }
6288
+ ),
6289
+ rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6290
+ Button_default.icon,
6291
+ {
6292
+ icon: rightIcon,
6293
+ position: "absolute",
6294
+ top: 46 / 2,
6295
+ right: theme2.styles.space + 1 - theme2.styles.space / 2,
6296
+ transform: "translateY(-50%)",
6297
+ onClick: onClickRightIcon
6298
+ }
6299
+ ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6300
+ Icon_default,
6301
+ {
6302
+ name: rightIcon,
6303
+ position: "absolute",
6304
+ top: 46 / 2,
6305
+ right: theme2.styles.space + 1,
6306
+ transform: "translateY(-50%)",
6307
+ pointerEvents: "none"
6308
+ }
6309
+ ) : void 0,
6310
+ insideInputFieldComponent
6311
+ ] }),
6312
+ suffix && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6313
+ Div_default.row,
6274
6314
  {
6275
- name: rightIcon,
6276
- position: "absolute",
6277
- top: 46 / 2,
6278
- right: theme2.styles.space + 1,
6279
- transform: "translateY(-50%)",
6280
- pointerEvents: "none"
6315
+ alignItems: "center",
6316
+ justifyContent: "center",
6317
+ border: `1px solid ${theme2.colors.border}`,
6318
+ borderLeft: "none",
6319
+ backgroundColor: lightenColor(theme2.colors.border, 0.8),
6320
+ borderTopRightRadius: theme2.styles.borderRadius,
6321
+ borderBottomRightRadius: theme2.styles.borderRadius,
6322
+ paddingInline: theme2.styles.space,
6323
+ children: suffix
6281
6324
  }
6282
- ) : void 0,
6283
- insideInputFieldComponent
6325
+ )
6284
6326
  ] }),
6285
6327
  (errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6286
6328
  Text_default,