@pine-ds/core 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/custom-elements.d.ts +2 -0
- package/components/index.d.ts +92 -0
- package/components/index.js +32 -0
- package/components/index.js.map +1 -0
- package/components/index2.js +14 -0
- package/components/index2.js.map +1 -0
- package/components/package.json +9 -0
- package/components/pds-accordion.d.ts +11 -0
- package/components/pds-accordion.js +74 -0
- package/components/pds-accordion.js.map +1 -0
- package/components/pds-avatar.d.ts +11 -0
- package/components/pds-avatar.js +103 -0
- package/components/pds-avatar.js.map +1 -0
- package/components/pds-box.d.ts +11 -0
- package/components/pds-box.js +124 -0
- package/components/pds-box.js.map +1 -0
- package/components/pds-button.d.ts +11 -0
- package/components/pds-button.js +8 -0
- package/components/pds-button.js.map +1 -0
- package/components/pds-button2.js +84 -0
- package/components/pds-button2.js.map +1 -0
- package/components/pds-checkbox.d.ts +11 -0
- package/components/pds-checkbox.js +8 -0
- package/components/pds-checkbox.js.map +1 -0
- package/components/pds-checkbox2.js +86 -0
- package/components/pds-checkbox2.js.map +1 -0
- package/components/pds-chip.d.ts +11 -0
- package/components/pds-chip.js +78 -0
- package/components/pds-chip.js.map +1 -0
- package/components/pds-copytext.d.ts +11 -0
- package/components/pds-copytext.js +88 -0
- package/components/pds-copytext.js.map +1 -0
- package/components/pds-divider.d.ts +11 -0
- package/components/pds-divider.js +54 -0
- package/components/pds-divider.js.map +1 -0
- package/components/pds-icon.js +8 -0
- package/components/pds-icon.js.map +1 -0
- package/components/pds-icon2.js +359 -0
- package/components/pds-icon2.js.map +1 -0
- package/components/pds-image.d.ts +11 -0
- package/components/pds-image.js +55 -0
- package/components/pds-image.js.map +1 -0
- package/components/pds-input.d.ts +11 -0
- package/components/pds-input.js +72 -0
- package/components/pds-input.js.map +1 -0
- package/components/pds-label.js +39 -0
- package/components/pds-label.js.map +1 -0
- package/components/pds-link.d.ts +11 -0
- package/components/pds-link.js +65 -0
- package/components/pds-link.js.map +1 -0
- package/components/pds-progress.d.ts +11 -0
- package/components/pds-progress.js +49 -0
- package/components/pds-progress.js.map +1 -0
- package/components/pds-radio.d.ts +11 -0
- package/components/pds-radio.js +78 -0
- package/components/pds-radio.js.map +1 -0
- package/components/pds-row.d.ts +11 -0
- package/components/pds-row.js +72 -0
- package/components/pds-row.js.map +1 -0
- package/components/pds-sortable-item.d.ts +11 -0
- package/components/pds-sortable-item.js +58 -0
- package/components/pds-sortable-item.js.map +1 -0
- package/components/pds-sortable.d.ts +11 -0
- package/components/pds-sortable.js +2722 -0
- package/components/pds-sortable.js.map +1 -0
- package/components/pds-switch.d.ts +11 -0
- package/components/pds-switch.js +82 -0
- package/components/pds-switch.js.map +1 -0
- package/components/pds-tab.d.ts +11 -0
- package/components/pds-tab.js +53 -0
- package/components/pds-tab.js.map +1 -0
- package/components/pds-table-body.d.ts +11 -0
- package/components/pds-table-body.js +36 -0
- package/components/pds-table-body.js.map +1 -0
- package/components/pds-table-cell.d.ts +11 -0
- package/components/pds-table-cell.js +8 -0
- package/components/pds-table-cell.js.map +1 -0
- package/components/pds-table-cell2.js +72 -0
- package/components/pds-table-cell2.js.map +1 -0
- package/components/pds-table-head-cell.d.ts +11 -0
- package/components/pds-table-head-cell.js +8 -0
- package/components/pds-table-head-cell.js.map +1 -0
- package/components/pds-table-head-cell2.js +96 -0
- package/components/pds-table-head-cell2.js.map +1 -0
- package/components/pds-table-head.d.ts +11 -0
- package/components/pds-table-head.js +56 -0
- package/components/pds-table-head.js.map +1 -0
- package/components/pds-table-row.d.ts +11 -0
- package/components/pds-table-row.js +78 -0
- package/components/pds-table-row.js.map +1 -0
- package/components/pds-table.d.ts +11 -0
- package/components/pds-table.js +100 -0
- package/components/pds-table.js.map +1 -0
- package/components/pds-tabpanel.d.ts +11 -0
- package/components/pds-tabpanel.js +45 -0
- package/components/pds-tabpanel.js.map +1 -0
- package/components/pds-tabs.d.ts +11 -0
- package/components/pds-tabs.js +119 -0
- package/components/pds-tabs.js.map +1 -0
- package/components/pds-textarea.d.ts +11 -0
- package/components/pds-textarea.js +82 -0
- package/components/pds-textarea.js.map +1 -0
- package/components/pds-tooltip.d.ts +11 -0
- package/components/pds-tooltip.js +178 -0
- package/components/pds-tooltip.js.map +1 -0
- package/dist/docs.json +1 -1
- package/hydrate/index.d.ts +218 -0
- package/hydrate/index.js +13120 -0
- package/hydrate/package.json +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const positionTooltip = ({ elem, elemPlacement, overlay, offset = 8 }) => {
|
|
4
|
+
if (elem == undefined)
|
|
5
|
+
return;
|
|
6
|
+
const rect = elem.getBoundingClientRect();
|
|
7
|
+
const contentRect = overlay.getBoundingClientRect();
|
|
8
|
+
// Exit the function if the placement is not set
|
|
9
|
+
if (!elemPlacement || elemPlacement == "")
|
|
10
|
+
return;
|
|
11
|
+
switch (true) {
|
|
12
|
+
case elemPlacement.includes("right"):
|
|
13
|
+
overlay.style.top = '50%';
|
|
14
|
+
overlay.style.left = `calc(${rect.width}px + ${offset}px)`;
|
|
15
|
+
overlay.style.transform = 'translateY(-50%)';
|
|
16
|
+
if (elemPlacement.includes("start")) {
|
|
17
|
+
overlay.style.top = '0';
|
|
18
|
+
overlay.style.transform = 'translateY(0)';
|
|
19
|
+
}
|
|
20
|
+
if (elemPlacement.includes("end")) {
|
|
21
|
+
overlay.style.bottom = '0';
|
|
22
|
+
overlay.style.top = 'initial';
|
|
23
|
+
overlay.style.transform = 'translateY(0)';
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
case elemPlacement.includes("left"):
|
|
27
|
+
overlay.style.top = '50%';
|
|
28
|
+
overlay.style.right = `calc(${rect.width}px + ${offset}px)`;
|
|
29
|
+
overlay.style.transform = 'translateY(-50%)';
|
|
30
|
+
if (elemPlacement.includes("start")) {
|
|
31
|
+
overlay.style.top = '0';
|
|
32
|
+
overlay.style.transform = 'translateY(0)';
|
|
33
|
+
}
|
|
34
|
+
if (elemPlacement.includes("end")) {
|
|
35
|
+
overlay.style.bottom = '0';
|
|
36
|
+
overlay.style.top = 'initial';
|
|
37
|
+
overlay.style.transform = 'translateY(0)';
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
case elemPlacement.includes("bottom"):
|
|
41
|
+
overlay.style.top = `calc(${rect.height}px + ${offset}px)`;
|
|
42
|
+
overlay.style.left = '50%';
|
|
43
|
+
overlay.style.transform = 'translateX(-50%)';
|
|
44
|
+
if (elemPlacement.includes("start")) {
|
|
45
|
+
overlay.style.left = '0';
|
|
46
|
+
overlay.style.transform = 'translateX(0)';
|
|
47
|
+
}
|
|
48
|
+
if (elemPlacement.includes("end")) {
|
|
49
|
+
overlay.style.left = 'initial';
|
|
50
|
+
overlay.style.right = '0';
|
|
51
|
+
overlay.style.transform = 'translateX(0)';
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
case elemPlacement.includes("top"):
|
|
55
|
+
overlay.style.top = `calc((${contentRect.height}px + ${offset}px) * -1)`;
|
|
56
|
+
overlay.style.left = '50%';
|
|
57
|
+
overlay.style.transform = 'translateX(-50%)';
|
|
58
|
+
if (elemPlacement.includes("start")) {
|
|
59
|
+
overlay.style.left = '0';
|
|
60
|
+
overlay.style.transform = 'translateX(0)';
|
|
61
|
+
}
|
|
62
|
+
if (elemPlacement.includes("end")) {
|
|
63
|
+
overlay.style.left = 'initial';
|
|
64
|
+
overlay.style.right = '0';
|
|
65
|
+
overlay.style.transform = 'translateX(0)';
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const pdsTooltipCss = ":host{--border-radius-overlay:var(--pine-border-radius-125);--border-width-arrow-down:var(--sizing-arrow-default) var(--sizing-arrow-default) 0;--border-width-arrow-left:var(--sizing-arrow-default) var(--sizing-arrow-default) var(--sizing-arrow-default) 0;--border-width-arrow-right:var(--sizing-arrow-default) 0 var(--sizing-arrow-default) var(--sizing-arrow-default);--border-width-arrow-up:0 var(--sizing-arrow-default) var(--sizing-arrow-default);--box-shadow-default:var(--pine-box-shadow-md);--color-background-default:var(--pine-color-charcoal-400);--color-text-default:var(--pine-color-white);--font-size-overlay:var(--pine-font-size-087);--line-height-overlay:var(--pine-line-height-125);--sizing-arrow-default:6px;--sizing-arrow-offset:14px;--sizing-width-default:320px;--spacing-padding-overlay:var(--pine-spacing-100) calc(var(--pine-spacing-300) / 2);display:inline-block;position:relative}:host ::slotted([slot=content]){white-space:normal;width:var(--sizing-width-default)}.pds-tooltip__content{background-color:var(--color-background-default);border-radius:var(--border-radius-overlay);-webkit-box-shadow:var(--box-shadow-default);box-shadow:var(--box-shadow-default);color:var(--color-text-default);font-size:var(--font-size-overlay);line-height:var(--line-height-overlay);opacity:0;padding:var(--spacing-padding-overlay);position:absolute;visibility:hidden;width:-webkit-max-content;width:-moz-max-content;width:max-content}.pds-tooltip--is-open .pds-tooltip__content{opacity:1;visibility:visible;z-index:1}:host(.pds-tooltip--has-html-content) .pds-tooltip__content{width:auto}.pds-tooltip__content::after{border-color:transparent;border-right-color:transparent;border-style:solid;border-width:var(--border-width-arrow-left);content:\"\";height:0;position:absolute;width:0}.pds-tooltip--right .pds-tooltip__content::after{border-inline-end-color:var(--color-background-default);border-width:var(--border-width-arrow-left);left:calc(var(--sizing-arrow-default) * -1);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.pds-tooltip--right-end .pds-tooltip__content::after{border-inline-end-color:var(--color-background-default);border-width:var(--border-width-arrow-left);bottom:var(--sizing-arrow-offset);left:calc(var(--sizing-arrow-default) * -1);top:initial}.pds-tooltip--right-start .pds-tooltip__content::after{border-inline-end-color:var(--color-background-default);border-width:var(--border-width-arrow-left);left:calc(var(--sizing-arrow-default) * -1);top:var(--sizing-arrow-offset)}.pds-tooltip--top .pds-tooltip__content::after{border-block-start-color:var(--color-background-default);border-width:var(--border-width-arrow-down);bottom:calc(var(--sizing-arrow-default) * -1);left:50%;top:initial;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.pds-tooltip--top-start .pds-tooltip__content::after{border-block-start-color:var(--color-background-default);border-width:var(--border-width-arrow-down);bottom:calc(var(--sizing-arrow-default) * -1);left:var(--sizing-arrow-offset);top:initial}.pds-tooltip--top-end .pds-tooltip__content::after{border-block-start-color:var(--color-background-default);border-width:var(--border-width-arrow-down);bottom:calc(var(--sizing-arrow-default) * -1);left:initial;right:var(--sizing-arrow-offset);top:initial}.pds-tooltip--left .pds-tooltip__content::after{border-inline-start-color:var(--color-background-default);border-width:var(--border-width-arrow-right);left:initial;right:calc(var(--sizing-arrow-default) * -1);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.pds-tooltip--left-end .pds-tooltip__content::after{border-inline-start-color:var(--color-background-default);border-width:var(--border-width-arrow-right);bottom:var(--sizing-arrow-offset);left:initial;right:calc(var(--sizing-arrow-default) * -1);top:initial}.pds-tooltip--left-start .pds-tooltip__content::after{border-inline-start-color:var(--color-background-default);border-width:var(--border-width-arrow-right);left:initial;right:calc(var(--sizing-arrow-default) * -1);top:var(--sizing-arrow-offset)}.pds-tooltip--bottom .pds-tooltip__content::after{border-block-end-color:var(--color-background-default);border-width:var(--border-width-arrow-up);left:50%;top:calc(var(--sizing-arrow-default) * -1);-webkit-transform:translateX(-50%);transform:translateX(-50%)}.pds-tooltip--bottom-end .pds-tooltip__content::after{border-block-end-color:var(--color-background-default);border-width:var(--border-width-arrow-up);left:initial;right:var(--sizing-arrow-offset);top:calc(var(--sizing-arrow-default) * -1)}.pds-tooltip--bottom-start .pds-tooltip__content::after{border-block-end-color:var(--color-background-default);border-width:var(--border-width-arrow-up);left:var(--sizing-arrow-offset);top:calc(var(--sizing-arrow-default) * -1)}.pds-tooltip--no-arrow .pds-tooltip__content::after{border-width:0}";
|
|
72
|
+
const PdsTooltipStyle0 = pdsTooltipCss;
|
|
73
|
+
|
|
74
|
+
const PdsTooltip$1 = /*@__PURE__*/ proxyCustomElement(class PdsTooltip extends HTMLElement {
|
|
75
|
+
constructor() {
|
|
76
|
+
super();
|
|
77
|
+
this.__registerHost();
|
|
78
|
+
this.__attachShadow();
|
|
79
|
+
this.pdsTooltipHide = createEvent(this, "pdsTooltipHide", 7);
|
|
80
|
+
this.pdsTooltipShow = createEvent(this, "pdsTooltipShow", 7);
|
|
81
|
+
this.handleHide = () => {
|
|
82
|
+
this.hideTooltip();
|
|
83
|
+
this.pdsTooltipHide.emit();
|
|
84
|
+
};
|
|
85
|
+
this.handleShow = () => {
|
|
86
|
+
this.showTooltip();
|
|
87
|
+
this.pdsTooltipShow.emit();
|
|
88
|
+
};
|
|
89
|
+
this.isOpen = false;
|
|
90
|
+
this.content = undefined;
|
|
91
|
+
this.componentId = undefined;
|
|
92
|
+
this.hasArrow = true;
|
|
93
|
+
this.htmlContent = false;
|
|
94
|
+
this.placement = 'right';
|
|
95
|
+
this.opened = false;
|
|
96
|
+
}
|
|
97
|
+
handleOpenToggle() {
|
|
98
|
+
if (this.opened) {
|
|
99
|
+
this.handleShow();
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
this.handleHide();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
componentWillLoad() {
|
|
106
|
+
if (this.opened) {
|
|
107
|
+
this.showTooltip();
|
|
108
|
+
}
|
|
109
|
+
this.el.addEventListener('blur', this.handleHide, true);
|
|
110
|
+
this.el.addEventListener('focus', this.handleShow, true);
|
|
111
|
+
}
|
|
112
|
+
componentDidUpdate() {
|
|
113
|
+
if (this.opened) {
|
|
114
|
+
this.showTooltip();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
componentDidRender() {
|
|
118
|
+
positionTooltip({ elem: this.el, elemPlacement: this.placement, overlay: this.contentEl });
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Shows the tooltip by enabling the opened property
|
|
122
|
+
*/
|
|
123
|
+
async showTooltip() {
|
|
124
|
+
this.opened = true;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Hides the tooltip by disabling the opened property
|
|
128
|
+
*/
|
|
129
|
+
async hideTooltip() {
|
|
130
|
+
this.opened = false;
|
|
131
|
+
}
|
|
132
|
+
render() {
|
|
133
|
+
return (h(Host, { key: '088766be31b8716e158cbffd4afc4ada0f14dc3d', onMouseEnter: this.handleShow, onMouseLeave: this.handleHide, onFocusin: this.handleShow, onFocusout: this.handleHide }, h("div", { key: 'c4fb29b5d5834a9e94f040ded6daf15cf3fcc6ff', class: `
|
|
134
|
+
pds-tooltip
|
|
135
|
+
pds-tooltip--${this.placement}
|
|
136
|
+
${this.htmlContent ? 'pds-tooltip--has-html-content' : ''}
|
|
137
|
+
${this.opened ? 'pds-tooltip--is-open' : ''}
|
|
138
|
+
${this.hasArrow ? '' : 'pds-tooltip--no-arrow'}
|
|
139
|
+
` }, h("span", { key: '25a69f567a33df83ff784d36de5bce86874d6d1d', "aria-describedby": this.componentId, class: "pds-tooltip__trigger" }, h("slot", { key: 'eab3bbca9b913b04ef4dfe7a8e472c43d57c4979' })), h("div", { key: 'bdaa9f26f848b440a8432a44481f8a1059ae0689', class: "pds-tooltip__content", "aria-hidden": this.opened ? 'false' : 'true', "aria-live": this.opened ? 'polite' : 'off', id: this.componentId, ref: (el) => (this.contentEl = el), role: "tooltip" }, h("slot", { key: '0e62fe237e9a39208aa2146e2dc1d6df6b25b41d', name: "content" }), this.content))));
|
|
140
|
+
}
|
|
141
|
+
get el() { return this; }
|
|
142
|
+
static get watchers() { return {
|
|
143
|
+
"opened": ["handleOpenToggle"]
|
|
144
|
+
}; }
|
|
145
|
+
static get style() { return PdsTooltipStyle0; }
|
|
146
|
+
}, [1, "pds-tooltip", {
|
|
147
|
+
"content": [1],
|
|
148
|
+
"componentId": [1, "component-id"],
|
|
149
|
+
"hasArrow": [4, "has-arrow"],
|
|
150
|
+
"htmlContent": [4, "html-content"],
|
|
151
|
+
"placement": [513],
|
|
152
|
+
"opened": [1540],
|
|
153
|
+
"isOpen": [32],
|
|
154
|
+
"showTooltip": [64],
|
|
155
|
+
"hideTooltip": [64]
|
|
156
|
+
}, undefined, {
|
|
157
|
+
"opened": ["handleOpenToggle"]
|
|
158
|
+
}]);
|
|
159
|
+
function defineCustomElement$1() {
|
|
160
|
+
if (typeof customElements === "undefined") {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const components = ["pds-tooltip"];
|
|
164
|
+
components.forEach(tagName => { switch (tagName) {
|
|
165
|
+
case "pds-tooltip":
|
|
166
|
+
if (!customElements.get(tagName)) {
|
|
167
|
+
customElements.define(tagName, PdsTooltip$1);
|
|
168
|
+
}
|
|
169
|
+
break;
|
|
170
|
+
} });
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const PdsTooltip = PdsTooltip$1;
|
|
174
|
+
const defineCustomElement = defineCustomElement$1;
|
|
175
|
+
|
|
176
|
+
export { PdsTooltip, defineCustomElement };
|
|
177
|
+
|
|
178
|
+
//# sourceMappingURL=pds-tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"pds-tooltip.js","mappings":";;AAOO,MAAM,eAAe,GAAG,CAAC,EAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,EAAc;IACrF,IAAI,IAAI,IAAI,SAAS;QAAE,OAAO;IAE9B,MAAM,IAAI,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC1C,MAAM,WAAW,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;;IAGpD,IAAI,CAAC,aAAa,IAAI,aAAa,IAAI,EAAE;QAAE,OAAO;IAElD,QAAQ,IAAI;QACV,KAAK,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC;YAClC,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC;YAC1B,OAAO,CAAC,KAAK,CAAC,IAAI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IAAI,CAAC;KACpB;;;;IAMD,MAAM,WAAW;QACf,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;KACrB;IAYD,MAAM;QACJ,QACE,EAAC,IAAI,qDACH,YAAY,EAAE,IAAI,CAAC,UAAU,EAC7B,YAAY,EAAE,IAAI,CAAC,UAAU,EAC7B,SAAS,EAAE,IAAI,CAAC,UAAU,EAC1B,UAAU,EAAE,IAAI,CAAC,UAAU,IAE3B,4DACE,KAAK,EAAE;;2BAEU,IAAI,CAAC,SAAS;cAC3B,IAAI,CAAC,WAAW,GAAG,+BAA+B,GAAG,EAAE;cACvD,IAAI,CAAC,MAAM,GAAG,sBAAsB,GAAG,EAAE;cACzC,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG,uBAAuB;WAC/C,IAED,iFACoB,IAAI,CAAC,WAAW,EAClC,KAAK,EAAC,sBAAsB,IAE5B,8DAAQ,CACH,EAEP,4DAAK,KAAK,EAAC,sBAAsB,iBAClB,IAAI,CAAC,MAAM,GAAG,OAAO,GAAG,MAAM,eAChC,IAAI,CAAC,MAAM,GAAG,QAAQ,GAAG,KAAK,EACzC,EAAE,EAAE,IAAI,CAAC,WAAW,EACpB,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,EAClC,IAAI,EAAC,SAAS,IAEd,6DACE,IAAI,EAAC,SAAS,GACR,EACP,IAAI,CAAC,OAAO,CACT,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["PdsTooltip"],"sources":["src/utils/overlay.ts","src/components/pds-tooltip/pds-tooltip.scss?tag=pds-tooltip&encapsulation=shadow","src/components/pds-tooltip/pds-tooltip.tsx"],"sourcesContent":["interface OverlayArgs {\n elem: HTMLElement;\n elemPlacement: string;\n overlay: HTMLElement;\n offset?: number;\n}\n\nexport const positionTooltip = ({elem, elemPlacement, overlay, offset = 8}: OverlayArgs) => {\n if (elem == undefined) return;\n\n const rect = elem.getBoundingClientRect();\n const contentRect = overlay.getBoundingClientRect();\n\n // Exit the function if the placement is not set\n if (!elemPlacement || elemPlacement == \"\") return;\n\n switch (true) {\n case elemPlacement.includes(\"right\"):\n overlay.style.top = '50%';\n overlay.style.left = `calc(${rect.width}px + ${offset}px)`;\n overlay.style.transform = 'translateY(-50%)';\n\n if (elemPlacement.includes(\"start\")) {\n overlay.style.top = '0';\n overlay.style.transform = 'translateY(0)';\n }\n\n if (elemPlacement.includes(\"end\")) {\n overlay.style.bottom = '0';\n overlay.style.top = 'initial';\n overlay.style.transform = 'translateY(0)';\n }\n\n break;\n\n case elemPlacement.includes(\"left\"):\n overlay.style.top = '50%';\n overlay.style.right = `calc(${rect.width}px + ${offset}px)`;\n overlay.style.transform = 'translateY(-50%)';\n\n if (elemPlacement.includes(\"start\")) {\n overlay.style.top = '0';\n overlay.style.transform = 'translateY(0)';\n }\n\n if (elemPlacement.includes(\"end\")) {\n overlay.style.bottom = '0';\n overlay.style.top = 'initial';\n overlay.style.transform = 'translateY(0)';\n }\n\n break;\n\n case elemPlacement.includes(\"bottom\"):\n overlay.style.top = `calc(${rect.height}px + ${offset}px)`;\n overlay.style.left = '50%';\n overlay.style.transform = 'translateX(-50%)';\n\n if (elemPlacement.includes(\"start\")) {\n overlay.style.left = '0';\n overlay.style.transform = 'translateX(0)';\n }\n\n if (elemPlacement.includes(\"end\")) {\n overlay.style.left = 'initial';\n overlay.style.right = '0';\n overlay.style.transform = 'translateX(0)';\n }\n\n break;\n\n case elemPlacement.includes(\"top\"):\n overlay.style.top = `calc((${contentRect.height}px + ${offset}px) * -1)`;\n overlay.style.left = '50%';\n overlay.style.transform = 'translateX(-50%)';\n\n if (elemPlacement.includes(\"start\")) {\n overlay.style.left = '0';\n overlay.style.transform = 'translateX(0)';\n }\n if (elemPlacement.includes(\"end\")) {\n overlay.style.left = 'initial';\n overlay.style.right = '0';\n overlay.style.transform = 'translateX(0)';\n }\n\n break;\n }\n}\n",":host {\n --border-radius-overlay: var(--pine-border-radius-125);\n\n --border-width-arrow-down: var(--sizing-arrow-default) var(--sizing-arrow-default) 0;\n --border-width-arrow-left: var(--sizing-arrow-default) var(--sizing-arrow-default) var(--sizing-arrow-default) 0;\n --border-width-arrow-right: var(--sizing-arrow-default) 0 var(--sizing-arrow-default) var(--sizing-arrow-default);\n --border-width-arrow-up: 0 var(--sizing-arrow-default) var(--sizing-arrow-default);\n\n --box-shadow-default: var(--pine-box-shadow-md);\n\n --color-background-default: var(--pine-color-charcoal-400);\n --color-text-default: var(--pine-color-white);\n\n --font-size-overlay: var(--pine-font-size-087);\n\n --line-height-overlay: var(--pine-line-height-125);\n\n --sizing-arrow-default: 6px;\n --sizing-arrow-offset: 14px;\n --sizing-width-default: 320px;\n\n --spacing-padding-overlay: var(--pine-spacing-100) calc(var(--pine-spacing-300) / 2);\n\n display: inline-block;\n position: relative;\n\n ::slotted([slot=\"content\"]) {\n white-space: normal;\n width: var(--sizing-width-default);\n }\n}\n\n.pds-tooltip__content {\n background-color: var(--color-background-default);\n border-radius: var(--border-radius-overlay);\n box-shadow: var(--box-shadow-default);\n color: var(--color-text-default);\n font-size: var(--font-size-overlay);\n line-height: var(--line-height-overlay);\n // TODO: need to use block / none but the tooltip content width and height are needed for calculations\n opacity: 0;\n padding: var(--spacing-padding-overlay);\n position: absolute;\n visibility: hidden;\n width: max-content;\n\n .pds-tooltip--is-open & {\n // TODO: need to use block / none but the tooltip content width and height are needed for calculations\n opacity: 1;\n visibility: visible;\n z-index: 1;\n }\n\n :host(.pds-tooltip--has-html-content) & {\n width: auto;\n }\n\n &::after {\n border-color: transparent;\n border-right-color: transparent;\n border-style: solid;\n border-width: var(--border-width-arrow-left);\n content: '';\n height: 0;\n position: absolute;\n width: 0;\n\n .pds-tooltip--right & {\n border-inline-end-color: var(--color-background-default);\n border-width: var(--border-width-arrow-left);\n left: calc(var(--sizing-arrow-default) * -1);\n top: 50%;\n transform: translateY(-50%);\n }\n\n .pds-tooltip--right-end & {\n border-inline-end-color: var(--color-background-default);\n border-width: var(--border-width-arrow-left);\n bottom: var(--sizing-arrow-offset);\n left: calc(var(--sizing-arrow-default) * -1);\n top: initial;\n }\n\n .pds-tooltip--right-start & {\n border-inline-end-color: var(--color-background-default);\n border-width: var(--border-width-arrow-left);\n left: calc(var(--sizing-arrow-default) * -1);\n top: var(--sizing-arrow-offset);\n }\n\n .pds-tooltip--top & {\n border-block-start-color: var(--color-background-default);\n border-width: var(--border-width-arrow-down);\n bottom: calc(var(--sizing-arrow-default) * -1);\n left: 50%;\n top: initial;\n transform: translateX(-50%);\n }\n\n .pds-tooltip--top-start & {\n border-block-start-color: var(--color-background-default);\n border-width: var(--border-width-arrow-down);\n bottom: calc(var(--sizing-arrow-default) * -1);\n left: var(--sizing-arrow-offset);\n top: initial;\n }\n\n .pds-tooltip--top-end & {\n border-block-start-color: var(--color-background-default);\n border-width: var(--border-width-arrow-down);\n bottom: calc(var(--sizing-arrow-default) * -1);\n left: initial;\n right: var(--sizing-arrow-offset);\n top: initial;\n }\n\n .pds-tooltip--left & {\n border-inline-start-color: var(--color-background-default);\n border-width: var(--border-width-arrow-right);\n left: initial;\n right: calc(var(--sizing-arrow-default) * -1);\n top: 50%;\n transform: translateY(-50%);\n }\n\n .pds-tooltip--left-end & {\n border-inline-start-color: var(--color-background-default);\n border-width: var(--border-width-arrow-right);\n bottom: var(--sizing-arrow-offset);\n left: initial;\n right: calc(var(--sizing-arrow-default) * -1);\n top: initial;\n }\n\n .pds-tooltip--left-start & {\n border-inline-start-color: var(--color-background-default);\n border-width: var(--border-width-arrow-right);\n left: initial;\n right: calc(var(--sizing-arrow-default) * -1);\n top: var(--sizing-arrow-offset);\n }\n\n .pds-tooltip--bottom & {\n border-block-end-color: var(--color-background-default);\n border-width: var(--border-width-arrow-up);\n left: 50%;\n top: calc(var(--sizing-arrow-default) * -1);\n transform: translateX(-50%);\n }\n\n .pds-tooltip--bottom-end & {\n border-block-end-color: var(--color-background-default);\n border-width: var(--border-width-arrow-up);\n left: initial;\n right: var(--sizing-arrow-offset);\n top: calc(var(--sizing-arrow-default) * -1);\n }\n\n .pds-tooltip--bottom-start & {\n border-block-end-color: var(--color-background-default);\n border-width: var(--border-width-arrow-up);\n left: var(--sizing-arrow-offset);\n top: calc(var(--sizing-arrow-default) * -1);\n }\n\n .pds-tooltip--no-arrow & {\n border-width: 0;\n }\n }\n}\n","import { Component, Element, Event, Host, Prop, State, h, EventEmitter, Method, Watch } from '@stencil/core';\nimport {\n positionTooltip\n} from '../../utils/overlay';\n\n/**\n * @slot (default) - The tooltip's target element\n * @slot content - HTML content for the tooltip\n */\n\n@Component({\n tag: 'pds-tooltip',\n styleUrl: 'pds-tooltip.scss',\n shadow: true,\n})\nexport class PdsTooltip {\n private contentEl: HTMLElement | null;\n\n /**\n * Reference to the Host element\n */\n @Element() el: HTMLPdsTooltipElement;\n\n /**\n * Determines when the tooltip is open\n * @defaultValue false\n */\n @State() isOpen = false;\n\n /**\n * Content for the tooltip. If HTML is required, use the content slot\n */\n @Prop() content: string;\n\n /**\n * A unique identifier used for the underlying component `id` attribute.\n */\n @Prop() componentId: string;\n\n /**\n * Determines whether or not the tooltip has an arrow\n * @defaultValue true\n */\n @Prop() hasArrow? = true;\n\n /**\n * Enable this option when using the content slot\n * @defaultValue false\n */\n @Prop() htmlContent = false;\n\n /**\n * Determines the preferred position of the tooltip\n * @defaultValue \"right\"\n */\n @Prop({ reflect: true }) placement:\n 'top'\n | 'top-start'\n | 'top-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end' = 'right';\n\n /**\n * Determines whether or not the tooltip is visible\n * @defaultValue false\n */\n @Prop({mutable: true, reflect: true}) opened = false;\n\n @Watch('opened')\n handleOpenToggle() {\n if (this.opened) {\n this.handleShow();\n } else {\n this.handleHide();\n }\n }\n\n /**\n * Emitted after a tooltip is closed\n */\n @Event() pdsTooltipHide: EventEmitter;\n\n /**\n * Emitted after a tooltip is shown\n */\n @Event() pdsTooltipShow: EventEmitter;\n\n componentWillLoad() {\n if (this.opened) {\n this.showTooltip();\n }\n\n this.el.addEventListener('blur', this.handleHide, true);\n this.el.addEventListener('focus', this.handleShow, true);\n }\n\n componentDidUpdate() {\n if (this.opened) {\n this.showTooltip();\n }\n }\n\n componentDidRender() {\n positionTooltip({elem: this.el, elemPlacement: this.placement, overlay: this.contentEl});\n }\n\n /**\n * Shows the tooltip by enabling the opened property\n */\n @Method()\n async showTooltip() {\n this.opened = true;\n }\n\n /**\n * Hides the tooltip by disabling the opened property\n */\n @Method()\n async hideTooltip() {\n this.opened = false;\n }\n\n private handleHide = () => {\n this.hideTooltip();\n this.pdsTooltipHide.emit();\n };\n\n private handleShow = () => {\n this.showTooltip();\n this.pdsTooltipShow.emit();\n };\n\n render() {\n return (\n <Host\n onMouseEnter={this.handleShow}\n onMouseLeave={this.handleHide}\n onFocusin={this.handleShow}\n onFocusout={this.handleHide}\n >\n <div\n class={`\n pds-tooltip\n pds-tooltip--${this.placement}\n ${this.htmlContent ? 'pds-tooltip--has-html-content' : ''}\n ${this.opened ? 'pds-tooltip--is-open' : ''}\n ${this.hasArrow ? '' : 'pds-tooltip--no-arrow'}\n `}\n >\n <span\n aria-describedby={this.componentId}\n class=\"pds-tooltip__trigger\"\n >\n <slot />\n </span>\n\n <div class=\"pds-tooltip__content\"\n aria-hidden={this.opened ? 'false' : 'true'}\n aria-live={this.opened ? 'polite' : 'off'}\n id={this.componentId}\n ref={(el) => (this.contentEl = el)}\n role=\"tooltip\"\n >\n <slot\n name=\"content\"\n ></slot>\n {this.content}\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
package/dist/docs.json
CHANGED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.3.1
|
|
2
|
+
|
|
3
|
+
export declare function createWindowFromHtml(templateHtml: string, uniqueId: string): any;
|
|
4
|
+
export interface HydrateDocumentOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Build ID that will be added to `<html data-stencil-build="BUILD_ID">`. By default
|
|
7
|
+
* a random ID will be generated
|
|
8
|
+
*/
|
|
9
|
+
buildId?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Sets the `href` attribute on the `<link rel="canonical">`
|
|
12
|
+
* tag within the `<head>`. If the value is not defined it will
|
|
13
|
+
* ensure a canonical link tag is no included in the `<head>`.
|
|
14
|
+
*/
|
|
15
|
+
canonicalUrl?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Include the HTML comments and attributes used by the client-side
|
|
18
|
+
* JavaScript to read the structure of the HTML and rebuild each
|
|
19
|
+
* component. Defaults to `true`.
|
|
20
|
+
*/
|
|
21
|
+
clientHydrateAnnotations?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Constrain `setTimeout()` to 1ms, but still async. Also
|
|
24
|
+
* only allows `setInterval()` to fire once, also constrained to 1ms.
|
|
25
|
+
* Defaults to `true`.
|
|
26
|
+
*/
|
|
27
|
+
constrainTimeouts?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Sets `document.cookie`
|
|
30
|
+
*/
|
|
31
|
+
cookie?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Sets the `dir` attribute on the top level `<html>`.
|
|
34
|
+
*/
|
|
35
|
+
direction?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Component tag names listed here will not be prerendered, nor will
|
|
38
|
+
* hydrated on the client-side. Components listed here will be ignored
|
|
39
|
+
* as custom elements and treated no differently than a `<div>`.
|
|
40
|
+
*/
|
|
41
|
+
excludeComponents?: string[];
|
|
42
|
+
/**
|
|
43
|
+
* Sets the `lang` attribute on the top level `<html>`.
|
|
44
|
+
*/
|
|
45
|
+
language?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Maximum number of components to hydrate on one page. Defaults to `300`.
|
|
48
|
+
*/
|
|
49
|
+
maxHydrateCount?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Sets `document.referrer`
|
|
52
|
+
*/
|
|
53
|
+
referrer?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Removes every `<script>` element found in the `document`. Defaults to `false`.
|
|
56
|
+
*/
|
|
57
|
+
removeScripts?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Removes CSS not used by elements within the `document`. Defaults to `true`.
|
|
60
|
+
*/
|
|
61
|
+
removeUnusedStyles?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The url the runtime uses for the resources, such as the assets directory.
|
|
64
|
+
*/
|
|
65
|
+
resourcesUrl?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Prints out runtime console logs to the NodeJS process. Defaults to `false`.
|
|
68
|
+
*/
|
|
69
|
+
runtimeLogging?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Component tags listed here will only be prerendered or server-side-rendered
|
|
72
|
+
* and will not be client-side hydrated. This is useful for components that
|
|
73
|
+
* are not dynamic and do not need to be defined as a custom element within the
|
|
74
|
+
* browser. For example, a header or footer component would be a good example that
|
|
75
|
+
* may not require any client-side JavaScript.
|
|
76
|
+
*/
|
|
77
|
+
staticComponents?: string[];
|
|
78
|
+
/**
|
|
79
|
+
* The amount of milliseconds to wait for a page to finish rendering until
|
|
80
|
+
* a timeout error is thrown. Defaults to `15000`.
|
|
81
|
+
*/
|
|
82
|
+
timeout?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Sets `document.title`.
|
|
85
|
+
*/
|
|
86
|
+
title?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Sets `location.href`
|
|
89
|
+
*/
|
|
90
|
+
url?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Sets `navigator.userAgent`
|
|
93
|
+
*/
|
|
94
|
+
userAgent?: string;
|
|
95
|
+
}
|
|
96
|
+
export interface SerializeDocumentOptions extends HydrateDocumentOptions {
|
|
97
|
+
/**
|
|
98
|
+
* Runs after the `document` has been hydrated.
|
|
99
|
+
*/
|
|
100
|
+
afterHydrate?(document: any): any | Promise<any>;
|
|
101
|
+
/**
|
|
102
|
+
* Sets an approximate line width the HTML should attempt to stay within.
|
|
103
|
+
* Note that this is "approximate", in that HTML may often not be able
|
|
104
|
+
* to be split at an exact line width. Additionally, new lines created
|
|
105
|
+
* is where HTML naturally already has whitespace, such as before an
|
|
106
|
+
* attribute or spaces between words. Defaults to `100`.
|
|
107
|
+
*/
|
|
108
|
+
approximateLineWidth?: number;
|
|
109
|
+
/**
|
|
110
|
+
* Runs before the `document` has been hydrated.
|
|
111
|
+
*/
|
|
112
|
+
beforeHydrate?(document: any): any | Promise<any>;
|
|
113
|
+
/**
|
|
114
|
+
* Format the HTML in a nicely indented format.
|
|
115
|
+
* Defaults to `false`.
|
|
116
|
+
*/
|
|
117
|
+
prettyHtml?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Remove quotes from attribute values when possible.
|
|
120
|
+
* Defaults to `true`.
|
|
121
|
+
*/
|
|
122
|
+
removeAttributeQuotes?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Remove the `=""` from standardized `boolean` attributes,
|
|
125
|
+
* such as `hidden` or `checked`. Defaults to `true`.
|
|
126
|
+
*/
|
|
127
|
+
removeBooleanAttributeQuotes?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Remove these standardized attributes when their value is empty:
|
|
130
|
+
* `class`, `dir`, `id`, `lang`, and `name`, `title`. Defaults to `true`.
|
|
131
|
+
*/
|
|
132
|
+
removeEmptyAttributes?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Remove HTML comments. Defaults to `true`.
|
|
135
|
+
*/
|
|
136
|
+
removeHtmlComments?: boolean;
|
|
137
|
+
}
|
|
138
|
+
export interface HydrateFactoryOptions extends SerializeDocumentOptions {
|
|
139
|
+
serializeToHtml: boolean;
|
|
140
|
+
destroyWindow: boolean;
|
|
141
|
+
destroyDocument: boolean;
|
|
142
|
+
}
|
|
143
|
+
export interface Diagnostic {
|
|
144
|
+
absFilePath?: string | undefined;
|
|
145
|
+
code?: string;
|
|
146
|
+
columnNumber?: number | undefined;
|
|
147
|
+
debugText?: string;
|
|
148
|
+
header?: string;
|
|
149
|
+
language?: string;
|
|
150
|
+
level: "error" | "warn" | "info" | "log" | "debug";
|
|
151
|
+
lineNumber?: number | undefined;
|
|
152
|
+
lines: PrintLine[];
|
|
153
|
+
messageText: string;
|
|
154
|
+
relFilePath?: string | undefined;
|
|
155
|
+
type: string;
|
|
156
|
+
}
|
|
157
|
+
export interface PrintLine {
|
|
158
|
+
lineIndex: number;
|
|
159
|
+
lineNumber: number;
|
|
160
|
+
text: string;
|
|
161
|
+
errorCharStart: number;
|
|
162
|
+
errorLength?: number;
|
|
163
|
+
}
|
|
164
|
+
export interface HydrateResults {
|
|
165
|
+
buildId: string;
|
|
166
|
+
diagnostics: Diagnostic[];
|
|
167
|
+
url: string;
|
|
168
|
+
host: string;
|
|
169
|
+
hostname: string;
|
|
170
|
+
href: string;
|
|
171
|
+
port: string;
|
|
172
|
+
pathname: string;
|
|
173
|
+
search: string;
|
|
174
|
+
hash: string;
|
|
175
|
+
html: string;
|
|
176
|
+
components: HydrateComponent[];
|
|
177
|
+
anchors: HydrateAnchorElement[];
|
|
178
|
+
imgs: HydrateImgElement[];
|
|
179
|
+
scripts: HydrateScriptElement[];
|
|
180
|
+
styles: HydrateStyleElement[];
|
|
181
|
+
staticData: HydrateStaticData[];
|
|
182
|
+
title: string;
|
|
183
|
+
hydratedCount: number;
|
|
184
|
+
httpStatus: number;
|
|
185
|
+
}
|
|
186
|
+
export interface HydrateComponent {
|
|
187
|
+
tag: string;
|
|
188
|
+
mode: string;
|
|
189
|
+
count: number;
|
|
190
|
+
depth: number;
|
|
191
|
+
}
|
|
192
|
+
export interface HydrateElement {
|
|
193
|
+
[attrName: string]: string | undefined;
|
|
194
|
+
}
|
|
195
|
+
export interface HydrateAnchorElement extends HydrateElement {
|
|
196
|
+
href?: string;
|
|
197
|
+
target?: string;
|
|
198
|
+
}
|
|
199
|
+
export interface HydrateImgElement extends HydrateElement {
|
|
200
|
+
src?: string;
|
|
201
|
+
}
|
|
202
|
+
export interface HydrateScriptElement extends HydrateElement {
|
|
203
|
+
src?: string;
|
|
204
|
+
type?: string;
|
|
205
|
+
}
|
|
206
|
+
export interface HydrateStyleElement extends HydrateElement {
|
|
207
|
+
href?: string;
|
|
208
|
+
}
|
|
209
|
+
export interface HydrateStaticData {
|
|
210
|
+
id: string;
|
|
211
|
+
type: string;
|
|
212
|
+
content: string;
|
|
213
|
+
}
|
|
214
|
+
export declare function renderToString(html: string | any, options?: SerializeDocumentOptions): Promise<HydrateResults>;
|
|
215
|
+
export declare function hydrateDocument(doc: any | string, options?: HydrateDocumentOptions): Promise<HydrateResults>;
|
|
216
|
+
export declare function serializeDocumentToString(doc: any, opts: HydrateFactoryOptions): string;
|
|
217
|
+
|
|
218
|
+
export {};
|