Git Product home page Git Product logo

px-popover's Introduction

px-popover Build Status

Overview

Px-popover is a Predix UI component used for displaying additional information to a user. The popover is similar to a tooltip, but is invoked by clicking instead of hovering on a target component, and can also contain richer content than a basic tooltip.

Usage

Prerequisites

  1. node.js
  2. npm
  3. bower
  4. webcomponents-lite.js polyfill

Node, npm, and bower are necessary to install the component and dependencies. webcomponents.js adds support for web components and custom elements to your application.

Getting Started

First, install the component via bower on the command line:

bower install px-popover --save

Second, import the component in your application with the following tag in your head:

<link rel="import" href="/bower_components/px-popover/px-popover.html"/>

Finally, use the component in your application:

Top popover

<div class="sample-container">
    <button id="btnUp" type="button" name="button">Up</button>
    <px-popover
        for="btnUp"
        orientation="top"
        popover-title="Top Popover"
        popover-body="Lorem ipsum dolor sit amet, consectetur elit, sed do eiusmod.">
    </px-popover>
</div>

Bottom popover

<div class="sample-container">
    <button id="btnUp" type="button" name="button">Bottom</button>
    <px-popover
        for="btnUp"
        orientation="bottom"
        popover-title="Bottom Popover"
        popover-body="Lorem ipsum dolor sit amet, consectetur elit, sed do eiusmod.">
    </px-popover>
</div>

Popover in a Relative position ancestor

<div class="sample-container" style="position:relative">
...
  <div style="position:relative>"
    <button id="btnRel" type="button" name="button">Bottom</button>
    <px-popover
        for="btnRel"
        orientation="bottom"
        popover-title="Bottom Popover"
        popover-body="Lorem ipsum dolor sit amet, consectetur elit, sed do eiusmod."
        position="relative" >
    </px-popover>
  </div>
  ...
</div>

Layout

The px-popover component has a fixed width but will grow vertically relative to its contents.

Documentation

Read the full API and view the demo here.

Local Development

From the component's directory...

$ npm install
$ bower install
$ gulp sass

From the component's directory, to start a local server run:

$ gulp serve

