All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lucuma.react.primereact.hooks.UseOverlayPanelRef.scala Maven / Gradle / Ivy

The newest version!
// Copyright (c) 2016-2023 Association of Universities for Research in Astronomy, Inc. (AURA)
// For license information see LICENSE or https://opensource.org/licenses/BSD-3-Clause

package lucuma.react.primereact.hooks

import japgolly.scalajs.react.*
import lucuma.react.primereact.OverlayPanel
import lucuma.react.primereact.OverlayPanelRef

object UseOverlayPanelRef {

  val hook = CustomHook[Unit]
    .useRefToJsComponentWithMountedFacade[OverlayPanel.OverlayPanelProps, Null, OverlayPanel.Facade]
    .buildReturning((_, ref) => OverlayPanelRef(ref))

  object HooksApiExt {
    sealed class Primary[Ctx, Step <: HooksApi.AbstractStep](api: HooksApi.Primary[Ctx, Step]) {

      final def useOverlayPanelRef(implicit step: Step): step.Next[OverlayPanelRef] =
        api.custom(hook)
    }
  }

  trait HooksApiExt {
    import HooksApiExt._

    implicit def hooksExtOverlayPanelRefHook[Ctx, Step <: HooksApi.AbstractStep](
      api: HooksApi.Primary[Ctx, Step]
    ): Primary[Ctx, Step] =
      new Primary(api)
  }

  object implicits extends HooksApiExt
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy