Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DSS-462] add Popover #100

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
80cfc75
feat(popover): copy over tooltip as starting poing and rename pds-too…
QuintonJason Sep 5, 2023
a17d486
refactor(popover): change trigger action from mouse based to click based
QuintonJason Sep 5, 2023
1b04042
chore(popover): add close when clicking outside cotent
QuintonJason Sep 5, 2023
b427a56
docs(popover): update docs page
QuintonJason Sep 5, 2023
fe84e86
feat(pds-list-options): add pds list options and pds list components …
QuintonJason Sep 6, 2023
e1c5846
chore(pds-popover): update list option in list
QuintonJason Sep 6, 2023
3fe3346
docs(popover): update copy and section title
QuintonJason Sep 6, 2023
b38530a
docs(pds-popover): clean up demo code
QuintonJason Sep 6, 2023
06e333e
test(pds-popover): begin spec test
QuintonJason Sep 8, 2023
c3c8fae
test(pds-popover): add units tests
QuintonJason Sep 8, 2023
6e44b43
test(list-options): add specs
QuintonJason Sep 8, 2023
bb32742
chore(list-options): add keyboard support
QuintonJason Sep 11, 2023
32f66eb
docs(list-options): update stories
QuintonJason Sep 11, 2023
969c4c8
test(list-options): add keyboard tests
QuintonJason Sep 11, 2023
67cc62a
chore(list-options): remove list options and put into own pr and jira…
QuintonJason Sep 11, 2023
b11527e
docs(popover): update role and story
QuintonJason Sep 11, 2023
40d8434
chore(readme): auto correcting of readme files
QuintonJason Sep 11, 2023
12a1652
docs(popover): add story with avatar dropdown as trigger
QuintonJason Sep 11, 2023
3f4c3a3
docs(popover): update default props and clean up copy
QuintonJason Sep 11, 2023
f4de45b
style(pds-popover): add display property to trigger
QuintonJason Sep 26, 2023
ea3207d
style(pds-popover): add css vars
QuintonJason Sep 26, 2023
b6cb81a
docs(pds-popover): updated prop copy
QuintonJason Sep 26, 2023
9dec9c7
docs(pds-popover): updated opened prop to work in demos
QuintonJason Sep 26, 2023
6fdcd59
docs(popover): add decorator to demos and add id to popover content
QuintonJason Dec 1, 2023
aef18cd
style(popover): update to logical properties
QuintonJason Dec 1, 2023
d455c1f
chore(input): revert readme to next version
QuintonJason Dec 1, 2023
a9172f7
chore(input): revert readme to next version
QuintonJason Dec 1, 2023
9e4bb2f
chore(input): revert readme to next version
QuintonJason Dec 1, 2023
af4e1f2
style(popover): move custom props location
QuintonJason Dec 4, 2023
c367dae
refactor(popover): move class interpolation outside of return
QuintonJason Dec 4, 2023
07b4d4e
refactor(popover): extract placement to a type
QuintonJason Dec 4, 2023
4042471
chore(popover): add space
QuintonJason Dec 4, 2023
fad1588
docs(popover): update placement docs
QuintonJason Dec 4, 2023
db85214
docs(popover): add trigger documentation suggestion
QuintonJason Dec 4, 2023
74052eb
docs(popover): add arrow suggestion
QuintonJason Dec 4, 2023
ed4f9e0
docs(popover): update placement copy form suggestion
QuintonJason Dec 4, 2023
2afbb18
docs(popover): update popover description
QuintonJason Dec 4, 2023
b51c38e
test(popover): add has-arrow test
QuintonJason Dec 4, 2023
6611a6f
test(popover): write e2e tests
QuintonJason Dec 4, 2023
c5e51b3
test(popover): add new line
QuintonJason Dec 4, 2023
8e3a02e
docs(pds-popover): updated default props
QuintonJason Dec 13, 2023
6da74b5
docs(pds-popover): shorten copy in popover content
QuintonJason Dec 13, 2023
ef6ca39
docs(pds-popover): shorten popver content
QuintonJason Dec 14, 2023
2a6d69e
refactor(pds-popover): align popoverclasses with our pattern
QuintonJason Dec 14, 2023
37d6940
test(pds-popover): update spec test to show popover
QuintonJason Dec 14, 2023
c44a0e4
test(pds-popover): update e2e to not give false negative
QuintonJason Dec 14, 2023
31a9f82
docs(pds-popover): add controls and update demos
QuintonJason Dec 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions libs/core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* It contains typing information for all components that exist in this project.
*/
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
import { OverlayPlacementType } from "./utils/types";
import { TextareaChangeEventDetail } from "./components/pds-textarea/textarea-interface";
export { OverlayPlacementType } from "./utils/types";
export { TextareaChangeEventDetail } from "./components/pds-textarea/textarea-interface";
export namespace Components {
interface PdsAvatar {
Expand Down Expand Up @@ -306,6 +308,39 @@ export namespace Components {
*/
"variant": 'inline' | 'plain';
}
interface PdsPopover {
/**
* A unique identifier used for the underlying component id attribute.
*/
"componentId": string;
/**
* Determines whether or not the popover has an arrow
* @defaultValue true
*/
"hasArrow"?: boolean;
/**
* Hides the popover by disabling the opened property
*/
"hidePopover": () => Promise<void>;
/**
* Determines whether or not the popover is visible
* @defaultValue false
*/
"opened": boolean;
/**
* Determines the preferred position of the popover
* @defaultValue "right"
*/
"placement": OverlayPlacementType;
/**
* Shows the popover by enabling the opened property
*/
"showPopover": () => Promise<void>;
/**
* Toggles the popover visibility on click
*/
"togglePopover": () => Promise<void>;
}
interface PdsProgress {
/**
* Determines whether or not progress is animated.
Expand Down Expand Up @@ -622,6 +657,10 @@ export interface PdsInputCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLPdsInputElement;
}
export interface PdsPopoverCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLPdsPopoverElement;
}
export interface PdsRadioCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLPdsRadioElement;
Expand Down Expand Up @@ -701,6 +740,12 @@ declare global {
prototype: HTMLPdsLinkElement;
new (): HTMLPdsLinkElement;
};
interface HTMLPdsPopoverElement extends Components.PdsPopover, HTMLStencilElement {
}
var HTMLPdsPopoverElement: {
prototype: HTMLPdsPopoverElement;
new (): HTMLPdsPopoverElement;
};
interface HTMLPdsProgressElement extends Components.PdsProgress, HTMLStencilElement {
}
var HTMLPdsProgressElement: {
Expand Down Expand Up @@ -771,6 +816,7 @@ declare global {
"pds-image": HTMLPdsImageElement;
"pds-input": HTMLPdsInputElement;
"pds-link": HTMLPdsLinkElement;
"pds-popover": HTMLPdsPopoverElement;
"pds-progress": HTMLPdsProgressElement;
"pds-radio": HTMLPdsRadioElement;
"pds-sortable": HTMLPdsSortableElement;
Expand Down Expand Up @@ -1098,6 +1144,35 @@ declare namespace LocalJSX {
*/
"variant"?: 'inline' | 'plain';
}
interface PdsPopover {
/**
* A unique identifier used for the underlying component id attribute.
*/
"componentId"?: string;
/**
* Determines whether or not the popover has an arrow
* @defaultValue true
*/
"hasArrow"?: boolean;
/**
* Emitted after a popover is closed
*/
"onPdsPopoverHide"?: (event: PdsPopoverCustomEvent<any>) => void;
/**
* Emitted after a popover is shown
*/
"onPdsPopoverShow"?: (event: PdsPopoverCustomEvent<any>) => void;
/**
* Determines whether or not the popover is visible
* @defaultValue false
*/
"opened"?: boolean;
/**
* Determines the preferred position of the popover
* @defaultValue "right"
*/
"placement"?: OverlayPlacementType;
}
interface PdsProgress {
/**
* Determines whether or not progress is animated.
Expand Down Expand Up @@ -1424,6 +1499,7 @@ declare namespace LocalJSX {
"pds-image": PdsImage;
"pds-input": PdsInput;
"pds-link": PdsLink;
"pds-popover": PdsPopover;
"pds-progress": PdsProgress;
"pds-radio": PdsRadio;
"pds-sortable": PdsSortable;
Expand All @@ -1449,6 +1525,7 @@ declare module "@stencil/core" {
"pds-image": LocalJSX.PdsImage & JSXBase.HTMLAttributes<HTMLPdsImageElement>;
"pds-input": LocalJSX.PdsInput & JSXBase.HTMLAttributes<HTMLPdsInputElement>;
"pds-link": LocalJSX.PdsLink & JSXBase.HTMLAttributes<HTMLPdsLinkElement>;
"pds-popover": LocalJSX.PdsPopover & JSXBase.HTMLAttributes<HTMLPdsPopoverElement>;
"pds-progress": LocalJSX.PdsProgress & JSXBase.HTMLAttributes<HTMLPdsProgressElement>;
"pds-radio": LocalJSX.PdsRadio & JSXBase.HTMLAttributes<HTMLPdsRadioElement>;
"pds-sortable": LocalJSX.PdsSortable & JSXBase.HTMLAttributes<HTMLPdsSortableElement>;
Expand Down
167 changes: 167 additions & 0 deletions libs/core/src/components/pds-popover/pds-popover.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
:host {
display: inline-block;
position: relative;
}

div {
// These custom props are not reachable
--background-color: var(--pine-color-base-white);
--box-shadow: var(--pine-box-shadow-md);
--color: var(--pine-color-neutral-charcoal-400);
--arrow-size: 6px;
--arrow-offset: 14px;

--overlay-border-radius: var(--pine-border-radius-md);
--overlay-font-size: var(--pine-font-size-body-sm);
--overlay-line-height: var(--pine-line-height-sm);
--overlay-min-width: 240px;
--overlay-padding: var(--pine-spacing-xs) 12px;

--arrow-pointing-down: var(--arrow-size) var(--arrow-size) 0;
--arrow-pointing-to-the-right: var(--arrow-size) 0 var(--arrow-size) var(--arrow-size);
--arrow-pointing-to-the-left: var(--arrow-size) var(--arrow-size) var(--arrow-size) 0;
--arrow-pointing-up: 0 var(--arrow-size) var(--arrow-size);
QuintonJason marked this conversation as resolved.
Show resolved Hide resolved
}

.pds-popover__content {
background-color: var(--background-color);
border-radius: var(--overlay-border-radius);
box-shadow: var(--box-shadow);
color: var(--color);
font-size: var(--overlay-font-size);
line-height: var(--overlay-line-height);
min-width: var(--overlay-min-width);
// TODO: need to use block / none but the popover content width and height are needed for calculations
QuintonJason marked this conversation as resolved.
Show resolved Hide resolved
opacity: 0;
padding: var(--overlay-padding);
position: absolute;
visibility: hidden;

.pds-popover--is-open & {
// TODO: need to use block / none but the popover content width and height are needed for calculations
opacity: 1;
visibility: visible;
z-index: 1;
}

:host(.pds-popover--has-html-content) & {
width: auto;
}

&::after {
border-color: transparent;
border-inline-end-color: transparent;
border-style: solid;
border-width: var(--arrow-pointing-to-the-left);
content: '';
height: 0;
position: absolute;
width: 0;

.pds-popover--right & {
border-inline-end-color: var(--background-color);
border-width: var(--arrow-pointing-to-the-left);
inset-block-start: 50%;
inset-inline-start: calc(var(--arrow-size) * -1);
transform: translateY(-50%);
}

.pds-popover--right-end & {
border-inline-end-color: var(--background-color);
border-width: var(--arrow-pointing-to-the-left);
inset-block-end: var(--arrow-offset);
inset-block-start: initial;
inset-inline-start: calc(var(--arrow-size) * -1);
}

.pds-popover--right-start & {
border-inline-end-color: var(--background-color);
border-width: var(--arrow-pointing-to-the-left);
inset-block-start: var(--arrow-offset);
inset-inline-start: calc(var(--arrow-size) * -1);
}

.pds-popover--top & {
border-block-start-color: var(--background-color);
border-width: var(--arrow-pointing-down);
inset-block-end: calc(var(--arrow-size) * -1);
inset-block-start: initial;
inset-inline-start: 50%;
transform: translateX(-50%);
}

.pds-popover--top-start & {
border-block-start-color: var(--background-color);
border-width: var(--arrow-pointing-down);
inset-block-end: calc(var(--arrow-size) * -1);
inset-block-start: initial;
inset-inline-start: var(--arrow-offset);
}

.pds-popover--top-end & {
border-block-start-color: var(--background-color);
border-width: var(--arrow-pointing-down);
inset-block-end: calc(var(--arrow-size) * -1);
inset-block-start: initial;
inset-inline-end: var(--arrow-offset);
inset-inline-start: initial;
}

.pds-popover--left & {
border-inline-start-color: var(--background-color);
border-width: var(--arrow-pointing-to-the-right);
inset-block-start: 50%;
inset-inline-end: calc(var(--arrow-size) * -1);
inset-inline-start: initial;
transform: translateY(-50%);
}

.pds-popover--left-end & {
border-inline-start-color: var(--background-color);
border-width: var(--arrow-pointing-to-the-right);
bottom: var(--arrow-offset);
inset-block-start: initial;
inset-inline-end: calc(var(--arrow-size) * -1);
inset-inline-start: initial;
}

.pds-popover--left-start & {
border-inline-start-color: var(--background-color);
border-width: var(--arrow-pointing-to-the-right);
inset-block-start: var(--arrow-offset);
inset-inline-end: calc(var(--arrow-size) * -1);
inset-inline-start: initial;
}

.pds-popover--bottom & {
border-block-end-color: var(--background-color);
border-width: var(--arrow-pointing-up);
inset-block-start: calc(var(--arrow-size) * -1);
inset-inline-start: 50%;
transform: translateX(-50%);
}

.pds-popover--bottom-end & {
border-block-end-color: var(--background-color);
border-width: var(--arrow-pointing-up);
inset-block-start: calc(var(--arrow-size) * -1);
inset-inline-end: var(--arrow-offset);
inset-inline-start: initial;
}

.pds-popover--bottom-start & {
border-block-end-color: var(--background-color);
border-width: var(--arrow-pointing-up);
inset-block-start: calc(var(--arrow-size) * -1);
inset-inline-start: var(--arrow-offset);
}

.pds-popover--no-arrow & {
border-width: 0;
}
}
}

.pds-popover__trigger {
display: inline-block;
}
Loading
Loading