Navigate to the root of that server (e.g. http://localhost:8080/) in a browser to open the API documentation page, with link to the "Demo" / working examples.

GE Coding Style Guide

GE JS Developer's Guide



Known Issues

  • Transformations on the target with position relative parent do not work. Instead, apply the transformation to the parent div so the popover gets it too.

Please use Github Issues to submit any bugs you might find.

px-popover's People

Contributors

benoitjchevalier avatar davidrleonard avatar evanjd avatar gigmania avatar grantrpickett avatar hannav95 avatar itzzshirlayyy avatar katemenkhaus avatar lrbridge avatar mdwragg avatar nonmetalhail avatar randyaskin avatar stevewinkler avatar talimarcus avatar yashdoshi89 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

px-popover's Issues

Position of popover is offset relative to page scroll position

Expected behavior and actual behavior:

Expected: Popover position should be in the same relative position regardless of scroll location of page.
Actual: Popover position is offset by the same amount of the scroll offset (see screen shot)

Steps to reproduce the problem:

Simply use your demo (https://www.predix-ui.com/#/elements/px-popover), and scroll down a bit, then click the "Click here" button.

Environment (component version number, Browser (including version), operating system, hardware, etc):

v.2.0.3 (2.0.4?)
Chrome 61
Mac El Capitan

Screenshots (optional, but very helpful):

screen shot 2017-10-09 at 4 20 11 pm

Enhancement Request: New custom attributes

Can you please add two attributes to enable customization of the div with id="popover":

  1. background
  2. box-shadow

I know you already expose background-color; if you expose the "background" shorthand, I can easily set all the background attributes. Specifically, I need to be able to use a linear-gradient on the background as well as setting things like repeat, position, etc.
Thanks!

[Feature Request] Ability to have orientation fall back to auto or other user specified orientation

Currently, when I have a popover with orientation "top," there can be some display issues when the popover is near the top of the window. Like so:

Normal popover:
screen shot 2018-03-16 at 11 51 59 am

When it's toward the top of the screen:
screen shot 2018-03-16 at 11 52 12 am

When I use the "auto" orientation, it can cause the popover to cover up information or show up in undesired places:
screen shot 2018-03-16 at 11 53 43 am

It would be neat if we could specify a desired orientation, "top" in this case. But have it fall back to "auto" or "bottom" if opening at the top would cause overflow or a really small popover in general.

Popover appearing in the wrong place

Expected behavior and actual behavior:

When clicking on the button in the demo for px-popover, I expected the popover to be directly adjacent to the button. Instead, it's appearing far away on the screen, per this screenshot:

screen shot 2017-08-29 at 10 11 10 am

This is also the case when I scroll down on the page and click on the button again:

screen shot 2017-08-29 at 10 14 06 am

Steps to reproduce the problem:

Click the "Click here" button in the demo.

Environment:

Using Google Chrome for px-popover v2.0.3.

popover location bug

Expected behavior and actual behavior:

Upgraded to the latest release (2.2.3) and noticed the popover location is broken - the popover appears in the top left-hand corner of the page. I noticed this in the px-login component. As of 2.1.3 the popover location is correct. I tested 2.1.3 (working), 2.2.0 (broken), 2.2.3 (broken).

Steps to reproduce the problem:

Place the popover (or px-login which uses popover) on a web page and and click it. The popover shows up in the top left-hand side corner.

Environment (component version number, Browser (including version), operating system, hardware, etc):

=2.2.0
chrome: 64.0.3282.167 (64 bit)
windows 7

Screenshots (optional, but very helpful):

Working(2.1.3)
image

Broken:
image

enhanced mode not working

Expected behavior and actual behavior:

px-popover content not rendered when enhanced = true.

Steps to reproduce the problem:

See codepen: https://codepen.io/anon/pen/pwpypz

Environment (component version number, Browser (including version), operating system, hardware, etc):

Chrome Version 58.0.3029.110 on Mac

light-dom for enhance property does not render within html table

Expected behavior and actual behavior:

Expected: with enhance="true" should render custom html inside of popover

Actual: enhance="true" shows an empty popover when popover used within a table

Steps to reproduce the problem:

Use a px-popover component inside of an html table with enhance="true" and light-dom content to be applied.

Environment (component version number, Browser (including version), operating system, hardware, etc):

px-popover v1.7.3
Chrome Version 55.0.2883.95 (64-bit)
OSX
Polymer v1.7.0

Screenshots (optional, but very helpful):

Expected (used outside table):
image

Actual (used inside table):
image

Popover not opening

Expected behavior and actual behavior:

Popover should open even if the click event target is a child element of the trigger element.

Steps to reproduce the problem:

See codepen: https://codepen.io/anon/pen/pwpypz
Clicking on the child element (red) will not open popover.

Environment (component version number, Browser (including version), operating system, hardware, etc):

Chrome v.59.0.3071.115 on Mac

Clean up component sass

Couple of thoughts:

  • BEM-up class names.
  • Consider dropping out normalize.scss in favour of targeted reset just for this component (div and h5 off the top of my head).

CC/ @Menkhaus-ge

Popover only responds to tap OR click

Expected behavior and actual behavior:

Expected:
Popover responds to mouse clicks and finger taps.

Actual:
Popover responds to taps only.

Steps to reproduce the problem:

Try to use the popover on a laptop with a touch screen. Tapping the screen works as expected but using the mouse doesn't work.

Environment

px-popover version ^1.7.3
Chrome 57.0.2987.133
Windows10

Code examples

Based on a cursory look it seems like the trouble is here in px-popover.html:

hideOverlayChanged: function(hideOverlay) {
	var tapEvent = ('ontouchstart' in window) ? 'tap' : 'click';
    (hideOverlay === true) {
		document.addEventListener(tapEvent, this._onCaptureClick.bind(this), true);
		} 
		else {
            document.removeEventListener(tapEvent, this._onCaptureClick.bind(this));
          }
	}

Possible to change to respond to click and tap as opposed to one or the other?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.