@webdevarif/dashui 0.3.6 → 0.3.7

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
@@ -3380,9 +3380,13 @@ var ColorPicker = ({
3380
3380
  var ColorPickerSelection = (0, import_react.memo)(({ className, ...props }) => {
3381
3381
  const containerRef = (0, import_react.useRef)(null);
3382
3382
  const [isDragging, setIsDragging] = (0, import_react.useState)(false);
3383
- const [posX, setPosX] = (0, import_react.useState)(0);
3384
- const [posY, setPosY] = (0, import_react.useState)(0);
3385
- const { hue, setSaturation, setLightness } = useColorPicker();
3383
+ const { hue, saturation, lightness, setSaturation, setLightness } = useColorPicker();
3384
+ const [posX, setPosX] = (0, import_react.useState)(() => saturation / 100);
3385
+ const [posY, setPosY] = (0, import_react.useState)(() => {
3386
+ const x = saturation / 100;
3387
+ const topL = x < 0.01 ? 100 : 50 + 50 * (1 - x);
3388
+ return topL > 0 ? Math.max(0, Math.min(1, 1 - lightness / topL)) : 0;
3389
+ });
3386
3390
  const bg = (0, import_react.useMemo)(
3387
3391
  () => `linear-gradient(0deg,rgba(0,0,0,1),rgba(0,0,0,0)),linear-gradient(90deg,rgba(255,255,255,1),rgba(255,255,255,0)),hsl(${hue},100%,50%)`,
3388
3392
  [hue]