@uvalib/web-components 1.1.1 → 1.3.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/CHANGELOG.md +140 -0
- package/README.md +1310 -80
- package/dist/analytics.d.ts +10 -0
- package/dist/analytics.js +9 -0
- package/dist/analytics.js.map +1 -0
- package/dist/base/UvalibElement.js +8 -5
- package/dist/base/UvalibElement.js.map +1 -1
- package/dist/base/analytics-state.d.ts +7 -0
- package/dist/base/analytics-state.js.map +1 -1
- package/dist/base/light-dom-styles.d.ts +13 -0
- package/dist/base/light-dom-styles.js +26 -0
- package/dist/base/light-dom-styles.js.map +1 -1
- package/dist/base/search-tracker.d.ts +57 -0
- package/dist/base/search-tracker.js +51 -0
- package/dist/base/search-tracker.js.map +1 -0
- package/dist/base/url-param.d.ts +23 -0
- package/dist/base/url-param.js +49 -0
- package/dist/base/url-param.js.map +1 -0
- package/dist/base.css +562 -2
- package/dist/base.d.ts +2 -0
- package/dist/base.js +1 -0
- package/dist/base.js.map +1 -1
- package/dist/components/site-analytics/SiteAnalytics.d.ts +20 -1
- package/dist/components/site-analytics/SiteAnalytics.js +93 -12
- package/dist/components/site-analytics/SiteAnalytics.js.map +1 -1
- package/dist/components/site-page/SitePage.d.ts +23 -0
- package/dist/components/site-page/SitePage.js +77 -0
- package/dist/components/site-page/SitePage.js.map +1 -1
- package/dist/components/uvalib-back-to-top/UvalibBackToTop.d.ts +58 -0
- package/dist/components/uvalib-back-to-top/UvalibBackToTop.js +250 -0
- package/dist/components/uvalib-back-to-top/UvalibBackToTop.js.map +1 -0
- package/dist/components/uvalib-back-to-top/uvalib-back-to-top.d.ts +1 -0
- package/dist/components/uvalib-back-to-top/uvalib-back-to-top.js +4 -0
- package/dist/components/uvalib-back-to-top/uvalib-back-to-top.js.map +1 -0
- package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.d.ts +14 -0
- package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js +56 -4
- package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js.map +1 -1
- package/dist/components/uvalib-card/UvalibCard.d.ts +19 -5
- package/dist/components/uvalib-card/UvalibCard.js +112 -9
- package/dist/components/uvalib-card/UvalibCard.js.map +1 -1
- package/dist/components/uvalib-chip-group/UvalibChipGroup.d.ts +178 -0
- package/dist/components/uvalib-chip-group/UvalibChipGroup.js +817 -0
- package/dist/components/uvalib-chip-group/UvalibChipGroup.js.map +1 -0
- package/dist/components/uvalib-chip-group/uvalib-chip-group.d.ts +1 -0
- package/dist/components/uvalib-chip-group/uvalib-chip-group.js +4 -0
- package/dist/components/uvalib-chip-group/uvalib-chip-group.js.map +1 -0
- package/dist/components/uvalib-combobox/UvalibCombobox.d.ts +212 -0
- package/dist/components/uvalib-combobox/UvalibCombobox.js +1088 -0
- package/dist/components/uvalib-combobox/UvalibCombobox.js.map +1 -0
- package/dist/components/uvalib-combobox/uvalib-combobox.d.ts +1 -0
- package/dist/components/uvalib-combobox/uvalib-combobox.js +4 -0
- package/dist/components/uvalib-combobox/uvalib-combobox.js.map +1 -0
- package/dist/components/uvalib-contents/UvalibContents.d.ts +53 -0
- package/dist/components/uvalib-contents/UvalibContents.js +202 -3
- package/dist/components/uvalib-contents/UvalibContents.js.map +1 -1
- package/dist/components/uvalib-date-histogram/UvalibDateHistogram.d.ts +187 -0
- package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js +1452 -0
- package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js.map +1 -0
- package/dist/components/uvalib-date-histogram/uvalib-date-histogram.d.ts +1 -0
- package/dist/components/uvalib-date-histogram/uvalib-date-histogram.js +4 -0
- package/dist/components/uvalib-date-histogram/uvalib-date-histogram.js.map +1 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.d.ts +6 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.js +23 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.js.map +1 -1
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.d.ts +113 -0
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js +589 -0
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js.map +1 -0
- package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.d.ts +1 -0
- package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.js +4 -0
- package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.js.map +1 -0
- package/dist/components/uvalib-image-regions/UvalibImageRegions.d.ts +130 -0
- package/dist/components/uvalib-image-regions/UvalibImageRegions.js +658 -0
- package/dist/components/uvalib-image-regions/UvalibImageRegions.js.map +1 -0
- package/dist/components/uvalib-image-regions/regions.d.ts +57 -0
- package/dist/components/uvalib-image-regions/regions.js +117 -0
- package/dist/components/uvalib-image-regions/regions.js.map +1 -0
- package/dist/components/uvalib-image-regions/uvalib-image-regions.d.ts +1 -0
- package/dist/components/uvalib-image-regions/uvalib-image-regions.js +4 -0
- package/dist/components/uvalib-image-regions/uvalib-image-regions.js.map +1 -0
- package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +40 -0
- package/dist/components/uvalib-lightbox/UvalibLightbox.js +152 -17
- package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
- package/dist/components/uvalib-lightbox/media.d.ts +1 -18
- package/dist/components/uvalib-lightbox/media.js +1 -42
- package/dist/components/uvalib-lightbox/media.js.map +1 -1
- package/dist/components/uvalib-map/UvalibMap.d.ts +182 -0
- package/dist/components/uvalib-map/UvalibMap.js +1001 -0
- package/dist/components/uvalib-map/UvalibMap.js.map +1 -0
- package/dist/components/uvalib-map/uvalib-map.d.ts +1 -0
- package/dist/components/uvalib-map/uvalib-map.js +4 -0
- package/dist/components/uvalib-map/uvalib-map.js.map +1 -0
- package/dist/components/uvalib-metadata/UvalibMetadata.d.ts +39 -2
- package/dist/components/uvalib-metadata/UvalibMetadata.js +214 -8
- package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
- package/dist/components/uvalib-pager/UvalibPager.d.ts +77 -4
- package/dist/components/uvalib-pager/UvalibPager.js +270 -8
- package/dist/components/uvalib-pager/UvalibPager.js.map +1 -1
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.d.ts +27 -1
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js +192 -26
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js.map +1 -1
- package/dist/components/uvalib-results-count/UvalibResultsCount.d.ts +62 -0
- package/dist/components/uvalib-results-count/UvalibResultsCount.js +208 -0
- package/dist/components/uvalib-results-count/UvalibResultsCount.js.map +1 -0
- package/dist/components/uvalib-results-count/uvalib-results-count.d.ts +1 -0
- package/dist/components/uvalib-results-count/uvalib-results-count.js +4 -0
- package/dist/components/uvalib-results-count/uvalib-results-count.js.map +1 -0
- package/dist/components/uvalib-tabs/UvalibTabs.d.ts +127 -0
- package/dist/components/uvalib-tabs/UvalibTabs.js +821 -0
- package/dist/components/uvalib-tabs/UvalibTabs.js.map +1 -0
- package/dist/components/uvalib-tabs/uvalib-tabs.d.ts +1 -0
- package/dist/components/uvalib-tabs/uvalib-tabs.js +4 -0
- package/dist/components/uvalib-tabs/uvalib-tabs.js.map +1 -0
- package/dist/components/uvalib-tag-list/UvalibTagList.d.ts +89 -0
- package/dist/components/uvalib-tag-list/UvalibTagList.js +411 -0
- package/dist/components/uvalib-tag-list/UvalibTagList.js.map +1 -0
- package/dist/components/uvalib-tag-list/uvalib-tag-list.d.ts +1 -0
- package/dist/components/uvalib-tag-list/uvalib-tag-list.js +4 -0
- package/dist/components/uvalib-tag-list/uvalib-tag-list.js.map +1 -0
- package/dist/custom-elements.json +14007 -3497
- package/dist/index.d.ts +16 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/pagefind.css +4 -0
- package/dist/styles/base.js +154 -1
- package/dist/styles/base.js.map +1 -1
- package/dist/styles/color-scheme.js +9 -0
- package/dist/styles/color-scheme.js.map +1 -1
- package/dist/styles/controls.js +8 -0
- package/dist/styles/controls.js.map +1 -1
- package/dist/styles/hidden.d.ts +2 -0
- package/dist/styles/hidden.js +51 -0
- package/dist/styles/hidden.js.map +1 -0
- package/dist/styles/message.d.ts +1 -0
- package/dist/styles/message.js +82 -0
- package/dist/styles/message.js.map +1 -0
- package/dist/styles/pagefind.js +4 -0
- package/dist/styles/pagefind.js.map +1 -1
- package/dist/styles/result-list.d.ts +1 -0
- package/dist/styles/result-list.js +111 -0
- package/dist/styles/result-list.js.map +1 -0
- package/dist/styles/results.d.ts +1 -0
- package/dist/styles/results.js +242 -0
- package/dist/styles/results.js.map +1 -0
- package/dist/testing/index.d.ts +110 -0
- package/dist/testing/index.js +100 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/lighthouse-rules.d.ts +10 -0
- package/dist/testing/lighthouse-rules.js +44 -0
- package/dist/testing/lighthouse-rules.js.map +1 -0
- package/dist/tokens.css +9 -0
- package/dist-cdn/analytics.js +32 -0
- package/dist-cdn/analytics.js.map +1 -0
- package/dist-cdn/base.css +562 -2
- package/dist-cdn/bento-box.js +3 -3
- package/dist-cdn/chunks/{SiteAnalytics-Cm-FyhYS.js → SiteAnalytics-B9gu5aGO.js} +59 -30
- package/dist-cdn/chunks/SiteAnalytics-B9gu5aGO.js.map +1 -0
- package/dist-cdn/chunks/{UvalibElement-BnI-eRRR.js → UvalibElement-pGONDAwB.js} +108 -101
- package/dist-cdn/chunks/UvalibElement-pGONDAwB.js.map +1 -0
- package/dist-cdn/chunks/{accessible-GqhVn5_H.js → accessible-DJv7YOtS.js} +2 -2
- package/dist-cdn/chunks/{accessible-GqhVn5_H.js.map → accessible-DJv7YOtS.js.map} +1 -1
- package/dist-cdn/chunks/analytics-state-Ce8DKe4F.js.map +1 -1
- package/dist-cdn/chunks/base-BI8h0Gf3.js +281 -0
- package/dist-cdn/chunks/base-BI8h0Gf3.js.map +1 -0
- package/dist-cdn/chunks/inline-copy-BANQSMIR.js +69 -0
- package/dist-cdn/chunks/inline-copy-BANQSMIR.js.map +1 -0
- package/dist-cdn/chunks/{library-weekly-hours-COE7Vv6V.js → library-weekly-hours-CrV3TlP5.js} +3 -3
- package/dist-cdn/chunks/{library-weekly-hours-COE7Vv6V.js.map → library-weekly-hours-CrV3TlP5.js.map} +1 -1
- package/dist-cdn/chunks/regions-B8ExwUGP.js +86 -0
- package/dist-cdn/chunks/regions-B8ExwUGP.js.map +1 -0
- package/dist-cdn/chunks/{repeat-CIFUYkyh.js → repeat-m5Zd_QeP.js} +2 -2
- package/dist-cdn/chunks/{repeat-CIFUYkyh.js.map → repeat-m5Zd_QeP.js.map} +1 -1
- package/dist-cdn/chunks/{site-header-C9V7Wuw2.js → site-header-DYRMpdBj.js} +13 -4
- package/dist-cdn/chunks/site-header-DYRMpdBj.js.map +1 -0
- package/dist-cdn/chunks/{site-main-nav-AaxZ9rQf.js → site-main-nav-DURrQMal.js} +3 -3
- package/dist-cdn/chunks/{site-main-nav-AaxZ9rQf.js.map → site-main-nav-DURrQMal.js.map} +1 -1
- package/dist-cdn/chunks/source-children-BHsDwCvL.js +53 -0
- package/dist-cdn/chunks/source-children-BHsDwCvL.js.map +1 -0
- package/dist-cdn/chunks/{static-html-1mTAG6nS.js → static-html-C1rhtCHu.js} +2 -2
- package/dist-cdn/chunks/{static-html-1mTAG6nS.js.map → static-html-C1rhtCHu.js.map} +1 -1
- package/dist-cdn/chunks/url-param-C1sk_F1d.js +28 -0
- package/dist-cdn/chunks/url-param-C1sk_F1d.js.map +1 -0
- package/dist-cdn/custom-elements.json +14007 -3497
- package/dist-cdn/events-section.js +3 -3
- package/dist-cdn/library-hours-setup.js +2 -2
- package/dist-cdn/library-weekly-hours.js +1 -1
- package/dist-cdn/manifest.json +15 -2
- package/dist-cdn/pagefind.css +4 -0
- package/dist-cdn/site-alerts.js +4 -4
- package/dist-cdn/site-analytics.js +2 -2
- package/dist-cdn/site-footer.js +2 -2
- package/dist-cdn/site-header.js +1 -1
- package/dist-cdn/site-hours-section.js +4 -4
- package/dist-cdn/site-main-nav.js +1 -1
- package/dist-cdn/site-page.js +56 -11
- package/dist-cdn/site-page.js.map +1 -1
- package/dist-cdn/site-style.js +2 -2
- package/dist-cdn/skills/uvalib-web-components/SKILL.md +269 -24
- package/dist-cdn/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +514 -13
- package/dist-cdn/skills/uvalib-web-components/reference/snippets.md +1 -1
- package/dist-cdn/tokens.css +9 -0
- package/dist-cdn/uvalib-analytics.js +2 -2
- package/dist-cdn/uvalib-back-to-top.js +156 -0
- package/dist-cdn/uvalib-back-to-top.js.map +1 -0
- package/dist-cdn/uvalib-breadcrumbs.js +31 -11
- package/dist-cdn/uvalib-breadcrumbs.js.map +1 -1
- package/dist-cdn/uvalib-card-grid.js +1 -1
- package/dist-cdn/uvalib-card.js +97 -23
- package/dist-cdn/uvalib-card.js.map +1 -1
- package/dist-cdn/uvalib-chip-group.js +535 -0
- package/dist-cdn/uvalib-chip-group.js.map +1 -0
- package/dist-cdn/uvalib-combobox.js +667 -0
- package/dist-cdn/uvalib-combobox.js.map +1 -0
- package/dist-cdn/uvalib-contents.js +102 -23
- package/dist-cdn/uvalib-contents.js.map +1 -1
- package/dist-cdn/uvalib-date-histogram.js +960 -0
- package/dist-cdn/uvalib-date-histogram.js.map +1 -0
- package/dist-cdn/uvalib-date-range.js +14 -2
- package/dist-cdn/uvalib-date-range.js.map +1 -1
- package/dist-cdn/uvalib-filter-drawer.js +355 -0
- package/dist-cdn/uvalib-filter-drawer.js.map +1 -0
- package/dist-cdn/uvalib-filter.js +3 -3
- package/dist-cdn/uvalib-image-regions.js +447 -0
- package/dist-cdn/uvalib-image-regions.js.map +1 -0
- package/dist-cdn/uvalib-lightbox.js +145 -78
- package/dist-cdn/uvalib-lightbox.js.map +1 -1
- package/dist-cdn/uvalib-map.js +471 -0
- package/dist-cdn/uvalib-map.js.map +1 -0
- package/dist-cdn/uvalib-metadata.js +152 -25
- package/dist-cdn/uvalib-metadata.js.map +1 -1
- package/dist-cdn/uvalib-pager.js +164 -18
- package/dist-cdn/uvalib-pager.js.map +1 -1
- package/dist-cdn/uvalib-photo-grid.js +123 -21
- package/dist-cdn/uvalib-photo-grid.js.map +1 -1
- package/dist-cdn/uvalib-results-count.js +101 -0
- package/dist-cdn/uvalib-results-count.js.map +1 -0
- package/dist-cdn/uvalib-tabs.js +436 -0
- package/dist-cdn/uvalib-tabs.js.map +1 -0
- package/dist-cdn/uvalib-tag-list.js +267 -0
- package/dist-cdn/uvalib-tag-list.js.map +1 -0
- package/package.json +66 -3
- package/skills/uvalib-web-components/SKILL.md +269 -24
- package/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
- package/skills/uvalib-web-components/reference/components.md +514 -13
- package/skills/uvalib-web-components/reference/snippets.md +1 -1
- package/dist-cdn/chunks/SiteAnalytics-Cm-FyhYS.js.map +0 -1
- package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js.map +0 -1
- package/dist-cdn/chunks/base-CAFQWnZG.js +0 -128
- package/dist-cdn/chunks/base-CAFQWnZG.js.map +0 -1
- package/dist-cdn/chunks/site-header-C9V7Wuw2.js.map +0 -1
- package/dist-cdn/chunks/source-children-RuAec527.js +0 -119
- package/dist-cdn/chunks/source-children-RuAec527.js.map +0 -1
|
@@ -255,7 +255,7 @@ Live UVA Library alerts, drawn as library.virginia.edu draws them. The alerts pr
|
|
|
255
255
|
|
|
256
256
|
## `<site-analytics>`
|
|
257
257
|
|
|
258
|
-
Matomo analytics, with no visual output. Loads matomo.js for the site and records the page view, then forwards the events below, fired anywhere in the page, to Matomo. Every call goes through Matomo's `_paq` queue, so events fired before matomo.js loads are kept. One tracker per page: however many `<site-analytics>` and `<uvalib-analytics>` elements there are (from any copy of this library), matomo.js is loaded and the page view recorded once, and only one element forwards each event; if it is removed, the next takes over. A Matomo snippet already on the page is used as it is (nothing is loaded or recorded again). When the browser sends Do Not Track or Global Privacy Control, or the page has `<html data-uvalib-analytics="off">`, it loads nothing and records nothing. A click on an element with `data-uvalib-track="category,action[,name[,value]]"` (or inside one, in light or shadow DOM) sends that event, unless `<html data-uvalib-analytics="off">` or a `no-analytics` ancestor opts it out. The same element is registered as `<uvalib-analytics>` by `uvalib-analytics.js`.
|
|
258
|
+
Matomo analytics, with no visual output. Loads matomo.js for the site and records the page view, then forwards the events below, fired anywhere in the page, to Matomo. Every call goes through Matomo's `_paq` queue, so events fired before matomo.js loads are kept. One tracker per page: however many `<site-analytics>` and `<uvalib-analytics>` elements there are (from any copy of this library), matomo.js is loaded and the page view recorded once, and only one element forwards each event; if it is removed, the next takes over. A Matomo snippet already on the page is used as it is (nothing is loaded or recorded again). When the browser sends Do Not Track or Global Privacy Control, or the page has `<html data-uvalib-analytics="off">`, it loads nothing and records nothing. A click on an element with `data-uvalib-track="category,action[,name[,value]]"` (or inside one, in light or shadow DOM) sends that event, unless `<html data-uvalib-analytics="off">` or a `no-analytics` ancestor opts it out. With `downloads="event"` downloads are counted as `['download', '<extension>']` events, without their URLs, instead of by Matomo's link tracking. The same element is registered as `<uvalib-analytics>` by `uvalib-analytics.js`.
|
|
259
259
|
|
|
260
260
|
### Attributes
|
|
261
261
|
|
|
@@ -265,6 +265,7 @@ Matomo analytics, with no visual output. Loads matomo.js for the site and record
|
|
|
265
265
|
| `matomoid` | `number \| undefined` | | The Matomo site id (attribute `matomoid`). Default: the site whose URL the page is under. |
|
|
266
266
|
| `spa` | `boolean \| 'auto'` | `false` | A single-page app. `spa` (no value): it records its own page views (`uvalib-analytics-pageview`), none on load. `spa="auto"`: a page view on load and one per same-document route change (hash change, Back and Forward, `history.pushState`), once the title has settled, never twice in a row for the same URL, with the previous URL as the referrer. Either way Matomo's link tracking is off. |
|
|
267
267
|
| `variables` | `Record<string, unknown> \| null` | `null` | Custom dimensions, a JSON object of `{ id: value }`, set before the page view. |
|
|
268
|
+
| `downloads` | `string \| undefined` | | `event`: count downloads without their URLs. Matomo's link tracking is left off; a left or middle click on a link to a file (the `download` attribute, or a download file type) sends the event `['download', '<extension>']` (no URL, no file name), and a click on a link to another site is still sent as an outlink (`trackLink`), as Matomo's link tracking would. Off by default. Read when Matomo is set up; no effect with a Matomo snippet already on the page. |
|
|
268
269
|
| `no-shadow-dom` | `boolean` | `false` | |
|
|
269
270
|
| `no-style` | `boolean` | `false` | |
|
|
270
271
|
|
|
@@ -464,7 +465,7 @@ The UVA Library main navigation (About, Using the Library, Research & teaching s
|
|
|
464
465
|
|
|
465
466
|
## `<site-page>`
|
|
466
467
|
|
|
467
|
-
Page wrapper: skip link (inside the header landmark in shadow mode), header, a single `<main>`, footer (unless `no-footer`), and global page styles. Side-effect free: `site-page.ts` registers `<site-header>` (and its `<site-main-nav>`) and `<site-footer>`. The header shows the UVA Library main navigation by default (`no-main-nav` turns it off; `header-variant="vendor"` never shows it). Shows live UVA Library alerts by default with `<site-alerts>` (its code loads only then), placed as Virgo places them: a full-bleed `<site-alerts show="header">` banner at the top of the header landmark (after the skip link), a full-bleed band between the header and `<main>` holding `<site-alerts show="list">` (a `<section aria-label="Library alerts">` region, hidden while the list has nothing to show), and `<site-alerts show="regional">` as the first child of `<main>`, inside its padding. Their data comes from one headless `<uvalib-alerts>`, loaded once per document, with a module script, from the alerts CDN (`alerts-env`, or `alerts-src`); if it fails to load, one console warning is logged and the page works as before. `no-alerts` renders no alert elements and loads nothing. A `slot="breadcrumbs"` child (a `<uvalib-breadcrumbs>`) is placed where library.virginia.edu puts the trail: after the header and the alert list band, before `<main>` and outside it (so the skip link lands past it), with the same gutters as `<main>`.
|
|
468
|
+
Page wrapper: skip link (inside the header landmark in shadow mode), header, a single `<main>`, footer (unless `no-footer`), and global page styles. Side-effect free: `site-page.ts` registers `<site-header>` (and its `<site-main-nav>`) and `<site-footer>`. The header shows the UVA Library main navigation by default (`no-main-nav` turns it off; `header-variant="vendor"` never shows it). Shows live UVA Library alerts by default with `<site-alerts>` (its code loads only then), placed as Virgo places them: a full-bleed `<site-alerts show="header">` banner at the top of the header landmark (after the skip link), a full-bleed band between the header and `<main>` holding `<site-alerts show="list">` (a `<section aria-label="Library alerts">` region, hidden while the list has nothing to show), and `<site-alerts show="regional">` as the first child of `<main>`, inside its padding. Their data comes from one headless `<uvalib-alerts>`, loaded once per document, with a module script, from the alerts CDN (`alerts-env`, or `alerts-src`); if it fails to load, one console warning is logged and the page works as before. `no-alerts` renders no alert elements and loads nothing. A `slot="breadcrumbs"` child (a `<uvalib-breadcrumbs>`) is placed where library.virginia.edu puts the trail: after the header and the alert list band, before `<main>` and outside it (so the skip link lands past it), with the same gutters as `<main>`. Printing leaves out the chrome: the skip link, header (with the main navigation and the header alert), alert list band, regional alerts, breadcrumbs, pre-footer and footer are not printed, `<main>` loses its gutters, and the content prints black on white (a dark scheme prints light), its links underlined. A short line above the content says where the page came from ("UVA Library — <site name or page title>" and the page's URL). `print-chrome` prints the page as it is shown instead. With `no-style` none of this applies.
|
|
468
469
|
|
|
469
470
|
### Attributes
|
|
470
471
|
|
|
@@ -474,6 +475,7 @@ Page wrapper: skip link (inside the header landmark in shadow mode), header, a s
|
|
|
474
475
|
| `header-variant` | `'full' \| 'vendor'` | `'full'` | |
|
|
475
476
|
| `no-global-styles` | `boolean` | `false` | |
|
|
476
477
|
| `no-footer` | `boolean` | `false` | Hide the footer (and any pre-footer band), for tools and app-like pages where the site footer does not belong. The footer is kept hidden rather than removed, so toggling the attribute keeps pre-footer content. |
|
|
478
|
+
| `print-chrome` | `boolean` | `false` | Print the header, alerts, breadcrumbs and footer too. By default printing leaves them out and prints only `<main>`, black on white. |
|
|
477
479
|
| `site-links-label` | `string \| undefined` | | Accessible name of the header navigation when site links are given (default "Site"). |
|
|
478
480
|
| `site-name` | `string \| undefined` | | The sub-site's name, forwarded to `<site-header site-name>`: shown after the logo as a link to the site's home. |
|
|
479
481
|
| `site-name-href` | `string \| undefined` | | Where the site name links, forwarded to `<site-header site-name-href>` (default `/`). |
|
|
@@ -487,6 +489,7 @@ Page wrapper: skip link (inside the header landmark in shadow mode), header, a s
|
|
|
487
489
|
| `color-scheme-switch` | `boolean` | `false` | Opt in to dark mode, forwarded to `<site-header color-scheme-switch>`: the page follows the OS preference, and a Light / Dark / System control in the header lets the visitor override it (remembered per site). Off by default: the page is always light. The page's own content must support it (see the README's "Dark mode"). |
|
|
488
490
|
| `matomo-id` | `number \| undefined` | | Opt in to Matomo analytics: the site's Matomo id. The page then adds one `<site-analytics>` for it (loading its code only then), which records the page view and what the library's components report (see the README's "Analytics"). Off by default. With an analytics element or a Matomo snippet already on the page nothing is counted twice. |
|
|
489
491
|
| `matomo-url` | `string \| undefined` | | The Matomo server for `matomo-id`, ending in `/` (default: the library's). |
|
|
492
|
+
| `matomo-downloads` | `string \| undefined` | | `event`: the `<site-analytics downloads="event">` option for `matomo-id`, counting downloads as `['download', '<extension>']` events without their URLs. |
|
|
490
493
|
| `no-shadow-dom` | `boolean` | `false` | |
|
|
491
494
|
| `no-style` | `boolean` | `false` | |
|
|
492
495
|
|
|
@@ -564,6 +567,7 @@ Compatibility element. Light mode (`no-shadow-dom`) installs the tokens and base
|
|
|
564
567
|
| `matomoid` | `number \| undefined` | | The Matomo site id (attribute `matomoid`). Default: the site whose URL the page is under. |
|
|
565
568
|
| `spa` | `boolean \| 'auto'` | `false` | A single-page app. `spa` (no value): it records its own page views (`uvalib-analytics-pageview`), none on load. `spa="auto"`: a page view on load and one per same-document route change (hash change, Back and Forward, `history.pushState`), once the title has settled, never twice in a row for the same URL, with the previous URL as the referrer. Either way Matomo's link tracking is off. |
|
|
566
569
|
| `variables` | `Record<string, unknown> \| null` | `null` | Custom dimensions, a JSON object of `{ id: value }`, set before the page view. |
|
|
570
|
+
| `downloads` | `string \| undefined` | | `event`: count downloads without their URLs. Matomo's link tracking is left off; a left or middle click on a link to a file (the `download` attribute, or a download file type) sends the event `['download', '<extension>']` (no URL, no file name), and a click on a link to another site is still sent as an outlink (`trackLink`), as Matomo's link tracking would. Off by default. Read when Matomo is set up; no effect with a Matomo snippet already on the page. |
|
|
567
571
|
| `no-shadow-dom` | `boolean` | `false` | |
|
|
568
572
|
| `no-style` | `boolean` | `false` | |
|
|
569
573
|
|
|
@@ -580,9 +584,46 @@ Compatibility element. Light mode (`no-shadow-dom`) installs the tokens and base
|
|
|
580
584
|
| `site-analytics-event` | Listened for on `document` too: the same as `uvalib-analytics-event`. |
|
|
581
585
|
| `site-analytics-content` | Listened for on `document` too: the same as `uvalib-analytics-content`. |
|
|
582
586
|
|
|
587
|
+
## `<uvalib-back-to-top>`
|
|
588
|
+
|
|
589
|
+
A “Back to top” button for long pages: minutes, finding aids, transcriptions, long result lists. It stays hidden (`visibility: hidden`, so it is neither a tab stop nor in the accessibility tree) until the top `offset` pixels of the page (default 400) have scrolled out of view, watched with an IntersectionObserver on a small sentinel at the top of the page, never a scroll listener. If it has focus as it hides, focus moves to the target. Activating it scrolls to the top (smoothly unless the visitor prefers reduced motion) and moves focus to the page's `<h1>` (the first in `<main>`, else the first anywhere, else `#top`), or to `target` (a selector), adding `tabindex="-1"` when it is not focusable, so keyboard and screen reader users land at the top too. The button is fixed in the bottom corner (end side), inside the safe-area insets. The element itself is an empty block 4.75rem tall: put it last in the page's main content and that is the space the button needs, so the last lines can always scroll clear of it. When that space comes into view the button sits in it instead of floating, so it never covers the footer either. It is hidden in print.
|
|
590
|
+
|
|
591
|
+
### Attributes
|
|
592
|
+
|
|
593
|
+
| Attribute | Type | Default | Description |
|
|
594
|
+
|---|---|---|---|
|
|
595
|
+
| `label` | | `DEFAULT_LABEL` | The button's text. |
|
|
596
|
+
| `offset` | | `DEFAULT_OFFSET` | How many pixels at the top of the page must scroll out of view before the button shows. |
|
|
597
|
+
| `target` | `string` | `''` | A selector for where focus goes (default: the page's `<h1>`, else `#top`). |
|
|
598
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
599
|
+
| `no-style` | `boolean` | `false` | |
|
|
600
|
+
|
|
601
|
+
### CSS parts
|
|
602
|
+
|
|
603
|
+
| Part | Description |
|
|
604
|
+
|---|---|
|
|
605
|
+
| `button` | The button. |
|
|
606
|
+
|
|
607
|
+
### Events
|
|
608
|
+
|
|
609
|
+
| Event | Description |
|
|
610
|
+
|---|---|
|
|
611
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['uvalib-back-to-top', 'click']` when activated. Bubbles and is composed. |
|
|
612
|
+
|
|
613
|
+
### CSS custom properties
|
|
614
|
+
|
|
615
|
+
| Property | Default | Description |
|
|
616
|
+
|---|---|---|
|
|
617
|
+
| `--uvalib-back-to-top-space` | `4.75rem` | The height the element keeps for the button at the end of the content. |
|
|
618
|
+
| `--uva-color-surface-raised` | | Dark-mode role token: button background (else #fff). |
|
|
619
|
+
| `--uva-color-button-bg` | | Dark-mode role token: button border and text (else `--uva-blue-alt`, #007bac). |
|
|
620
|
+
| `--uva-color-button-hover-bg` | | Dark-mode role token: hovered button (else `--uva-blue-alt-A`, #005679). |
|
|
621
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
622
|
+
| `--uva-color-shadow` | | Dark-mode role token: the floating button's shadow. |
|
|
623
|
+
|
|
583
624
|
## `<uvalib-breadcrumbs>`
|
|
584
625
|
|
|
585
|
-
A breadcrumb trail, as on library.virginia.edu: links separated by slashes, ending with the current page, at body size. A `<nav aria-label="Breadcrumb">` holding an `<ol>`; the separators are hidden from assistive technology and the last item has `aria-current="page"` (a `<span>`, or a link when it has an href). Give the trail as children: `<a href>` elements, ending with the current page as a text-only element (`<span>Hours</span>`) or a link (`<a href aria-current="page">`). The last child is always the current page. An earlier child without an href is shown as plain text. Children with no text are skipped with one console warning. Hrefs are used as written, and the trail follows changes to the children (attributes and text too). Apps that build the trail in JavaScript set the `items` property instead (it then wins over any children); assigning a new array re-renders. Inside `<site-page>`, give it `slot="breadcrumbs"`: it is placed between the header (and alerts band) and `<main>`, with the page's gutters. It works anywhere else too. Single-page apps: the trail is drawn from copies of the children, so a router's own click handlers on them do not run. Listen for `uvalib-breadcrumbs-navigate` and cancel it to route in place; hash links need nothing.
|
|
626
|
+
A breadcrumb trail, as on library.virginia.edu: links separated by slashes, ending with the current page, at body size. A `<nav aria-label="Breadcrumb">` holding an `<ol>`; the separators are hidden from assistive technology and the last item has `aria-current="page"` (a `<span>`, or a link when it has an href). Give the trail as children: `<a href>` elements, ending with the current page as a text-only element (`<span>Hours</span>`) or a link (`<a href aria-current="page">`). The last child is always the current page. An earlier child without an href is shown as plain text. Children with no text are skipped with one console warning. Hrefs are used as written, and the trail follows changes to the children (attributes and text too). Apps that build the trail in JavaScript set the `items` property instead (it then wins over any children); assigning a new array re-renders. A step back to a search: give its link `data-return-from` with the search page's path (or several, separated by spaces), as in `<a href="/" data-return-from="/">Search</a>`. When the visitor came from that page on this site with a query string (`document.referrer`; a trailing slash or `index.html` does not matter), the step links back to that search (path and query) instead; its text stays the same. Otherwise, as when the result was opened in a new tab or the site sends no referrer, it keeps its href. Nothing is stored or sent. In `items`, the same is `returnFrom`. Inside `<site-page>`, give it `slot="breadcrumbs"`: it is placed between the header (and alerts band) and `<main>`, with the page's gutters. It works anywhere else too. Single-page apps: the trail is drawn from copies of the children, so a router's own click handlers on them do not run. Listen for `uvalib-breadcrumbs-navigate` and cancel it to route in place; hash links need nothing.
|
|
586
627
|
|
|
587
628
|
### Attributes
|
|
588
629
|
|
|
@@ -613,13 +654,14 @@ A breadcrumb trail, as on library.virginia.edu: links separated by slashes, endi
|
|
|
613
654
|
|
|
614
655
|
## `<uvalib-card>`
|
|
615
656
|
|
|
616
|
-
One card: a collection (title and “N texts”), a photo (image, count, date, category, title, excerpt) or any other raised summary. With `href`, the heading is the link and a pseudo-element stretches that link over the card, so the whole card is one click. The arrow is only a visual aid. The card is never wrapped in an `<a>`. A clickable card must not contain another link, button or other control: the stretched link covers it. A static card (no `href`, or an empty or unsafe one) has no stretch, so its excerpt may contain links. With `href`, the heading needs an accessible name (text, or an image `alt` or `aria-label`); otherwise the link is hidden. Regions are light-DOM children. Give `slot="media"`, `slot="badge"`, `slot="heading"`, `slot="meta"` or `slot="
|
|
657
|
+
One card: a collection (title and “N texts”), a photo (image, count, date, category, title, excerpt) or any other raised summary. With `href`, the heading is the link and a pseudo-element stretches that link over the card, so the whole card is one click. The arrow is only a visual aid. The card is never wrapped in an `<a>`. A clickable card must not contain another link, button or other control: the stretched link covers it. A static card (no `href`, or an empty or unsafe one) has no stretch, so its excerpt and `actions` slot may contain links. With `href`, the heading needs an accessible name (text, or an image `alt` or `aria-label`); otherwise the link is hidden. `media-shape="circle"` draws the media as a centered circle, for a person or avatar. The image keeps its alt, and the count badge still sits on it. Any other shape is ignored. Regions are light-DOM children. Give `slot="media"`, `slot="badge"`, `slot="heading"`, `slot="meta"`, `slot="chip"` or `slot="actions"`; anything else (including text) is the excerpt. An image needs a real alt, or `alt=""` when the heading already names it. A date belongs in `<time>` in the meta slot. One element per chip. `actions` is a row of links or buttons on a static card (“Read the story”, “Photos (132)”). The heading level defaults like `<events-section>`: one below the nearest heading before the card, or 3 when there is none. `heading-level` (1–6) wins. An invalid value is ignored.
|
|
617
658
|
|
|
618
659
|
### Attributes
|
|
619
660
|
|
|
620
661
|
| Attribute | Type | Default | Description |
|
|
621
662
|
|---|---|---|---|
|
|
622
663
|
| `href` | `string \| undefined` | | Makes the card one link: the heading stretches over the card. Empty is not a link. |
|
|
664
|
+
| `media-shape` | `string` | `''` | `circle` crops the media to a centered circle and keeps the image alt. Anything else is ignored, with one console warning. |
|
|
623
665
|
| `heading-level` | `number \| undefined` | | Heading level of the title, 1–6. Unset, it is one below the nearest heading before this card, or 3 when there is none. Any other value is ignored. |
|
|
624
666
|
| `no-shadow-dom` | `boolean` | `false` | |
|
|
625
667
|
| `no-style` | `boolean` | `false` | |
|
|
@@ -633,6 +675,7 @@ One card: a collection (title and “N texts”), a photo (image, count, date, c
|
|
|
633
675
|
| `heading` | The card title. With `href`, this heading’s link is the card, so it needs an accessible name. |
|
|
634
676
|
| `meta` | Date (`<time>`) or byline, under the title. |
|
|
635
677
|
| `chip` | Category. One element per chip. |
|
|
678
|
+
| `actions` | Links or buttons on a static card. A clickable card must not contain them; the card link covers them. |
|
|
636
679
|
| (default) | Excerpt. A static card may put links here; a clickable card must not contain other controls. |
|
|
637
680
|
|
|
638
681
|
### Events
|
|
@@ -684,9 +727,112 @@ A grid of `<uvalib-card>` elements. It is a list, so a screen reader announces h
|
|
|
684
727
|
|---|---|---|
|
|
685
728
|
| `--uvalib-card-min` | | Set from `min-card-width` when that value is a length. The grid uses it as the `auto-fill` minimum. |
|
|
686
729
|
|
|
730
|
+
## `<uvalib-chip-group>`
|
|
731
|
+
|
|
732
|
+
A row of chips: a segmented control or single-select filter (`mode="single"`), filter chips that toggle (`mode="multi"`), or suggestion chips that go somewhere (`mode="links"`), as in a year rail with counts (“2005 213”), a sort toggle (“Most photos \| Date \| Title A–Z”) or “Try: snow on the Lawn”. Give the chips as children, `<button value="2005" data-count="213">2005</button>` (the value is the `value` attribute, else `data-value`, else the text; `disabled` disables), or `<a href>` in `links` mode, or set the `items` property (`{ value, label, count?, href?, disabled?, swatch? }`), which wins over the children while set. The chips follow later changes to the children. `single`: native radios drawn as chips, in a `role="radiogroup"` named by `label`. Tab enters the group at the selected chip, the arrow keys move and select (as any radio group), and `value` is the selected chip's value. `multi`: toggle buttons with `aria-pressed`, and `value` is an array (as an attribute, comma-separated). `links`: links, or buttons that fire `select`, with no selected state; a chip whose href is unsafe (`javascript:`) is plain text, and an empty href is a button. `data-swatch` (or `swatch` in `items`) is a CSS colour drawn as a small bordered square before the label, so the chips double as a chart's or map's colour key. It is decorative (`aria-hidden`) and never the only cue: the name stays the label. An invalid colour is ignored with one warning. In forced colors the square keeps its colour. A count is shown in a smaller muted span after the label and read as part of the name: “2005, 213 items”, with `count-label` in place of “items”. A selected chip is filled, keeps its border and shows a tick. Chips wrap on a narrow screen; `scroll` keeps them on one row that scrolls sideways, with its scrollbar shown and a fade at an edge with more chips. Each chip is a target at least 44px square. `segmented` joins the chips into one bar that does not wrap (a long label wraps inside its segment), like the header's Light / Dark / System control. `description` is a hint shown under the chips and tied to the group with `aria-describedby`, so it is read when focus enters the group (“Keyword matches your words…”). It is plain text in the element's own root, so it works in a closed shadow root. `url-param` (for example `year`) keeps the value in the address (`?year=2005`, a multi value comma-separated, inside the hash on a hash route). It is read on connect; the markup's `value` stands for the address without the parameter, and any other value is written, an empty one as `?year=`. Each change is one `pushState`: in `multi` at once, in `single` once the visitor settles (a second after the last change, so arrowing through a year rail adds one entry, none if it ends where it started). Back and Forward are followed and fire `change` with `restored: true`.
|
|
733
|
+
|
|
734
|
+
### Attributes
|
|
735
|
+
|
|
736
|
+
| Attribute | Type | Default | Description |
|
|
737
|
+
|---|---|---|---|
|
|
738
|
+
| `mode` | `ChipGroupMode` | `'single'` | `single` (radios: one value), `multi` (toggles: an array of values) or `links`. |
|
|
739
|
+
| `label` | `string` | `''` | The group's accessible name (required), also the first part of the analytics name. |
|
|
740
|
+
| `description` | `string` | `''` | A hint shown under the chips and read with the group when focus enters it (`aria-describedby` on the group). Plain text. |
|
|
741
|
+
| `value` | `string \| string[]` | `''` | The selection: a chip's value in `single`, an array of values in `multi` (as an attribute, comma-separated). Setting it does not fire `change`. Unused in `links`. |
|
|
742
|
+
| `count-label` | `string` | `'items'` | The word after a count in each chip's accessible name: “2005, 213 items”. |
|
|
743
|
+
| `scroll` | `boolean` | `false` | One row that scrolls sideways instead of wrapping. |
|
|
744
|
+
| `segmented` | `boolean` | `false` | Join the chips into one segmented bar. |
|
|
745
|
+
| `url-param` | `string` | `''` | Query parameter that keeps the value in the address, for example `year` → `?year=2005`. |
|
|
746
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
747
|
+
| `no-style` | `boolean` | `false` | |
|
|
748
|
+
|
|
749
|
+
### CSS parts
|
|
750
|
+
|
|
751
|
+
| Part | Description |
|
|
752
|
+
|---|---|
|
|
753
|
+
| `swatch` | The colour square before a chip's label (`data-swatch`, `swatch`). |
|
|
754
|
+
|
|
755
|
+
### Events
|
|
756
|
+
|
|
757
|
+
| Event | Description |
|
|
758
|
+
|---|---|
|
|
759
|
+
| `change` | The visitor changed the selection (`single`, `multi`), or Back or Forward changed it through `url-param`: `detail` is `{ value, restored? }` (a string in `single`, an array in `multi`; `restored` is true for Back and Forward). Not fired when the app sets `value`. Bubbles and is composed. |
|
|
760
|
+
| `select` | `links` mode: a chip was chosen. `detail` is `{ value, href? }`. For a link, a plain primary click fires it cancelable: cancel it (`preventDefault()`) to route in the app, and the click's default is prevented too. Bubbles and is composed. |
|
|
761
|
+
| `uvalib-analytics-event` | For `<site-analytics>`, on the visitor's actions only: `['uvalib-chip-group', 'change', '<label>: <chip label>', <count>?]` (in `single`, one second after the last change, for the chip then selected; in `multi`, for the chip toggled), and `['uvalib-chip-group', 'select', '<label>']` in `links` mode (never the chip or its URL). The count is sent when it is a number. Bubbles and is composed. |
|
|
762
|
+
|
|
763
|
+
### CSS custom properties
|
|
764
|
+
|
|
765
|
+
| Property | Default | Description |
|
|
766
|
+
|---|---|---|
|
|
767
|
+
| `--uva-color-surface-raised` | | Dark-mode role token: chip background (else #fff). |
|
|
768
|
+
| `--uva-color-control-border` | | Dark-mode role token: chip border (else `--uva-grey`, #808080). |
|
|
769
|
+
| `--uva-color-link` | | Dark-mode role token: chip text and hover border (else `--uva-brand-blue`). |
|
|
770
|
+
| `--uva-color-text-muted` | | Dark-mode role token: the count and the description (else #4f4f4f). |
|
|
771
|
+
| `--uva-color-accent-bg` | | Dark-mode role token: selected chip background and border (else `--uva-brand-blue`). |
|
|
772
|
+
| `--uva-color-on-accent` | | Dark-mode role token: selected chip text (else #fff). |
|
|
773
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
774
|
+
| `--uva-color-surface` | | Dark-mode role token: the page background the scrolling row fades into at an edge with more chips (else #fff). |
|
|
775
|
+
|
|
776
|
+
## `<uvalib-combobox>`
|
|
777
|
+
|
|
778
|
+
An editable text field that suggests values as you type, from a local list or a URL: a person, place or subject picker. It follows the WAI-ARIA APG “Editable Combobox With List Autocomplete”: a real `<input role="combobox">` and a `role="listbox"` popup under it. Suggestions come from the `items` property (`{ value, label?, description?, disabled? }` objects, or strings), from `<option>` children (directly or inside a `<datalist>`; the `label` attribute or text is the label, `data-description` the second line), or from `src`, a URL template with `{q}` (fetched 250 ms after the last keystroke once the text has `min-length` characters, default 1; a newer keystroke aborts the older request; the response is a JSON array of the same shape, or anything `transform(data, query)` turns into one). `items` wins over the children while set. Local suggestions match anywhere in the label, ignoring case and accents, those starting with the text first, then those with a word starting with it; at most `max-results` (default 50, 0 for all) are shown, which keeps a list of 16,000 people fast. The matched text is bold and underlined in a `<mark>`. Keys: Down opens the list on the first suggestion and moves (wrapping), Up opens on the last, Alt+Down opens without moving, Alt+Up closes, Enter chooses the active suggestion (and then does not submit the form; with none active, Enter submits as in any field), Escape closes the list and a second Escape clears the field, Home, End, Left and Right move the caret, and Tab leaves without choosing. A real clear button (“Clear <label>”, 44px, shown only with text) empties the field and returns focus to it. Free text is allowed: `value` is whatever is in the field, and `selected` the chosen suggestion (or null); typing after choosing clears it, and leaving the field with text that is exactly one suggestion's label chooses it. `must-choose` makes any other text invalid (“Choose one of the suggestions.”). The element is form-associated: with `name` it submits the chosen suggestion's value, or else the text, and a form reset restores the `value` attribute. `required` and `disabled` (also from a disabled fieldset) work as on an input. A polite status says “5 suggestions”, “50 of 1,234 suggestions”, “No suggestions”, “Loading suggestions” or “Couldn't load suggestions” half a second after the list settles (never on the first render); the popup shows the same notes visibly. A failed load never throws. Before it upgrades, `base.css` shows the label (from the attribute) and holds the field's height. A fallback `<input list>` child works as a plain field meanwhile; on upgrade its text, `name` and `placeholder` carry over, and it is disabled so it does not submit twice.
|
|
779
|
+
|
|
780
|
+
### Attributes
|
|
781
|
+
|
|
782
|
+
| Attribute | Type | Default | Description |
|
|
783
|
+
|---|---|---|---|
|
|
784
|
+
| `label` | `string` | `''` | The field's visible label (required); also the analytics name. |
|
|
785
|
+
| `description` | `string` | `''` | A hint under the field, read with it (aria-describedby). |
|
|
786
|
+
| `placeholder` | `string` | `''` | |
|
|
787
|
+
| `name` | `string` | `''` | The form field name. |
|
|
788
|
+
| `value` | `string` | `''` | The text in the field. The attribute is the starting text, and what a form reset restores. Setting it does not fire `change`. |
|
|
789
|
+
| `src` | `string` | `''` | A URL template with `{q}` (the trimmed text, URL-encoded) that returns suggestions as JSON. |
|
|
790
|
+
| `min-length` | `number` | `1` | Characters typed before suggestions appear (and `src` is fetched). |
|
|
791
|
+
| `max-results` | `number` | `50` | The most suggestions shown at once; 0 for all. |
|
|
792
|
+
| `must-choose` | `boolean` | `false` | Text that is not one of the suggestions is invalid. |
|
|
793
|
+
| `required` | `boolean` | `false` | |
|
|
794
|
+
| `disabled` | `boolean` | `false` | |
|
|
795
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
796
|
+
| `no-style` | `boolean` | `false` | |
|
|
797
|
+
|
|
798
|
+
### CSS parts
|
|
799
|
+
|
|
800
|
+
| Part | Description |
|
|
801
|
+
|---|---|
|
|
802
|
+
| `label` | The visible label. |
|
|
803
|
+
| `input` | The text field. |
|
|
804
|
+
| `clear` | The clear button. |
|
|
805
|
+
| `popup` | The popup under the field. |
|
|
806
|
+
| `option` | Each suggestion. |
|
|
807
|
+
| `description` | The hint under the field. |
|
|
808
|
+
|
|
809
|
+
### Events
|
|
810
|
+
|
|
811
|
+
| Event | Description |
|
|
812
|
+
|---|---|
|
|
813
|
+
| `type` | |
|
|
814
|
+
| `input` | The text changed by typing (the native event of the field, composed). Not fired when an option is chosen. |
|
|
815
|
+
| `select` | A suggestion was chosen (click or Enter). `detail` is `{ item }`, the object given. Bubbles and is composed. |
|
|
816
|
+
| `change` | The value was committed: a suggestion chosen, the field cleared, or the field left with changed text. `detail` is `{ value, item }` (`item` is the chosen suggestion or null). Not fired when the app sets `value` or `selected`. Bubbles and is composed. |
|
|
817
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['uvalib-combobox', 'select', '<label>', <position from 1>]` when a suggestion is chosen, `['uvalib-combobox', 'clear', '<label>']` when the clear button or Escape empties the field, and `['uvalib-combobox', 'error', 'load']` once when `src` fails. Never the typed text or a suggestion's text or value. Bubbles and is composed. |
|
|
818
|
+
|
|
819
|
+
### CSS custom properties
|
|
820
|
+
|
|
821
|
+
| Property | Default | Description |
|
|
822
|
+
|---|---|---|
|
|
823
|
+
| `--uva-color-surface-raised` | | Dark-mode role token: field and popup background (else #fff). |
|
|
824
|
+
| `--uva-color-control-border` | | Dark-mode role token: field and popup border (else `--uva-grey`, #808080). |
|
|
825
|
+
| `--uva-color-input-text` | | Dark-mode role token: field and suggestion text (else #2b2b2b). |
|
|
826
|
+
| `--uva-color-text-muted` | | Dark-mode role token: descriptions, notes and the clear icon (else #4f4f4f). |
|
|
827
|
+
| `--uva-color-surface-hover` | | Dark-mode role token: active suggestion background (else #dadada). |
|
|
828
|
+
| `--uva-color-track` | | Dark-mode role token: hovered suggestion background (else #f1f1f1). |
|
|
829
|
+
| `--uva-color-accent-bg` | | Dark-mode role token: the active suggestion's bar and outline (else `--uva-brand-blue`). |
|
|
830
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
831
|
+
| `--uva-color-shadow` | | Dark-mode role token: popup shadow. |
|
|
832
|
+
|
|
687
833
|
## `<uvalib-contents>`
|
|
688
834
|
|
|
689
|
-
Sub-navigation or a table of contents, as library.virginia.edu's sub-navigation: a `<nav>` landmark (named by `label`, "Contents" by default) with the label as a visible headline, and a nested list of links with dividers between the top-level entries and a bar beside each nested level. Give the list as a child: an `<ol>` or `<ul>` of `<li>` elements, each with an `<a href>` (or plain text for a group label) and, for sub-entries, a nested `<ol>`/`<ul>`, to any depth. Other children (a heading) are ignored. The list follows changes to the children. Apps set the `items` property instead (`{ label, href?, children? }`, winning over the children while set). The current entry gets `aria-current`: `page` for the link to this page, `location` for the link to the section of it in the URL's hash. It is found from the page URL (path, and hash for in-page sections), followed through same-document navigations (`hashchange`, `popstate` and the Navigation API), or from the `current` attribute (a URL, resolved like the links). An entry whose href has a query string matches only that query (`?part=2`); one without matches the page whatever its query. Hash-only hrefs are places on that page. With `current` unset, a valid `aria-current` on a source link (`page`, `location` or `true`) is used instead, the first of each kind. `lang` and `dir` on the source links and items, and inline markup in their text (`em`, `cite`, `code`, `abbr`…, copied element by element, never as HTML), are kept. On narrow screens the list collapses into a disclosure: the headline becomes a button with `aria-expanded`, and the list starts closed (as the Electronic Text Collections' Contents does on phones, so the text comes first) until the reader opens it, or while the `open` attribute is set; opening it shows the current entry. Narrow means the viewport (`collapse-below`, 64rem by default), not the element's own width: a contents sidebar is always far narrower than 64rem, so a container query could not tell a phone from a desktop. `sticky` keeps it in view in a sidebar on wide screens; a list longer than the window then scrolls, and the current entry is scrolled into view inside it (never the page). Single-page apps: the list is drawn from copies of the children, so a router's own click handlers on them do not run. Listen for `uvalib-contents-navigate` and cancel it to route in place; hash links need nothing.
|
|
835
|
+
Sub-navigation or a table of contents, as library.virginia.edu's sub-navigation: a `<nav>` landmark (named by `label`, "Contents" by default) with the label as a visible headline, and a nested list of links with dividers between the top-level entries and a bar beside each nested level. Give the list as a child: an `<ol>` or `<ul>` of `<li>` elements, each with an `<a href>` (or plain text for a group label) and, for sub-entries, a nested `<ol>`/`<ul>`, to any depth. Other children (a heading) are ignored. The list follows changes to the children. Apps set the `items` property instead (`{ label, href?, children? }`, winning over the children while set). The current entry gets `aria-current`: `page` for the link to this page, `location` for the link to the section of it in the URL's hash. It is found from the page URL (path, and hash for in-page sections), followed through same-document navigations (`hashchange`, `popstate` and the Navigation API), or from the `current` attribute (a URL, resolved like the links). An entry whose href has a query string matches only that query (`?part=2`); one without matches the page whatever its query. Hash-only hrefs are places on that page. With `current` unset, a valid `aria-current` on a source link (`page`, `location` or `true`) is used instead, the first of each kind. `lang` and `dir` on the source links and items, and inline markup in their text (`em`, `cite`, `code`, `abbr`…, copied element by element, never as HTML), are kept. On narrow screens the list collapses into a disclosure: the headline becomes a button with `aria-expanded`, and the list starts closed (as the Electronic Text Collections' Contents does on phones, so the text comes first) until the reader opens it, or while the `open` attribute is set; opening it shows the current entry. Narrow means the viewport (`collapse-below`, 64rem by default), not the element's own width: a contents sidebar is always far narrower than 64rem, so a container query could not tell a phone from a desktop. `sticky` keeps it in view in a sidebar on wide screens; a list longer than the window then scrolls, and the current entry is scrolled into view inside it (never the page). A table of contents for a long document: `headings-from="#article"` builds the list from the headings in that element (`levels`, `2-3` by default; nothing shown below `min` top-level entries, 2 by default). Headings without text or hidden with `aria-hidden` are skipped; one without an id gets one from its text (`budget-report`, then `budget-report-2`), and existing ids are kept, so links to sections keep working. It follows headings added, removed or retitled; `refresh()` reads them again after other changes. The children and `items` win while they give a list. Without JavaScript there is no list: a list rendered at build time, as children, works everywhere. Single-page apps: the list is drawn from copies of the children, so a router's own click handlers on them do not run. Listen for `uvalib-contents-navigate` and cancel it to route in place; hash links need nothing.
|
|
690
836
|
|
|
691
837
|
### Attributes
|
|
692
838
|
|
|
@@ -698,6 +844,9 @@ Sub-navigation or a table of contents, as library.virginia.edu's sub-navigation:
|
|
|
698
844
|
| `collapse-below` | | `DEFAULT_COLLAPSE` | The viewport width at and below which the list collapses into a disclosure: a CSS length (`64rem`, `800px`). `0` or `none` never collapses. |
|
|
699
845
|
| `open` | `boolean` | `false` | Whether the collapsed disclosure is open (no effect on wide screens). Toggled by its button. |
|
|
700
846
|
| `sticky` | `boolean` | `false` | Keep it in view while the page scrolls (a sidebar), on wide screens. |
|
|
847
|
+
| `headings-from` | `string \| undefined` | | Build the list from the headings in the element this selector names (`#article`): each heading at `levels` gets an entry linking to it (an id is added when it has none), the lower levels nested under the heading before them. The children and `items` win while they give a list. |
|
|
848
|
+
| `levels` | | `DEFAULT_LEVELS` | With `headings-from`: the heading levels to list, `2-3` (the default) or one level, `2`. |
|
|
849
|
+
| `min` | | `DEFAULT_MIN` | With `headings-from`: the fewest top-level entries worth a list (default 2). With fewer, nothing is shown. |
|
|
701
850
|
| `no-shadow-dom` | `boolean` | `false` | |
|
|
702
851
|
| `no-style` | `boolean` | `false` | |
|
|
703
852
|
|
|
@@ -727,6 +876,65 @@ Sub-navigation or a table of contents, as library.virginia.edu's sub-navigation:
|
|
|
727
876
|
| `--uva-color-surface-raised` | | Dark-mode role token: the button's background (else #fff). |
|
|
728
877
|
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
729
878
|
|
|
879
|
+
## `<uvalib-date-histogram>`
|
|
880
|
+
|
|
881
|
+
Monthly, yearly or per-decade counts as bars: a date distribution for a search page, an archive timeline or a card. Give `items` (`{ date, count }`, `date` a `YYYY` or `YYYY-MM`) or a child `<table>` (the no-JS fallback). `granularity="month"` draws twelve bars for every year from the first date to the last, including months with a count of zero. A year-only count in a month chart, a day, or any other date is a chip beside the chart. `granularity="decade"` is for a long span (two centuries of minutes): one bar per decade ("1810s: 22 meetings"), an empty decade a gap, five decades to a row labelled with its first year (1800, 1850, …), the decades lined up in columns. Choosing a decade selects its first to last year (`selected="1810/1819"`, `select` `{ from: '1810-01-01', to: '1819-12-31' }`); up and down arrows move 50 years. `granularity="auto"` draws months when every count is a month within 3 years (at most 36 bars), years up to 30 years, and decades beyond. A year row that scrolls sideways is not offered: 200 years at the 24px minimum bar is over 5,000px, so a sidebar would show ten years at a time and lose the shape that decades show whole. Each bar is a button named like "October 2015: 5,311 photos". Arrow keys move between bars; Enter or Space selects. `selected` is one bucket (`2015-10`, `2015`) or a range (`2015-03/2016-01`, also `..` or an en dash). The selection is `aria-pressed`, an inset ring and a stripe, not colour alone. Choosing a bar fires `select` with `{ from, to }` as ISO dates (a month runs from its first day to its last). Choosing the selected bar again clears it (`from` and `to` are empty strings). `range-for` is the id of a `<uvalib-date-range>`. A bar click sets that element's `value`. Whenever the range's value changes, from its controls or set in script (a Clear button, Back/Forward, a restored URL), this element highlights the buckets that overlap it (it listens for `uvalib-date-range-value`). A value that is exactly the range's own `min` and `max` is no selection. On connect or reconnect, or when the range is added later, the range's value wins when it holds a selection or changed while this element was away; otherwise `selected` is written to it. A range value is never rounded to whole buckets and written back. Setting `selected` here updates the date range. `variant="strip"` is the small per-year row for a card: not interactive, `role="img"`, one bar per year, or per decade with `decade` (or `auto` over more than 30 years). The chart reserves its height before the counts arrive: one bar track, or one track per year (per half-century for decades) when those years are already known from the data, a linked date range or the table (`--uvalib-date-histogram-bar-size`, 8rem, plus the row gap). Filling the bars in does not move the page. On a narrow screen a month row scrolls inside the component; "Scroll sideways to see more." shows while it overflows. Years wrap; a decade row fits 320px.
|
|
882
|
+
|
|
883
|
+
### Attributes
|
|
884
|
+
|
|
885
|
+
| Attribute | Type | Default | Description |
|
|
886
|
+
|---|---|---|---|
|
|
887
|
+
| `items` | `HistogramItem[]` | `[]` | Counts to draw. When non-empty, wins over the child table. Set a new array to update. |
|
|
888
|
+
| `granularity` | `'year' \| 'month' \| 'decade' \| 'auto'` | `'month'` | `month` (twelve bars per year), `year`, `decade` (one bar per decade, five to a row), or `auto`: months when every count is a month within 3 years, years up to 30 years, else decades. Anything else is month, with one console warning. |
|
|
889
|
+
| `scale` | `'linear' \| 'log'` | `'linear'` | `log` scales bar height by log(count + 1). Anything else is linear. |
|
|
890
|
+
| `selected` | `string` | `''` | One bucket (`2015-10` or `2015`) or a range (`2015-03/2016-01`). A linked date range writes a range here. Empty when nothing is selected. |
|
|
891
|
+
| `range-for` | `string` | `''` | Id of a `<uvalib-date-range>` to keep in step with, both ways. |
|
|
892
|
+
| `variant` | `string` | `''` | `strip`: a non-interactive per-year row (`role="img"`). Anything else is the bar chart. |
|
|
893
|
+
| `unit` | `string` | `'items'` | Word after the count in each bar's name. Plural; a count of one drops a trailing s. |
|
|
894
|
+
| `label` | `string` | `'Dates'` | Accessible name of the bar group, and the start of the strip's summary. |
|
|
895
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
896
|
+
| `no-style` | `boolean` | `false` | |
|
|
897
|
+
|
|
898
|
+
### Slots
|
|
899
|
+
|
|
900
|
+
| Slot | Description |
|
|
901
|
+
|---|---|
|
|
902
|
+
| (default) | A `<table>` of dates and counts: two columns (date, count) or a year-by-month grid. Without JavaScript it is the fallback. With JavaScript it supplies the counts when `items` is empty. Show as table lists those counts, including odd dates; once `items` is set it lists `items` instead. |
|
|
903
|
+
|
|
904
|
+
### CSS parts
|
|
905
|
+
|
|
906
|
+
| Part | Description |
|
|
907
|
+
|---|---|
|
|
908
|
+
| `chart` | The bar chart (shadow mode). |
|
|
909
|
+
| `bar` | A bar button, or a strip segment (shadow mode). |
|
|
910
|
+
| `table` | The generated table in Show as table (shadow mode). |
|
|
911
|
+
|
|
912
|
+
### Events
|
|
913
|
+
|
|
914
|
+
| Event | Description |
|
|
915
|
+
|---|---|
|
|
916
|
+
| `select` | A bar or an odd-date chip was chosen, or the current one chosen again to clear it. `detail` is `{ from, to }` (ISO dates, or the odd token). Empty strings clear the selection. Not fired when `selected` is set in script or when a linked date range changes. Bubbles and is composed. |
|
|
917
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['uvalib-date-histogram', 'select', '<from>–<to>']` when both ends are ISO dates, or `'other'` for any other choice. Not fired when the selection is cleared, set in script, or restored from a date range. Bubbles and is composed. |
|
|
918
|
+
|
|
919
|
+
### CSS custom properties
|
|
920
|
+
|
|
921
|
+
| Property | Default | Description |
|
|
922
|
+
|---|---|---|
|
|
923
|
+
| `--uvalib-date-histogram-bar-size` | `8rem` | Height of each bar track. The chart reserves one track, or one per known year, before the counts arrive. |
|
|
924
|
+
| `--uvalib-date-histogram-strip-size` | `1.5rem` | Height of `variant="strip"`. |
|
|
925
|
+
| `--uva-brand-blue` | `#232d4b` | Bar fill. |
|
|
926
|
+
| `--uva-brand-orange` | `#e57200` | Focus ring when `--uva-color-focus` is unset. |
|
|
927
|
+
| `--uva-font-family` | `inherit` | Font family. |
|
|
928
|
+
| `--uva-color-accent-bg` | | Dark-mode role token: bar fill (else `--uva-brand-blue`). |
|
|
929
|
+
| `--uva-color-on-accent` | | Dark-mode role token: the selection stripe (else #fff). |
|
|
930
|
+
| `--uva-color-text` | | Dark-mode role token: labels and the selection ring (else #2b2b2b). |
|
|
931
|
+
| `--uva-color-text-muted` | | Dark-mode role token: the scroll hint (else #4b5563). |
|
|
932
|
+
| `--uva-color-track` | | Dark-mode role token: the empty part of a bar (else #e5e7eb). |
|
|
933
|
+
| `--uva-color-surface` | | Dark-mode role token: the sticky year label (else #fff). |
|
|
934
|
+
| `--uva-color-surface-raised` | | Dark-mode role token: odd-date chips (else #fff). |
|
|
935
|
+
| `--uva-color-control-border` | | Dark-mode role token: bar, chip and table borders (else #808080). |
|
|
936
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
937
|
+
|
|
730
938
|
## `<uvalib-date-range>`
|
|
731
939
|
|
|
732
940
|
A date-range picker: a two-thumb year slider plus "From" and "To" date inputs. `min` and `max` (ISO dates, `YYYY-MM-DD`) are required; without valid ones the element renders nothing and logs a console warning once. The start can never pass the end, and both stay within `min`..`max`.
|
|
@@ -746,6 +954,7 @@ A date-range picker: a two-thumb year slider plus "From" and "To" date inputs. `
|
|
|
746
954
|
|
|
747
955
|
| Event | Description |
|
|
748
956
|
|---|---|
|
|
957
|
+
| `uvalib-date-range-value` | The selected range changed for any reason: a slider, a date input, or `value`, `min` or `max` set in script (a Clear button, Back/Forward, a restored URL). `detail` is `{ value: [start, end] }`, the range as shown (ISO dates inside `min`..`max`). For keeping other components in step; it is not a visitor action, so it is never sent to analytics. Not fired for the first render or when the shown range is unchanged. Bubbles and is composed. |
|
|
749
958
|
| `date-range-change` | The range changed from a slider or a date input. `detail` is `{ value: [start, end] }` (ISO dates). Bubbles and is composed. |
|
|
750
959
|
| `uvalib-analytics-event` | For `<site-analytics>`: `['uvalib-date-range', 'range-change', '<from year>–<to year>']`, 1 s after the visitor's last change (not when the range ends where it started). Bubbles and is composed. |
|
|
751
960
|
|
|
@@ -811,6 +1020,117 @@ A faceted-search filter: a fieldset of checkboxes (value plus result count), opt
|
|
|
811
1020
|
| `--uva-color-on-accent` | | Dark-mode role token: pressed chip text (else #fff). |
|
|
812
1021
|
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
813
1022
|
|
|
1023
|
+
## `<uvalib-filter-drawer>`
|
|
1024
|
+
|
|
1025
|
+
A search page's form and filters: a plain sidebar on wide screens, and on narrow ones a “Search and filters” button that opens them in a modal panel from the side. Put the page's search form, `<uvalib-filter>`s and other facets inside. Above `breakpoint` (default `48rem`) they are shown as written: no button, no dialog role. At and below it only the button is shown; it opens a native `<dialog>` (`showModal()`) with a visible heading (the `label`) and a 44px Close button, which takes focus. Escape, Close and a click on the backdrop close it, and focus returns to the button; widening the window past the breakpoint closes it and keeps focus where it was. While it is open the rest of the page, including `<site-page>`'s header, skip link and alerts, is inert (the browser's modal dialog), so focus cannot leave it except to the browser itself, and nothing else is announced. The children are the same nodes in both layouts (moved, never re-created): typed text, checked boxes, listeners and each filter's state are kept. Inert content is not announced, so results counts and status notices outside the panel would go silent while the visitor filters: name them in `live` (space-separated ids) and the drawer repeats what they announce in its own polite live region while it is open. `count` (the page's number of active filters) is shown on the button when above 0. The drawer never counts by itself: only the page knows which inputs are filters.
|
|
1026
|
+
|
|
1027
|
+
### Attributes
|
|
1028
|
+
|
|
1029
|
+
| Attribute | Type | Default | Description |
|
|
1030
|
+
|---|---|---|---|
|
|
1031
|
+
| `label` | | `DEFAULT_LABEL` | The button's text, the panel's heading and the dialog's name. |
|
|
1032
|
+
| `breakpoint` | | `DEFAULT_BREAKPOINT` | The widest viewport that gets the button and panel (`48rem`, `768px`); wider gets the sidebar. |
|
|
1033
|
+
| `count` | `number` | `0` | Active filters, set by the page; shown on the button when above 0. |
|
|
1034
|
+
| `live` | `string` | `''` | Space-separated ids of live regions outside the drawer (a results count, a status notice) to keep announcing while the panel is open. |
|
|
1035
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1036
|
+
| `no-style` | `boolean` | `false` | |
|
|
1037
|
+
|
|
1038
|
+
### Slots
|
|
1039
|
+
|
|
1040
|
+
| Slot | Description |
|
|
1041
|
+
|---|---|
|
|
1042
|
+
| (default) | The search form and filters. Shown as the sidebar on wide screens and inside the panel on narrow ones. |
|
|
1043
|
+
|
|
1044
|
+
### CSS parts
|
|
1045
|
+
|
|
1046
|
+
| Part | Description |
|
|
1047
|
+
|---|---|
|
|
1048
|
+
| `toggle` | The “Search and filters” button (narrow screens only). |
|
|
1049
|
+
| `count` | The number of active filters on the button. |
|
|
1050
|
+
| `sidebar` | The wrapper of the children on wide screens. |
|
|
1051
|
+
| `dialog` | The `<dialog>` panel. |
|
|
1052
|
+
| `header` | The panel's heading row. |
|
|
1053
|
+
| `heading` | The panel's heading. |
|
|
1054
|
+
| `close` | The Close button. |
|
|
1055
|
+
| `body` | The wrapper of the children, in the sidebar or the panel. |
|
|
1056
|
+
|
|
1057
|
+
### Events
|
|
1058
|
+
|
|
1059
|
+
| Event | Description |
|
|
1060
|
+
|---|---|
|
|
1061
|
+
| `close` | The panel closed (Close, Escape, the backdrop, `close()`, or the window widening past the breakpoint). Does not bubble. |
|
|
1062
|
+
| `open` | The panel opened. Does not bubble. |
|
|
1063
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['uvalib-filter-drawer', 'open', '<label>']` when the visitor opens the panel, and `['uvalib-filter-drawer', 'close', '<label>']` when they close it (Close, Escape or the backdrop; not when the window widens or a script closes it). Bubbles and is composed. |
|
|
1064
|
+
|
|
1065
|
+
### CSS custom properties
|
|
1066
|
+
|
|
1067
|
+
| Property | Default | Description |
|
|
1068
|
+
|---|---|---|
|
|
1069
|
+
| `--uvalib-filter-drawer-width` | `min(24rem, 100% - 3rem)` | The panel's width. |
|
|
1070
|
+
| `--uva-color-surface` | | Dark-mode role token: panel background (else #fff). |
|
|
1071
|
+
| `--uva-color-text` | | Dark-mode role token: panel text (else #2b2b2b). |
|
|
1072
|
+
| `--uva-color-border` | | Dark-mode role token: panel edge and heading rule (else #dadada). |
|
|
1073
|
+
| `--uva-color-button-bg` | | Dark-mode role token: button border and text, the count's background (else `--uva-blue-alt`, #007bac). |
|
|
1074
|
+
| `--uva-color-button-hover-bg` | | Dark-mode role token: hovered button (else `--uva-blue-alt-A`, #005679). |
|
|
1075
|
+
| `--uva-color-button-text` | | Dark-mode role token: the count's text (else #fff). |
|
|
1076
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
1077
|
+
|
|
1078
|
+
## `<uvalib-image-regions>`
|
|
1079
|
+
|
|
1080
|
+
An image with numbered region outlines (people, objects, inscriptions) and a list of the same regions beside it (under it on a narrow screen). The list is the way in: the outlines are a visual aid, hidden from assistive technology and not in the tab order, so no region is a second tab stop. Hovering or focusing a list entry (or anything in it) highlights its region with a thicker double outline and its label, and dims the others; hovering a region highlights its entry. Clicking a region moves focus to its entry. The image: an `<img>` (or `<picture>`) child, which keeps its `alt`, or `src` and `alt`. Give it `width` and `height` so its space is reserved before it loads. The regions: an `<ol>` child whose `<li>` items carry `data-xywh` (IIIF / Media Fragments: `percent:10,20,30,40`, or pixels `160,120,320,240` of the image's natural size). The list is shown as written, so it works before the component loads or without JavaScript, and any links and buttons in it stay the page's own (their events are the page's). Or set the `items` property, and the component draws the list. Region numbers are the list's numbers, from 1 (or the `<ol>`'s `start`).
|
|
1081
|
+
|
|
1082
|
+
### Attributes
|
|
1083
|
+
|
|
1084
|
+
| Attribute | Type | Default | Description |
|
|
1085
|
+
|---|---|---|---|
|
|
1086
|
+
| `src` | `string` | `''` | Image URL, when there is no `<img>` child. |
|
|
1087
|
+
| `alt` | `string` | `''` | The image's alternative text (with `src`). |
|
|
1088
|
+
| `width` | `number \| undefined` | | The image's width (with `src`), reserving its space. |
|
|
1089
|
+
| `height` | `number \| undefined` | | The image's height (with `src`). |
|
|
1090
|
+
| `image-width` | `number \| undefined` | | The size pixel regions are measured in, when it is not the image's natural size (for example a IIIF derivative of a larger original: the original's width and height). |
|
|
1091
|
+
| `image-height` | `number \| undefined` | | The height pixel regions are measured in (with `image-width`). |
|
|
1092
|
+
| `label` | `string` | `'Regions'` | The list's heading, and the analytics name. |
|
|
1093
|
+
| `heading-level` | `number \| undefined` | | The heading's level (2 to 6). Default: one below the heading before the element. |
|
|
1094
|
+
| `numbering` | `'numbers' \| 'none'` | `'numbers'` | `numbers` (default) shows each region's number on its outline; `none` hides them. |
|
|
1095
|
+
| `hide-outlines` | `boolean` | `false` | Hide the outlines (the list stays). |
|
|
1096
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1097
|
+
| `no-style` | `boolean` | `false` | |
|
|
1098
|
+
|
|
1099
|
+
### Slots
|
|
1100
|
+
|
|
1101
|
+
| Slot | Description |
|
|
1102
|
+
|---|---|
|
|
1103
|
+
| (default) | The region list (`<ol>` with `<li data-xywh>`), shown as written. Not used with `items`. |
|
|
1104
|
+
| `image` | The image. A first `<img>` or `<picture>` child is put here by itself. |
|
|
1105
|
+
|
|
1106
|
+
### CSS parts
|
|
1107
|
+
|
|
1108
|
+
| Part | Description |
|
|
1109
|
+
|---|---|
|
|
1110
|
+
| `layout` | The grid holding the image and the list. |
|
|
1111
|
+
| `media` | The image and its overlay. |
|
|
1112
|
+
| `overlay` | The outlines over the image (`aria-hidden`). |
|
|
1113
|
+
| `region` | One outline. |
|
|
1114
|
+
| `list` | The heading and the list. |
|
|
1115
|
+
|
|
1116
|
+
### Events
|
|
1117
|
+
|
|
1118
|
+
| Event | Description |
|
|
1119
|
+
|---|---|
|
|
1120
|
+
| `highlight` | The highlighted region changed by hover or focus: `detail` is `{ item, index }` (`item` null and `index` -1 when none is). Bubbles and is composed. |
|
|
1121
|
+
| `select` | A region's outline was clicked (focus moved to its list entry): `detail` is `{ item, index }`. Bubbles and is composed. |
|
|
1122
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['uvalib-image-regions', 'select', '<label>', <number>]` when an outline is clicked (the list's `label`, and the region's number from 1). Never a region's label (it may be a person's name). Nothing on hover or focus. Bubbles and is composed. |
|
|
1123
|
+
|
|
1124
|
+
### CSS custom properties
|
|
1125
|
+
|
|
1126
|
+
| Property | Default | Description |
|
|
1127
|
+
|---|---|---|
|
|
1128
|
+
| `--uva-color-text` | | Dark-mode role token: text (else `--uva-grey-darkest`). |
|
|
1129
|
+
| `--uva-color-surface-hover` | | Dark-mode role token: the highlighted entry's tint (else #f1f1f1). |
|
|
1130
|
+
| `--uva-color-link` | | Dark-mode role token: entry links (else `--uva-brand-blue`). |
|
|
1131
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
1132
|
+
| `--uva-color-text-muted` | | Dark-mode role token: descriptions (else #4b5563). |
|
|
1133
|
+
|
|
814
1134
|
## `<uvalib-lightbox>`
|
|
815
1135
|
|
|
816
1136
|
An accessible image viewer over a set of plain links. With JavaScript a primary click opens a modal dialog; without it (or with a modified click) the link opens the image as before. Wrap the links, or point at them with `selector` (for example `a.pb-image` on a reading page). There is no autoplay and no carousel. The dialog is labelled by the caption (`data-caption`, else the image alt, else the link text). Focus moves to Close on open and back to the trigger on close. Escape and a click on the backdrop close it. With more than one image, Previous and Next and the arrow keys move through the set (wrapping), and a polite “3 of 13” counter is shown. Full size opens the original image in a new tab. A IIIF Image API URL keeps its region; only the size becomes `!W,H` for the viewport. TIFF and JPEG2000 URLs are left as written. `url-param` (for example `photo`) keeps `?photo=<id>` in sync, including on a hash route (`#/text?photo=<id>`): opening pushes a history entry, stepping replaces it, and Back closes. Optional details: children with `slot="details"` (and `data-for` equal to the item's id or its position from 1; without `data-for` they show for every image), or `data-details-id` on a link pointing at an element elsewhere on the page. Either is shown inside the dialog and put back when the viewer moves on or closes.
|
|
@@ -821,6 +1141,7 @@ An accessible image viewer over a set of plain links. With JavaScript a primary
|
|
|
821
1141
|
|---|---|---|---|
|
|
822
1142
|
| `selector` | `string` | `''` | CSS selector for image links elsewhere in this root (the page, or the shadow root the component sits in). Combined with any links inside the component. Example: `a.pb-image`. |
|
|
823
1143
|
| `url-param` | `string` | `''` | Query parameter kept in sync with the open image, for example `photo` → `?photo=<id>`. The id is the link's `data-id`, else its `id`, else the IIIF identifier, else its position from 1. On a hash route the parameter is written inside the hash. Empty: no deep link. |
|
|
1144
|
+
| `regions-label` | `string` | `'Regions'` | The heading of the regions list (for example `People`). |
|
|
824
1145
|
| `no-shadow-dom` | `boolean` | `false` | |
|
|
825
1146
|
| `no-style` | `boolean` | `false` | |
|
|
826
1147
|
|
|
@@ -841,6 +1162,7 @@ An accessible image viewer over a set of plain links. With JavaScript a primary
|
|
|
841
1162
|
| `image` | The image. |
|
|
842
1163
|
| `controls` | Previous, Next, the counter and Full size. |
|
|
843
1164
|
| `details` | The details panel. |
|
|
1165
|
+
| `regions` | The `<uvalib-image-regions>` around an image with regions. |
|
|
844
1166
|
|
|
845
1167
|
### Events
|
|
846
1168
|
|
|
@@ -866,9 +1188,72 @@ An accessible image viewer over a set of plain links. With JavaScript a primary
|
|
|
866
1188
|
| `--uva-grey-darkest` | `#2b2b2b` | Text when `--uva-color-text` is unset. |
|
|
867
1189
|
| `--uva-grey-100` | `#dadada` | Border when `--uva-color-border` is unset. |
|
|
868
1190
|
|
|
1191
|
+
## `<uvalib-map>`
|
|
1192
|
+
|
|
1193
|
+
A map of places with a linked list of the same places: buildings, rooms or outdoor spaces, each a marker sized by a count, with a link to the place's page. It wraps [Leaflet](https://leafletjs.com) 1.9, which the page provides (the library never bundles it): set the `leaflet` property to the Leaflet module (`import * as L from 'leaflet'`), or load leaflet.js so that `window.L` exists. Without Leaflet only the list is shown, with one console warning. Leaflet's leaflet.css is optional: the element carries the layout rules it needs, in shadow DOM and light DOM alike. Places come from `items` (`{ id?, name, lat, lng, count?, href?, description? }`) or from a child `<ul>`/`<ol>` of `<li><a href data-lat data-lng data-count>Name</a></li>`, which is the list before the script runs (and without it). The list always stays, under the map: it is the text equivalent. Each marker is a real link (a button when the place has no `href`) named like "The Rotunda, 2,702 photos" (`count-label` is the noun), sized by the square root of its count (a 24 to 56px dot in a hit area of at least 44px). Tab or the arrow keys move between markers, Enter follows the link (or chooses the place), and Escape hides the tooltip. Hovering or focusing a marker shows a tooltip with its name and count and highlights its list entry; hovering or focusing a list entry highlights its marker (a ring and a larger dot, not colour alone) and brings it into view. The map is a region named by `label`, after a "Skip map, go to the list" link and a line of key instructions. It opens on the bounds of the places, or on `center` and `zoom`. The zoom buttons are 44px with a visible focus ring; the attribution stays. Tiles come from `tile-url` (OpenStreetMap by default: low-traffic use only) with `attribution`. In the page's dark mode the tiles are inverted with a CSS filter (`--uvalib-map-dark-filter`) unless `dark-tile-url` gives dark tiles; markers and controls are never filtered. With `prefers-reduced-motion` nothing animates.
|
|
1194
|
+
|
|
1195
|
+
### Attributes
|
|
1196
|
+
|
|
1197
|
+
| Attribute | Type | Default | Description |
|
|
1198
|
+
|---|---|---|---|
|
|
1199
|
+
| `items` | `MapItem[]` | `[]` | The places. When non-empty, wins over the child list. Set a new array to update. |
|
|
1200
|
+
| `label` | `string` | `''` | The map's name (required): the region's label, the list's label and the analytics name. |
|
|
1201
|
+
| `count-label` | `string` | `'items'` | The noun after each count, plural ("photos"); a count of one drops a trailing s. |
|
|
1202
|
+
| `tile-url` | | `OSM_TILE_URL` | The tile URL template (`{z}/{x}/{y}`, optionally `{s}` and `{r}`). |
|
|
1203
|
+
| `dark-tile-url` | `string` | `''` | Tiles for the page's dark mode. Without it, dark mode filters the light tiles instead. |
|
|
1204
|
+
| `attribution` | | `OSM_ATTRIBUTION` | The tiles' attribution, as HTML. Required by most tile sources; always shown. |
|
|
1205
|
+
| `center` | `string` | `''` | Where the map opens, `"lat,lng"`. Without it the map fits every place. |
|
|
1206
|
+
| `zoom` | `number \| undefined` | | The opening zoom level (with `center`, or centred on the places). |
|
|
1207
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1208
|
+
| `no-style` | `boolean` | `false` | |
|
|
1209
|
+
|
|
1210
|
+
### Slots
|
|
1211
|
+
|
|
1212
|
+
| Slot | Description |
|
|
1213
|
+
|---|---|
|
|
1214
|
+
| (default) | A `<ul>` or `<ol>` of places: each `<li>` holds an `<a href>` (or the `<li>` itself) with `data-lat`, `data-lng` and optionally `data-count`, `data-id` and `data-description`. Used when `items` is empty; without JavaScript it is the list. |
|
|
1215
|
+
|
|
1216
|
+
### CSS parts
|
|
1217
|
+
|
|
1218
|
+
| Part | Description |
|
|
1219
|
+
|---|---|
|
|
1220
|
+
| `map` | The map region (the Leaflet container). |
|
|
1221
|
+
| `instructions` | The line of key instructions above the map. |
|
|
1222
|
+
| `list` | The list of places. |
|
|
1223
|
+
| `place` | Each list entry. |
|
|
1224
|
+
|
|
1225
|
+
### Events
|
|
1226
|
+
|
|
1227
|
+
| Event | Description |
|
|
1228
|
+
|---|---|
|
|
1229
|
+
| `select` | A marker was chosen (click, Enter or Space). `detail` is `{ item }`. Cancelable: for a place with `href`, `preventDefault()` keeps the page from following the link. Bubbles and is composed. |
|
|
1230
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['uvalib-map', 'select', '<label>', <position from 1>]` when a marker is chosen, and `['uvalib-map', 'zoom', '<label>', <zoom level>]` 1 s after the last zoom-button press. Never a place's name, coordinates or URL. Bubbles and is composed. |
|
|
1231
|
+
|
|
1232
|
+
### CSS custom properties
|
|
1233
|
+
|
|
1234
|
+
| Property | Default | Description |
|
|
1235
|
+
|---|---|---|
|
|
1236
|
+
| `--uvalib-map-height` | `min(24rem, 75vw)` | Height of the map. |
|
|
1237
|
+
| `--uvalib-map-dark-filter` | `invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9)` | The filter on the tiles in dark mode, when there is no `dark-tile-url`. |
|
|
1238
|
+
| `--uva-brand-blue` | `#232d4b` | Marker fill. |
|
|
1239
|
+
| `--uva-brand-orange` | `#e57200` | Focus ring when `--uva-color-focus` is unset. |
|
|
1240
|
+
| `--uva-font-family` | `inherit` | Font family. |
|
|
1241
|
+
| `--uva-color-accent-bg` | | Dark-mode role token: marker fill (else `--uva-brand-blue`). |
|
|
1242
|
+
| `--uva-color-on-accent` | | Dark-mode role token: marker border (else #fff). |
|
|
1243
|
+
| `--uva-color-text` | | Dark-mode role token: text and the highlight ring (else #2b2b2b). |
|
|
1244
|
+
| `--uva-color-text-muted` | | Dark-mode role token: instructions and descriptions (else #4b5563). |
|
|
1245
|
+
| `--uva-color-link` | | Dark-mode role token: links (else `--uva-brand-blue`). |
|
|
1246
|
+
| `--uva-color-surface` | | Dark-mode role token: attribution background and the highlight ring's gap (else #fff). |
|
|
1247
|
+
| `--uva-color-surface-raised` | | Dark-mode role token: zoom buttons, tooltip and list entries (else #fff). |
|
|
1248
|
+
| `--uva-color-surface-hover` | | Dark-mode role token: hovered zoom button (else #dadada). |
|
|
1249
|
+
| `--uva-color-track` | | Dark-mode role token: the map before tiles load, and count badges (else #e5e7eb). |
|
|
1250
|
+
| `--uva-color-control-border` | | Dark-mode role token: borders (else #808080). |
|
|
1251
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
1252
|
+
| `--uva-color-shadow` | | Dark-mode role token: control and tooltip shadow. |
|
|
1253
|
+
|
|
869
1254
|
## `<uvalib-metadata>`
|
|
870
1255
|
|
|
871
|
-
A record's details as a description list, as on the library's digital collections: label and value side by side on wide screens (the element's own width, 36rem and up), stacked on narrow ones. Values may be text, links or lists (subjects). Give the rows as a `<dl>` child (so the page reads the same before the script loads): `<dt>` labels and `<dd>` values, optionally wrapped in a `<div>` per row; several `<dd>` after one `<dt>` are several values. The values are copied as written (links, lists, `download` attributes kept); a link with `data-size="184 KB"` is shown as a download, "EPUB · 184 KB". The list follows changes to the children. Apps set the `items` property instead (`{ label, value }`, winning over the children while set). Built-in rows for credit and rights (as Special Collections asks): `creator` and `organization` come first; `rights` (a rightsstatements.org or Creative Commons URL, shown as its short name linked to it, or plain text) and `citation` ("How to cite", with a Copy citation button that announces "Copied" politely) come last. `citation-title` builds the Special Collections citation, "<title>, Albert and Shirley Small Special Collections Library, University of Virginia".
|
|
1256
|
+
A record's details as a description list, as on the library's digital collections: label and value side by side on wide screens (the element's own width, 36rem and up), stacked on narrow ones. Values may be text, links or lists (subjects). Give the rows as a `<dl>` child (so the page reads the same before the script loads): `<dt>` labels and `<dd>` values, optionally wrapped in a `<div>` per row; several `<dd>` after one `<dt>` are several values. The values are copied as written (links, lists, `download` attributes kept); a link with `data-size="184 KB"` is shown as a download, "EPUB · 184 KB". The list follows changes to the children. Apps set the `items` property instead (`{ label, value }`, winning over the children while set). Built-in rows for credit and rights (as Special Collections asks): `creator` and `organization` come first; `rights` (a rightsstatements.org or Creative Commons URL, shown as its short name linked to it, or plain text) and `citation` ("How to cite", with a Copy citation button that announces "Copied" politely) come last. `citation-title` builds the Special Collections citation, "<title>, Albert and Shirley Small Special Collections Library, University of Virginia". Long lists: `list-limit="8"` shortens every value that is a list (a `<ul>`/`<ol>` in the `<dd>`) of more than 8 items to its first 8 and a “Show all 34 participants” button (`aria-expanded`, `aria-controls`) that reveals the rest in place and moves focus to the first one; it then reads “Show fewer”. `data-limit` on a `<dd>` or its list sets that row's own limit (`0`: none); the noun is the label with a lowercase first letter, or `data-limit-label`. Every value stays in the markup (the hidden ones `hidden`).
|
|
872
1257
|
|
|
873
1258
|
### Attributes
|
|
874
1259
|
|
|
@@ -881,6 +1266,7 @@ A record's details as a description list, as on the library's digital collection
|
|
|
881
1266
|
| `rights-info` | `string \| undefined` | | A "More about rights and permissions" link under the statement, such as `https://www.library.virginia.edu/policies/use-of-materials`. |
|
|
882
1267
|
| `citation` | `string \| undefined` | | "How to cite": the citation, as written. Wins over `citation-title`. |
|
|
883
1268
|
| `citation-title` | `string \| undefined` | | A title or collection name for the Special Collections citation: "<title>, Albert and Shirley Small Special Collections Library, University of Virginia". |
|
|
1269
|
+
| `list-limit` | `number \| undefined` | | Shorten every list value of more than this many items to its first ones and a “Show all N” button. Zero or empty shows every item. A row's `data-limit` wins. |
|
|
884
1270
|
| `no-shadow-dom` | `boolean` | `false` | |
|
|
885
1271
|
| `no-style` | `boolean` | `false` | |
|
|
886
1272
|
|
|
@@ -888,7 +1274,7 @@ A record's details as a description list, as on the library's digital collection
|
|
|
888
1274
|
|
|
889
1275
|
| Event | Description |
|
|
890
1276
|
|---|---|
|
|
891
|
-
| `uvalib-analytics-event` | For `<site-analytics>`: the Copy citation button, `['uvalib-metadata', 'copy-citation']
|
|
1277
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: the Copy citation button, `['uvalib-metadata', 'copy-citation']`, and a list's toggle, `['uvalib-metadata', 'show-all'\|'show-fewer', 'row N']` (N from 1, the row's place in the list; never its label or values). Downloads are left to Matomo's own download tracking. Bubbles and is composed. |
|
|
892
1278
|
|
|
893
1279
|
### CSS custom properties
|
|
894
1280
|
|
|
@@ -900,7 +1286,7 @@ A record's details as a description list, as on the library's digital collection
|
|
|
900
1286
|
| `--uva-color-text` | | Dark-mode role token: value colour (else `--uva-grey-darkest`). |
|
|
901
1287
|
| `--uva-color-text-muted` | | Dark-mode role token: label and status colour (else #4b5563). |
|
|
902
1288
|
| `--uva-color-border` | | Dark-mode role token: row dividers (else #dadada). |
|
|
903
|
-
| `--uva-color-link` | | Dark-mode role token: the
|
|
1289
|
+
| `--uva-color-link` | | Dark-mode role token: the buttons' text and the Copy citation button's border (else `--uva-brand-blue`). |
|
|
904
1290
|
| `--uva-color-surface-raised` | | Dark-mode role token: the button's background (else #fff). |
|
|
905
1291
|
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
906
1292
|
|
|
@@ -935,7 +1321,7 @@ Pagefind's default search UI (`PagefindUI`, from the site's own Pagefind bundle)
|
|
|
935
1321
|
|
|
936
1322
|
## `<uvalib-pager>`
|
|
937
1323
|
|
|
938
|
-
Previous/next section links, as on a reading page, or a numbered page list. Previous/next: set `prev-href` and `next-href` (either may be omitted). Each link shows a “Previous” or “Next” kicker and, when `prev-label` or `next-label` is set, that title. A visually hidden “: ” sits between them, so the accessible name is punctuated even when CSS is off. A long title truncates visually; the full text stays in the accessible name. The links use `rel="prev"` and `rel="next"`. With neither href, nothing is rendered. Numbered pages: set `pages` (a positive count). `page` is the current page, clamped to `1…pages`. Each link’s href comes from `href-template`, which must contain `{page}` (the default is `?page={page}`). The current page is text with `aria-current="page"`, not a link. Long ranges collapse to the first page, a window around the current page, the last page, and an ellipsis where numbers are skipped. `pages` wins when previous/next attributes are also set, with one console warning. The landmark’s accessible name is `label`, or “Sections” for previous/next and “Pagination” for numbered pages. An empty `label` uses that default. Two pagers on one page need different labels: a repeated landmark name fails the accessibility check.
|
|
1324
|
+
Previous/next section links, as on a reading page, or a numbered page list. Previous/next: set `prev-href` and `next-href` (either may be omitted). Each link shows a “Previous” or “Next” kicker and, when `prev-label` or `next-label` is set, that title. A visually hidden “: ” sits between them, so the accessible name is punctuated even when CSS is off. A long title truncates visually; the full text stays in the accessible name. The links use `rel="prev"` and `rel="next"`. With neither href, nothing is rendered. Numbered pages: set `pages` (a positive count). `page` is the current page, clamped to `1…pages`. Each link’s href comes from `href-template`, which must contain `{page}` (the default is `?page={page}`). The current page is text with `aria-current="page"`, not a link. Long ranges collapse to the first page, a window around the current page, the last page, and an ellipsis where numbers are skipped. `pages` wins when previous/next attributes are also set, with one console warning. Load more: `mode="load-more"` shows a “Load more” button and “Showing N of M” (`shown` of `total`), or “Showing N” when `total` is unset or 0 (ranked search often cannot know it). It wins over numbered pages and previous/next, with one warning when those are also set. The button is not a link and the control is a group, not a navigation landmark. Once `has-more` has been set (the attribute, or the `hasMore` property), it alone decides whether the button shows: present (or `hasMore = true`) shows it; removed, `has-more="false"` or `hasMore = false` hides it. Left unset, the button hides once `shown` has reached a positive `total`, and stays with no total. `page` is the last loaded page (default 1). A click fires `load-more` with `{ page }` set to the next page and reports `['uvalib-pager', 'load-more', '', page]`. Nothing is reported on render. Call `loaded(firstNewElement)`, or set `for` to a list id and call `loaded()`, and focus moves to that new item. The landmark’s accessible name is `label`, or “Sections” for previous/next and “Pagination” for numbered pages. Load more uses `label` or “More results”. An empty `label` uses that default. Two pagers on one page need different labels: a repeated landmark name fails the accessibility check.
|
|
939
1325
|
|
|
940
1326
|
### Attributes
|
|
941
1327
|
|
|
@@ -945,7 +1331,12 @@ Previous/next section links, as on a reading page, or a numbered page list. Prev
|
|
|
945
1331
|
| `prev-label` | `string \| undefined` | | Title of the previous section, under the “Previous” kicker. |
|
|
946
1332
|
| `next-href` | `string \| undefined` | | Href of the next section. Omitted, that side is not shown. |
|
|
947
1333
|
| `next-label` | `string \| undefined` | | Title of the next section, under the “Next” kicker. |
|
|
948
|
-
| `
|
|
1334
|
+
| `mode` | `string \| undefined` | | `load-more` shows a Load more button instead of previous/next or numbered pages. Any other value, including empty, leaves the pager in its other modes. |
|
|
1335
|
+
| `shown` | `number \| undefined` | | How many results are already shown. Used by `mode="load-more"` as N in “Showing N of M”. |
|
|
1336
|
+
| `total` | `number \| undefined` | | How many results there are. Used by `mode="load-more"` as M in “Showing N of M”. Unset or 0 (an unknown total), the count reads “Showing N”. |
|
|
1337
|
+
| `has-more` | `boolean \| undefined` | | Whether `mode="load-more"` has more to load, for when `total` is not known. Unset (the default), the button follows `total`. Set, it decides: the attribute present means true; removing it, `has-more="false"` or `hasMore = false` means false. `hasMore = undefined` returns to following `total`. |
|
|
1338
|
+
| `for` | `string \| undefined` | | Id of the list Load more appends to. `loaded()` focuses the first child added after the click. Ignored when `loaded` is passed an element. |
|
|
1339
|
+
| `page` | `number \| undefined` | | Current page, from 1. Clamped to `pages`. Used when `pages` is set. In load-more, the last loaded page (default 1); a click asks for the next one. |
|
|
949
1340
|
| `pages` | `number \| undefined` | | How many pages. A positive number selects numbered pages and ignores previous/next. Zero, negative or non-numeric does not. |
|
|
950
1341
|
| `href-template` | `string \| undefined` | | Href of each numbered page, with `{page}` where the number goes. Default `?page={page}` when omitted. Without `{page}`, numbered links are not made. |
|
|
951
1342
|
| `label` | `string \| undefined` | | Accessible name of the navigation landmark. Default “Pagination” for numbered pages and “Sections” for previous/next. Empty uses that default. A second pager on the page needs its own name. |
|
|
@@ -956,7 +1347,8 @@ Previous/next section links, as on a reading page, or a numbered page list. Prev
|
|
|
956
1347
|
|
|
957
1348
|
| Event | Description |
|
|
958
1349
|
|---|---|
|
|
959
|
-
| `
|
|
1350
|
+
| `load-more` | A primary click on Load more: `detail` is `{ page }` (the next page). Bubbles and is composed. |
|
|
1351
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: a primary-button click that was not already canceled, including a modified click, on a page link `['uvalib-pager', 'page-change', 'number', <n>]`, on a section link `['uvalib-pager', 'page-change', 'next'\|'previous']`, or on Load more `['uvalib-pager', 'load-more', '', <next page>]`. Never the label or URL. Nothing on render. Bubbles and is composed. |
|
|
960
1352
|
| `uvalib-pager-navigate` | A plain click on a pager link: `detail` is `{ href, kind, page? }` (`kind` is `'next'`, `'previous'` or `'number'`; `page` is set for `'number'`). Cancel it (`preventDefault()`) to route in the app; the click’s default is then prevented. Bubbles and is composed. |
|
|
961
1353
|
|
|
962
1354
|
### CSS custom properties
|
|
@@ -969,10 +1361,13 @@ Previous/next section links, as on a reading page, or a numbered page list. Prev
|
|
|
969
1361
|
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
970
1362
|
| `--uva-color-accent-bg` | | Dark-mode role token: current page background (else `--uva-brand-blue`). |
|
|
971
1363
|
| `--uva-color-on-accent` | | Text on the current page background (else #fff). |
|
|
1364
|
+
| `--uva-color-button-bg` | | Load more background (else `--uva-blue-alt`). |
|
|
1365
|
+
| `--uva-color-button-text` | | Load more text (else #fff). Dark mode’s own text is dark on the light button. |
|
|
1366
|
+
| `--uva-color-button-hover-bg` | | Load more hover background (else `--uva-blue-alt-A`). |
|
|
972
1367
|
|
|
973
1368
|
## `<uvalib-photo-grid>`
|
|
974
1369
|
|
|
975
|
-
Justified rows of thumbnails. Each direct child that is a link or a button is one photo; its image keeps its shape from the `width` and `height` attributes, or from the loaded image, so the row does not jump when the picture arrives. The row is about 220px tall and shorter on a phone; `row-height` sets that height. Every item stays a real link or button. An image with no visible text gets a visible caption from its alt (the caption is then the accessible name, and a repeated alt is cleared). The original alt is kept in `data-uvalib-alt` so a lightbox still describes the picture. An item with no name at all is captioned “Photo N” and warned about once; that caption is renumbered when the photos change order. An `aria-label` is left as the name: the grid does not add a caption that would disagree with it. Put the grid inside `<uvalib-lightbox>` and a plain click opens the viewer.
|
|
1370
|
+
Justified rows of thumbnails. Each direct child that is a link or a button is one photo; its image keeps its shape from the `width` and `height` attributes, or from the loaded image, so the row does not jump when the picture arrives. The row is about 220px tall and shorter on a phone; `row-height` sets that height. Every item stays a real link or button. An image with no visible text gets a visible caption from its alt (the caption is then the accessible name, and a repeated alt is cleared). The original alt is kept in `data-uvalib-alt` so a lightbox still describes the picture. An item with no name at all is captioned “Photo N” and warned about once; that caption is renumbered when the photos change order. An `aria-label` is left as the name: the grid does not add a caption that would disagree with it. Put the grid inside `<uvalib-lightbox>` and a plain click opens the viewer. A badge sits on the thumbnail: `<span slot="badge">` inside the link or button, or `data-badge` on that item (for example “seq” or “3 photos”). It is read after the caption (“The Lawn, 3 photos”). When the item already has an `aria-label`, the badge is appended to that label (the author’s words stay in `data-uvalib-label`) and an alt that repeats those words is cleared. A badge does not replace the alt caption.
|
|
976
1371
|
|
|
977
1372
|
### Attributes
|
|
978
1373
|
|
|
@@ -986,7 +1381,7 @@ Justified rows of thumbnails. Each direct child that is a link or a button is on
|
|
|
986
1381
|
|
|
987
1382
|
| Slot | Description |
|
|
988
1383
|
|---|---|
|
|
989
|
-
| (default) | The thumbnails: one `<a href>` or `<button>` per photo, each with an `<img>`. |
|
|
1384
|
+
| (default) | The thumbnails: one `<a href>` or `<button>` per photo, each with an `<img>`. A `<span slot="badge">` inside an item is drawn over that thumbnail. |
|
|
990
1385
|
|
|
991
1386
|
### CSS custom properties
|
|
992
1387
|
|
|
@@ -998,6 +1393,112 @@ Justified rows of thumbnails. Each direct child that is a link or a button is on
|
|
|
998
1393
|
| `--uva-grey-darkest` | `#2b2b2b` | Caption colour when `--uva-color-text` is unset. |
|
|
999
1394
|
| `--uva-brand-orange` | `#e57200` | Focus ring when `--uva-color-focus` is unset. |
|
|
1000
1395
|
|
|
1396
|
+
## `<uvalib-results-count>`
|
|
1397
|
+
|
|
1398
|
+
The results summary of a search or listing page, such as “Showing 48 of 3,694 shoots”, and a polite live region that tells screen reader users when it changes. Set `total` (how many match), `shown` (how many are on the page) and `noun` (plural, default “results”; `singular` for a total of one). The visible text follows at once: “Showing 48 of 3,694 shoots”, “Showing all 12 shoots” (shown is the total, or unset), “Showing 1 shoot” or “No shoots” (a total of 0, or 0 shown); with only `shown`, “Showing 48 shoots”. Numbers use thousands separators. A missing or blank `shown` or `total` is unset, not 0. The announcement waits until the text has not changed for `announce-delay` milliseconds (default 1000, as `<bento-box>` and `<uvalib-pagefind-search>` settle), so typing in a filter box is announced once. The first render is never announced; when it has no count yet (the data still loading), the first count that arrives is. A count is announced again when it comes back after a different one (a new search with the same number of results), but not when nothing was shown in between. The announcement is cleared from the hidden region five seconds later, so reading the page finds the count once. `<bento-box>` and `<uvalib-pagefind-search>` announce their own counts: use this element for your own listings, not beside them.
|
|
1399
|
+
|
|
1400
|
+
### Attributes
|
|
1401
|
+
|
|
1402
|
+
| Attribute | Type | Default | Description |
|
|
1403
|
+
|---|---|---|---|
|
|
1404
|
+
| `shown` | `number \| undefined` | | How many results are shown on the page. |
|
|
1405
|
+
| `total` | `number \| undefined` | | How many results match in all. |
|
|
1406
|
+
| `noun` | `string` | `'results'` | What is counted, plural: “results” by default. |
|
|
1407
|
+
| `singular` | `string` | `''` | What is counted, singular, for a total of one. Default: “result” when `noun` is unset, else `noun`. |
|
|
1408
|
+
| `announce-delay` | `number` | `1000` | Milliseconds the text must stay the same before it is announced. |
|
|
1409
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1410
|
+
| `no-style` | `boolean` | `false` | |
|
|
1411
|
+
|
|
1412
|
+
### CSS parts
|
|
1413
|
+
|
|
1414
|
+
| Part | Description |
|
|
1415
|
+
|---|---|
|
|
1416
|
+
| `text` | The visible summary. |
|
|
1417
|
+
|
|
1418
|
+
### CSS custom properties
|
|
1419
|
+
|
|
1420
|
+
| Property | Default | Description |
|
|
1421
|
+
|---|---|---|
|
|
1422
|
+
| `--uva-color-text-muted` | | Dark-mode role token: text colour (else `--uva-grey-A`, #4f4f4f). |
|
|
1423
|
+
|
|
1424
|
+
## `<uvalib-tabs>`
|
|
1425
|
+
|
|
1426
|
+
Tabs, as on library.virginia.edu: a row of buttons over one visible panel. Each panel is a child with `data-tab="Events"` (and an `id` when the tab should be linkable). Or put `<button slot="tab">` elements first and one panel element after each; the button text is the label and those buttons are hidden, because the component draws the real tabs. The selected panel stays visible across the upgrade. With `base.css`, later `data-tab` panels stay hidden before the element upgrades, and space is reserved for the tab row so the first panel does not jump. The tab row wraps on a narrow screen. Arrow keys, Home and End move between tabs. Selection follows the arrow unless `activation="manual"`, in which case Enter or Space selects the focused tab. `selected` is the panel id (a label or a 0-based index also selects). It reflects the panel id. `url-param` writes that id into the query string, or into the hash when the page is a hash route (`#/stories?tab=events`). `url-param="hash"` uses the hash itself (`#events`) and leaves a hash route (`#/…`) alone.
|
|
1427
|
+
|
|
1428
|
+
### Attributes
|
|
1429
|
+
|
|
1430
|
+
| Attribute | Type | Default | Description |
|
|
1431
|
+
|---|---|---|---|
|
|
1432
|
+
| `selected` | `string` | `''` | The selected tab. A panel id, the tab label, or a 0-based index. Reflects the panel id once the tabs have been read. Empty selects the first tab. |
|
|
1433
|
+
| `activation` | `string` | `''` | `manual`: arrow keys move focus and Enter or Space selects. Anything else, including empty, selects as the arrow moves. |
|
|
1434
|
+
| `url-param` | `string` | `''` | Name of the query parameter that stores the selected panel id, so the tab is linkable and Back restores it. `hash` stores it in the hash (`#panel-id`) instead. Empty does not touch the URL. |
|
|
1435
|
+
| `label` | `string` | `''` | Accessible name of the tab list. Empty uses “Tabs”. |
|
|
1436
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1437
|
+
| `no-style` | `boolean` | `false` | |
|
|
1438
|
+
|
|
1439
|
+
### Slots
|
|
1440
|
+
|
|
1441
|
+
| Slot | Description |
|
|
1442
|
+
|---|---|
|
|
1443
|
+
| (default) | The panels. Each element with `data-tab` is a panel, or each element that is not a `slot="tab"` button. |
|
|
1444
|
+
| `tab` | A `<button>` whose text labels the panel that follows. Hidden once the tabs are drawn. |
|
|
1445
|
+
|
|
1446
|
+
### Events
|
|
1447
|
+
|
|
1448
|
+
| Event | Description |
|
|
1449
|
+
|---|---|
|
|
1450
|
+
| `change` | The selected tab changed after the first render, including a script setting `selected` and the Back button. `detail` is `{ id, label, index }` (`id` is the panel id, `index` from 0). Not fired on the first render. Bubbles and is composed. |
|
|
1451
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: a click or arrow-key selection, `['uvalib-tabs', 'change', '<tab label>']`. The label is cut to 100 characters. Not fired on the first render, when `selected` is set from script, or when Back or the hash restores a tab. |
|
|
1452
|
+
|
|
1453
|
+
### CSS custom properties
|
|
1454
|
+
|
|
1455
|
+
| Property | Default | Description |
|
|
1456
|
+
|---|---|---|
|
|
1457
|
+
| `--uva-color-button-bg` | | Dark-mode role token: unselected tab background (else `--uva-blue-alt-base`). |
|
|
1458
|
+
| `--uva-color-button-text` | | Text on an unselected tab (else #fff). |
|
|
1459
|
+
| `--uva-color-button-hover-bg` | | Dark-mode role token: unselected tab hover (else `--uva-blue-alt-dark`). |
|
|
1460
|
+
| `--uva-color-accent-bg` | | Dark-mode role token: selected tab background (else `--uva-brand-blue`). |
|
|
1461
|
+
| `--uva-color-on-accent` | | Selected tab text and the selected underline (else #fff). |
|
|
1462
|
+
| `--uva-color-focus` | | Dark-mode role token: focus outline (else `--uva-brand-orange`). |
|
|
1463
|
+
| `--uva-blue-alt-base` | `#007BAC` | Unselected tab when `--uva-color-button-bg` is unset. |
|
|
1464
|
+
| `--uva-blue-alt-dark` | `#005679` | Unselected hover when `--uva-color-button-hover-bg` is unset. |
|
|
1465
|
+
| `--uva-brand-blue` | `#232D4B` | Selected tab when `--uva-color-accent-bg` is unset. |
|
|
1466
|
+
| `--uva-brand-orange` | `#E57200` | Focus outline when `--uva-color-focus` is unset. |
|
|
1467
|
+
|
|
1468
|
+
## `<uvalib-tag-list>`
|
|
1469
|
+
|
|
1470
|
+
A labelled list of keywords or subjects that wraps: each tag a link (for example a search for that term) or plain text. Link tags are outlined pills in the link colour; plain tags are filled chips (the card chip's colours), so a link never looks like a label. Every tag and the toggle are at least 2rem (34px) tall and wide, 0.5rem apart. Give the tags as children: `<a href>` for a link, any other element (`<span>`) for plain text. A child's `lang` and `dir` are kept, and so is inline markup inside it (`em`, `cite`, `abbr`, `bdi`, a `span lang`…), copied element by element (never parsed as HTML). Or set `href-template` (with `{tag}`, replaced by the URL-encoded text) to make every tag without its own href a link; a blank href counts as none. Apps can set the `items` property (`{ label, href?, lang?, dir? }`) instead; it wins over the children. Children with no text are skipped with one warning. `label` names the list (shown above it, or visually hidden with `hide-label`); without one a console warning is logged. `limit` shows that many tags and a “Show all N” button (`aria-expanded`, `aria-controls`), which reveals the rest in place and keeps focus. Analytics never sends a tag's text (record tags can be user-submitted or machine-made), and by default not the label either, which a template may fill from a record: the name is the list's place among the tag lists on the page, `list N`. Add `track-label` when the label is fixed text the page author wrote (“Subjects”), to send it instead.
|
|
1471
|
+
|
|
1472
|
+
### Attributes
|
|
1473
|
+
|
|
1474
|
+
| Attribute | Type | Default | Description |
|
|
1475
|
+
|---|---|---|---|
|
|
1476
|
+
| `label` | `string` | `''` | The list's name: shown above the tags (and, with `track-label`, the analytics name). |
|
|
1477
|
+
| `hide-label` | `boolean` | `false` | Hide the label visually; it still names the list. |
|
|
1478
|
+
| `track-label` | `boolean` | `false` | Send the label as the analytics name. Only for fixed text the page author wrote, never a label filled from a record. Without it the name is `list N`. |
|
|
1479
|
+
| `limit` | `number \| undefined` | | Show this many tags and a “Show all N” button. Zero or empty shows every tag. |
|
|
1480
|
+
| `href-template` | `string` | `''` | Href for tags without their own, with `{tag}` where the URL-encoded text goes, for example `/search?q={tag}`. Empty: such tags are plain text. |
|
|
1481
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1482
|
+
| `no-style` | `boolean` | `false` | |
|
|
1483
|
+
|
|
1484
|
+
### Events
|
|
1485
|
+
|
|
1486
|
+
| Event | Description |
|
|
1487
|
+
|---|---|
|
|
1488
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: a primary-button click on a tag link, `['uvalib-tag-list', 'tag-click', '<name>', <n>]` (n from 1, the tag's place in the list), and the toggle, `['uvalib-tag-list', 'show-all'\|'show-fewer', '<name>']`. The name is `list N` (N from 1, the list's place among the tag lists in its document or shadow root), or with `track-label` the list's `label`; never the tag text or URL. Bubbles and is composed. |
|
|
1489
|
+
| `uvalib-tag-list-navigate` | A plain click on a tag link: `detail` is `{ href, tag, index }` (index from 0). Cancel it (`preventDefault()`) to route in the app; the click's default is then prevented. Bubbles and is composed. |
|
|
1490
|
+
|
|
1491
|
+
### CSS custom properties
|
|
1492
|
+
|
|
1493
|
+
| Property | Default | Description |
|
|
1494
|
+
|---|---|---|
|
|
1495
|
+
| `--uva-blue-alt-300` | `#BFE7F7` | Plain tag background (the card chip's). |
|
|
1496
|
+
| `--uva-blue-alt-dark` | `#005679` | Plain tag text. |
|
|
1497
|
+
| `--uva-color-link` | | Dark-mode role token: link tag text (else `--uva-brand-blue`). |
|
|
1498
|
+
| `--uva-color-control-border` | | Dark-mode role token: link tag outline (else `--uva-grey`). |
|
|
1499
|
+
| `--uva-color-text` | | Dark-mode role token: the label (else `--uva-grey-darkest`). |
|
|
1500
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
1501
|
+
|
|
1001
1502
|
## `<website-section>`
|
|
1002
1503
|
|
|
1003
1504
|
The library website's first pages (pages, people, libraries, news) matching `query`, from Drupal's search index, with its excerpt (the matched words marked). The index sends no CORS headers, so this section works on library.virginia.edu (or wherever `BentoBox.endpoints.website` points to a same-origin copy) only.
|