pollcatch 1.0.10 → 1.0.11
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/package.json +1 -1
- package/pc.js +38 -37
package/package.json
CHANGED
package/pc.js
CHANGED
|
@@ -45,7 +45,7 @@ const _e = (e) => new ae(typeof e == "string" ? e : e + "", void 0, Ct), H = (e,
|
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is: Pe, defineProperty: Oe, getOwnPropertyDescriptor: Me, getOwnPropertyNames:
|
|
48
|
+
const { is: Pe, defineProperty: Oe, getOwnPropertyDescriptor: Me, getOwnPropertyNames: Ne, getOwnPropertySymbols: ze, getPrototypeOf: Re } = Object, j = globalThis, jt = j.trustedTypes, Ie = jt ? jt.emptyScript : "", bt = j.reactiveElementPolyfillSupport, et = (e, t) => e, pt = { toAttribute(e, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
51
|
e = e ? Ie : null;
|
|
@@ -112,7 +112,7 @@ let Z = class extends HTMLElement {
|
|
|
112
112
|
static finalize() {
|
|
113
113
|
if (this.hasOwnProperty(et("finalized"))) return;
|
|
114
114
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(et("properties"))) {
|
|
115
|
-
const s = this.properties, i = [...
|
|
115
|
+
const s = this.properties, i = [...Ne(s), ...ze(s)];
|
|
116
116
|
for (const o of i) this.createProperty(o, s[o]);
|
|
117
117
|
}
|
|
118
118
|
const t = this[Symbol.metadata];
|
|
@@ -1328,7 +1328,7 @@ function fs(e) {
|
|
|
1328
1328
|
const { r: o, g: r, b: n } = i.toRgb();
|
|
1329
1329
|
return { r: o, g: r, b: n };
|
|
1330
1330
|
}
|
|
1331
|
-
function
|
|
1331
|
+
function N(e, t) {
|
|
1332
1332
|
return e === "left" || e === "right" ? t || "center" : e === "top" || e === "bottom" ? t || "start" : t || "center";
|
|
1333
1333
|
}
|
|
1334
1334
|
function gs(e, t = "1rem") {
|
|
@@ -1776,7 +1776,8 @@ g([
|
|
|
1776
1776
|
const Es = H`
|
|
1777
1777
|
/* Add responsive sizing with CSS variables */
|
|
1778
1778
|
:host {
|
|
1779
|
-
--pc-nps-button-
|
|
1779
|
+
--pc-nps-button-height: clamp(1.6em, calc(1.5em + 0.5vw), 2.4em);
|
|
1780
|
+
--pc-nps-button-width: clamp(1em, calc(1.2em + 0.3vw), 1.6em);
|
|
1780
1781
|
--pc-nps-font-size: calc(0.85em + 0.1vw);
|
|
1781
1782
|
}
|
|
1782
1783
|
|
|
@@ -1831,8 +1832,8 @@ const Es = H`
|
|
|
1831
1832
|
}
|
|
1832
1833
|
|
|
1833
1834
|
.nps-button {
|
|
1834
|
-
min-width: var(--pc-nps-button-
|
|
1835
|
-
height: var(--pc-nps-button-
|
|
1835
|
+
min-width: var(--pc-nps-button-width);
|
|
1836
|
+
height: var(--pc-nps-button-height);
|
|
1836
1837
|
display: flex;
|
|
1837
1838
|
align-items: center;
|
|
1838
1839
|
justify-content: center;
|
|
@@ -1982,7 +1983,8 @@ const Es = H`
|
|
|
1982
1983
|
@media screen and (max-width: 480px) {
|
|
1983
1984
|
:host {
|
|
1984
1985
|
/* Increase NPS button size for small screens */
|
|
1985
|
-
--pc-nps-button-
|
|
1986
|
+
--pc-nps-button-height: 2.2em;
|
|
1987
|
+
--pc-nps-button-width: 1.6em;
|
|
1986
1988
|
--pc-nps-font-size: 1em;
|
|
1987
1989
|
}
|
|
1988
1990
|
|
|
@@ -2117,13 +2119,13 @@ function Ee(e, t = {}) {
|
|
|
2117
2119
|
ariaHidden: !1
|
|
2118
2120
|
};
|
|
2119
2121
|
}
|
|
2120
|
-
function
|
|
2122
|
+
function Nt(e, t = "polite") {
|
|
2121
2123
|
let s = document.getElementById("screen-reader-announcer");
|
|
2122
2124
|
s ? s.setAttribute("aria-live", t) : (s = document.createElement("div"), s.id = "screen-reader-announcer", s.setAttribute("aria-live", t), s.setAttribute("role", "status"), s.setAttribute("aria-atomic", "true"), s.style.position = "absolute", s.style.width = "1px", s.style.height = "1px", s.style.margin = "-1px", s.style.padding = "0", s.style.overflow = "hidden", s.style.clip = "rect(0, 0, 0, 0)", s.style.whiteSpace = "nowrap", s.style.border = "0", document.body.appendChild(s)), s.textContent = "", setTimeout(() => {
|
|
2123
2125
|
s.textContent = e;
|
|
2124
2126
|
}, 50);
|
|
2125
2127
|
}
|
|
2126
|
-
function
|
|
2128
|
+
function zt(e, t) {
|
|
2127
2129
|
return `${e}: ${t}`;
|
|
2128
2130
|
}
|
|
2129
2131
|
var $ = /* @__PURE__ */ ((e) => (e.BUTTON = "button", e.CHECKBOX = "checkbox", e.RADIO = "radio", e.RADIOGROUP = "radiogroup", e.SWITCH = "switch", e.TAB = "tab", e.TABLIST = "tablist", e.TABPANEL = "tabpanel", e.MENU = "menu", e.MENUITEM = "menuitem", e.MENUITEMCHECKBOX = "menuitemcheckbox", e.MENUITEMRADIO = "menuitemradio", e.SLIDER = "slider", e.TEXTBOX = "textbox", e.COMBOBOX = "combobox", e.LISTBOX = "listbox", e.OPTION = "option", e.PROGRESSBAR = "progressbar", e.STATUS = "status", e.ALERT = "alert", e.DIALOG = "dialog", e.GROUP = "group", e.REGION = "region", e.NONE = "none", e.PRESENTATION = "presentation", e))($ || {});
|
|
@@ -2340,7 +2342,7 @@ let V = class extends m {
|
|
|
2340
2342
|
if (this.readonly) return;
|
|
2341
2343
|
this.hoverValue = -1;
|
|
2342
2344
|
const t = this.label || "NPS", s = `Rated ${e} out of ${this.max}`;
|
|
2343
|
-
zt(
|
|
2345
|
+
Nt(zt(t, s)), await this.handleChange(e, [String(e)]), this.isEditMode = !1;
|
|
2344
2346
|
}
|
|
2345
2347
|
/**
|
|
2346
2348
|
* Render min/max labels
|
|
@@ -2381,13 +2383,13 @@ let V = class extends m {
|
|
|
2381
2383
|
render() {
|
|
2382
2384
|
const e = {
|
|
2383
2385
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
2384
|
-
[`pc-flex-align-${
|
|
2386
|
+
[`pc-flex-align-${N(this.labelPosition, this.labelAlign)}`]: !0,
|
|
2385
2387
|
"edit-mode": this.isEditMode,
|
|
2386
2388
|
"view-mode": !this.isEditMode
|
|
2387
2389
|
}, t = {
|
|
2388
2390
|
nps: !0,
|
|
2389
2391
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
2390
|
-
[`pc-flex-align-${
|
|
2392
|
+
[`pc-flex-align-${N(this.statsPosition, this.statsAlign)}`]: !0
|
|
2391
2393
|
}, s = T({
|
|
2392
2394
|
role: $.REGION,
|
|
2393
2395
|
ariaLabel: this.label || "NPS Rating"
|
|
@@ -2854,8 +2856,8 @@ X([
|
|
|
2854
2856
|
C = X([
|
|
2855
2857
|
B("pc-poll-option")
|
|
2856
2858
|
], C);
|
|
2857
|
-
var Ms = Object.defineProperty,
|
|
2858
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
2859
|
+
var Ms = Object.defineProperty, Ns = Object.getOwnPropertyDescriptor, z = (e, t, s, i) => {
|
|
2860
|
+
for (var o = i > 1 ? void 0 : i ? Ns(t, s) : t, r = e.length - 1, n; r >= 0; r--)
|
|
2859
2861
|
(n = e[r]) && (o = (i ? n(t, s, o) : n(o)) || o);
|
|
2860
2862
|
return i && o && Ms(t, s, o), o;
|
|
2861
2863
|
};
|
|
@@ -3248,16 +3250,16 @@ let A = class extends m {
|
|
|
3248
3250
|
announceSelectionChange(e, t, s) {
|
|
3249
3251
|
const i = `Poll for: ${e.label}`;
|
|
3250
3252
|
let o = "";
|
|
3251
|
-
this.multiple ? o = (t == null ? void 0 : t.includes(e.value)) || !1 ? `${e.label} selected` : `${e.label} unselected` : o = t && t.length > 0 ? `${e.label} selected` : "Selection cleared", zt(
|
|
3253
|
+
this.multiple ? o = (t == null ? void 0 : t.includes(e.value)) || !1 ? `${e.label} selected` : `${e.label} unselected` : o = t && t.length > 0 ? `${e.label} selected` : "Selection cleared", Nt(zt(i, o));
|
|
3252
3254
|
}
|
|
3253
3255
|
render() {
|
|
3254
3256
|
const e = {
|
|
3255
3257
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
3256
|
-
[`pc-flex-align-${
|
|
3258
|
+
[`pc-flex-align-${N(this.labelPosition, this.labelAlign)}`]: !0
|
|
3257
3259
|
}, t = "bottom", s = {
|
|
3258
3260
|
poll: !0,
|
|
3259
3261
|
[`pc-flex-pos-${t}`]: !0,
|
|
3260
|
-
[`pc-flex-align-${
|
|
3262
|
+
[`pc-flex-align-${N(t, this.statsAlign)}`]: !0
|
|
3261
3263
|
}, i = T({
|
|
3262
3264
|
role: $.REGION,
|
|
3263
3265
|
ariaLabel: this.label || this.name || "Poll"
|
|
@@ -3270,8 +3272,7 @@ let A = class extends m {
|
|
|
3270
3272
|
>
|
|
3271
3273
|
${this.renderLabel()}
|
|
3272
3274
|
<div class="pc-body ${y(s)}" data-testid="poll-body">
|
|
3273
|
-
${this.renderContent()} ${this.renderChart()}
|
|
3274
|
-
${this.renderStatsText()}
|
|
3275
|
+
${this.renderContent()} ${this.renderChart()} ${this.renderStatsText()}
|
|
3275
3276
|
</div>
|
|
3276
3277
|
<slot @slotchange=${() => this.updateNormalizedOptions()}></slot>
|
|
3277
3278
|
</div>
|
|
@@ -3279,34 +3280,34 @@ let A = class extends m {
|
|
|
3279
3280
|
}
|
|
3280
3281
|
};
|
|
3281
3282
|
A.styles = [...m.styles, Ts];
|
|
3282
|
-
|
|
3283
|
+
z([
|
|
3283
3284
|
d({ type: Array })
|
|
3284
3285
|
], A.prototype, "options", 2);
|
|
3285
|
-
|
|
3286
|
+
z([
|
|
3286
3287
|
d({ type: Boolean, reflect: !0 })
|
|
3287
3288
|
], A.prototype, "multiple", 2);
|
|
3288
|
-
|
|
3289
|
+
z([
|
|
3289
3290
|
d({ type: String, attribute: "button-radius" })
|
|
3290
3291
|
], A.prototype, "buttonRadius", 2);
|
|
3291
|
-
|
|
3292
|
+
z([
|
|
3292
3293
|
d({ type: String, attribute: "thank-you-msg" })
|
|
3293
3294
|
], A.prototype, "thankYouMsg", 2);
|
|
3294
|
-
|
|
3295
|
+
z([
|
|
3295
3296
|
d({ type: String, attribute: "button-text" })
|
|
3296
3297
|
], A.prototype, "buttonText", 2);
|
|
3297
|
-
|
|
3298
|
+
z([
|
|
3298
3299
|
x()
|
|
3299
3300
|
], A.prototype, "normalizedOptions", 2);
|
|
3300
|
-
|
|
3301
|
+
z([
|
|
3301
3302
|
x()
|
|
3302
3303
|
], A.prototype, "slotExists", 2);
|
|
3303
|
-
|
|
3304
|
+
z([
|
|
3304
3305
|
x()
|
|
3305
3306
|
], A.prototype, "pendingSelections", 2);
|
|
3306
|
-
A =
|
|
3307
|
+
A = z([
|
|
3307
3308
|
B("pc-poll")
|
|
3308
3309
|
], A);
|
|
3309
|
-
const
|
|
3310
|
+
const zs = H`
|
|
3310
3311
|
.pc-container {
|
|
3311
3312
|
gap: 0.6em;
|
|
3312
3313
|
}
|
|
@@ -3676,7 +3677,7 @@ let k = class extends m {
|
|
|
3676
3677
|
render() {
|
|
3677
3678
|
const e = {
|
|
3678
3679
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
3679
|
-
[`pc-flex-align-${
|
|
3680
|
+
[`pc-flex-align-${N(this.labelPosition, this.labelAlign)}`]: !0
|
|
3680
3681
|
};
|
|
3681
3682
|
return c`
|
|
3682
3683
|
<div class="pc-container ${y(e)}" data-testid="text-container">
|
|
@@ -3686,7 +3687,7 @@ let k = class extends m {
|
|
|
3686
3687
|
`;
|
|
3687
3688
|
}
|
|
3688
3689
|
};
|
|
3689
|
-
k.styles = [...m.styles,
|
|
3690
|
+
k.styles = [...m.styles, zs];
|
|
3690
3691
|
O([
|
|
3691
3692
|
d({ type: String })
|
|
3692
3693
|
], k.prototype, "placeholder", 2);
|
|
@@ -4440,15 +4441,15 @@ let _ = class extends m {
|
|
|
4440
4441
|
*/
|
|
4441
4442
|
announceReactionChange(e, t) {
|
|
4442
4443
|
const s = this.label ? `Reactions for: ${this.label}` : "Reactions", i = t ? `Added ${e.name} reaction` : `Removed ${e.name} reaction`;
|
|
4443
|
-
zt(
|
|
4444
|
+
Nt(zt(s, i));
|
|
4444
4445
|
}
|
|
4445
4446
|
render() {
|
|
4446
4447
|
const e = {
|
|
4447
4448
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
4448
|
-
[`pc-flex-align-${
|
|
4449
|
+
[`pc-flex-align-${N(this.labelPosition, this.labelAlign)}`]: !0
|
|
4449
4450
|
}, t = {
|
|
4450
4451
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
4451
|
-
[`pc-flex-align-${
|
|
4452
|
+
[`pc-flex-align-${N(this.statsPosition, this.statsAlign)}`]: !0
|
|
4452
4453
|
};
|
|
4453
4454
|
return c`
|
|
4454
4455
|
<div class="pc-container ${y(e)}" data-testid="reaction-container">
|
|
@@ -4891,7 +4892,7 @@ let G = class extends m {
|
|
|
4891
4892
|
}, this.widgetType = "stars", this.statsText = "Average {avg} ({count} votes)", this.labelPosition = "top", this.statsPosition = "bottom", this.buttonRadius = "pill";
|
|
4892
4893
|
}
|
|
4893
4894
|
async firstUpdated() {
|
|
4894
|
-
super.firstUpdated(), console.log("defaultMode", this.defaultMode), this.defaultMode === "edit" ?
|
|
4895
|
+
super.firstUpdated(), console.log("defaultMode", this.defaultMode), this.defaultMode === "edit" ? this.isEditMode = !0 : this.isEditMode = !1;
|
|
4895
4896
|
}
|
|
4896
4897
|
/**
|
|
4897
4898
|
* Render stars for view mode (showing average rating)
|
|
@@ -5009,13 +5010,13 @@ let G = class extends m {
|
|
|
5009
5010
|
render() {
|
|
5010
5011
|
const e = {
|
|
5011
5012
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
5012
|
-
[`pc-flex-align-${
|
|
5013
|
+
[`pc-flex-align-${N(this.labelPosition, this.labelAlign)}`]: !0,
|
|
5013
5014
|
"edit-mode": this.isEditMode,
|
|
5014
5015
|
"view-mode": !this.isEditMode
|
|
5015
5016
|
}, t = {
|
|
5016
5017
|
stars: !0,
|
|
5017
5018
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
5018
|
-
[`pc-flex-align-${
|
|
5019
|
+
[`pc-flex-align-${N(this.statsPosition, this.statsAlign)}`]: !0
|
|
5019
5020
|
};
|
|
5020
5021
|
return c`
|
|
5021
5022
|
<div class="pc-container ${y(e)}" data-testid="stars-container">
|