react-better-html 1.1.153 → 1.1.155

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
@@ -3084,6 +3084,7 @@ var DivComponent = forwardRef4(function Div({
3084
3084
  as = "div",
3085
3085
  value,
3086
3086
  isTabAccessed,
3087
+ htmlContentTranslate,
3087
3088
  onClickWithValue,
3088
3089
  role,
3089
3090
  onClick,
@@ -3119,6 +3120,7 @@ var DivComponent = forwardRef4(function Div({
3119
3120
  {
3120
3121
  as,
3121
3122
  tabIndex: isTabAccessed && !isMobileDevice ? 0 : void 0,
3123
+ translate: htmlContentTranslate,
3122
3124
  role: role ?? (onClick ? "button" : void 0),
3123
3125
  onClick: onClickElement,
3124
3126
  onKeyDown: onKeyDownElement,
@@ -5944,7 +5946,9 @@ var colorPickerSpacing = 4;
5944
5946
  var colorPickerColorWidth = 12 + 27 + colorPickerSpacing;
5945
5947
  var colorPickerValueWidth = 12 + 74 + colorPickerSpacing;
5946
5948
  var InputElement = styled10.input.withConfig({
5947
- shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
5949
+ shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "withPrefix", "withSuffix", "normalStyle", "hoverStyle"].includes(
5950
+ prop
5951
+ )
5948
5952
  })`
5949
5953
  position: relative;
5950
5954
  width: 100%;
@@ -5955,10 +5959,14 @@ var InputElement = styled10.input.withConfig({
5955
5959
  background: ${(props) => props.theme.colors.backgroundContent};
5956
5960
  border: 1px solid ${(props) => props.theme.colors.border};
5957
5961
  border-radius: ${(props) => props.theme.styles.borderRadius}px;
5962
+ border-top-left-radius: ${(props) => props.withPrefix ? 0 : void 0};
5963
+ border-bottom-left-radius: ${(props) => props.withPrefix ? 0 : void 0};
5964
+ border-top-right-radius: ${(props) => props.withSuffix ? 0 : void 0};
5965
+ border-bottom-right-radius: ${(props) => props.withSuffix ? 0 : void 0};
5958
5966
  outline: none;
5959
- padding: ${(props) => `${(props.theme.styles.space + props.theme.styles.gap) / 2}px ${props.theme.styles.space + props.theme.styles.gap}px`};
5960
- padding-left: ${(props) => props.withLeftIcon ? `${props.theme.styles.space + 16 + props.theme.styles.space - 1}px` : void 0};
5961
- padding-right: ${(props) => props.withRightIcon ? `${props.theme.styles.space + 16 + props.theme.styles.space - 1}px` : void 0};
5967
+ padding: ${(props) => `${(props.theme.styles.space + props.theme.styles.gap) / 2}px ${props.theme.styles.space}px`};
5968
+ 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};
5969
+ 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};
5962
5970
  transition: ${(props) => props.theme.styles.transition};
5963
5971
 
5964
5972
  &::placeholder {
@@ -6065,7 +6073,7 @@ var TextareaElement = styled10.textarea.withConfig({
6065
6073
  border: 1px solid ${(props) => props.theme.colors.border};
6066
6074
  border-radius: ${(props) => props.theme.styles.borderRadius}px;
6067
6075
  outline: none;
6068
- padding: ${(props) => `${(props.theme.styles.gap + props.theme.styles.space) / 2}px ${props.theme.styles.space + props.theme.styles.gap}px`};
6076
+ padding: ${(props) => `${(props.theme.styles.gap + props.theme.styles.space) / 2}px ${props.theme.styles.space}px`};
6069
6077
  padding-left: ${(props) => props.withLeftIcon ? `${props.theme.styles.space + 16 + props.theme.styles.space - 1}px` : void 0};
6070
6078
  padding-right: ${(props) => props.withRightIcon ? `${props.theme.styles.space + 16 + props.theme.styles.space - 1}px` : void 0};
6071
6079
  resize: vertical;
@@ -6094,6 +6102,10 @@ var InputFieldComponent = forwardRef11(function InputField({
6094
6102
  infoText,
6095
6103
  leftIcon,
6096
6104
  rightIcon,
6105
+ prefix,
6106
+ prefixBackgroundColor,
6107
+ suffix,
6108
+ suffixBackgroundColor,
6097
6109
  insideInputFieldComponent,
6098
6110
  withDebounce,
6099
6111
  debounceDelay = 0.5,
@@ -6108,6 +6120,7 @@ var InputFieldComponent = forwardRef11(function InputField({
6108
6120
  }, ref) {
6109
6121
  const theme2 = useTheme();
6110
6122
  const internalId = useId();
6123
+ const { colorTheme } = useBetterHtmlContextInternal();
6111
6124
  const [_, debouncedValue, setDebouncedValue] = useDebounceState(
6112
6125
  props.value?.toString() ?? "",
6113
6126
  debounceDelay
@@ -6143,58 +6156,90 @@ var InputFieldComponent = forwardRef11(function InputField({
6143
6156
  const readyId = id ?? internalId;
6144
6157
  return /* @__PURE__ */ jsxs12(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, ...styledComponentStylesWithExcluded, children: [
6145
6158
  label && /* @__PURE__ */ jsx17(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
6146
- /* @__PURE__ */ jsxs12(Div_default, { position: "relative", width: "100%", ref: holderRef, children: [
6147
- leftIcon && /* @__PURE__ */ jsx17(
6148
- Icon_default,
6149
- {
6150
- name: leftIcon,
6151
- position: "absolute",
6152
- top: (props.type === "date" || props.type === "time" || props.type === "datetime-local" ? 48 : 46) / 2,
6153
- left: theme2.styles.space + 1,
6154
- transform: "translateY(-50%)",
6155
- pointerEvents: "none",
6156
- zIndex: leftIconZIndex
6157
- }
6158
- ),
6159
- /* @__PURE__ */ jsx17(
6160
- InputElement,
6159
+ /* @__PURE__ */ jsxs12(Div_default.row, { alignItems: "stretch", width: "100%", children: [
6160
+ prefix && /* @__PURE__ */ jsx17(
6161
+ Div_default.row,
6161
6162
  {
6162
- theme: theme2,
6163
- withLeftIcon: leftIcon !== void 0,
6164
- withRightIcon: rightIcon !== void 0,
6165
- required,
6166
- placeholder: placeholder ?? label,
6167
- id: readyId,
6168
- onChange: onChangeElement,
6169
- ...styledComponentStylesWithoutExcluded,
6170
- ...dataProps,
6171
- ...ariaProps,
6172
- ...restProps,
6173
- ref
6163
+ alignItems: "center",
6164
+ justifyContent: "center",
6165
+ border: `1px solid ${theme2.colors.border}`,
6166
+ borderRight: "none",
6167
+ backgroundColor: prefixBackgroundColor ?? (colorTheme === "light" ? darkenColor(theme2.colors.backgroundContent, 0.03) : lightenColor(theme2.colors.backgroundContent, 0.1)),
6168
+ borderTopLeftRadius: theme2.styles.borderRadius,
6169
+ borderBottomLeftRadius: theme2.styles.borderRadius,
6170
+ paddingInline: theme2.styles.space,
6171
+ children: prefix
6174
6172
  }
6175
6173
  ),
6176
- rightIcon ? onClickRightIcon ? /* @__PURE__ */ jsx17(
6177
- Button_default.icon,
6178
- {
6179
- icon: rightIcon,
6180
- position: "absolute",
6181
- top: 46 / 2,
6182
- right: theme2.styles.space + 1 - theme2.styles.space / 2,
6183
- transform: "translateY(-50%)",
6184
- onClick: onClickRightIcon
6185
- }
6186
- ) : /* @__PURE__ */ jsx17(
6187
- Icon_default,
6174
+ /* @__PURE__ */ jsxs12(Div_default, { position: "relative", width: "100%", height: "fit-content", ref: holderRef, children: [
6175
+ leftIcon && /* @__PURE__ */ jsx17(
6176
+ Icon_default,
6177
+ {
6178
+ name: leftIcon,
6179
+ position: "absolute",
6180
+ top: (props.type === "date" || props.type === "time" || props.type === "datetime-local" ? 48 : 46) / 2,
6181
+ left: theme2.styles.space + 1,
6182
+ transform: "translateY(-50%)",
6183
+ pointerEvents: "none",
6184
+ zIndex: leftIconZIndex
6185
+ }
6186
+ ),
6187
+ /* @__PURE__ */ jsx17(
6188
+ InputElement,
6189
+ {
6190
+ theme: theme2,
6191
+ withLeftIcon: leftIcon !== void 0,
6192
+ withRightIcon: rightIcon !== void 0,
6193
+ withPrefix: prefix !== void 0,
6194
+ withSuffix: suffix !== void 0,
6195
+ required,
6196
+ placeholder: placeholder ?? label,
6197
+ id: readyId,
6198
+ onChange: onChangeElement,
6199
+ ...styledComponentStylesWithoutExcluded,
6200
+ ...dataProps,
6201
+ ...ariaProps,
6202
+ ...restProps,
6203
+ ref
6204
+ }
6205
+ ),
6206
+ rightIcon ? onClickRightIcon ? /* @__PURE__ */ jsx17(
6207
+ Button_default.icon,
6208
+ {
6209
+ icon: rightIcon,
6210
+ position: "absolute",
6211
+ top: 46 / 2,
6212
+ right: theme2.styles.space + 1 - theme2.styles.space / 2,
6213
+ transform: "translateY(-50%)",
6214
+ onClick: onClickRightIcon
6215
+ }
6216
+ ) : /* @__PURE__ */ jsx17(
6217
+ Icon_default,
6218
+ {
6219
+ name: rightIcon,
6220
+ position: "absolute",
6221
+ top: 46 / 2,
6222
+ right: theme2.styles.space + 1,
6223
+ transform: "translateY(-50%)",
6224
+ pointerEvents: "none"
6225
+ }
6226
+ ) : void 0,
6227
+ insideInputFieldComponent
6228
+ ] }),
6229
+ suffix && /* @__PURE__ */ jsx17(
6230
+ Div_default.row,
6188
6231
  {
6189
- name: rightIcon,
6190
- position: "absolute",
6191
- top: 46 / 2,
6192
- right: theme2.styles.space + 1,
6193
- transform: "translateY(-50%)",
6194
- pointerEvents: "none"
6232
+ alignItems: "center",
6233
+ justifyContent: "center",
6234
+ border: `1px solid ${theme2.colors.border}`,
6235
+ borderLeft: "none",
6236
+ backgroundColor: suffixBackgroundColor ?? (colorTheme === "light" ? darkenColor(theme2.colors.backgroundContent, 0.03) : lightenColor(theme2.colors.backgroundContent, 0.1)),
6237
+ borderTopRightRadius: theme2.styles.borderRadius,
6238
+ borderBottomRightRadius: theme2.styles.borderRadius,
6239
+ paddingInline: theme2.styles.space,
6240
+ children: suffix
6195
6241
  }
6196
- ) : void 0,
6197
- insideInputFieldComponent
6242
+ )
6198
6243
  ] }),
6199
6244
  (errorText || infoText) && /* @__PURE__ */ jsx17(
6200
6245
  Text_default,