@fab1o978/react-ui 0.1.7 → 0.1.8

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.js CHANGED
@@ -643,6 +643,7 @@ var SliderControl = ({
643
643
  step = 1,
644
644
  onChange,
645
645
  showTooltip = "drag",
646
+ showPercentage = false,
646
647
  leftIcon,
647
648
  rightIcon,
648
649
  railBackground,
@@ -736,7 +737,8 @@ var SliderControl = ({
736
737
  [disabled, step, min, max, value, setValue]
737
738
  );
738
739
  const tooltipVisible = showTooltip === "always" || showTooltip === "drag" && (isDragging || isFocused);
739
- const displayValue = `${Math.round(value)}%`;
740
+ const decimals = step < 1 ? Math.ceil(-Math.log10(step)) : 0;
741
+ const displayValue = showPercentage ? `${Math.round((value - min) / (max - min) * 100)}%` : value.toFixed(decimals);
740
742
  const tooltipOffset = `calc(${pct * 100}% + ${(0.5 - pct) * 20}px)`;
741
743
  return /* @__PURE__ */ jsxs(
742
744
  "div",