react-better-html 1.1.240 → 1.1.242

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
@@ -87,9 +87,11 @@ declare const Button: typeof ButtonComponent & {
87
87
  type InputFieldProps = {
88
88
  label?: string;
89
89
  labelFontFamily?: React.CSSProperties["fontFamily"];
90
+ labelFontSize?: React.CSSProperties["fontSize"];
90
91
  labelLetterSpacing?: React.CSSProperties["letterSpacing"];
91
92
  labelTextTransform?: React.CSSProperties["textTransform"];
92
93
  labelColor?: React.CSSProperties["color"];
94
+ labelGap?: React.CSSProperties["gap"];
93
95
  errorText?: string;
94
96
  infoText?: string;
95
97
  leftIcon?: IconName | AnyOtherString;
@@ -284,9 +286,11 @@ type DropdownOption<Value, Data = unknown> = {
284
286
  type DropdownProps<Value = unknown, Data = unknown> = {
285
287
  label?: string;
286
288
  labelFontFamily?: React.CSSProperties["fontFamily"];
289
+ labelFontSize?: React.CSSProperties["fontSize"];
287
290
  labelLetterSpacing?: React.CSSProperties["letterSpacing"];
288
291
  labelTextTransform?: React.CSSProperties["textTransform"];
289
292
  labelColor?: React.CSSProperties["color"];
293
+ labelGap?: React.CSSProperties["gap"];
290
294
  errorText?: string;
291
295
  infoText?: string;
292
296
  /** @default false */
@@ -338,19 +342,24 @@ type ToggleInputRef = {};
338
342
  type InternalToggleInputProps<Value> = {
339
343
  label?: string;
340
344
  labelFontFamily?: React.CSSProperties["fontFamily"];
345
+ labelFontSize?: React.CSSProperties["fontSize"];
341
346
  labelLetterSpacing?: React.CSSProperties["letterSpacing"];
342
347
  labelTextTransform?: React.CSSProperties["textTransform"];
343
348
  labelColor?: React.CSSProperties["color"];
349
+ labelGap?: React.CSSProperties["gap"];
344
350
  text?: string;
345
351
  textFontFamily?: React.CSSProperties["fontFamily"];
352
+ textFontSize?: React.CSSProperties["fontSize"];
346
353
  textLetterSpacing?: React.CSSProperties["letterSpacing"];
347
354
  textTextTransform?: React.CSSProperties["textTransform"];
348
355
  textAdvanced?: React.ReactNode;
349
356
  errorText?: string;
350
357
  infoText?: string;
358
+ /** @default 26 */
359
+ size?: number;
351
360
  value?: Value;
352
361
  onChange?: (checked: boolean, value?: Value) => void;
353
- } & OmitProps<React.ComponentProps<"input">, "style" | "value" | "ref" | "onChange"> & ComponentStyle & ComponentHoverStyle;
362
+ } & OmitProps<React.ComponentProps<"input">, "style" | "value" | "ref" | "onChange" | "size"> & ComponentStyle & ComponentHoverStyle;
354
363
  type ToggleInputProps<Value = unknown> = ComponentPropWithRef<ToggleInputRef, OmitProps<InternalToggleInputProps<Value>, "type">>;
355
364
  type ToggleInputComponentType = <Value>(props: ToggleInputProps<Value>) => React.ReactElement;
356
365
  declare const _default$5: {
@@ -392,9 +401,13 @@ type LabelProps = {
392
401
  text?: string;
393
402
  /** @default false */
394
403
  required?: boolean;
404
+ /** @default 16 */
405
+ requiredSize?: React.CSSProperties["fontSize"];
395
406
  /** @default false */
396
407
  isError?: boolean;
397
408
  fontFamily?: React.CSSProperties["fontFamily"];
409
+ /** @default 14 */
410
+ fontSize?: React.CSSProperties["fontSize"];
398
411
  letterSpacing?: React.CSSProperties["letterSpacing"];
399
412
  textTransform?: React.CSSProperties["textTransform"];
400
413
  color?: React.CSSProperties["color"];
@@ -404,7 +417,7 @@ declare function Label(labelProps: LabelProps): react_jsx_runtime.JSX.Element;
404
417
  declare const _default$3: react.MemoExoticComponent<typeof Label>;
405
418
 
406
419
  type ComponentStyleConfig<ComponentProps, Subcomponents extends string> = {
407
- [key in Subcomponents]?: ComponentProps;
420
+ [key in Subcomponents]?: Partial<ComponentProps>;
408
421
  };
409
422
  type ComponentTagReplacementConfig<Subcomponents extends string> = {
410
423
  [key in Subcomponents]?: React.ElementType;
package/dist/index.d.ts CHANGED
@@ -87,9 +87,11 @@ declare const Button: typeof ButtonComponent & {
87
87
  type InputFieldProps = {
88
88
  label?: string;
89
89
  labelFontFamily?: React.CSSProperties["fontFamily"];
90
+ labelFontSize?: React.CSSProperties["fontSize"];
90
91
  labelLetterSpacing?: React.CSSProperties["letterSpacing"];
91
92
  labelTextTransform?: React.CSSProperties["textTransform"];
92
93
  labelColor?: React.CSSProperties["color"];
94
+ labelGap?: React.CSSProperties["gap"];
93
95
  errorText?: string;
94
96
  infoText?: string;
95
97
  leftIcon?: IconName | AnyOtherString;
@@ -284,9 +286,11 @@ type DropdownOption<Value, Data = unknown> = {
284
286
  type DropdownProps<Value = unknown, Data = unknown> = {
285
287
  label?: string;
286
288
  labelFontFamily?: React.CSSProperties["fontFamily"];
289
+ labelFontSize?: React.CSSProperties["fontSize"];
287
290
  labelLetterSpacing?: React.CSSProperties["letterSpacing"];
288
291
  labelTextTransform?: React.CSSProperties["textTransform"];
289
292
  labelColor?: React.CSSProperties["color"];
293
+ labelGap?: React.CSSProperties["gap"];
290
294
  errorText?: string;
291
295
  infoText?: string;
292
296
  /** @default false */
@@ -338,19 +342,24 @@ type ToggleInputRef = {};
338
342
  type InternalToggleInputProps<Value> = {
339
343
  label?: string;
340
344
  labelFontFamily?: React.CSSProperties["fontFamily"];
345
+ labelFontSize?: React.CSSProperties["fontSize"];
341
346
  labelLetterSpacing?: React.CSSProperties["letterSpacing"];
342
347
  labelTextTransform?: React.CSSProperties["textTransform"];
343
348
  labelColor?: React.CSSProperties["color"];
349
+ labelGap?: React.CSSProperties["gap"];
344
350
  text?: string;
345
351
  textFontFamily?: React.CSSProperties["fontFamily"];
352
+ textFontSize?: React.CSSProperties["fontSize"];
346
353
  textLetterSpacing?: React.CSSProperties["letterSpacing"];
347
354
  textTextTransform?: React.CSSProperties["textTransform"];
348
355
  textAdvanced?: React.ReactNode;
349
356
  errorText?: string;
350
357
  infoText?: string;
358
+ /** @default 26 */
359
+ size?: number;
351
360
  value?: Value;
352
361
  onChange?: (checked: boolean, value?: Value) => void;
353
- } & OmitProps<React.ComponentProps<"input">, "style" | "value" | "ref" | "onChange"> & ComponentStyle & ComponentHoverStyle;
362
+ } & OmitProps<React.ComponentProps<"input">, "style" | "value" | "ref" | "onChange" | "size"> & ComponentStyle & ComponentHoverStyle;
354
363
  type ToggleInputProps<Value = unknown> = ComponentPropWithRef<ToggleInputRef, OmitProps<InternalToggleInputProps<Value>, "type">>;
355
364
  type ToggleInputComponentType = <Value>(props: ToggleInputProps<Value>) => React.ReactElement;
356
365
  declare const _default$5: {
@@ -392,9 +401,13 @@ type LabelProps = {
392
401
  text?: string;
393
402
  /** @default false */
394
403
  required?: boolean;
404
+ /** @default 16 */
405
+ requiredSize?: React.CSSProperties["fontSize"];
395
406
  /** @default false */
396
407
  isError?: boolean;
397
408
  fontFamily?: React.CSSProperties["fontFamily"];
409
+ /** @default 14 */
410
+ fontSize?: React.CSSProperties["fontSize"];
398
411
  letterSpacing?: React.CSSProperties["letterSpacing"];
399
412
  textTransform?: React.CSSProperties["textTransform"];
400
413
  color?: React.CSSProperties["color"];
@@ -404,7 +417,7 @@ declare function Label(labelProps: LabelProps): react_jsx_runtime.JSX.Element;
404
417
  declare const _default$3: react.MemoExoticComponent<typeof Label>;
405
418
 
406
419
  type ComponentStyleConfig<ComponentProps, Subcomponents extends string> = {
407
- [key in Subcomponents]?: ComponentProps;
420
+ [key in Subcomponents]?: Partial<ComponentProps>;
408
421
  };
409
422
  type ComponentTagReplacementConfig<Subcomponents extends string> = {
410
423
  [key in Subcomponents]?: React.ElementType;
package/dist/index.js CHANGED
@@ -2064,7 +2064,11 @@ var ButtonElement = import_styled_components6.default.button.withConfig({
2064
2064
  }
2065
2065
 
2066
2066
  &.secondary:hover {
2067
- border-color: ${props.theme.colors.primary};
2067
+ ${props.withNoBorder ? import_styled_components6.css`
2068
+ filter: ${props.colorTheme === "dark" ? "brightness(1.2)" : "brightness(0.9)"};
2069
+ ` : import_styled_components6.css`
2070
+ border-color: ${props.theme.colors.primary};
2071
+ `}
2068
2072
  }
2069
2073
  ` : ""}
2070
2074
 
@@ -2162,6 +2166,7 @@ var ButtonComponent = function Button(buttonProps) {
2162
2166
  isSmall,
2163
2167
  withText: text !== void 0,
2164
2168
  isLoading: isLoadingElement,
2169
+ withNoBorder: theme2.styles.borderWidth === 0,
2165
2170
  disabled,
2166
2171
  to: href,
2167
2172
  href,
@@ -3574,16 +3579,26 @@ var import_react_better_core16 = require("react-better-core");
3574
3579
  var import_jsx_runtime15 = require("react/jsx-runtime");
3575
3580
  function Label(labelProps) {
3576
3581
  const betterHtmlContextInternal = useBetterHtmlContextInternal();
3577
- const { text, required, isError, fontFamily, letterSpacing, textTransform, color, htmlFor } = useComponentsPropsMerger(betterHtmlContextInternal.components.label?.style?.default, labelProps);
3582
+ const {
3583
+ text,
3584
+ required,
3585
+ requiredSize = 16,
3586
+ isError,
3587
+ fontFamily,
3588
+ fontSize = 14,
3589
+ letterSpacing,
3590
+ textTransform,
3591
+ color,
3592
+ htmlFor
3593
+ } = useComponentsPropsMerger(betterHtmlContextInternal.components.label?.style?.default, labelProps);
3578
3594
  const theme2 = (0, import_react_better_core16.useTheme)();
3579
3595
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3580
3596
  Text_default,
3581
3597
  {
3582
3598
  as: "label",
3583
3599
  width: "fit-content",
3584
- height: 16,
3585
3600
  fontFamily,
3586
- fontSize: 14,
3601
+ fontSize,
3587
3602
  color: isError ? theme2.colors.error : color ?? theme2.colors.textSecondary,
3588
3603
  letterSpacing,
3589
3604
  textTransform,
@@ -3591,10 +3606,21 @@ function Label(labelProps) {
3591
3606
  "aria-required": required,
3592
3607
  children: [
3593
3608
  text,
3594
- required && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
3595
- " ",
3596
- "*"
3597
- ] })
3609
+ required && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3610
+ Text_default,
3611
+ {
3612
+ as: "span",
3613
+ display: "inline-block",
3614
+ height: fontSize,
3615
+ fontSize: requiredSize,
3616
+ letterSpacing: "normal",
3617
+ color: theme2.colors.error,
3618
+ children: [
3619
+ " ",
3620
+ "*"
3621
+ ]
3622
+ }
3623
+ )
3598
3624
  ]
3599
3625
  }
3600
3626
  );
@@ -3611,9 +3637,11 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
3611
3637
  const {
3612
3638
  label,
3613
3639
  labelFontFamily,
3640
+ labelFontSize,
3614
3641
  labelLetterSpacing,
3615
3642
  labelTextTransform,
3616
3643
  labelColor,
3644
+ labelGap,
3617
3645
  errorText,
3618
3646
  infoText,
3619
3647
  required,
@@ -3853,9 +3881,11 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdow
3853
3881
  {
3854
3882
  label,
3855
3883
  labelFontFamily,
3884
+ labelFontSize,
3856
3885
  labelLetterSpacing,
3857
3886
  labelTextTransform,
3858
3887
  labelColor,
3888
+ labelGap,
3859
3889
  errorText,
3860
3890
  infoText,
3861
3891
  required: withMultiselect ? (Array.isArray(value) ? value.length > 0 : value !== void 0) ? false : required : required,
@@ -4427,9 +4457,11 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inp
4427
4457
  const {
4428
4458
  label,
4429
4459
  labelFontFamily,
4460
+ labelFontSize,
4430
4461
  labelLetterSpacing,
4431
4462
  labelTextTransform,
4432
4463
  labelColor,
4464
+ labelGap,
4433
4465
  errorText,
4434
4466
  infoText,
4435
4467
  leftIcon,
@@ -4485,12 +4517,13 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inp
4485
4517
  onChangeValue?.(debouncedValue);
4486
4518
  }, [withDebounce, onChangeValue, debouncedValue]);
4487
4519
  const readyId = id ?? internalId;
4488
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, ...excludeStyle, children: [
4520
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap: labelGap ?? theme2.styles.gap / 2, ...excludeStyle, children: [
4489
4521
  label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4490
4522
  Label_default,
4491
4523
  {
4492
4524
  text: label,
4493
4525
  fontFamily: labelFontFamily,
4526
+ fontSize: labelFontSize,
4494
4527
  letterSpacing: labelLetterSpacing,
4495
4528
  textTransform: labelTextTransform,
4496
4529
  color: labelColor,
@@ -4605,9 +4638,11 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
4605
4638
  const {
4606
4639
  label,
4607
4640
  labelFontFamily,
4641
+ labelFontSize,
4608
4642
  labelLetterSpacing,
4609
4643
  labelTextTransform,
4610
4644
  labelColor,
4645
+ labelGap,
4611
4646
  placeholder,
4612
4647
  errorText,
4613
4648
  infoText,
@@ -4636,12 +4671,13 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
4636
4671
  [onChange, onChangeValue]
4637
4672
  );
4638
4673
  const readyId = id ?? internalId;
4639
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
4674
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { gap: labelGap ?? theme2.styles.gap / 2, children: [
4640
4675
  label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4641
4676
  Label_default,
4642
4677
  {
4643
4678
  text: label,
4644
4679
  fontFamily: labelFontFamily,
4680
+ fontSize: labelFontSize,
4645
4681
  letterSpacing: labelLetterSpacing,
4646
4682
  textTransform: labelTextTransform,
4647
4683
  color: labelColor,
@@ -4809,6 +4845,7 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
4809
4845
  const {
4810
4846
  label,
4811
4847
  labelFontFamily,
4848
+ labelFontSize,
4812
4849
  labelLetterSpacing,
4813
4850
  labelTextTransform,
4814
4851
  labelColor,
@@ -4881,6 +4918,7 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
4881
4918
  {
4882
4919
  text: readyLabel,
4883
4920
  fontFamily: betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.labelFontFamily ?? labelFontFamily,
4921
+ fontSize: betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.labelFontSize ?? labelFontSize,
4884
4922
  letterSpacing: betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.labelLetterSpacing ?? labelLetterSpacing,
4885
4923
  textTransform: betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.labelTextTransform ?? labelTextTransform,
4886
4924
  color: betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.labelColor ?? labelColor,
@@ -5430,12 +5468,12 @@ var componentSize = 26;
5430
5468
  var switchComponentBallGap = 3;
5431
5469
  var switchComponentMouseDownDifference = 4;
5432
5470
  var InputElement2 = import_styled_components12.default.input.withConfig({
5433
- shouldForwardProp: (prop) => !["theme", "style", "hoverStyle"].includes(prop)
5471
+ shouldForwardProp: (prop) => !["theme", "style", "hoverStyle", "size"].includes(prop)
5434
5472
  })`
5435
5473
  position: relative;
5436
5474
  appearance: none;
5437
- width: ${componentSize}px;
5438
- height: ${componentSize}px;
5475
+ width: ${(props) => props.size ?? componentSize}px;
5476
+ height: ${(props) => props.size ?? componentSize}px;
5439
5477
  background-color: ${(props) => props.theme.colors.backgroundContent};
5440
5478
  border: ${(props) => props.theme.styles.borderWidth}px solid ${(props) => props.theme.colors.border};
5441
5479
  border-radius: ${(props) => props.theme.styles.borderRadius / 2}px;
@@ -5521,16 +5559,20 @@ var SwitchElement = import_styled_components12.default.div.withConfig({
5521
5559
  var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
5522
5560
  label,
5523
5561
  labelFontFamily,
5562
+ labelFontSize,
5524
5563
  labelLetterSpacing,
5525
5564
  labelTextTransform,
5526
5565
  labelColor,
5566
+ labelGap,
5527
5567
  text,
5528
5568
  textFontFamily,
5569
+ textFontSize,
5529
5570
  textLetterSpacing,
5530
5571
  textTextTransform,
5531
5572
  textAdvanced,
5532
5573
  errorText,
5533
5574
  infoText,
5575
+ size,
5534
5576
  value,
5535
5577
  onChange,
5536
5578
  checked: controlledChecked,
@@ -5560,12 +5602,13 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
5560
5602
  onChange?.(newIsChecked, value);
5561
5603
  }, [checked, controlledChecked, onChange, value]);
5562
5604
  const readyId = id ?? internalId;
5563
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { gap: theme2.styles.gap, ...excludeStyle, children: [
5605
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { gap: labelGap ?? theme2.styles.gap, ...excludeStyle, children: [
5564
5606
  label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5565
5607
  Label_default,
5566
5608
  {
5567
5609
  text: label,
5568
5610
  fontFamily: labelFontFamily,
5611
+ fontSize: labelFontSize,
5569
5612
  letterSpacing: labelLetterSpacing,
5570
5613
  textTransform: labelTextTransform,
5571
5614
  color: labelColor,
@@ -5580,6 +5623,7 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
5580
5623
  InputElement2,
5581
5624
  {
5582
5625
  theme: theme2,
5626
+ size,
5583
5627
  type: props.type ?? "checkbox",
5584
5628
  checked,
5585
5629
  onChange: onChangeElement,
@@ -5625,6 +5669,7 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
5625
5669
  Text_default,
5626
5670
  {
5627
5671
  fontFamily: textFontFamily,
5672
+ fontSize: textFontSize,
5628
5673
  letterSpacing: textLetterSpacing,
5629
5674
  textTransform: textTextTransform,
5630
5675
  color,
@@ -5681,6 +5726,7 @@ var ToggleInput_default = {
5681
5726
  const {
5682
5727
  label,
5683
5728
  labelFontFamily,
5729
+ labelFontSize,
5684
5730
  labelLetterSpacing,
5685
5731
  labelTextTransform,
5686
5732
  labelColor,
@@ -5718,6 +5764,7 @@ var ToggleInput_default = {
5718
5764
  {
5719
5765
  text: label,
5720
5766
  fontFamily: labelFontFamily,
5767
+ fontSize: labelFontSize,
5721
5768
  letterSpacing: labelLetterSpacing,
5722
5769
  textTransform: labelTextTransform,
5723
5770
  color: labelColor,