@penn-libraries/web 1.2.0-dev.2 → 1.2.1-dev.0
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/dist/cjs/{index-Ag6DtE87.js → index-C2lJ0X_b.js} +64 -2
- package/dist/cjs/index-C2lJ0X_b.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/pennlibs-autocomplete.cjs.entry.js +281 -0
- package/dist/cjs/pennlibs-autocomplete.entry.cjs.js.map +1 -0
- package/dist/cjs/pennlibs-banner.cjs.entry.js +1 -1
- package/dist/cjs/pennlibs-chat.cjs.entry.js +1 -1
- package/dist/cjs/pennlibs-fallback-img.cjs.entry.js +1 -1
- package/dist/cjs/pennlibs-feedback.pennlibs-footer.pennlibs-header.entry.cjs.js.map +1 -0
- package/dist/cjs/{pennlibs-autocomplete_4.cjs.entry.js → pennlibs-feedback_3.cjs.entry.js} +29 -299
- package/dist/cjs/pennlibs-hero.cjs.entry.js +1 -1
- package/dist/cjs/pennlibs-iiif-img.cjs.entry.js +1 -1
- package/dist/cjs/web.cjs.js +2 -2
- package/dist/collection/components/pennlibs-feedback/pennlibs-feedback.css +22 -1
- package/dist/collection/components/pennlibs-feedback/pennlibs-feedback.js +29 -23
- package/dist/collection/components/pennlibs-feedback/pennlibs-feedback.js.map +1 -1
- package/dist/components/pennlibs-feedback.js +30 -25
- package/dist/components/pennlibs-feedback.js.map +1 -1
- package/dist/docs.json +2 -2
- package/dist/{web/p-CNQ9-Wwh.js → esm/index-kmszRyIe.js} +65 -3
- package/dist/esm/index-kmszRyIe.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/pennlibs-autocomplete.entry.js +279 -0
- package/dist/esm/pennlibs-autocomplete.entry.js.map +1 -0
- package/dist/esm/pennlibs-banner.entry.js +1 -1
- package/dist/esm/pennlibs-chat.entry.js +1 -1
- package/dist/esm/pennlibs-fallback-img.entry.js +1 -1
- package/dist/esm/pennlibs-feedback.pennlibs-footer.pennlibs-header.entry.js.map +1 -0
- package/dist/esm/{pennlibs-autocomplete_4.entry.js → pennlibs-feedback_3.entry.js} +30 -299
- package/dist/esm/pennlibs-hero.entry.js +1 -1
- package/dist/esm/pennlibs-iiif-img.entry.js +1 -1
- package/dist/esm/web.js +3 -3
- package/dist/types/components/pennlibs-feedback/pennlibs-feedback.d.ts +2 -2
- package/dist/web/index.esm.js +1 -1
- package/dist/web/p-1c0dd1ec.entry.js +279 -0
- package/dist/web/{p-3da26275.entry.js → p-37644cf5.entry.js} +30 -299
- package/dist/web/{p-662e4125.entry.js → p-51bc70b8.entry.js} +1 -1
- package/dist/web/{p-eb633f4d.entry.js → p-906263a3.entry.js} +1 -1
- package/dist/web/{p-c96a3643.entry.js → p-badb334a.entry.js} +1 -1
- package/dist/web/{p-b6e686d1.entry.js → p-d392e98a.entry.js} +1 -1
- package/dist/web/{p-a34e1e3e.entry.js → p-e1947e84.entry.js} +1 -1
- package/dist/{esm/index-CNQ9-Wwh.js → web/p-kmszRyIe.js} +65 -3
- package/dist/web/p-kmszRyIe.js.map +1 -0
- package/dist/web/pennlibs-autocomplete.entry.esm.js.map +1 -0
- package/dist/web/pennlibs-feedback.pennlibs-footer.pennlibs-header.entry.esm.js.map +1 -0
- package/dist/web/web.esm.js +3 -3
- package/hydrate/index.js +59 -24
- package/hydrate/index.mjs +59 -24
- package/package.json +1 -1
- package/dist/cjs/index-Ag6DtE87.js.map +0 -1
- package/dist/cjs/pennlibs-autocomplete.pennlibs-feedback.pennlibs-footer.pennlibs-header.entry.cjs.js.map +0 -1
- package/dist/esm/index-CNQ9-Wwh.js.map +0 -1
- package/dist/esm/pennlibs-autocomplete.pennlibs-feedback.pennlibs-footer.pennlibs-header.entry.js.map +0 -1
- package/dist/web/p-CNQ9-Wwh.js.map +0 -1
- package/dist/web/pennlibs-autocomplete.pennlibs-feedback.pennlibs-footer.pennlibs-header.entry.esm.js.map +0 -1
package/hydrate/index.js
CHANGED
|
@@ -737,6 +737,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
737
737
|
const shadowRootNodes = shadowRoot ? [] : null;
|
|
738
738
|
const vnode = newVNode(tagName, null);
|
|
739
739
|
vnode.$elm$ = hostElm;
|
|
740
|
+
let scopeId2;
|
|
741
|
+
{
|
|
742
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
743
|
+
if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
|
|
744
|
+
scopeId2 = hostElm["s-sc"];
|
|
745
|
+
hostElm.classList.add(scopeId2 + "-h");
|
|
746
|
+
} else if (hostElm["s-sc"]) {
|
|
747
|
+
delete hostElm["s-sc"];
|
|
748
|
+
}
|
|
749
|
+
}
|
|
740
750
|
if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
|
|
741
751
|
initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
|
|
742
752
|
}
|
|
@@ -840,6 +850,11 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
840
850
|
}
|
|
841
851
|
}
|
|
842
852
|
}
|
|
853
|
+
if (scopeId2 && slotNodes.length) {
|
|
854
|
+
slotNodes.forEach((slot) => {
|
|
855
|
+
slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
|
|
856
|
+
});
|
|
857
|
+
}
|
|
843
858
|
if (shadowRoot) {
|
|
844
859
|
let rnIdex = 0;
|
|
845
860
|
const rnLen = shadowRootNodes.length;
|
|
@@ -869,6 +884,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
869
884
|
let childIdSplt;
|
|
870
885
|
let childVNode;
|
|
871
886
|
let i2;
|
|
887
|
+
const scopeId2 = hostElm["s-sc"];
|
|
872
888
|
if (node.nodeType === 1 /* ElementNode */) {
|
|
873
889
|
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
874
890
|
if (childNodeType) {
|
|
@@ -891,6 +907,10 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
891
907
|
if (!parentVNode.$children$) {
|
|
892
908
|
parentVNode.$children$ = [];
|
|
893
909
|
}
|
|
910
|
+
if (scopeId2 && childIdSplt[0] === hostId) {
|
|
911
|
+
node["s-si"] = scopeId2;
|
|
912
|
+
childVNode.$attrs$.class += " " + scopeId2;
|
|
913
|
+
}
|
|
894
914
|
const slotName = childVNode.$elm$.getAttribute("s-sn");
|
|
895
915
|
if (typeof slotName === "string") {
|
|
896
916
|
if (childVNode.$tag$ === "slot-fb") {
|
|
@@ -905,6 +925,9 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
905
925
|
shadowRootNodes,
|
|
906
926
|
slottedNodes
|
|
907
927
|
);
|
|
928
|
+
if (scopeId2) {
|
|
929
|
+
node.classList.add(scopeId2);
|
|
930
|
+
}
|
|
908
931
|
}
|
|
909
932
|
childVNode.$elm$["s-sn"] = slotName;
|
|
910
933
|
childVNode.$elm$.removeAttribute("s-sn");
|
|
@@ -2061,6 +2084,9 @@ var markSlotContentForRelocation = (elm) => {
|
|
|
2061
2084
|
}
|
|
2062
2085
|
};
|
|
2063
2086
|
var insertBefore = (parent, newNode, reference) => {
|
|
2087
|
+
if (typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
|
|
2088
|
+
addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
2089
|
+
}
|
|
2064
2090
|
{
|
|
2065
2091
|
return parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
|
2066
2092
|
}
|
|
@@ -2613,6 +2639,9 @@ var connectedCallback = (elm) => {
|
|
|
2613
2639
|
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2614
2640
|
const scopeId2 = addStyle(elm.shadowRoot, cmpMeta);
|
|
2615
2641
|
elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
|
|
2642
|
+
} else if (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
2643
|
+
const scopeId2 = getScopeId(cmpMeta);
|
|
2644
|
+
elm["s-sc"] = scopeId2;
|
|
2616
2645
|
}
|
|
2617
2646
|
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
2618
2647
|
}
|
|
@@ -4206,13 +4235,11 @@ class NoImage {
|
|
|
4206
4235
|
}; }
|
|
4207
4236
|
}
|
|
4208
4237
|
|
|
4209
|
-
const pennlibsFeedbackCss = "
|
|
4238
|
+
const pennlibsFeedbackCss = ".feedback__container.sc-pennlibs-feedback{display:block;background:#eeeff4;font-family:var(--pl-font-family);font-size:var(--pl-font-size);color:var(--pl-color-fg-default);line-height:1.4;box-sizing:border-box;padding:0.75em 0}@media print{.sc-pennlibs-feedback-h{display:none}}*.sc-pennlibs-feedback,*.sc-pennlibs-feedback::before,*.sc-pennlibs-feedback::after{box-sizing:border-box}.viewport-margins.sc-pennlibs-feedback{max-width:var(--pl-viewport-margins-max-width);margin:0 auto;padding:0 var(--pl-viewport-margins-gutter, 1em)}.feedback__content.sc-pennlibs-feedback{display:flex;justify-content:space-between;gap:var(--pl-space-s);flex-wrap:wrap}.feedback__inline-question.sc-pennlibs-feedback{display:flex;flex-wrap:wrap;gap:0.5em;align-items:center}h2.sc-pennlibs-feedback{display:inline-block;margin:0;font-family:var(--pl-font-sans-serif);font-size:1em;font-weight:400}p.sc-pennlibs-feedback{margin:0;padding:calc(0.5em + 1px) 0}strong.sc-pennlibs-feedback{font-weight:600}a.sc-pennlibs-feedback{color:var(--pl-color-fg-accent);text-decoration:underline;text-underline-offset:var(--pl-link-text-underline-offset);text-decoration-thickness:var(--pl-link-hover-text-decoration-thickness)}button.sc-pennlibs-feedback{all:unset;display:flex;align-items:center;gap:0.5em;padding:0.25em 1.25em;font-family:var(--pl-font-family);font-weight:500;line-height:1.4;color:var(--pl-color-fg-default);background:var(--pl-color-bg-default);border:solid 1px var(--pl-color-fg-subtle);border-radius:1em;box-sizing:border-box}button.sc-pennlibs-feedback:hover{cursor:pointer}button.sc-pennlibs-feedback:hover span.sc-pennlibs-feedback{text-decoration:underline}button.selected.sc-pennlibs-feedback{background:var(--pl-color-bg-accent-emphasis);color:var(--pl-color-fg-on-emphasis);border-color:var(--pl-color-bg-accent-emphasis)}.feedback__inline-question.sc-pennlibs-feedback+.feedback__share-feedback.sc-pennlibs-feedback,p.sc-pennlibs-feedback{animation:none}.feedback__content.sc-pennlibs-feedback>p.sc-pennlibs-feedback{animation:fadeIn 300ms ease-in}@keyframes fadeIn{from{opacity:0}to{opacity:1}}*.sc-pennlibs-feedback:focus{outline:0;box-shadow:0 0 0 2px var(--pl-color-bg-attention),\n 0 0 0 3px var(--pl-color-bg-emphasis)}p.sc-pennlibs-feedback:focus{outline:none;box-shadow:0 0 0 2px var(--pl-color-bg-attention), 0 0 0 3px var(--pl-color-bg-emphasis)}@media (max-width: 26em){h2.sc-pennlibs-feedback{display:block;width:100%;text-align:center}}.help-us.sc-pennlibs-feedback{display:flex;flex-direction:column;gap:0.5em}.visually-hidden.sc-pennlibs-feedback{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}.visually-hidden.sc-pennlibs-feedback:focus,.visually-hidden.sc-pennlibs-feedback:active{clip:auto;clip-path:none;height:auto;overflow:visible;position:static;white-space:normal;width:auto}";
|
|
4210
4239
|
|
|
4211
|
-
const FEEDBACK_STORAGE_KEY =
|
|
4212
|
-
const FEEDBACK_TIMESTAMP_KEY = 'pennlibs-feedback-timestamp';
|
|
4240
|
+
const FEEDBACK_STORAGE_KEY = `pennlibs-feedback-${window.location.pathname}`;
|
|
4213
4241
|
const FEEDBACK_TTL = 5 * 60 * 1000; // 5 minutes
|
|
4214
|
-
const FEEDBACK_QUESTION = '
|
|
4215
|
-
const FEEDBACK_ERROR_STORAGE_KEY = 'pennlibs-feedback-error';
|
|
4242
|
+
const FEEDBACK_QUESTION = 'Did you find what you need?';
|
|
4216
4243
|
/**
|
|
4217
4244
|
* A feedback component that asks visitors "Did you find what you need?" and
|
|
4218
4245
|
* links to a feedback form. The answer is stored in sessionStorage for 5 minutes
|
|
@@ -4232,27 +4259,32 @@ class PennlibsFeedback {
|
|
|
4232
4259
|
* When true, hides the yes/no question and only shows the "share your feedback" link.
|
|
4233
4260
|
*/
|
|
4234
4261
|
this.hideQuestion = false;
|
|
4235
|
-
this.error = false;
|
|
4236
4262
|
this.answer = undefined;
|
|
4263
|
+
this.selected = undefined;
|
|
4237
4264
|
}
|
|
4238
4265
|
componentWillLoad() {
|
|
4239
|
-
const
|
|
4240
|
-
if (
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4266
|
+
const stored = sessionStorage.getItem(FEEDBACK_STORAGE_KEY);
|
|
4267
|
+
if (stored) {
|
|
4268
|
+
try {
|
|
4269
|
+
const { answer, timestamp } = JSON.parse(stored);
|
|
4270
|
+
if (Date.now() - timestamp > FEEDBACK_TTL) {
|
|
4271
|
+
sessionStorage.removeItem(FEEDBACK_STORAGE_KEY);
|
|
4272
|
+
}
|
|
4273
|
+
else {
|
|
4274
|
+
this.answer = answer;
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4277
|
+
catch (_a) {
|
|
4278
|
+
sessionStorage.removeItem(FEEDBACK_STORAGE_KEY);
|
|
4279
|
+
}
|
|
4249
4280
|
}
|
|
4250
4281
|
}
|
|
4251
|
-
|
|
4282
|
+
handleSubmit(event) {
|
|
4252
4283
|
var _a;
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4284
|
+
event.preventDefault();
|
|
4285
|
+
const answer = event.submitter.value;
|
|
4286
|
+
this.selected = answer;
|
|
4287
|
+
sessionStorage.setItem(FEEDBACK_STORAGE_KEY, JSON.stringify({ answer, timestamp: Date.now() }));
|
|
4256
4288
|
this.feedbackEvent.emit({
|
|
4257
4289
|
question: FEEDBACK_QUESTION,
|
|
4258
4290
|
answer: answer,
|
|
@@ -4260,18 +4292,21 @@ class PennlibsFeedback {
|
|
|
4260
4292
|
pageHeading: ((_a = document.querySelector('h1')) === null || _a === void 0 ? void 0 : _a.textContent) || undefined,
|
|
4261
4293
|
pageTitle: document.title || undefined
|
|
4262
4294
|
});
|
|
4295
|
+
setTimeout(() => {
|
|
4296
|
+
this.answer = answer;
|
|
4297
|
+
}, 600);
|
|
4263
4298
|
}
|
|
4264
4299
|
render() {
|
|
4265
|
-
return (hAsync("div", { key: '
|
|
4300
|
+
return (hAsync("div", { key: '013c3b140f249641d412bd0c19108a6c51d2f12e', class: "feedback__container" }, hAsync("div", { key: 'ef51ab5c419dfdd8679b027882a59171480ea039', class: "viewport-margins" }, hAsync("div", { key: '2c61b86b1e69037d7d63ecde5288bfcc0e1dad75', class: "feedback__content" }, !this.hideQuestion && (this.answer === 'yes' ? (hAsync("p", null, "Thank you for letting us know.")) : this.answer === 'no' ? (hAsync("p", null, "We'd like to help. ", hAsync("a", { href: "https://www.library.upenn.edu/contact-us" }, "Contact us"), " and let us know what you're looking for.")) : (hAsync("form", { class: "feedback__inline-question", onSubmit: (e) => this.handleSubmit(e) }, hAsync("h2", null, "Did you find what you need?"), hAsync("button", { type: "submit", name: "answer", value: "yes", class: { 'selected': this.selected === 'yes' }, disabled: !!this.selected }, hAsync("span", null, "Yes"), hAsync("span", { class: "visually-hidden" }, ", I found what I needed.")), hAsync("button", { type: "submit", name: "answer", value: "no", class: { 'selected': this.selected === 'no' }, disabled: !!this.selected }, hAsync("span", null, "No"), hAsync("span", { class: "visually-hidden" }, ", I did not find what I needed."))))), hAsync("div", { key: '90ccdacc682229570f83867f8d8f587a3e0c16aa', class: "feedback__share-feedback" }, hAsync("p", { key: 'edd15c793ac6af5d31bd98863cd76fce27aed69a' }, "To help us improve, ", hAsync("a", { key: '25f5c322d0fb717b8618b40625af978d57f805bd', href: `https://upenn.co1.qualtrics.com/jfe/form/SV_3xVrP7EKWS92zfE?reporting_from_url=${encodeURIComponent(window.location.href)}` }, "share your feedback"), "."))))));
|
|
4266
4301
|
}
|
|
4267
4302
|
static get style() { return pennlibsFeedbackCss; }
|
|
4268
4303
|
static get cmpMeta() { return {
|
|
4269
|
-
"$flags$":
|
|
4304
|
+
"$flags$": 258,
|
|
4270
4305
|
"$tagName$": "pennlibs-feedback",
|
|
4271
4306
|
"$members$": {
|
|
4272
4307
|
"hideQuestion": [4, "hide-question"],
|
|
4273
|
-
"
|
|
4274
|
-
"
|
|
4308
|
+
"answer": [32],
|
|
4309
|
+
"selected": [32]
|
|
4275
4310
|
},
|
|
4276
4311
|
"$listeners$": undefined,
|
|
4277
4312
|
"$lazyBundleId$": "-",
|
package/hydrate/index.mjs
CHANGED
|
@@ -735,6 +735,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
735
735
|
const shadowRootNodes = shadowRoot ? [] : null;
|
|
736
736
|
const vnode = newVNode(tagName, null);
|
|
737
737
|
vnode.$elm$ = hostElm;
|
|
738
|
+
let scopeId2;
|
|
739
|
+
{
|
|
740
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
741
|
+
if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
|
|
742
|
+
scopeId2 = hostElm["s-sc"];
|
|
743
|
+
hostElm.classList.add(scopeId2 + "-h");
|
|
744
|
+
} else if (hostElm["s-sc"]) {
|
|
745
|
+
delete hostElm["s-sc"];
|
|
746
|
+
}
|
|
747
|
+
}
|
|
738
748
|
if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
|
|
739
749
|
initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
|
|
740
750
|
}
|
|
@@ -838,6 +848,11 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
838
848
|
}
|
|
839
849
|
}
|
|
840
850
|
}
|
|
851
|
+
if (scopeId2 && slotNodes.length) {
|
|
852
|
+
slotNodes.forEach((slot) => {
|
|
853
|
+
slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
|
|
854
|
+
});
|
|
855
|
+
}
|
|
841
856
|
if (shadowRoot) {
|
|
842
857
|
let rnIdex = 0;
|
|
843
858
|
const rnLen = shadowRootNodes.length;
|
|
@@ -867,6 +882,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
867
882
|
let childIdSplt;
|
|
868
883
|
let childVNode;
|
|
869
884
|
let i2;
|
|
885
|
+
const scopeId2 = hostElm["s-sc"];
|
|
870
886
|
if (node.nodeType === 1 /* ElementNode */) {
|
|
871
887
|
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
872
888
|
if (childNodeType) {
|
|
@@ -889,6 +905,10 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
889
905
|
if (!parentVNode.$children$) {
|
|
890
906
|
parentVNode.$children$ = [];
|
|
891
907
|
}
|
|
908
|
+
if (scopeId2 && childIdSplt[0] === hostId) {
|
|
909
|
+
node["s-si"] = scopeId2;
|
|
910
|
+
childVNode.$attrs$.class += " " + scopeId2;
|
|
911
|
+
}
|
|
892
912
|
const slotName = childVNode.$elm$.getAttribute("s-sn");
|
|
893
913
|
if (typeof slotName === "string") {
|
|
894
914
|
if (childVNode.$tag$ === "slot-fb") {
|
|
@@ -903,6 +923,9 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
903
923
|
shadowRootNodes,
|
|
904
924
|
slottedNodes
|
|
905
925
|
);
|
|
926
|
+
if (scopeId2) {
|
|
927
|
+
node.classList.add(scopeId2);
|
|
928
|
+
}
|
|
906
929
|
}
|
|
907
930
|
childVNode.$elm$["s-sn"] = slotName;
|
|
908
931
|
childVNode.$elm$.removeAttribute("s-sn");
|
|
@@ -2059,6 +2082,9 @@ var markSlotContentForRelocation = (elm) => {
|
|
|
2059
2082
|
}
|
|
2060
2083
|
};
|
|
2061
2084
|
var insertBefore = (parent, newNode, reference) => {
|
|
2085
|
+
if (typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
|
|
2086
|
+
addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
2087
|
+
}
|
|
2062
2088
|
{
|
|
2063
2089
|
return parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
|
2064
2090
|
}
|
|
@@ -2611,6 +2637,9 @@ var connectedCallback = (elm) => {
|
|
|
2611
2637
|
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2612
2638
|
const scopeId2 = addStyle(elm.shadowRoot, cmpMeta);
|
|
2613
2639
|
elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
|
|
2640
|
+
} else if (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
2641
|
+
const scopeId2 = getScopeId(cmpMeta);
|
|
2642
|
+
elm["s-sc"] = scopeId2;
|
|
2614
2643
|
}
|
|
2615
2644
|
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
2616
2645
|
}
|
|
@@ -4204,13 +4233,11 @@ class NoImage {
|
|
|
4204
4233
|
}; }
|
|
4205
4234
|
}
|
|
4206
4235
|
|
|
4207
|
-
const pennlibsFeedbackCss = "
|
|
4236
|
+
const pennlibsFeedbackCss = ".feedback__container.sc-pennlibs-feedback{display:block;background:#eeeff4;font-family:var(--pl-font-family);font-size:var(--pl-font-size);color:var(--pl-color-fg-default);line-height:1.4;box-sizing:border-box;padding:0.75em 0}@media print{.sc-pennlibs-feedback-h{display:none}}*.sc-pennlibs-feedback,*.sc-pennlibs-feedback::before,*.sc-pennlibs-feedback::after{box-sizing:border-box}.viewport-margins.sc-pennlibs-feedback{max-width:var(--pl-viewport-margins-max-width);margin:0 auto;padding:0 var(--pl-viewport-margins-gutter, 1em)}.feedback__content.sc-pennlibs-feedback{display:flex;justify-content:space-between;gap:var(--pl-space-s);flex-wrap:wrap}.feedback__inline-question.sc-pennlibs-feedback{display:flex;flex-wrap:wrap;gap:0.5em;align-items:center}h2.sc-pennlibs-feedback{display:inline-block;margin:0;font-family:var(--pl-font-sans-serif);font-size:1em;font-weight:400}p.sc-pennlibs-feedback{margin:0;padding:calc(0.5em + 1px) 0}strong.sc-pennlibs-feedback{font-weight:600}a.sc-pennlibs-feedback{color:var(--pl-color-fg-accent);text-decoration:underline;text-underline-offset:var(--pl-link-text-underline-offset);text-decoration-thickness:var(--pl-link-hover-text-decoration-thickness)}button.sc-pennlibs-feedback{all:unset;display:flex;align-items:center;gap:0.5em;padding:0.25em 1.25em;font-family:var(--pl-font-family);font-weight:500;line-height:1.4;color:var(--pl-color-fg-default);background:var(--pl-color-bg-default);border:solid 1px var(--pl-color-fg-subtle);border-radius:1em;box-sizing:border-box}button.sc-pennlibs-feedback:hover{cursor:pointer}button.sc-pennlibs-feedback:hover span.sc-pennlibs-feedback{text-decoration:underline}button.selected.sc-pennlibs-feedback{background:var(--pl-color-bg-accent-emphasis);color:var(--pl-color-fg-on-emphasis);border-color:var(--pl-color-bg-accent-emphasis)}.feedback__inline-question.sc-pennlibs-feedback+.feedback__share-feedback.sc-pennlibs-feedback,p.sc-pennlibs-feedback{animation:none}.feedback__content.sc-pennlibs-feedback>p.sc-pennlibs-feedback{animation:fadeIn 300ms ease-in}@keyframes fadeIn{from{opacity:0}to{opacity:1}}*.sc-pennlibs-feedback:focus{outline:0;box-shadow:0 0 0 2px var(--pl-color-bg-attention),\n 0 0 0 3px var(--pl-color-bg-emphasis)}p.sc-pennlibs-feedback:focus{outline:none;box-shadow:0 0 0 2px var(--pl-color-bg-attention), 0 0 0 3px var(--pl-color-bg-emphasis)}@media (max-width: 26em){h2.sc-pennlibs-feedback{display:block;width:100%;text-align:center}}.help-us.sc-pennlibs-feedback{display:flex;flex-direction:column;gap:0.5em}.visually-hidden.sc-pennlibs-feedback{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}.visually-hidden.sc-pennlibs-feedback:focus,.visually-hidden.sc-pennlibs-feedback:active{clip:auto;clip-path:none;height:auto;overflow:visible;position:static;white-space:normal;width:auto}";
|
|
4208
4237
|
|
|
4209
|
-
const FEEDBACK_STORAGE_KEY =
|
|
4210
|
-
const FEEDBACK_TIMESTAMP_KEY = 'pennlibs-feedback-timestamp';
|
|
4238
|
+
const FEEDBACK_STORAGE_KEY = `pennlibs-feedback-${window.location.pathname}`;
|
|
4211
4239
|
const FEEDBACK_TTL = 5 * 60 * 1000; // 5 minutes
|
|
4212
|
-
const FEEDBACK_QUESTION = '
|
|
4213
|
-
const FEEDBACK_ERROR_STORAGE_KEY = 'pennlibs-feedback-error';
|
|
4240
|
+
const FEEDBACK_QUESTION = 'Did you find what you need?';
|
|
4214
4241
|
/**
|
|
4215
4242
|
* A feedback component that asks visitors "Did you find what you need?" and
|
|
4216
4243
|
* links to a feedback form. The answer is stored in sessionStorage for 5 minutes
|
|
@@ -4230,27 +4257,32 @@ class PennlibsFeedback {
|
|
|
4230
4257
|
* When true, hides the yes/no question and only shows the "share your feedback" link.
|
|
4231
4258
|
*/
|
|
4232
4259
|
this.hideQuestion = false;
|
|
4233
|
-
this.error = false;
|
|
4234
4260
|
this.answer = undefined;
|
|
4261
|
+
this.selected = undefined;
|
|
4235
4262
|
}
|
|
4236
4263
|
componentWillLoad() {
|
|
4237
|
-
const
|
|
4238
|
-
if (
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4264
|
+
const stored = sessionStorage.getItem(FEEDBACK_STORAGE_KEY);
|
|
4265
|
+
if (stored) {
|
|
4266
|
+
try {
|
|
4267
|
+
const { answer, timestamp } = JSON.parse(stored);
|
|
4268
|
+
if (Date.now() - timestamp > FEEDBACK_TTL) {
|
|
4269
|
+
sessionStorage.removeItem(FEEDBACK_STORAGE_KEY);
|
|
4270
|
+
}
|
|
4271
|
+
else {
|
|
4272
|
+
this.answer = answer;
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
catch (_a) {
|
|
4276
|
+
sessionStorage.removeItem(FEEDBACK_STORAGE_KEY);
|
|
4277
|
+
}
|
|
4247
4278
|
}
|
|
4248
4279
|
}
|
|
4249
|
-
|
|
4280
|
+
handleSubmit(event) {
|
|
4250
4281
|
var _a;
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4282
|
+
event.preventDefault();
|
|
4283
|
+
const answer = event.submitter.value;
|
|
4284
|
+
this.selected = answer;
|
|
4285
|
+
sessionStorage.setItem(FEEDBACK_STORAGE_KEY, JSON.stringify({ answer, timestamp: Date.now() }));
|
|
4254
4286
|
this.feedbackEvent.emit({
|
|
4255
4287
|
question: FEEDBACK_QUESTION,
|
|
4256
4288
|
answer: answer,
|
|
@@ -4258,18 +4290,21 @@ class PennlibsFeedback {
|
|
|
4258
4290
|
pageHeading: ((_a = document.querySelector('h1')) === null || _a === void 0 ? void 0 : _a.textContent) || undefined,
|
|
4259
4291
|
pageTitle: document.title || undefined
|
|
4260
4292
|
});
|
|
4293
|
+
setTimeout(() => {
|
|
4294
|
+
this.answer = answer;
|
|
4295
|
+
}, 600);
|
|
4261
4296
|
}
|
|
4262
4297
|
render() {
|
|
4263
|
-
return (hAsync("div", { key: '
|
|
4298
|
+
return (hAsync("div", { key: '013c3b140f249641d412bd0c19108a6c51d2f12e', class: "feedback__container" }, hAsync("div", { key: 'ef51ab5c419dfdd8679b027882a59171480ea039', class: "viewport-margins" }, hAsync("div", { key: '2c61b86b1e69037d7d63ecde5288bfcc0e1dad75', class: "feedback__content" }, !this.hideQuestion && (this.answer === 'yes' ? (hAsync("p", null, "Thank you for letting us know.")) : this.answer === 'no' ? (hAsync("p", null, "We'd like to help. ", hAsync("a", { href: "https://www.library.upenn.edu/contact-us" }, "Contact us"), " and let us know what you're looking for.")) : (hAsync("form", { class: "feedback__inline-question", onSubmit: (e) => this.handleSubmit(e) }, hAsync("h2", null, "Did you find what you need?"), hAsync("button", { type: "submit", name: "answer", value: "yes", class: { 'selected': this.selected === 'yes' }, disabled: !!this.selected }, hAsync("span", null, "Yes"), hAsync("span", { class: "visually-hidden" }, ", I found what I needed.")), hAsync("button", { type: "submit", name: "answer", value: "no", class: { 'selected': this.selected === 'no' }, disabled: !!this.selected }, hAsync("span", null, "No"), hAsync("span", { class: "visually-hidden" }, ", I did not find what I needed."))))), hAsync("div", { key: '90ccdacc682229570f83867f8d8f587a3e0c16aa', class: "feedback__share-feedback" }, hAsync("p", { key: 'edd15c793ac6af5d31bd98863cd76fce27aed69a' }, "To help us improve, ", hAsync("a", { key: '25f5c322d0fb717b8618b40625af978d57f805bd', href: `https://upenn.co1.qualtrics.com/jfe/form/SV_3xVrP7EKWS92zfE?reporting_from_url=${encodeURIComponent(window.location.href)}` }, "share your feedback"), "."))))));
|
|
4264
4299
|
}
|
|
4265
4300
|
static get style() { return pennlibsFeedbackCss; }
|
|
4266
4301
|
static get cmpMeta() { return {
|
|
4267
|
-
"$flags$":
|
|
4302
|
+
"$flags$": 258,
|
|
4268
4303
|
"$tagName$": "pennlibs-feedback",
|
|
4269
4304
|
"$members$": {
|
|
4270
4305
|
"hideQuestion": [4, "hide-question"],
|
|
4271
|
-
"
|
|
4272
|
-
"
|
|
4306
|
+
"answer": [32],
|
|
4307
|
+
"selected": [32]
|
|
4273
4308
|
},
|
|
4274
4309
|
"$listeners$": undefined,
|
|
4275
4310
|
"$lazyBundleId$": "-",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@penn-libraries/web",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1-dev.0",
|
|
4
4
|
"description": "Reusable web designs for University of Pennsylvania Libraries websites. This package contains our code for shared Web Components and Cascading Style Sheets (CSS).",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|