{"version":3,"sources":["../src/index.tsx","../src/StarGlide.tsx"],"sourcesContent":["// src/index.tsx\r\nexport { default as StarGlide } from './StarGlide';\r\nexport type { StarGlideProps } from './StarGlide.types';\r\n","\r\nimport { useEffect, useMemo, useState, } from \"react\";\r\nimport { OverlayTrigger, Tooltip } from \"react-bootstrap\";\r\nimport type { StarGlideProps, FillColorSpec } from \"./StarGlide.types\";\r\nconst DEF_HEIGHT_STARS = 14;\r\nconst DEF_ICONS_COUNT = 5;\r\nconst INITIAL_RATING = 0;\r\nconst INITIAL_SIZE_RATING = 0;\r\n\r\nconst StarGlide: React.FC<StarGlideProps> = ({\r\n  containerKey,\r\n  fillColor: currentFillColor = \"\",\r\n  rating: currentRating = 0,\r\n  iconsCount: currentIconsCount = 5,\r\n  size: currentIconsSize = 14,\r\n  onPointerLeave = null,\r\n  onPointerClick = null,\r\n  onPointerMove = null,\r\n  className = \"\",\r\n  showTooltip = true,\r\n  transition = false,\r\n  staleOnClick = false,\r\n  readOnly = false,\r\n  ratingTitle = \"\",\r\n}) => {\r\n  // default svg data for star (string template)\r\n  const DEF_SVG_DATA = useMemo(\r\n    () =>\r\n      `\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' width='${DEF_HEIGHT_STARS}' height='${DEF_HEIGHT_STARS}' viewBox='0 0 58 58'%3E%3Cpath d='M58,22.111L40.041,35.8l6.92,22.154L29.024,44.236,11.115,58l6.872-22.171L0,22.18,22.185,22.2,28.976,0l6.839,22.182Z' /%3E%3C/svg%3E\"`,\r\n    []\r\n  );\r\n\r\n  const DEF_FILL_COLORS: Record<string, FillColorSpec> = useMemo(\r\n    () => ({\r\n      black: {\r\n        rgb: \"rgb(0, 0, 0)\",\r\n        hex: \"#000000\",\r\n        filter: \"brightness(0) saturate(100%)\",\r\n      },\r\n      green: {\r\n        rgb: \"rgb(2, 171, 110)\",\r\n        hex: \"#02ab6e\",\r\n        filter:\r\n          \"brightness(0) saturate(100%) invert(46%) sepia(26%) saturate(6040%) hue-rotate(132deg) brightness(94%) contrast(98%)\",\r\n      },\r\n      red: {\r\n        rgb: \"rgb(255, 0, 0)\",\r\n        hex: \"#ff0000\",\r\n        filter:\r\n          \"brightness(0) saturate(100%) invert(62%) sepia(99%) saturate(7485%) hue-rotate(350deg) brightness(92%) contrast(133%)\",\r\n      },\r\n      blue: {\r\n        rgb: \"rgb(0, 0, 255)\",\r\n        hex: \"#0000ff\",\r\n        filter:\r\n          \"brightness(0) saturate(100%) invert(8%) sepia(100%) saturate(7474%) hue-rotate(249deg) brightness(101%) contrast(142%)\",\r\n      },\r\n      yellow: {\r\n        rgb: \"rgb(255, 255, 0)\",\r\n        hex: \"#ffff00\",\r\n        filter:\r\n          \"brightness(0) saturate(100%) invert(91%) sepia(89%) saturate(1260%) hue-rotate(355deg) brightness(105%) contrast(105%)\",\r\n      },\r\n      orange: {\r\n        rgb: \"rgb(237, 127, 16)\",\r\n        hex: \"#ed7f10\",\r\n        filter:\r\n          \"brightness(0) saturate(100%) invert(59%) sepia(67%) saturate(3279%) hue-rotate(359deg) brightness(99%) contrast(89%)\",\r\n      },\r\n      purple: {\r\n        rgb: \"rgb(160, 32, 240)\",\r\n        hex: \"#a020f0\",\r\n        filter:\r\n          \"brightness(0) saturate(100%) invert(13%) sepia(89%) saturate(5580%) hue-rotate(277deg) brightness(105%) contrast(89%)\",\r\n      },\r\n    }),\r\n    []\r\n  );\r\n\r\n  // state\r\n  currentRating =\r\n    typeof currentRating === \"number\" && currentRating > 0\r\n      ? currentRating\r\n      : INITIAL_RATING;\r\n  const [rating, setRating] = useState<number>(currentRating);\r\n  const [sizeRating, setSizeRating] = useState<number>(INITIAL_SIZE_RATING);\r\n  const [triggerRating, setTriggerRating] = useState<number>(currentRating);\r\n  const [filterToApply, setFilterToApply] = useState<string>(\"\");\r\n  const [maxIcons, setMaxIcons] = useState<number>(currentIconsCount);\r\n  const [containerStars, setContainer] = useState<HTMLElement | null>(null);\r\n  const [currFillColor, setCurrentFillColor] = useState<string>(\r\n    currentFillColor.toString().trim()\r\n  );\r\n\r\n  // safe tooltip text (guard against non-finite rating)\r\n  const tooltipText = `${\r\n    Number.isFinite(rating) ? Math.abs(rating).toFixed(1) : \"0\"\r\n  } / ${maxIcons}`;\r\n\r\n  const tooltip = (\r\n    <Tooltip\r\n      id={`${containerKey ?? \"default\"}-tooltip`}\r\n      style={{ zIndex: 500 }}\r\n    >\r\n      {tooltipText}\r\n    </Tooltip>\r\n  );\r\n  \r\n  // set up fill color filter and find container element\r\n  useEffect(() => {\r\n    try {\r\n      let filter = \"\";\r\n      const allowColors: Array<string> = [];\r\n      const defColorKeys = Object.keys(DEF_FILL_COLORS);\r\n\r\n      // normalize incoming prop to trimmed string\r\n      setCurrentFillColor(String(currentFillColor || \"\").trim());\r\n\r\n      // extract accepted colors (name + rgb + hex)\r\n      defColorKeys.forEach((primaryColor) => {\r\n        allowColors.push(primaryColor);\r\n        const spec = DEF_FILL_COLORS[primaryColor];\r\n        allowColors.push(spec.rgb);\r\n        allowColors.push(spec.hex);\r\n      });\r\n\r\n      // determine matching filter\r\n      if (currFillColor && allowColors.includes(currFillColor)) {\r\n        for (const primaryColor of defColorKeys) {\r\n          if (primaryColor === currFillColor) {\r\n            filter = primaryColor;\r\n            break;\r\n          }\r\n          const spec = DEF_FILL_COLORS[primaryColor];\r\n          if (\r\n            (spec.rgb === currFillColor || spec.hex === currFillColor) &&\r\n            !filter\r\n          ) {\r\n            filter = primaryColor;\r\n            break;\r\n          }\r\n        }\r\n        if (filter) {\r\n          setFilterToApply(DEF_FILL_COLORS[filter].filter);\r\n        }\r\n      }\r\n\r\n      if (!filter) setFilterToApply(\"\"); // filtre par default si aucune couleur predefini reconnue\r\n\r\n      // find container element by ID\r\n      if (typeof document !== \"undefined\") {\r\n        const container = document.getElementById(containerKey);\r\n        if (!container) {\r\n          throw new Error(\r\n            \"You need to provide a valid CSS identifier as [containerKey] for the container of your stars\"\r\n          );\r\n        }\r\n        setContainer(container);\r\n      }\r\n    } catch (error) {\r\n      // keep console.log to mirror original behavior\r\n      // eslint-disable-next-line no-console\r\n      console.log(error);\r\n    }\r\n  }, [DEF_FILL_COLORS, containerKey, currFillColor, currentFillColor]); // kept similar deps\r\n  \r\n  // make sure that tracking hover bloc stars don't lose his dimension when [showTooltip] changes\r\n  useEffect(() => {\r\n    if (!containerStars) return;\r\n    const hoverLayer = containerStars.querySelector<HTMLElement>(\r\n      \"span.sb-hover-layer\"\r\n    );\r\n    const starsBloc = containerStars.querySelector<HTMLElement>(\".stars-bloc\");\r\n    if (!hoverLayer || !starsBloc) return;\r\n    if (!hoverLayer.getAttribute('style')) {\r\n      hoverLayer.style.width=starsBloc.style.width;\r\n      hoverLayer.style.height=starsBloc.style.height;\r\n    }\r\n  }, [showTooltip, containerStars]);\r\n\r\n  // layout / sizing adjustments, DOM manipulations\r\n  useEffect(() => {\r\n    try {\r\n      if (!containerStars) return;\r\n      /*define all the 3 stars blocs *\r\n       * goldLayer : use to set the width of the colored bloc after stars hovering\r\n       * grayLayer : use to set the width of the gray bloc\r\n       * hoverLayer : use to track the width of the rating in relation to mouse position\r\n       */\r\n      const goldLayer =\r\n        containerStars.querySelector<HTMLElement>(\"span.sb-gold-layer\");\r\n      const grayLayer =\r\n        containerStars.querySelector<HTMLElement>(\"span.sb-gray-layer\");\r\n      const hoverLayer = containerStars.querySelector<HTMLElement>(\r\n        \"span.sb-hover-layer\"\r\n      );\r\n\r\n      if (hoverLayer && goldLayer && grayLayer) {\r\n        // verify wether to change numbers of icons or size of stars\r\n        const isWidthChanged = currentIconsSize >= DEF_HEIGHT_STARS;\r\n        const isIconsCountChanged = currentIconsCount >= DEF_ICONS_COUNT;\r\n        const isBothLowerZero = !isIconsCountChanged && !isWidthChanged;\r\n        let newWidthStars = 0;\r\n        let nbrIcons = currentIconsCount;\r\n\r\n        if (isIconsCountChanged || isWidthChanged || isBothLowerZero) {\r\n          // // round values\r\n          // setCurrentIconsSize(Math.round(currentIconsSize));\r\n          // setCurrentIconsCount(Math.round(currentIconsCount));\r\n\r\n          // calculate new width\r\n          if (isIconsCountChanged) {\r\n            newWidthStars = isWidthChanged\r\n              ? currentIconsSize * currentIconsCount\r\n              : currentIconsCount * DEF_HEIGHT_STARS;\r\n          } else if (isWidthChanged) {\r\n            newWidthStars = currentIconsSize * DEF_ICONS_COUNT;\r\n          }\r\n\r\n          // Modify max width of stars if width or height less than the default value\r\n          if (!isIconsCountChanged || !isWidthChanged) {\r\n            newWidthStars = currentIconsSize * Math.max(currentIconsCount, 1);\r\n          }\r\n          // verify the width and the height of the stars\r\n          const { innerWidth, innerHeight } = window;\r\n          const exceedVPWidth = newWidthStars >= innerWidth;\r\n          const exceedVPHeight = currentIconsSize >= innerHeight;\r\n\r\n          // check if the size of the stars doesnt exceed viewport size\r\n          if (exceedVPWidth || exceedVPHeight) {\r\n            const actualRating =\r\n              (currentRating * DEF_HEIGHT_STARS) / DEF_ICONS_COUNT;\r\n            goldLayer.classList.remove(\"sb-layer-none\");\r\n            goldLayer.style.width = actualRating + \"px\";\r\n\r\n            // set the new number of icons\r\n            setMaxIcons(DEF_ICONS_COUNT);\r\n\r\n            // prompt error if the width or the height of the stars exceed the viewport\r\n            if (exceedVPWidth)\r\n              throw new Error(\r\n                \"The width of your stars container must not exceed the width of your screen\\nReduce the [size] or the [iconsCount] to fit the screen\"\r\n              );\r\n            if (exceedVPHeight)\r\n              throw new Error(\r\n                \"The height of your stars container must not exceed the height of your screen\\nReduce the [size] or the [iconsCount] to fit the screen\"\r\n              );\r\n          }\r\n\r\n          // update svg background images\r\n          const newSVGData = DEF_SVG_DATA.replace(\r\n            `width='${DEF_HEIGHT_STARS}' height='${DEF_HEIGHT_STARS}'`,\r\n            `width='${currentIconsSize}' height='${currentIconsSize}'`\r\n          );\r\n\r\n          [grayLayer, goldLayer].forEach((layer, key) => {\r\n            const svgData = newSVGData.replace(\r\n              \"fill='currentColor'\",\r\n              `fill='${key === 0 ? \"%23dadbdb\" : \"%23ffd700\"}'`\r\n            );\r\n            layer.style.backgroundImage = `url(${svgData})`;\r\n          });\r\n\r\n          // define height and width of stars blocs\r\n          [hoverLayer, goldLayer, grayLayer].forEach((layer) => {\r\n            layer.style.width = newWidthStars + \"px\";\r\n            layer.style.height = currentIconsSize + \"px\";\r\n          });\r\n\r\n          // set the new width of the first stars container\r\n          const starsBloc =\r\n            containerStars.querySelector<HTMLElement>(\"div.stars-bloc\");\r\n          if (starsBloc) {\r\n            starsBloc.style.width = newWidthStars + \"px\";\r\n            starsBloc.style.height = currentIconsSize + \"px\";\r\n          }\r\n\r\n          // set the new number of icons\r\n          nbrIcons = Math.round(newWidthStars / currentIconsSize);\r\n          setMaxIcons(nbrIcons);\r\n        }\r\n\r\n        // define the new number of icons to show\r\n        if (typeof nbrIcons === \"number\") {\r\n          const actualRating =\r\n            (Math.min(currentRating, nbrIcons) * newWidthStars) / nbrIcons || 0;\r\n          setSizeRating(actualRating);\r\n          goldLayer.classList.remove(\"sb-layer-none\");\r\n          goldLayer.style.width = actualRating ? `${actualRating}px` : \"0\";\r\n        }\r\n      }\r\n    } catch (error) {\r\n      // eslint-disable-next-line no-console\r\n      console.log(error);\r\n    }\r\n    // keep dependency list similar to original\r\n  }, [\r\n    containerStars,\r\n    currentIconsSize,\r\n    currentIconsCount,\r\n    DEF_SVG_DATA,\r\n    currentRating,\r\n  ]);\r\n\r\n  // update star widths on sizeRating or rating changes\r\n  useEffect(() => {\r\n    try {\r\n      if (!containerStars) return;\r\n      const goldLayer =\r\n        containerStars.querySelector<HTMLElement>(\"span.sb-gold-layer\");\r\n      const starsBloc =\r\n        containerStars.querySelector<HTMLElement>(\"div.stars-bloc\");\r\n      // update the size of rating\r\n      if (goldLayer && starsBloc) {\r\n        goldLayer.classList.remove(\"sb-layer-none\");\r\n        goldLayer.style.width = `${sizeRating}px`;\r\n      }\r\n    } catch (error) {\r\n      // eslint-disable-next-line no-console\r\n      console.log(error);\r\n    }\r\n  }, [containerStars, rating, sizeRating]);\r\n\r\n  // user pointer left the hover area\r\n  function cancelRating(): void {\r\n    try {\r\n      if (!containerStars) return;\r\n      const hoverLayer = containerStars.querySelector<HTMLElement>(\r\n        \"span.sb-hover-layer\"\r\n      );\r\n      if (typeof currentRating !== \"number\" || currentRating < 0)\r\n        throw new Error(\"The [rating] value must be a positive float\");\r\n\r\n      // reset the size and the value of rating\r\n      if (hoverLayer && currentRating.toFixed(2) === triggerRating.toFixed(2)) {\r\n        const actualRating =\r\n          (Math.min(triggerRating, maxIcons) * hoverLayer.clientWidth) /\r\n          maxIcons;\r\n        setSizeRating(actualRating);\r\n        setRating(triggerRating);\r\n      }\r\n\r\n      // call onPointerLeave function when pointer leave star bloc if define\r\n      if (onPointerLeave && typeof onPointerLeave === \"function\") {\r\n        onPointerLeave(rating, sizeRating, maxIcons);\r\n      }\r\n    } catch (error) {\r\n      // eslint-disable-next-line no-console\r\n      console.log(error);\r\n    }\r\n  }\r\n\r\n  // calculate hover size and the live rating according to mouse position\r\n  function calculateRating(\r\n    e: React.MouseEvent<HTMLElement>,\r\n    containerStarsParam: HTMLElement | null\r\n  ) {\r\n    if (!containerStarsParam || !e.currentTarget) return;\r\n    const hoverLayer = e.currentTarget as HTMLElement;\r\n    const grayLayer =\r\n      containerStarsParam.querySelector<HTMLElement>(\"span.sb-gray-layer\");\r\n    if (!grayLayer) return;\r\n    const rect = hoverLayer.getBoundingClientRect();\r\n    const left = rect.left;\r\n    const clientX = e.clientX;\r\n    const x = clientX - left;\r\n    const percentHover = (100 * x) / grayLayer.clientWidth;\r\n    const actualRating = (maxIcons * percentHover) / 100;\r\n    return { size: x, liveRating: actualRating };\r\n  }\r\n\r\n  // pointer click\r\n  function saveRating(e: React.MouseEvent<HTMLElement>) {\r\n    try {\r\n      if (!containerStars) return;\r\n      let finalRating = rating;\r\n      let finalSizeRating = sizeRating;\r\n\r\n      // retourne les information de note actuelles\r\n      if (Math.floor(rating) === 0) {\r\n        const actualRating = calculateRating(e, containerStars);\r\n        if (actualRating) {\r\n          const { size, liveRating } = actualRating;\r\n          finalRating = liveRating;\r\n          finalSizeRating = size;\r\n        }\r\n      }\r\n\r\n      if (!readOnly || staleOnClick) {\r\n        setTriggerRating(finalRating);\r\n        // call onPointerClick function when pointer click star bloc if define\r\n        if (typeof onPointerClick === \"function\") {\r\n          onPointerClick(finalRating, finalSizeRating, maxIcons);\r\n        }\r\n      }\r\n    } catch (error) {\r\n      // eslint-disable-next-line no-console\r\n      console.log(error);\r\n    }\r\n  }\r\n\r\n  // pointer move (hover)\r\n  function hoverRating(e: React.MouseEvent<HTMLElement>) {\r\n    try {\r\n      if (!containerStars) return;\r\n\r\n      if (!readOnly || (readOnly && currentRating === 0)) {\r\n        const actualRating = calculateRating(e, containerStars);\r\n        if (!actualRating) return;\r\n        const { size, liveRating } = actualRating;\r\n\r\n        // verify if we need to bloc rating change or not [staleOnClick]\r\n        if (\r\n          !staleOnClick ||\r\n          (staleOnClick &&\r\n            triggerRating.toFixed(2) === currentRating.toFixed(2))\r\n        ) {\r\n          setRating(liveRating);\r\n          setSizeRating(size);\r\n\r\n          // call onPointerMove function when pointer hover star bloc if define\r\n          if (typeof onPointerMove === \"function\") {\r\n            onPointerMove(liveRating, size, maxIcons);\r\n          }\r\n        }\r\n      }\r\n    } catch (error) {\r\n      // eslint-disable-next-line no-console\r\n      console.log(error);\r\n    }\r\n  }\r\n\r\n  // render only when container is found (preserves original behavior)\r\n  if (!containerStars) return null;\r\n\r\n  return (\r\n    <div\r\n      className={\r\n        \"container-star\" +\r\n        (transition ? \" apply-stars-transition\" : \"\") +\r\n        (typeof className === \"string\" && className.length > 0\r\n          ? \" \" + className\r\n          : \"\")\r\n      }\r\n    >\r\n      <div\r\n        className=\"cs-child stars-bloc\"\r\n        role=\"button\"\r\n        title={\r\n          typeof ratingTitle === \"string\" && ratingTitle.length > 0\r\n            ? ratingTitle\r\n            : `Cliquez pour attribuer une note sur ${maxIcons}`\r\n        }\r\n        aria-label={`Attribuer une note sur ${maxIcons}`}\r\n      >\r\n        {showTooltip ? (\r\n          <OverlayTrigger placement=\"top\" overlay={tooltip}>\r\n            <span\r\n              className=\"sb-layer sb-hover-layer\"\r\n              onMouseMove={hoverRating}\r\n              onClick={saveRating}\r\n              onMouseLeave={cancelRating}\r\n            />\r\n          </OverlayTrigger>\r\n        ) : (\r\n          <span\r\n            className=\"sb-layer sb-hover-layer\"\r\n            onMouseMove={hoverRating}\r\n            onClick={saveRating}\r\n            onMouseLeave={cancelRating}\r\n          />\r\n        )}\r\n\r\n        <span className=\"sb-layer sb-gray-layer\" />\r\n        <span\r\n          className=\"sb-layer sb-gold-layer sb-layer-none\"\r\n          style={{ filter: filterToApply }}\r\n        />\r\n      </div>\r\n    </div>\r\n  );\r\n};\r\n\r\nexport default StarGlide;\r\n"],"mappings":"mbAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,eAAAE,IAAA,eAAAC,GAAAH,ICCA,IAAAI,EAA8C,iBAC9CC,EAAwC,2BAkGpCC,EAAA,6BAhGEC,EAAmB,GACnBC,EAAkB,EAClBC,GAAiB,EACjBC,GAAsB,EAEtBC,GAAsC,CAAC,CAC3C,aAAAC,EACA,UAAWC,EAAmB,GAC9B,OAAQC,EAAgB,EACxB,WAAYC,EAAoB,EAChC,KAAMC,EAAmB,GACzB,eAAAC,EAAiB,KACjB,eAAAC,EAAiB,KACjB,cAAAC,EAAgB,KAChB,UAAAC,EAAY,GACZ,YAAAC,EAAc,GACd,WAAAC,EAAa,GACb,aAAAC,EAAe,GACf,SAAAC,EAAW,GACX,YAAAC,EAAc,EAChB,IAAM,CAEJ,IAAMC,KAAe,WACnB,IACE,4FAA4FnB,CAAgB,aAAaA,CAAgB,yKAC3I,CAAC,CACH,EAEMoB,KAAiD,WACrD,KAAO,CACL,MAAO,CACL,IAAK,eACL,IAAK,UACL,OAAQ,8BACV,EACA,MAAO,CACL,IAAK,mBACL,IAAK,UACL,OACE,sHACJ,EACA,IAAK,CACH,IAAK,iBACL,IAAK,UACL,OACE,uHACJ,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OAAOK,GAAgB,UAAYA,EAAY,OAAS,EACpDA,EACA,uCAAuCW,CAAQ,GAErD,aAAY,0BAA0BA,CAAQ,GAE7C,UAAAf,KACC,OAAC,kBAAe,UAAU,MAAM,QAASsB,GACvC,mBAAC,QACC,UAAU,0BACV,YAAaqC,EACb,QAASL,EACT,aAAcN,EAChB,EACF,KAEA,OAAC,QACC,UAAU,0BACV,YAAaW,EACb,QAASL,EACT,aAAcN,EAChB,KAGF,OAAC,QAAK,UAAU,yBAAyB,KACzC,OAAC,QACC,UAAU,uCACV,MAAO,CAAE,OAAQnC,CAAc,EACjC,GACF,EACF,EA9C0B,IAgD9B,EAEO+C,EAAQtE","names":["index_exports","__export","StarGlide_default","__toCommonJS","import_react","import_react_bootstrap","import_jsx_runtime","DEF_HEIGHT_STARS","DEF_ICONS_COUNT","INITIAL_RATING","INITIAL_SIZE_RATING","StarGlide","containerKey","currentFillColor","currentRating","currentIconsCount","currentIconsSize","onPointerLeave","onPointerClick","onPointerMove","className","showTooltip","transition","staleOnClick","readOnly","ratingTitle","DEF_SVG_DATA","DEF_FILL_COLORS","rating","setRating","sizeRating","setSizeRating","triggerRating","setTriggerRating","filterToApply","setFilterToApply","maxIcons","setMaxIcons","containerStars","setContainer","currFillColor","setCurrentFillColor","tooltipText","tooltip","filter","allowColors","defColorKeys","primaryColor","spec","container","error","hoverLayer","starsBloc","goldLayer","grayLayer","isWidthChanged","isIconsCountChanged","isBothLowerZero","newWidthStars","nbrIcons","innerWidth","innerHeight","exceedVPWidth","exceedVPHeight","actualRating","newSVGData","layer","key","svgData","cancelRating","calculateRating","containerStarsParam","left","x","percentHover","saveRating","finalRating","finalSizeRating","size","liveRating","hoverRating","StarGlide_default"]}