@penn-libraries/web 1.1.0-dev.0 → 1.1.0-dev.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/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pennlibs-allow-tracking.pennlibs-autocomplete.pennlibs-footer.pennlibs-header.entry.cjs.js.map +1 -1
- package/dist/cjs/pennlibs-allow-tracking_4.cjs.entry.js +17 -8
- package/dist/cjs/pennlibs-allow-tracking_4.cjs.entry.js.map +1 -1
- package/dist/cjs/web.cjs.js +1 -1
- package/dist/collection/components/pennlibs-autocomplete/pennlibs-autocomplete.css +1 -0
- package/dist/collection/components/pennlibs-autocomplete/pennlibs-autocomplete.js +39 -7
- package/dist/collection/components/pennlibs-autocomplete/pennlibs-autocomplete.js.map +1 -1
- package/dist/components/pennlibs-autocomplete.js +18 -8
- package/dist/components/pennlibs-autocomplete.js.map +1 -1
- package/dist/docs.json +26 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pennlibs-allow-tracking.pennlibs-autocomplete.pennlibs-footer.pennlibs-header.entry.js.map +1 -1
- package/dist/esm/pennlibs-allow-tracking_4.entry.js +17 -8
- package/dist/esm/pennlibs-allow-tracking_4.entry.js.map +1 -1
- package/dist/esm/web.js +1 -1
- package/dist/types/components/pennlibs-autocomplete/pennlibs-autocomplete.d.ts +4 -0
- package/dist/types/components.d.ts +8 -0
- package/dist/web/{p-ceaf55b0.entry.js → p-270fd846.entry.js} +18 -9
- package/dist/web/p-270fd846.entry.js.map +1 -0
- package/dist/web/pennlibs-allow-tracking.pennlibs-autocomplete.pennlibs-footer.pennlibs-header.entry.esm.js.map +1 -1
- package/dist/web/web.esm.js +1 -1
- package/hydrate/index.js +18 -8
- package/hydrate/index.mjs +18 -8
- package/package.json +1 -1
- package/dist/web/p-ceaf55b0.entry.js.map +0 -1
package/dist/web/web.esm.js
CHANGED
|
@@ -17,7 +17,7 @@ var patchBrowser = () => {
|
|
|
17
17
|
|
|
18
18
|
patchBrowser().then(async (options) => {
|
|
19
19
|
await globalScripts();
|
|
20
|
-
return bootstrapLazy([["p-
|
|
20
|
+
return bootstrapLazy([["p-270fd846",[[1,"pennlibs-allow-tracking",{"consentGiven":[32],"hide":[32]}],[1,"pennlibs-autocomplete",{"for":[1],"showSuggestions":[32],"currentIndex":[32],"originalValue":[32],"options":[32]},[[0,"slotchange","handleSlotChange"],[16,"input","handleInputEvent"],[16,"focus","handleFocusEvent"],[16,"blur","handleBlurEvent"],[0,"focusout","handleFocusOut"],[4,"keydown","handleKeyDown"]]],[1,"pennlibs-footer",{"navigationByChildren":[32]}],[1,"pennlibs-header",{"serviceName":[1,"service-name"],"serviceLede":[1,"service-lede"],"serviceHref":[1,"service-href"],"theme":[1],"isMenuOpen":[32],"navigation":[32]}]]],["p-20c0bd7a",[[1,"pennlibs-banner"]]],["p-cbae5952",[[1,"pennlibs-chat",{"href":[32]}]]],["p-5e385536",[[1,"pennlibs-fallback-img"]]],["p-370e32b1",[[1,"pennlibs-feedback",{"error":[32],"answer":[32]}]]],["p-07ad051f",[[1,"pennlibs-hero",{"heroPictureElement":[32],"heroHeadingElement":[32],"heroParagraphElement":[32],"heroSrc":[32]}]]]], options);
|
|
21
21
|
});
|
|
22
22
|
//# sourceMappingURL=web.esm.js.map
|
|
23
23
|
|
package/hydrate/index.js
CHANGED
|
@@ -3228,7 +3228,7 @@ function TrackingIcon() {
|
|
|
3228
3228
|
return (hAsync("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "lucide lucide-trending-up-down-icon lucide-trending-up-down" }, hAsync("path", { d: "M14.828 14.828 21 21" }), hAsync("path", { d: "M21 16v5h-5" }), hAsync("path", { d: "m21 3-9 9-4-4-6 6" }), hAsync("path", { d: "M21 8V3h-5" })));
|
|
3229
3229
|
}
|
|
3230
3230
|
|
|
3231
|
-
const pennlibsAutocompleteCss = ":host {\n display: block;\n border-radius: 1.25rem;\n padding: 0;\n border-top: 0;\n position: relative;\n}\n\n[role=listbox] {\n position: absolute;\n margin-top: var(--pl-space-xs);\n background: var(--pl-color-bg-default);\n border-radius: 1.25rem;\n box-shadow: rgba(140, 149, 159, 0.3) 0px 8px 24px 0px;\n width: 100%;\n overflow: hidden;\n z-index: 1;\n\n display: flex;\n flex-direction: column;\n}\n\np {\n margin: 0;\n font-size: var(--pl-font-size-s);\n color: var(--pl-color-fg-subtle);\n padding: var(--pl-space-xs) calc(var(--pl-space-m) + var(--pl-space-2xs));\n font-size: var(--pl-font-size-s);\n order: 2;\n font-weight: 500;\n background: var(--pl-color-bg-subtle);\n border-radius: 0 0 1.25rem 1.25rem;\n\n display: flex;\n gap: var(--pl-space-s) var(--pl-space-l);\n flex-wrap: wrap;\n}\n\nol {\n list-style: none;\n margin: 0;\n padding: var(--pl-space-xs) 0;\n order: 1;\n}\n\n[role=option] {\n color: var(--pl-color-fg-default);\n padding: var(--pl-space-s) calc(var(--pl-space-m) + var(--pl-space-2xs));\n text-decoration: none;\n font-weight: 700; \n\n &:hover {\n cursor: pointer;\n }\n\n &:hover,\n &:focus {\n text-decoration-thickness: 2px;\n text-underline-offset: 2px;\n text-decoration: underline;\n }\n}\n\n[aria-selected=true] {\n text-decoration-thickness: 2px;\n text-underline-offset: 2px;\n text-decoration: underline;\n}\n\nmark {\n background: none;\n font-weight: 400;\n}\n\n.suggestion--border {\n border-bottom: solid 1px rgb(from var(--pl-color-fg-default) r g b / 0.2);\n padding-bottom: calc(var(--pl-space-2xs) + var(--pl-space-s));\n margin-bottom: var(--pl-space-2xs);\n}";
|
|
3231
|
+
const pennlibsAutocompleteCss = ":host {\n display: block;\n width: 100%;\n border-radius: 1.25rem;\n padding: 0;\n border-top: 0;\n position: relative;\n}\n\n[role=listbox] {\n position: absolute;\n margin-top: var(--pl-space-xs);\n background: var(--pl-color-bg-default);\n border-radius: 1.25rem;\n box-shadow: rgba(140, 149, 159, 0.3) 0px 8px 24px 0px;\n width: 100%;\n overflow: hidden;\n z-index: 1;\n\n display: flex;\n flex-direction: column;\n}\n\np {\n margin: 0;\n font-size: var(--pl-font-size-s);\n color: var(--pl-color-fg-subtle);\n padding: var(--pl-space-xs) calc(var(--pl-space-m) + var(--pl-space-2xs));\n font-size: var(--pl-font-size-s);\n order: 2;\n font-weight: 500;\n background: var(--pl-color-bg-subtle);\n border-radius: 0 0 1.25rem 1.25rem;\n\n display: flex;\n gap: var(--pl-space-s) var(--pl-space-l);\n flex-wrap: wrap;\n}\n\nol {\n list-style: none;\n margin: 0;\n padding: var(--pl-space-xs) 0;\n order: 1;\n}\n\n[role=option] {\n color: var(--pl-color-fg-default);\n padding: var(--pl-space-s) calc(var(--pl-space-m) + var(--pl-space-2xs));\n text-decoration: none;\n font-weight: 700; \n\n &:hover {\n cursor: pointer;\n }\n\n &:hover,\n &:focus {\n text-decoration-thickness: 2px;\n text-underline-offset: 2px;\n text-decoration: underline;\n }\n}\n\n[aria-selected=true] {\n text-decoration-thickness: 2px;\n text-underline-offset: 2px;\n text-decoration: underline;\n}\n\nmark {\n background: none;\n font-weight: 400;\n}\n\n.suggestion--border {\n border-bottom: solid 1px rgb(from var(--pl-color-fg-default) r g b / 0.2);\n padding-bottom: calc(var(--pl-space-2xs) + var(--pl-space-s));\n margin-bottom: var(--pl-space-2xs);\n}";
|
|
3232
3232
|
|
|
3233
3233
|
class Autocomplete {
|
|
3234
3234
|
constructor(hostRef) {
|
|
@@ -3268,27 +3268,36 @@ class Autocomplete {
|
|
|
3268
3268
|
return {
|
|
3269
3269
|
id: element.id || `option-${index}`,
|
|
3270
3270
|
html: element.innerHTML,
|
|
3271
|
-
value: element.getAttribute('data-value') || ((_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || ''
|
|
3271
|
+
value: element.getAttribute('data-pl-value') || ((_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || ''
|
|
3272
3272
|
};
|
|
3273
3273
|
}
|
|
3274
3274
|
getInput() {
|
|
3275
|
-
var _a
|
|
3275
|
+
var _a;
|
|
3276
|
+
if (!this.for)
|
|
3277
|
+
return null;
|
|
3276
3278
|
const slot = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot[name="start"]');
|
|
3277
|
-
|
|
3279
|
+
const input = slot.assignedElements()[0].querySelector(`input#${this.for}`);
|
|
3280
|
+
return input || null;
|
|
3278
3281
|
}
|
|
3279
3282
|
isInputFocused() {
|
|
3280
3283
|
return this.getInput() === document.activeElement;
|
|
3281
3284
|
}
|
|
3282
3285
|
isTrackedInput(input) {
|
|
3283
|
-
return (input === null || input === void 0 ? void 0 : input.getAttribute('data-pl-autocomplete-
|
|
3286
|
+
return (input === null || input === void 0 ? void 0 : input.getAttribute('data-pl-autocomplete-connected')) === 'true' &&
|
|
3284
3287
|
this.el.contains(input);
|
|
3285
3288
|
}
|
|
3286
3289
|
setupInput() {
|
|
3290
|
+
if (!this.for) {
|
|
3291
|
+
console.warn('<pennlibs-autocomplete> Missing "for" attribute. Please add for="input-id" to specify which input to attach to.');
|
|
3292
|
+
return;
|
|
3293
|
+
}
|
|
3287
3294
|
const input = this.getInput();
|
|
3288
|
-
if (!input)
|
|
3295
|
+
if (!input) {
|
|
3296
|
+
console.warn(`<pennlibs-autocomplete> No input element found with id="${this.for}". Ensure an input with this id exists.`);
|
|
3289
3297
|
return;
|
|
3298
|
+
}
|
|
3290
3299
|
this.setComboboxAttributes(input);
|
|
3291
|
-
input.setAttribute('data-pl-autocomplete-
|
|
3300
|
+
input.setAttribute('data-pl-autocomplete-connected', 'true');
|
|
3292
3301
|
}
|
|
3293
3302
|
setComboboxAttributes(input) {
|
|
3294
3303
|
input.setAttribute('role', 'combobox');
|
|
@@ -3452,7 +3461,7 @@ class Autocomplete {
|
|
|
3452
3461
|
return this.showSuggestions && this.options.length > 0 && this.isInputFocused();
|
|
3453
3462
|
}
|
|
3454
3463
|
render() {
|
|
3455
|
-
return (hAsync("div", { key: '
|
|
3464
|
+
return (hAsync("div", { key: '2091f8acacac10714c4d607e294248f3bd7e5fd7' }, hAsync("slot", { key: '628a216ce90ee693a354a74f91bcce2fe61b74a5', name: "start" }), this.shouldShowListbox() && (hAsync("ol", { key: '916eba0f4b2148616fac4cc96cac4c7506a9bd0e', role: "listbox", id: "listbox" }, this.options.map((option, index) => (hAsync("li", { role: "option", id: option.id, "aria-selected": this.currentIndex === index ? 'true' : 'false', tabindex: "-1", onClick: () => this.handleOptionClick(index), innerHTML: option.html })))))));
|
|
3456
3465
|
}
|
|
3457
3466
|
get el() { return getElement(this); }
|
|
3458
3467
|
static get style() { return pennlibsAutocompleteCss; }
|
|
@@ -3460,6 +3469,7 @@ class Autocomplete {
|
|
|
3460
3469
|
"$flags$": 9,
|
|
3461
3470
|
"$tagName$": "pennlibs-autocomplete",
|
|
3462
3471
|
"$members$": {
|
|
3472
|
+
"for": [1],
|
|
3463
3473
|
"showSuggestions": [32],
|
|
3464
3474
|
"currentIndex": [32],
|
|
3465
3475
|
"originalValue": [32],
|
package/hydrate/index.mjs
CHANGED
|
@@ -3226,7 +3226,7 @@ function TrackingIcon() {
|
|
|
3226
3226
|
return (hAsync("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "lucide lucide-trending-up-down-icon lucide-trending-up-down" }, hAsync("path", { d: "M14.828 14.828 21 21" }), hAsync("path", { d: "M21 16v5h-5" }), hAsync("path", { d: "m21 3-9 9-4-4-6 6" }), hAsync("path", { d: "M21 8V3h-5" })));
|
|
3227
3227
|
}
|
|
3228
3228
|
|
|
3229
|
-
const pennlibsAutocompleteCss = ":host {\n display: block;\n border-radius: 1.25rem;\n padding: 0;\n border-top: 0;\n position: relative;\n}\n\n[role=listbox] {\n position: absolute;\n margin-top: var(--pl-space-xs);\n background: var(--pl-color-bg-default);\n border-radius: 1.25rem;\n box-shadow: rgba(140, 149, 159, 0.3) 0px 8px 24px 0px;\n width: 100%;\n overflow: hidden;\n z-index: 1;\n\n display: flex;\n flex-direction: column;\n}\n\np {\n margin: 0;\n font-size: var(--pl-font-size-s);\n color: var(--pl-color-fg-subtle);\n padding: var(--pl-space-xs) calc(var(--pl-space-m) + var(--pl-space-2xs));\n font-size: var(--pl-font-size-s);\n order: 2;\n font-weight: 500;\n background: var(--pl-color-bg-subtle);\n border-radius: 0 0 1.25rem 1.25rem;\n\n display: flex;\n gap: var(--pl-space-s) var(--pl-space-l);\n flex-wrap: wrap;\n}\n\nol {\n list-style: none;\n margin: 0;\n padding: var(--pl-space-xs) 0;\n order: 1;\n}\n\n[role=option] {\n color: var(--pl-color-fg-default);\n padding: var(--pl-space-s) calc(var(--pl-space-m) + var(--pl-space-2xs));\n text-decoration: none;\n font-weight: 700; \n\n &:hover {\n cursor: pointer;\n }\n\n &:hover,\n &:focus {\n text-decoration-thickness: 2px;\n text-underline-offset: 2px;\n text-decoration: underline;\n }\n}\n\n[aria-selected=true] {\n text-decoration-thickness: 2px;\n text-underline-offset: 2px;\n text-decoration: underline;\n}\n\nmark {\n background: none;\n font-weight: 400;\n}\n\n.suggestion--border {\n border-bottom: solid 1px rgb(from var(--pl-color-fg-default) r g b / 0.2);\n padding-bottom: calc(var(--pl-space-2xs) + var(--pl-space-s));\n margin-bottom: var(--pl-space-2xs);\n}";
|
|
3229
|
+
const pennlibsAutocompleteCss = ":host {\n display: block;\n width: 100%;\n border-radius: 1.25rem;\n padding: 0;\n border-top: 0;\n position: relative;\n}\n\n[role=listbox] {\n position: absolute;\n margin-top: var(--pl-space-xs);\n background: var(--pl-color-bg-default);\n border-radius: 1.25rem;\n box-shadow: rgba(140, 149, 159, 0.3) 0px 8px 24px 0px;\n width: 100%;\n overflow: hidden;\n z-index: 1;\n\n display: flex;\n flex-direction: column;\n}\n\np {\n margin: 0;\n font-size: var(--pl-font-size-s);\n color: var(--pl-color-fg-subtle);\n padding: var(--pl-space-xs) calc(var(--pl-space-m) + var(--pl-space-2xs));\n font-size: var(--pl-font-size-s);\n order: 2;\n font-weight: 500;\n background: var(--pl-color-bg-subtle);\n border-radius: 0 0 1.25rem 1.25rem;\n\n display: flex;\n gap: var(--pl-space-s) var(--pl-space-l);\n flex-wrap: wrap;\n}\n\nol {\n list-style: none;\n margin: 0;\n padding: var(--pl-space-xs) 0;\n order: 1;\n}\n\n[role=option] {\n color: var(--pl-color-fg-default);\n padding: var(--pl-space-s) calc(var(--pl-space-m) + var(--pl-space-2xs));\n text-decoration: none;\n font-weight: 700; \n\n &:hover {\n cursor: pointer;\n }\n\n &:hover,\n &:focus {\n text-decoration-thickness: 2px;\n text-underline-offset: 2px;\n text-decoration: underline;\n }\n}\n\n[aria-selected=true] {\n text-decoration-thickness: 2px;\n text-underline-offset: 2px;\n text-decoration: underline;\n}\n\nmark {\n background: none;\n font-weight: 400;\n}\n\n.suggestion--border {\n border-bottom: solid 1px rgb(from var(--pl-color-fg-default) r g b / 0.2);\n padding-bottom: calc(var(--pl-space-2xs) + var(--pl-space-s));\n margin-bottom: var(--pl-space-2xs);\n}";
|
|
3230
3230
|
|
|
3231
3231
|
class Autocomplete {
|
|
3232
3232
|
constructor(hostRef) {
|
|
@@ -3266,27 +3266,36 @@ class Autocomplete {
|
|
|
3266
3266
|
return {
|
|
3267
3267
|
id: element.id || `option-${index}`,
|
|
3268
3268
|
html: element.innerHTML,
|
|
3269
|
-
value: element.getAttribute('data-value') || ((_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || ''
|
|
3269
|
+
value: element.getAttribute('data-pl-value') || ((_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || ''
|
|
3270
3270
|
};
|
|
3271
3271
|
}
|
|
3272
3272
|
getInput() {
|
|
3273
|
-
var _a
|
|
3273
|
+
var _a;
|
|
3274
|
+
if (!this.for)
|
|
3275
|
+
return null;
|
|
3274
3276
|
const slot = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot[name="start"]');
|
|
3275
|
-
|
|
3277
|
+
const input = slot.assignedElements()[0].querySelector(`input#${this.for}`);
|
|
3278
|
+
return input || null;
|
|
3276
3279
|
}
|
|
3277
3280
|
isInputFocused() {
|
|
3278
3281
|
return this.getInput() === document.activeElement;
|
|
3279
3282
|
}
|
|
3280
3283
|
isTrackedInput(input) {
|
|
3281
|
-
return (input === null || input === void 0 ? void 0 : input.getAttribute('data-pl-autocomplete-
|
|
3284
|
+
return (input === null || input === void 0 ? void 0 : input.getAttribute('data-pl-autocomplete-connected')) === 'true' &&
|
|
3282
3285
|
this.el.contains(input);
|
|
3283
3286
|
}
|
|
3284
3287
|
setupInput() {
|
|
3288
|
+
if (!this.for) {
|
|
3289
|
+
console.warn('<pennlibs-autocomplete> Missing "for" attribute. Please add for="input-id" to specify which input to attach to.');
|
|
3290
|
+
return;
|
|
3291
|
+
}
|
|
3285
3292
|
const input = this.getInput();
|
|
3286
|
-
if (!input)
|
|
3293
|
+
if (!input) {
|
|
3294
|
+
console.warn(`<pennlibs-autocomplete> No input element found with id="${this.for}". Ensure an input with this id exists.`);
|
|
3287
3295
|
return;
|
|
3296
|
+
}
|
|
3288
3297
|
this.setComboboxAttributes(input);
|
|
3289
|
-
input.setAttribute('data-pl-autocomplete-
|
|
3298
|
+
input.setAttribute('data-pl-autocomplete-connected', 'true');
|
|
3290
3299
|
}
|
|
3291
3300
|
setComboboxAttributes(input) {
|
|
3292
3301
|
input.setAttribute('role', 'combobox');
|
|
@@ -3450,7 +3459,7 @@ class Autocomplete {
|
|
|
3450
3459
|
return this.showSuggestions && this.options.length > 0 && this.isInputFocused();
|
|
3451
3460
|
}
|
|
3452
3461
|
render() {
|
|
3453
|
-
return (hAsync("div", { key: '
|
|
3462
|
+
return (hAsync("div", { key: '2091f8acacac10714c4d607e294248f3bd7e5fd7' }, hAsync("slot", { key: '628a216ce90ee693a354a74f91bcce2fe61b74a5', name: "start" }), this.shouldShowListbox() && (hAsync("ol", { key: '916eba0f4b2148616fac4cc96cac4c7506a9bd0e', role: "listbox", id: "listbox" }, this.options.map((option, index) => (hAsync("li", { role: "option", id: option.id, "aria-selected": this.currentIndex === index ? 'true' : 'false', tabindex: "-1", onClick: () => this.handleOptionClick(index), innerHTML: option.html })))))));
|
|
3454
3463
|
}
|
|
3455
3464
|
get el() { return getElement(this); }
|
|
3456
3465
|
static get style() { return pennlibsAutocompleteCss; }
|
|
@@ -3458,6 +3467,7 @@ class Autocomplete {
|
|
|
3458
3467
|
"$flags$": 9,
|
|
3459
3468
|
"$tagName$": "pennlibs-autocomplete",
|
|
3460
3469
|
"$members$": {
|
|
3470
|
+
"for": [1],
|
|
3461
3471
|
"showSuggestions": [32],
|
|
3462
3472
|
"currentIndex": [32],
|
|
3463
3473
|
"originalValue": [32],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@penn-libraries/web",
|
|
3
|
-
"version": "1.1.0-dev.
|
|
3
|
+
"version": "1.1.0-dev.2",
|
|
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",
|