Sha256: 86f90faeec17ab5c4fdb8e3b501b0ff03230fcfe9742a37b8a53eed82e909f73

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

// Inspired by: https://github.com/excid3/tailwindcss-stimulus-components/blob/master/src/popover.js

import { Controller } from "@hotwired/stimulus";
import { createPopper } from "@popperjs/core";

export default class extends Controller {
  static values = {
    dismissAfter: Number,
  };
  static targets = ["content", "wrapper", "trigger"];

  // Sets the popover offset using Stimulus data map objects.

  connect() {
    this.popperInstance = createPopper(this.triggerTarget, this.contentTarget, {
      placement: this.contentTarget.dataset.side || "bottom",
      modifiers: [
        {
          name: "offset",
          options: {
            offset: [0, 8],
          },
        },
      ],
    });
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shadcn-ui-0.0.1 app/javascript/controllers/ui/popover_controller.js