@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.
Files changed (252) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/README.md +1310 -80
  3. package/dist/analytics.d.ts +10 -0
  4. package/dist/analytics.js +9 -0
  5. package/dist/analytics.js.map +1 -0
  6. package/dist/base/UvalibElement.js +8 -5
  7. package/dist/base/UvalibElement.js.map +1 -1
  8. package/dist/base/analytics-state.d.ts +7 -0
  9. package/dist/base/analytics-state.js.map +1 -1
  10. package/dist/base/light-dom-styles.d.ts +13 -0
  11. package/dist/base/light-dom-styles.js +26 -0
  12. package/dist/base/light-dom-styles.js.map +1 -1
  13. package/dist/base/search-tracker.d.ts +57 -0
  14. package/dist/base/search-tracker.js +51 -0
  15. package/dist/base/search-tracker.js.map +1 -0
  16. package/dist/base/url-param.d.ts +23 -0
  17. package/dist/base/url-param.js +49 -0
  18. package/dist/base/url-param.js.map +1 -0
  19. package/dist/base.css +562 -2
  20. package/dist/base.d.ts +2 -0
  21. package/dist/base.js +1 -0
  22. package/dist/base.js.map +1 -1
  23. package/dist/components/site-analytics/SiteAnalytics.d.ts +20 -1
  24. package/dist/components/site-analytics/SiteAnalytics.js +93 -12
  25. package/dist/components/site-analytics/SiteAnalytics.js.map +1 -1
  26. package/dist/components/site-page/SitePage.d.ts +23 -0
  27. package/dist/components/site-page/SitePage.js +77 -0
  28. package/dist/components/site-page/SitePage.js.map +1 -1
  29. package/dist/components/uvalib-back-to-top/UvalibBackToTop.d.ts +58 -0
  30. package/dist/components/uvalib-back-to-top/UvalibBackToTop.js +250 -0
  31. package/dist/components/uvalib-back-to-top/UvalibBackToTop.js.map +1 -0
  32. package/dist/components/uvalib-back-to-top/uvalib-back-to-top.d.ts +1 -0
  33. package/dist/components/uvalib-back-to-top/uvalib-back-to-top.js +4 -0
  34. package/dist/components/uvalib-back-to-top/uvalib-back-to-top.js.map +1 -0
  35. package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.d.ts +14 -0
  36. package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js +56 -4
  37. package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js.map +1 -1
  38. package/dist/components/uvalib-card/UvalibCard.d.ts +19 -5
  39. package/dist/components/uvalib-card/UvalibCard.js +112 -9
  40. package/dist/components/uvalib-card/UvalibCard.js.map +1 -1
  41. package/dist/components/uvalib-chip-group/UvalibChipGroup.d.ts +178 -0
  42. package/dist/components/uvalib-chip-group/UvalibChipGroup.js +817 -0
  43. package/dist/components/uvalib-chip-group/UvalibChipGroup.js.map +1 -0
  44. package/dist/components/uvalib-chip-group/uvalib-chip-group.d.ts +1 -0
  45. package/dist/components/uvalib-chip-group/uvalib-chip-group.js +4 -0
  46. package/dist/components/uvalib-chip-group/uvalib-chip-group.js.map +1 -0
  47. package/dist/components/uvalib-combobox/UvalibCombobox.d.ts +212 -0
  48. package/dist/components/uvalib-combobox/UvalibCombobox.js +1088 -0
  49. package/dist/components/uvalib-combobox/UvalibCombobox.js.map +1 -0
  50. package/dist/components/uvalib-combobox/uvalib-combobox.d.ts +1 -0
  51. package/dist/components/uvalib-combobox/uvalib-combobox.js +4 -0
  52. package/dist/components/uvalib-combobox/uvalib-combobox.js.map +1 -0
  53. package/dist/components/uvalib-contents/UvalibContents.d.ts +53 -0
  54. package/dist/components/uvalib-contents/UvalibContents.js +202 -3
  55. package/dist/components/uvalib-contents/UvalibContents.js.map +1 -1
  56. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.d.ts +187 -0
  57. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js +1452 -0
  58. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js.map +1 -0
  59. package/dist/components/uvalib-date-histogram/uvalib-date-histogram.d.ts +1 -0
  60. package/dist/components/uvalib-date-histogram/uvalib-date-histogram.js +4 -0
  61. package/dist/components/uvalib-date-histogram/uvalib-date-histogram.js.map +1 -0
  62. package/dist/components/uvalib-date-range/UvalibDateRange.d.ts +6 -0
  63. package/dist/components/uvalib-date-range/UvalibDateRange.js +23 -0
  64. package/dist/components/uvalib-date-range/UvalibDateRange.js.map +1 -1
  65. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.d.ts +113 -0
  66. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js +589 -0
  67. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js.map +1 -0
  68. package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.d.ts +1 -0
  69. package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.js +4 -0
  70. package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.js.map +1 -0
  71. package/dist/components/uvalib-image-regions/UvalibImageRegions.d.ts +130 -0
  72. package/dist/components/uvalib-image-regions/UvalibImageRegions.js +658 -0
  73. package/dist/components/uvalib-image-regions/UvalibImageRegions.js.map +1 -0
  74. package/dist/components/uvalib-image-regions/regions.d.ts +57 -0
  75. package/dist/components/uvalib-image-regions/regions.js +117 -0
  76. package/dist/components/uvalib-image-regions/regions.js.map +1 -0
  77. package/dist/components/uvalib-image-regions/uvalib-image-regions.d.ts +1 -0
  78. package/dist/components/uvalib-image-regions/uvalib-image-regions.js +4 -0
  79. package/dist/components/uvalib-image-regions/uvalib-image-regions.js.map +1 -0
  80. package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +40 -0
  81. package/dist/components/uvalib-lightbox/UvalibLightbox.js +152 -17
  82. package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
  83. package/dist/components/uvalib-lightbox/media.d.ts +1 -18
  84. package/dist/components/uvalib-lightbox/media.js +1 -42
  85. package/dist/components/uvalib-lightbox/media.js.map +1 -1
  86. package/dist/components/uvalib-map/UvalibMap.d.ts +182 -0
  87. package/dist/components/uvalib-map/UvalibMap.js +1001 -0
  88. package/dist/components/uvalib-map/UvalibMap.js.map +1 -0
  89. package/dist/components/uvalib-map/uvalib-map.d.ts +1 -0
  90. package/dist/components/uvalib-map/uvalib-map.js +4 -0
  91. package/dist/components/uvalib-map/uvalib-map.js.map +1 -0
  92. package/dist/components/uvalib-metadata/UvalibMetadata.d.ts +39 -2
  93. package/dist/components/uvalib-metadata/UvalibMetadata.js +214 -8
  94. package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
  95. package/dist/components/uvalib-pager/UvalibPager.d.ts +77 -4
  96. package/dist/components/uvalib-pager/UvalibPager.js +270 -8
  97. package/dist/components/uvalib-pager/UvalibPager.js.map +1 -1
  98. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.d.ts +27 -1
  99. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js +192 -26
  100. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js.map +1 -1
  101. package/dist/components/uvalib-results-count/UvalibResultsCount.d.ts +62 -0
  102. package/dist/components/uvalib-results-count/UvalibResultsCount.js +208 -0
  103. package/dist/components/uvalib-results-count/UvalibResultsCount.js.map +1 -0
  104. package/dist/components/uvalib-results-count/uvalib-results-count.d.ts +1 -0
  105. package/dist/components/uvalib-results-count/uvalib-results-count.js +4 -0
  106. package/dist/components/uvalib-results-count/uvalib-results-count.js.map +1 -0
  107. package/dist/components/uvalib-tabs/UvalibTabs.d.ts +127 -0
  108. package/dist/components/uvalib-tabs/UvalibTabs.js +821 -0
  109. package/dist/components/uvalib-tabs/UvalibTabs.js.map +1 -0
  110. package/dist/components/uvalib-tabs/uvalib-tabs.d.ts +1 -0
  111. package/dist/components/uvalib-tabs/uvalib-tabs.js +4 -0
  112. package/dist/components/uvalib-tabs/uvalib-tabs.js.map +1 -0
  113. package/dist/components/uvalib-tag-list/UvalibTagList.d.ts +89 -0
  114. package/dist/components/uvalib-tag-list/UvalibTagList.js +411 -0
  115. package/dist/components/uvalib-tag-list/UvalibTagList.js.map +1 -0
  116. package/dist/components/uvalib-tag-list/uvalib-tag-list.d.ts +1 -0
  117. package/dist/components/uvalib-tag-list/uvalib-tag-list.js +4 -0
  118. package/dist/components/uvalib-tag-list/uvalib-tag-list.js.map +1 -0
  119. package/dist/custom-elements.json +14007 -3497
  120. package/dist/index.d.ts +16 -0
  121. package/dist/index.js +10 -0
  122. package/dist/index.js.map +1 -1
  123. package/dist/pagefind.css +4 -0
  124. package/dist/styles/base.js +154 -1
  125. package/dist/styles/base.js.map +1 -1
  126. package/dist/styles/color-scheme.js +9 -0
  127. package/dist/styles/color-scheme.js.map +1 -1
  128. package/dist/styles/controls.js +8 -0
  129. package/dist/styles/controls.js.map +1 -1
  130. package/dist/styles/hidden.d.ts +2 -0
  131. package/dist/styles/hidden.js +51 -0
  132. package/dist/styles/hidden.js.map +1 -0
  133. package/dist/styles/message.d.ts +1 -0
  134. package/dist/styles/message.js +82 -0
  135. package/dist/styles/message.js.map +1 -0
  136. package/dist/styles/pagefind.js +4 -0
  137. package/dist/styles/pagefind.js.map +1 -1
  138. package/dist/styles/result-list.d.ts +1 -0
  139. package/dist/styles/result-list.js +111 -0
  140. package/dist/styles/result-list.js.map +1 -0
  141. package/dist/styles/results.d.ts +1 -0
  142. package/dist/styles/results.js +242 -0
  143. package/dist/styles/results.js.map +1 -0
  144. package/dist/testing/index.d.ts +110 -0
  145. package/dist/testing/index.js +100 -0
  146. package/dist/testing/index.js.map +1 -0
  147. package/dist/testing/lighthouse-rules.d.ts +10 -0
  148. package/dist/testing/lighthouse-rules.js +44 -0
  149. package/dist/testing/lighthouse-rules.js.map +1 -0
  150. package/dist/tokens.css +9 -0
  151. package/dist-cdn/analytics.js +32 -0
  152. package/dist-cdn/analytics.js.map +1 -0
  153. package/dist-cdn/base.css +562 -2
  154. package/dist-cdn/bento-box.js +3 -3
  155. package/dist-cdn/chunks/{SiteAnalytics-Cm-FyhYS.js → SiteAnalytics-B9gu5aGO.js} +59 -30
  156. package/dist-cdn/chunks/SiteAnalytics-B9gu5aGO.js.map +1 -0
  157. package/dist-cdn/chunks/{UvalibElement-BnI-eRRR.js → UvalibElement-pGONDAwB.js} +108 -101
  158. package/dist-cdn/chunks/UvalibElement-pGONDAwB.js.map +1 -0
  159. package/dist-cdn/chunks/{accessible-GqhVn5_H.js → accessible-DJv7YOtS.js} +2 -2
  160. package/dist-cdn/chunks/{accessible-GqhVn5_H.js.map → accessible-DJv7YOtS.js.map} +1 -1
  161. package/dist-cdn/chunks/analytics-state-Ce8DKe4F.js.map +1 -1
  162. package/dist-cdn/chunks/base-BI8h0Gf3.js +281 -0
  163. package/dist-cdn/chunks/base-BI8h0Gf3.js.map +1 -0
  164. package/dist-cdn/chunks/inline-copy-BANQSMIR.js +69 -0
  165. package/dist-cdn/chunks/inline-copy-BANQSMIR.js.map +1 -0
  166. package/dist-cdn/chunks/{library-weekly-hours-COE7Vv6V.js → library-weekly-hours-CrV3TlP5.js} +3 -3
  167. package/dist-cdn/chunks/{library-weekly-hours-COE7Vv6V.js.map → library-weekly-hours-CrV3TlP5.js.map} +1 -1
  168. package/dist-cdn/chunks/regions-B8ExwUGP.js +86 -0
  169. package/dist-cdn/chunks/regions-B8ExwUGP.js.map +1 -0
  170. package/dist-cdn/chunks/{repeat-CIFUYkyh.js → repeat-m5Zd_QeP.js} +2 -2
  171. package/dist-cdn/chunks/{repeat-CIFUYkyh.js.map → repeat-m5Zd_QeP.js.map} +1 -1
  172. package/dist-cdn/chunks/{site-header-C9V7Wuw2.js → site-header-DYRMpdBj.js} +13 -4
  173. package/dist-cdn/chunks/site-header-DYRMpdBj.js.map +1 -0
  174. package/dist-cdn/chunks/{site-main-nav-AaxZ9rQf.js → site-main-nav-DURrQMal.js} +3 -3
  175. package/dist-cdn/chunks/{site-main-nav-AaxZ9rQf.js.map → site-main-nav-DURrQMal.js.map} +1 -1
  176. package/dist-cdn/chunks/source-children-BHsDwCvL.js +53 -0
  177. package/dist-cdn/chunks/source-children-BHsDwCvL.js.map +1 -0
  178. package/dist-cdn/chunks/{static-html-1mTAG6nS.js → static-html-C1rhtCHu.js} +2 -2
  179. package/dist-cdn/chunks/{static-html-1mTAG6nS.js.map → static-html-C1rhtCHu.js.map} +1 -1
  180. package/dist-cdn/chunks/url-param-C1sk_F1d.js +28 -0
  181. package/dist-cdn/chunks/url-param-C1sk_F1d.js.map +1 -0
  182. package/dist-cdn/custom-elements.json +14007 -3497
  183. package/dist-cdn/events-section.js +3 -3
  184. package/dist-cdn/library-hours-setup.js +2 -2
  185. package/dist-cdn/library-weekly-hours.js +1 -1
  186. package/dist-cdn/manifest.json +15 -2
  187. package/dist-cdn/pagefind.css +4 -0
  188. package/dist-cdn/site-alerts.js +4 -4
  189. package/dist-cdn/site-analytics.js +2 -2
  190. package/dist-cdn/site-footer.js +2 -2
  191. package/dist-cdn/site-header.js +1 -1
  192. package/dist-cdn/site-hours-section.js +4 -4
  193. package/dist-cdn/site-main-nav.js +1 -1
  194. package/dist-cdn/site-page.js +56 -11
  195. package/dist-cdn/site-page.js.map +1 -1
  196. package/dist-cdn/site-style.js +2 -2
  197. package/dist-cdn/skills/uvalib-web-components/SKILL.md +269 -24
  198. package/dist-cdn/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
  199. package/dist-cdn/skills/uvalib-web-components/reference/components.md +514 -13
  200. package/dist-cdn/skills/uvalib-web-components/reference/snippets.md +1 -1
  201. package/dist-cdn/tokens.css +9 -0
  202. package/dist-cdn/uvalib-analytics.js +2 -2
  203. package/dist-cdn/uvalib-back-to-top.js +156 -0
  204. package/dist-cdn/uvalib-back-to-top.js.map +1 -0
  205. package/dist-cdn/uvalib-breadcrumbs.js +31 -11
  206. package/dist-cdn/uvalib-breadcrumbs.js.map +1 -1
  207. package/dist-cdn/uvalib-card-grid.js +1 -1
  208. package/dist-cdn/uvalib-card.js +97 -23
  209. package/dist-cdn/uvalib-card.js.map +1 -1
  210. package/dist-cdn/uvalib-chip-group.js +535 -0
  211. package/dist-cdn/uvalib-chip-group.js.map +1 -0
  212. package/dist-cdn/uvalib-combobox.js +667 -0
  213. package/dist-cdn/uvalib-combobox.js.map +1 -0
  214. package/dist-cdn/uvalib-contents.js +102 -23
  215. package/dist-cdn/uvalib-contents.js.map +1 -1
  216. package/dist-cdn/uvalib-date-histogram.js +960 -0
  217. package/dist-cdn/uvalib-date-histogram.js.map +1 -0
  218. package/dist-cdn/uvalib-date-range.js +14 -2
  219. package/dist-cdn/uvalib-date-range.js.map +1 -1
  220. package/dist-cdn/uvalib-filter-drawer.js +355 -0
  221. package/dist-cdn/uvalib-filter-drawer.js.map +1 -0
  222. package/dist-cdn/uvalib-filter.js +3 -3
  223. package/dist-cdn/uvalib-image-regions.js +447 -0
  224. package/dist-cdn/uvalib-image-regions.js.map +1 -0
  225. package/dist-cdn/uvalib-lightbox.js +145 -78
  226. package/dist-cdn/uvalib-lightbox.js.map +1 -1
  227. package/dist-cdn/uvalib-map.js +471 -0
  228. package/dist-cdn/uvalib-map.js.map +1 -0
  229. package/dist-cdn/uvalib-metadata.js +152 -25
  230. package/dist-cdn/uvalib-metadata.js.map +1 -1
  231. package/dist-cdn/uvalib-pager.js +164 -18
  232. package/dist-cdn/uvalib-pager.js.map +1 -1
  233. package/dist-cdn/uvalib-photo-grid.js +123 -21
  234. package/dist-cdn/uvalib-photo-grid.js.map +1 -1
  235. package/dist-cdn/uvalib-results-count.js +101 -0
  236. package/dist-cdn/uvalib-results-count.js.map +1 -0
  237. package/dist-cdn/uvalib-tabs.js +436 -0
  238. package/dist-cdn/uvalib-tabs.js.map +1 -0
  239. package/dist-cdn/uvalib-tag-list.js +267 -0
  240. package/dist-cdn/uvalib-tag-list.js.map +1 -0
  241. package/package.json +66 -3
  242. package/skills/uvalib-web-components/SKILL.md +269 -24
  243. package/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
  244. package/skills/uvalib-web-components/reference/components.md +514 -13
  245. package/skills/uvalib-web-components/reference/snippets.md +1 -1
  246. package/dist-cdn/chunks/SiteAnalytics-Cm-FyhYS.js.map +0 -1
  247. package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js.map +0 -1
  248. package/dist-cdn/chunks/base-CAFQWnZG.js +0 -128
  249. package/dist-cdn/chunks/base-CAFQWnZG.js.map +0 -1
  250. package/dist-cdn/chunks/site-header-C9V7Wuw2.js.map +0 -1
  251. package/dist-cdn/chunks/source-children-RuAec527.js +0 -119
  252. package/dist-cdn/chunks/source-children-RuAec527.js.map +0 -1
@@ -0,0 +1,535 @@
1
+ import { a as e, d as t, f as n, i as r, l as i, m as a, n as o, o as s, p as c, r as l, t as u } from "./chunks/UvalibElement-pGONDAwB.js";
2
+ import { a as d } from "./chunks/analytics-DTTihuBD.js";
3
+ import { n as f, r as p, t as m } from "./chunks/source-children-BHsDwCvL.js";
4
+ import { t as h } from "./chunks/accessible-DJv7YOtS.js";
5
+ import { n as g, r as _, t as v } from "./chunks/url-param-C1sk_F1d.js";
6
+ // src/components/uvalib-chip-group/UvalibChipGroup.ts
7
+ var y = "uvalib-chip-group", b = /* @__PURE__ */ new Set([
8
+ "single",
9
+ "multi",
10
+ "links"
11
+ ]), x = { settle: 1e3 }, S = 0, C = (e) => `
12
+ ${e} { display: flow-root; min-width: 0; max-width: 100%; }
13
+ ${e} .chips {
14
+ display: flex;
15
+ flex-wrap: wrap;
16
+ align-items: center;
17
+ gap: 0.25rem 0.5rem;
18
+ min-width: 0;
19
+ }
20
+ ${e} .chips.scroll {
21
+ flex-wrap: nowrap;
22
+ overflow-x: auto;
23
+ overscroll-behavior-x: contain;
24
+ padding: 0.375rem;
25
+ scroll-padding-inline: 2.5rem;
26
+ }
27
+ ${e} .chips.scroll > .chip { flex: none; }
28
+ ${e} .rail { position: relative; min-width: 0; }
29
+ ${e} .chips.segmented {
30
+ flex-wrap: nowrap;
31
+ column-gap: 0;
32
+ overflow-x: auto;
33
+ padding: 0.375rem;
34
+ }
35
+ /* The padding only keeps the focus ring inside the scroll box: the bar stays 44px tall. */
36
+ ${e} .chips.segmented:not(.scroll) { margin-block: -0.375rem; }
37
+ ${e} .chips.segmented:not(.scroll) > .chip { flex: 0 1 auto; min-width: 44px; }
38
+ ${e} .chips.segmented > .chip + .chip { margin-inline-start: -1px; }
39
+ ${e} .chip {
40
+ position: relative;
41
+ display: inline-flex;
42
+ align-items: center;
43
+ box-sizing: border-box;
44
+ min-width: 44px;
45
+ min-height: 44px;
46
+ max-width: 100%;
47
+ margin: 0;
48
+ padding: 0;
49
+ border: 0;
50
+ background: none;
51
+ color: inherit;
52
+ font: inherit;
53
+ text-align: start;
54
+ text-decoration: none;
55
+ cursor: pointer;
56
+ }
57
+ ${e} .chip input {
58
+ position: absolute;
59
+ inset: 0;
60
+ width: 100%;
61
+ height: 100%;
62
+ margin: 0;
63
+ opacity: 0;
64
+ cursor: inherit;
65
+ }
66
+ ${e} .face {
67
+ display: inline-flex;
68
+ flex: 1;
69
+ align-items: center;
70
+ justify-content: center;
71
+ gap: 0.375rem;
72
+ box-sizing: border-box;
73
+ min-width: 0;
74
+ min-height: 2.25rem;
75
+ overflow-wrap: break-word;
76
+ }
77
+ ${e} .text { min-width: 0; }
78
+ ${e} .check { flex: none; width: 1em; height: 1em; }
79
+ /* A key's colour is content, not look: kept with no-style. Its border is the chip's text
80
+ colour, which contrasts with the chip in every state (selected, disabled, dark). */
81
+ ${e} .swatch {
82
+ flex: none;
83
+ box-sizing: border-box;
84
+ width: 0.75em;
85
+ height: 0.75em;
86
+ border: 1px solid currentColor;
87
+ border-radius: 2px;
88
+ }
89
+ /* Forced colors would flatten the fill: the key keeps its colour (it matches the chart or
90
+ map) and its border stays the chip's system text colour. */
91
+ @media (forced-colors: active) {
92
+ ${e} .swatch { forced-color-adjust: none; }
93
+ }
94
+ ${e} .chip:focus-visible { outline: none; }
95
+ ${e} :is(.chip:focus-visible > .face, .chip input:focus-visible + .face) {
96
+ position: relative;
97
+ z-index: 1;
98
+ outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));
99
+ outline-offset: 2px;
100
+ }
101
+ ${e} :is(.chip:disabled, .chip[aria-disabled='true'], .chip input:disabled) { cursor: not-allowed; }
102
+ ${e} .visually-hidden {
103
+ position: absolute;
104
+ width: 1px;
105
+ height: 1px;
106
+ margin: -1px;
107
+ padding: 0;
108
+ overflow: hidden;
109
+ clip: rect(0, 0, 0, 0);
110
+ white-space: nowrap;
111
+ border: 0;
112
+ }
113
+ ${e} .description { margin: 0.25rem 0 0; }
114
+ ${e}[hidden], ${e} [hidden] { display: none !important; }
115
+ `, w = c(C(":host")), T = "var(--uva-color-control-border, var(--uva-grey, #808080))", E = "var(--uva-color-link, var(--uva-brand-blue, #232d4b))", D = "var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b))", O = t`<svg class="check" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M3 8.5l3.2 3.2L13 4.8" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg>`, k = c(".chip[aria-pressed='true'] > .face, .chip input:checked + .face"), A = c(".chip:disabled:not([aria-pressed='true']) > .face, .chip[aria-disabled='true'] > .face, .chip input:disabled:not(:checked) + .face"), j = c(".chip:not(:disabled, [aria-disabled='true']):hover > .face, .chip:hover input:not(:disabled) + .face"), M = c(".chip:focus-visible > .face, .chip input:focus-visible + .face"), N = class extends u {
116
+ static {
117
+ this.styles = [
118
+ h,
119
+ w,
120
+ n`
121
+ .face {
122
+ padding: 0.25rem 0.875rem;
123
+ border: 1px solid ${c(T)};
124
+ border-radius: 999px;
125
+ background: var(--uva-color-surface-raised, #fff);
126
+ color: ${c(E)};
127
+ font-size: 0.875rem;
128
+ font-weight: 600;
129
+ line-height: 1.3;
130
+ }
131
+ .segmented .face {
132
+ padding-inline: 0.625rem;
133
+ border-radius: 0;
134
+ }
135
+ .segmented > .chip:first-child .face {
136
+ border-start-start-radius: 0.3rem;
137
+ border-end-start-radius: 0.3rem;
138
+ }
139
+ .segmented > .chip:last-child .face {
140
+ border-start-end-radius: 0.3rem;
141
+ border-end-end-radius: 0.3rem;
142
+ }
143
+ .description {
144
+ color: var(--uva-color-text-muted, #4f4f4f);
145
+ font-size: 0.875rem;
146
+ line-height: 1.5;
147
+ }
148
+ .count {
149
+ color: var(--uva-color-text-muted, #4f4f4f);
150
+ font-size: 0.8125rem;
151
+ font-weight: 400;
152
+ font-variant-numeric: tabular-nums;
153
+ }
154
+ ${j} {
155
+ position: relative;
156
+ border-color: ${c(E)};
157
+ }
158
+ ${k} {
159
+ position: relative;
160
+ border-color: ${c(D)};
161
+ background: ${c(D)};
162
+ color: var(--uva-color-on-accent, #fff);
163
+ }
164
+ .chip[aria-pressed='true'] .count,
165
+ .chip input:checked + .face .count {
166
+ color: inherit;
167
+ }
168
+ ${A} {
169
+ border-style: dashed;
170
+ color: var(--uva-color-text-muted, #4f4f4f);
171
+ }
172
+ /* One row that scrolls: the scrollbar stays visible, and the edge with more chips
173
+ fades out. */
174
+ .chips.scroll {
175
+ scrollbar-width: thin;
176
+ scrollbar-color: ${c(T)} transparent;
177
+ }
178
+ .rail::before,
179
+ .rail::after {
180
+ content: '';
181
+ position: absolute;
182
+ inset-block: 0 0.75rem;
183
+ z-index: 2;
184
+ width: 2.5rem;
185
+ pointer-events: none;
186
+ opacity: 0;
187
+ }
188
+ .rail::before {
189
+ left: 0;
190
+ background: linear-gradient(to right, var(--uva-color-surface, #fff), transparent);
191
+ }
192
+ .rail::after {
193
+ right: 0;
194
+ background: linear-gradient(to left, var(--uva-color-surface, #fff), transparent);
195
+ }
196
+ .rail[data-more-left]::before,
197
+ .rail[data-more-right]::after {
198
+ opacity: 1;
199
+ }
200
+ @media (forced-colors: active) {
201
+ .face {
202
+ border-color: ButtonText;
203
+ color: ButtonText;
204
+ }
205
+ a.chip > .face {
206
+ border-color: LinkText;
207
+ color: LinkText;
208
+ }
209
+ ${j} {
210
+ border-color: Highlight;
211
+ }
212
+ ${k} {
213
+ forced-color-adjust: none;
214
+ border-color: Highlight;
215
+ background: Highlight;
216
+ color: HighlightText;
217
+ }
218
+ ${A} {
219
+ border-color: GrayText;
220
+ color: GrayText;
221
+ }
222
+ ${M} {
223
+ outline-color: Highlight;
224
+ }
225
+ /* Forced colors keep gradients: a light fade would cover the edge chips. */
226
+ .rail::before,
227
+ .rail::after {
228
+ display: none;
229
+ }
230
+ }
231
+ `
232
+ ];
233
+ }
234
+ constructor() {
235
+ super(), this.mode = "single", this.label = "", this.description = "", this.value = "", this.countLabel = "items", this.scrollRow = !1, this.segmented = !1, this.urlParam = "", this.childItems = [], this.more = {
236
+ left: !1,
237
+ right: !1
238
+ }, this.uid = `${y}-${++S}`, this.warned = /* @__PURE__ */ new Set(), this.onPop = () => {
239
+ if (!this.urlParam || this.kind === "links") return;
240
+ this.cancel(), this.initial ??= Array.isArray(this.value) ? [...this.value] : this.value;
241
+ let e = this.urlValue() ?? this.initial ?? "", t = this.selected.join("\0");
242
+ this.value = Array.isArray(e) ? [...e] : e, this.selected.join("\0") !== t && this.emitChange(!0);
243
+ }, this.measure = () => {
244
+ let e = this.renderRoot.querySelector(".chips.scroll");
245
+ if (!e) return;
246
+ let t = e.scrollWidth - e.clientWidth, n = Math.abs(e.scrollLeft), r = getComputedStyle(e).direction === "rtl", i = n > 1, a = n < t - 1, o = {
247
+ left: r ? a : i,
248
+ right: r ? i : a
249
+ };
250
+ (o.left !== this.more.left || o.right !== this.more.right) && (this.more = o);
251
+ }, new m(this, () => this.lightDom, (e) => this.read(e));
252
+ }
253
+ createRenderRoot() {
254
+ let e = super.createRenderRoot();
255
+ if (e instanceof ShadowRoot && this.noStyle) {
256
+ let t = w.styleSheet;
257
+ t && (e.adoptedStyleSheets = [t]);
258
+ }
259
+ return e;
260
+ }
261
+ connectedCallback() {
262
+ if (super.connectedCallback(), this.lightDom && this.noStyle) {
263
+ let e = this.getRootNode();
264
+ l(`${this.localName}::structure`, c(C(this.localName)), {
265
+ root: e instanceof ShadowRoot || e instanceof Document ? e : void 0,
266
+ scope: !1
267
+ });
268
+ }
269
+ window.addEventListener("popstate", this.onPop), this.hasUpdated && this.requestUpdate();
270
+ }
271
+ disconnectedCallback() {
272
+ super.disconnectedCallback(), window.removeEventListener("popstate", this.onPop), this.cancel(), this.resize?.disconnect(), this.observed = void 0;
273
+ }
274
+ willUpdate(e) {
275
+ e.has("urlParam") && this.urlParam && this.readUrl(), e.has("value") && this.value !== this.ownValue && (this.cancel(), this.kind === "multi" && !Array.isArray(this.value) && (this.value = this.selected)), this.label.trim() || this.warnOnce("label", "set label: the group needs an accessible name."), b.has(this.mode) || this.warnOnce("mode", "mode must be single, multi or links.");
276
+ }
277
+ warnOnce(e, t) {
278
+ this.warned.has(e) || (this.warned.add(e), console.warn(`${this.localName}: ${t}`));
279
+ }
280
+ get kind() {
281
+ return b.has(this.mode) ? this.mode : "single";
282
+ }
283
+ read(e) {
284
+ let t = [];
285
+ for (let n of e) {
286
+ if (!(n instanceof Element)) continue;
287
+ let e = f(n.textContent);
288
+ if (!e) {
289
+ this.warnOnce("empty", "ignoring chips with no text.");
290
+ continue;
291
+ }
292
+ let r = {
293
+ value: n.getAttribute("value") ?? n.getAttribute("data-value") ?? e,
294
+ label: e
295
+ }, i = n.getAttribute("data-count");
296
+ i !== null && i.trim() && (r.count = i.trim()), n instanceof HTMLAnchorElement && n.hasAttribute("href") && (r.href = n.getAttribute("href")), (n.hasAttribute("disabled") || n.getAttribute("aria-disabled") === "true") && (r.disabled = !0);
297
+ let a = n.getAttribute("data-swatch");
298
+ a !== null && (r.swatch = a), t.push(r);
299
+ }
300
+ JSON.stringify(t) !== JSON.stringify(this.childItems) && (this.childItems = t);
301
+ }
302
+ get chips() {
303
+ return (this.items ?? this.childItems).filter((e) => e && f(e.label)).map((e) => ({
304
+ ...e,
305
+ label: f(e.label),
306
+ value: String(e.value ?? f(e.label)),
307
+ swatch: this.colour(e.swatch)
308
+ }));
309
+ }
310
+ colour(e) {
311
+ let t = typeof e == "string" ? e.trim() : "";
312
+ if (t || e != null && e !== "") {
313
+ if (t && CSS.supports("color", t)) return t;
314
+ this.warnOnce("swatch", `ignoring a swatch that is not a CSS colour: ${String(e)}`);
315
+ }
316
+ }
317
+ get selected() {
318
+ let e = this.value;
319
+ if (Array.isArray(e)) return e.map(String);
320
+ if (e == null) return [];
321
+ let t = String(e);
322
+ return this.kind === "multi" ? t.split(",").map((e) => e.trim()).filter(Boolean) : [t];
323
+ }
324
+ get locale() {
325
+ return this.closest("[lang]")?.getAttribute("lang") || "en";
326
+ }
327
+ formatCount(e) {
328
+ let t = typeof e == "number" ? e : Number(String(e).replace(/,/g, ""));
329
+ if (typeof e == "string" && !/^\s*[\d,]+(\.\d+)?\s*$/.test(e)) return e.trim();
330
+ if (!Number.isFinite(t)) return String(e);
331
+ try {
332
+ return t.toLocaleString(this.locale);
333
+ } catch {
334
+ return t.toLocaleString("en");
335
+ }
336
+ }
337
+ numericCount(e) {
338
+ if (e !== void 0) {
339
+ if (typeof e == "number") return Number.isFinite(e) ? e : void 0;
340
+ if (/^\s*\d[\d,]*(\.\d+)?\s*$/.test(e)) return Number(e.replace(/,/g, ""));
341
+ }
342
+ }
343
+ loc() {
344
+ return {
345
+ pathname: location.pathname,
346
+ search: location.search,
347
+ hash: location.hash
348
+ };
349
+ }
350
+ urlValue() {
351
+ let e = this.loc(), t = this.hashMode && !_(e.hash) ? null : g(e, this.urlParam);
352
+ return t === null ? null : this.kind === "multi" ? t.split(",").map((e) => e.trim()).filter(Boolean) : t;
353
+ }
354
+ readUrl() {
355
+ this.initial ??= Array.isArray(this.value) ? [...this.value] : this.value, this.hashMode ??= _(location.hash);
356
+ let e = this.urlValue();
357
+ e !== null && (this.value = e);
358
+ }
359
+ encode(e) {
360
+ return Array.isArray(e) ? e.join(",") : this.kind === "multi" ? String(e ?? "").split(",").map((e) => e.trim()).filter(Boolean).join(",") : String(e ?? "");
361
+ }
362
+ writeUrl() {
363
+ if (!this.urlParam) return;
364
+ this.initial ??= "", this.hashMode ??= _(location.hash);
365
+ let e = this.encode(this.selected), t = e === this.encode(this.initial) ? null : e, n = v(this.loc(), this.urlParam, t, this.hashMode, !0);
366
+ if (n !== location.pathname + location.search + location.hash) try {
367
+ history.pushState(history.state, "", n);
368
+ } catch {}
369
+ }
370
+ emitChange(e = !1) {
371
+ let t = { value: this.kind === "multi" ? this.selected : this.selected[0] ?? "" };
372
+ e && (t.restored = !0), this.dispatchEvent(new CustomEvent("change", {
373
+ detail: t,
374
+ bubbles: !0,
375
+ composed: !0
376
+ }));
377
+ }
378
+ send(e) {
379
+ let t = `${this.label.trim()}: ${e.label}`, n = this.numericCount(e.count);
380
+ d(this, n === void 0 ? [
381
+ y,
382
+ "change",
383
+ t
384
+ ] : [
385
+ y,
386
+ "change",
387
+ t,
388
+ n
389
+ ]);
390
+ }
391
+ track(e, t) {
392
+ this.kind === "multi" ? (this.writeUrl(), this.send(e)) : (this.pending = {
393
+ from: this.pending?.from ?? t,
394
+ item: e
395
+ }, clearTimeout(this.timer), this.timer = setTimeout(() => this.flush(), x.settle));
396
+ }
397
+ flush() {
398
+ let e = this.pending;
399
+ this.cancel(), e && e.item.value !== e.from && this.selected[0] === e.item.value && (this.writeUrl(), this.send(e.item));
400
+ }
401
+ cancel() {
402
+ clearTimeout(this.timer), this.timer = void 0, this.pending = void 0;
403
+ }
404
+ onRadio(e, t) {
405
+ if (e.stopPropagation(), !e.target.checked) return;
406
+ let n = this.selected[0] ?? "";
407
+ this.value = this.ownValue = t.value, this.track(t, n), this.emitChange();
408
+ }
409
+ onToggle(e) {
410
+ let t = this.selected, n = t.includes(e.value);
411
+ this.value = this.ownValue = n ? t.filter((t) => t !== e.value) : [...t, e.value], this.track(e, ""), this.emitChange();
412
+ }
413
+ onSelect(e, t, n) {
414
+ if (e.defaultPrevented || e.button !== 0 || (d(this, [
415
+ y,
416
+ "select",
417
+ this.label.trim()
418
+ ]), n && (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey))) return;
419
+ let r = { value: t.value };
420
+ n && t.href !== void 0 && (r.href = t.href);
421
+ let i = new CustomEvent("select", {
422
+ detail: r,
423
+ bubbles: !0,
424
+ composed: !0,
425
+ cancelable: n
426
+ });
427
+ !this.dispatchEvent(i) && n && e.preventDefault();
428
+ }
429
+ face(e, t) {
430
+ let n = e.count === void 0 ? "" : this.formatCount(e.count);
431
+ return i`<span class="face"
432
+ >${t ? O : s}${e.swatch ? i`<span
433
+ class="swatch"
434
+ part="swatch"
435
+ aria-hidden="true"
436
+ data-colour=${e.swatch}
437
+ ></span>` : s}<span class="text">${e.label}</span>${n ? i`<span class="visually-hidden">, </span><span class="count">${n}</span
438
+ ><span class="visually-hidden"> ${this.countLabel}</span>` : s}</span
439
+ >`;
440
+ }
441
+ renderChip(e) {
442
+ let t = this.kind;
443
+ if (t === "single") {
444
+ let t = this.selected[0] === e.value;
445
+ return i`<label class="chip"
446
+ ><input
447
+ type="radio"
448
+ name=${this.uid}
449
+ .value=${e.value}
450
+ .checked=${t}
451
+ ?disabled=${!!e.disabled}
452
+ @change=${(t) => this.onRadio(t, e)}
453
+ />${this.face(e, t)}</label
454
+ >`;
455
+ }
456
+ if (t === "multi") {
457
+ let t = this.selected.includes(e.value);
458
+ return i`<button
459
+ type="button"
460
+ class="chip"
461
+ aria-pressed=${t ? "true" : "false"}
462
+ ?disabled=${!!e.disabled}
463
+ @click=${() => this.onToggle(e)}
464
+ >
465
+ ${this.face(e, t)}
466
+ </button>`;
467
+ }
468
+ if (e.disabled) return i`<span class="chip" role="link" aria-disabled="true"
469
+ >${this.face(e, !1)}</span
470
+ >`;
471
+ let n = e.href?.trim();
472
+ return n ? p(n, this.ownerDocument.baseURI) ? i`<a
473
+ class="chip"
474
+ href=${e.href}
475
+ @click=${(t) => this.onSelect(t, e, !0)}
476
+ >${this.face(e, !1)}</a
477
+ >` : (this.warnOnce("href", "showing a chip as text: its href is not http(s), mailto, tel or relative."), i`<span class="chip">${this.face(e, !1)}</span>`) : i`<button
478
+ type="button"
479
+ class="chip"
480
+ @click=${(t) => this.onSelect(t, e, !1)}
481
+ >
482
+ ${this.face(e, !1)}
483
+ </button>`;
484
+ }
485
+ updated(e) {
486
+ super.updated(e);
487
+ for (let e of this.renderRoot.querySelectorAll(".chips .swatch")) e.style.backgroundColor = e.dataset.colour;
488
+ let t = this.renderRoot.querySelector(".chips.scroll") ?? void 0;
489
+ t !== this.observed && (this.resize?.disconnect(), this.observed = t, t && (this.resize ??= new ResizeObserver(() => this.measure()), this.resize.observe(t))), t && requestAnimationFrame(this.measure);
490
+ }
491
+ render() {
492
+ let e = this.chips, t = [
493
+ "chips",
494
+ this.scrollRow ? "scroll" : "",
495
+ this.segmented ? "segmented" : ""
496
+ ].filter(Boolean).join(" "), n = f(this.description), r = `${this.uid}-description`, a = n ? i`<p class="description" id=${r} ?hidden=${!e.length}>${n}</p>` : s, o = i`<div
497
+ class=${t}
498
+ role=${this.kind === "single" ? "radiogroup" : "group"}
499
+ aria-label=${this.label.trim() || s}
500
+ aria-describedby=${n ? r : s}
501
+ ?hidden=${!e.length}
502
+ @scroll=${this.scrollRow ? this.measure : s}
503
+ >
504
+ ${e.map((e) => this.renderChip(e))}
505
+ </div>`;
506
+ return this.scrollRow ? i`<div
507
+ class="rail"
508
+ ?data-more-left=${this.more.left}
509
+ ?data-more-right=${this.more.right}
510
+ >
511
+ ${o}
512
+ </div>
513
+ ${a}` : i`${o}${a}`;
514
+ }
515
+ };
516
+ // src/components/uvalib-chip-group/uvalib-chip-group.ts
517
+ o([e({
518
+ type: String,
519
+ reflect: !0
520
+ })], N.prototype, "mode", void 0), o([e({ type: String })], N.prototype, "label", void 0), o([e({ type: String })], N.prototype, "description", void 0), o([e({ converter: { fromAttribute: (e) => e ?? "" } })], N.prototype, "value", void 0), o([e({ attribute: !1 })], N.prototype, "items", void 0), o([e({
521
+ type: String,
522
+ attribute: "count-label"
523
+ })], N.prototype, "countLabel", void 0), o([e({
524
+ type: Boolean,
525
+ reflect: !0,
526
+ attribute: "scroll"
527
+ })], N.prototype, "scrollRow", void 0), o([e({
528
+ type: Boolean,
529
+ reflect: !0
530
+ })], N.prototype, "segmented", void 0), o([e({
531
+ type: String,
532
+ attribute: "url-param"
533
+ })], N.prototype, "urlParam", void 0), o([r()], N.prototype, "childItems", void 0), o([r()], N.prototype, "more", void 0), a("uvalib-chip-group", N);
534
+
535
+ //# sourceMappingURL=uvalib-chip-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uvalib-chip-group.js","names":["unsafeCSS","nothing","_decorate","property","state","n","w","i","r$1","b","define","__decorate","A","r","installLightDomStyles","UvalibElement","trackEvent","normalize","safeHref","SourceChildren","accessible","paramFromLocation","usesHashParam","hrefWithParam","TAG","MODES","chipGroupTiming","uid","structuralRules","host","shadowStructure","BORDER","LINK","ACCENT","CHECK","ON","OFF_DISABLED","HOVER","FOCUSED","UvalibChipGroup","v","before","g","max","x","rtl","after","more","nodes","root","sheet","node","changed","kind","message","items","label","item","count","swatch","c","s","loc","raw","value","id","next","detail","restored","name","from","p","now","on","link","go","e","href","chips","classes","description","descId","hint","row"],"sources":["../src/components/uvalib-chip-group/UvalibChipGroup.ts","../src/components/uvalib-chip-group/uvalib-chip-group.ts"],"sourcesContent":["import { css, html, nothing, svg, unsafeCSS, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { normalize, safeHref, SourceChildren } from '../../base/source-children.js';\nimport { accessible } from '../../styles/accessible.js';\nimport {\n hrefWithParam,\n paramFromLocation,\n usesHashParam,\n type PageLocation,\n} from '../../base/url-param.js';\n\n/** One chip: the value reported in events, its visible label, and optionally a count and link. */\nexport interface ChipItem {\n value: string;\n label: string;\n /** Shown in a smaller muted span and read as part of the name (`2005, 213 shoots`). */\n count?: number | string;\n /** `links` mode: the chip is a link. Without it the chip is a button that fires `select`. */\n href?: string;\n disabled?: boolean;\n /**\n * A CSS colour for a small square before the label, so the chips can be a chart's or map's\n * colour key. Decorative (`aria-hidden`): the name stays the label.\n */\n swatch?: string;\n}\n\nexport type ChipGroupMode = 'single' | 'multi' | 'links';\n\nconst TAG = 'uvalib-chip-group';\nconst MODES = new Set<ChipGroupMode>(['single', 'multi', 'links']);\n/**\n * Single-select changes within `settle` ms count as one: one analytics event (none when the\n * visitor ends where they started) and one history entry. Tests may shorten it.\n */\nexport const chipGroupTiming = { settle: 1000 };\nlet uid = 0;\n\n/**\n * Kept with `no-style`: the wrapping (or scrolling) row, each chip's target of at least 44px,\n * the radio laid over its chip, the joined segments and the visually hidden text. `host` is\n * `:host` or the tag.\n */\nconst structuralRules = (host: string) => `\n ${host} { display: flow-root; min-width: 0; max-width: 100%; }\n ${host} .chips {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.25rem 0.5rem;\n min-width: 0;\n }\n ${host} .chips.scroll {\n flex-wrap: nowrap;\n overflow-x: auto;\n overscroll-behavior-x: contain;\n padding: 0.375rem;\n scroll-padding-inline: 2.5rem;\n }\n ${host} .chips.scroll > .chip { flex: none; }\n ${host} .rail { position: relative; min-width: 0; }\n ${host} .chips.segmented {\n flex-wrap: nowrap;\n column-gap: 0;\n overflow-x: auto;\n padding: 0.375rem;\n }\n /* The padding only keeps the focus ring inside the scroll box: the bar stays 44px tall. */\n ${host} .chips.segmented:not(.scroll) { margin-block: -0.375rem; }\n ${host} .chips.segmented:not(.scroll) > .chip { flex: 0 1 auto; min-width: 44px; }\n ${host} .chips.segmented > .chip + .chip { margin-inline-start: -1px; }\n ${host} .chip {\n position: relative;\n display: inline-flex;\n align-items: center;\n box-sizing: border-box;\n min-width: 44px;\n min-height: 44px;\n max-width: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: none;\n color: inherit;\n font: inherit;\n text-align: start;\n text-decoration: none;\n cursor: pointer;\n }\n ${host} .chip input {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n opacity: 0;\n cursor: inherit;\n }\n ${host} .face {\n display: inline-flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n gap: 0.375rem;\n box-sizing: border-box;\n min-width: 0;\n min-height: 2.25rem;\n overflow-wrap: break-word;\n }\n ${host} .text { min-width: 0; }\n ${host} .check { flex: none; width: 1em; height: 1em; }\n /* A key's colour is content, not look: kept with no-style. Its border is the chip's text\n colour, which contrasts with the chip in every state (selected, disabled, dark). */\n ${host} .swatch {\n flex: none;\n box-sizing: border-box;\n width: 0.75em;\n height: 0.75em;\n border: 1px solid currentColor;\n border-radius: 2px;\n }\n /* Forced colors would flatten the fill: the key keeps its colour (it matches the chart or\n map) and its border stays the chip's system text colour. */\n @media (forced-colors: active) {\n ${host} .swatch { forced-color-adjust: none; }\n }\n ${host} .chip:focus-visible { outline: none; }\n ${host} :is(.chip:focus-visible > .face, .chip input:focus-visible + .face) {\n position: relative;\n z-index: 1;\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: 2px;\n }\n ${host} :is(.chip:disabled, .chip[aria-disabled='true'], .chip input:disabled) { cursor: not-allowed; }\n ${host} .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n ${host} .description { margin: 0.25rem 0 0; }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\nconst BORDER = 'var(--uva-color-control-border, var(--uva-grey, #808080))';\nconst LINK = 'var(--uva-color-link, var(--uva-brand-blue, #232d4b))';\nconst ACCENT = 'var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b))';\n\n/** The tick on a selected chip, so the state never rests on colour alone. */\nconst CHECK = svg`<svg class=\"check\" viewBox=\"0 0 16 16\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M3 8.5l3.2 3.2L13 4.8\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>`;\n\n/** The visual target of each face: selected (a radio checked or a toggle pressed). */\nconst ON = unsafeCSS(\".chip[aria-pressed='true'] > .face, .chip input:checked + .face\");\n/** Disabled and not selected (a selected disabled chip keeps the selected fill and text). */\nconst OFF_DISABLED = unsafeCSS(\n \".chip:disabled:not([aria-pressed='true']) > .face, .chip[aria-disabled='true'] > .face, .chip input:disabled:not(:checked) + .face\",\n);\n/** Hover, never on a disabled chip. */\nconst HOVER = unsafeCSS(\n \".chip:not(:disabled, [aria-disabled='true']):hover > .face, .chip:hover input:not(:disabled) + .face\",\n);\nconst FOCUSED = unsafeCSS('.chip:focus-visible > .face, .chip input:focus-visible + .face');\n\n/**\n * A row of chips: a segmented control or single-select filter (`mode=\"single\"`), filter chips\n * that toggle (`mode=\"multi\"`), or suggestion chips that go somewhere (`mode=\"links\"`), as in\n * a year rail with counts (“2005 213”), a sort toggle (“Most photos | Date | Title A–Z”) or\n * “Try: snow on the Lawn”.\n *\n * Give the chips as children, `<button value=\"2005\" data-count=\"213\">2005</button>` (the\n * value is the `value` attribute, else `data-value`, else the text; `disabled` disables), or\n * `<a href>` in `links` mode, or set the `items` property (`{ value, label, count?, href?,\n * disabled?, swatch? }`), which wins over the children while set. The chips follow later changes to\n * the children.\n *\n * `single`: native radios drawn as chips, in a `role=\"radiogroup\"` named by `label`. Tab\n * enters the group at the selected chip, the arrow keys move and select (as any radio group),\n * and `value` is the selected chip's value. `multi`: toggle buttons with `aria-pressed`, and\n * `value` is an array (as an attribute, comma-separated). `links`: links, or buttons that fire\n * `select`, with no selected state; a chip whose href is unsafe (`javascript:`) is plain text,\n * and an empty href is a button.\n *\n * `data-swatch` (or `swatch` in `items`) is a CSS colour drawn as a small bordered square\n * before the label, so the chips double as a chart's or map's colour key. It is decorative\n * (`aria-hidden`) and never the only cue: the name stays the label. An invalid colour is\n * ignored with one warning. In forced colors the square keeps its colour.\n *\n * A count is shown in a smaller muted span after the label and read as part of the name: “2005,\n * 213 items”, with `count-label` in place of “items”. A selected chip is filled, keeps its\n * border and shows a tick. Chips wrap on a narrow screen; `scroll` keeps them on one row that\n * scrolls sideways, with its scrollbar shown and a fade at an edge with more chips. Each chip\n * is a target at least 44px square. `segmented` joins the chips into one bar that does not\n * wrap (a long label wraps inside its segment), like the header's Light / Dark / System control.\n *\n * `description` is a hint shown under the chips and tied to the group with\n * `aria-describedby`, so it is read when focus enters the group (“Keyword matches your\n * words…”). It is plain text in the element's own root, so it works in a closed shadow root.\n *\n * `url-param` (for example `year`) keeps the value in the address (`?year=2005`, a multi\n * value comma-separated, inside the hash on a hash route). It is read on connect; the\n * markup's `value` stands for the address without the parameter, and any other value is\n * written, an empty one as `?year=`. Each change is one `pushState`: in `multi` at once, in\n * `single` once the visitor settles (a second after the last change, so arrowing through a\n * year rail adds one entry, none if it ends where it started). Back and Forward are followed\n * and fire `change` with `restored: true`.\n *\n * @tagname uvalib-chip-group\n * @fires 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.\n * @fires 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.\n * @fires 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.\n * @csspart swatch - The colour square before a chip's label (`data-swatch`, `swatch`).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: chip background (else #fff).\n * @cssprop --uva-color-control-border - Dark-mode role token: chip border (else `--uva-grey`, #808080).\n * @cssprop --uva-color-link - Dark-mode role token: chip text and hover border (else `--uva-brand-blue`).\n * @cssprop --uva-color-text-muted - Dark-mode role token: the count and the description (else #4f4f4f).\n * @cssprop --uva-color-accent-bg - Dark-mode role token: selected chip background and border (else `--uva-brand-blue`).\n * @cssprop --uva-color-on-accent - Dark-mode role token: selected chip text (else #fff).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n * @cssprop --uva-color-surface - Dark-mode role token: the page background the scrolling row fades into at an edge with more chips (else #fff).\n */\nexport class UvalibChipGroup extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n .face {\n padding: 0.25rem 0.875rem;\n border: 1px solid ${unsafeCSS(BORDER)};\n border-radius: 999px;\n background: var(--uva-color-surface-raised, #fff);\n color: ${unsafeCSS(LINK)};\n font-size: 0.875rem;\n font-weight: 600;\n line-height: 1.3;\n }\n .segmented .face {\n padding-inline: 0.625rem;\n border-radius: 0;\n }\n .segmented > .chip:first-child .face {\n border-start-start-radius: 0.3rem;\n border-end-start-radius: 0.3rem;\n }\n .segmented > .chip:last-child .face {\n border-start-end-radius: 0.3rem;\n border-end-end-radius: 0.3rem;\n }\n .description {\n color: var(--uva-color-text-muted, #4f4f4f);\n font-size: 0.875rem;\n line-height: 1.5;\n }\n .count {\n color: var(--uva-color-text-muted, #4f4f4f);\n font-size: 0.8125rem;\n font-weight: 400;\n font-variant-numeric: tabular-nums;\n }\n ${HOVER} {\n position: relative;\n border-color: ${unsafeCSS(LINK)};\n }\n ${ON} {\n position: relative;\n border-color: ${unsafeCSS(ACCENT)};\n background: ${unsafeCSS(ACCENT)};\n color: var(--uva-color-on-accent, #fff);\n }\n .chip[aria-pressed='true'] .count,\n .chip input:checked + .face .count {\n color: inherit;\n }\n ${OFF_DISABLED} {\n border-style: dashed;\n color: var(--uva-color-text-muted, #4f4f4f);\n }\n /* One row that scrolls: the scrollbar stays visible, and the edge with more chips\n fades out. */\n .chips.scroll {\n scrollbar-width: thin;\n scrollbar-color: ${unsafeCSS(BORDER)} transparent;\n }\n .rail::before,\n .rail::after {\n content: '';\n position: absolute;\n inset-block: 0 0.75rem;\n z-index: 2;\n width: 2.5rem;\n pointer-events: none;\n opacity: 0;\n }\n .rail::before {\n left: 0;\n background: linear-gradient(to right, var(--uva-color-surface, #fff), transparent);\n }\n .rail::after {\n right: 0;\n background: linear-gradient(to left, var(--uva-color-surface, #fff), transparent);\n }\n .rail[data-more-left]::before,\n .rail[data-more-right]::after {\n opacity: 1;\n }\n @media (forced-colors: active) {\n .face {\n border-color: ButtonText;\n color: ButtonText;\n }\n a.chip > .face {\n border-color: LinkText;\n color: LinkText;\n }\n ${HOVER} {\n border-color: Highlight;\n }\n ${ON} {\n forced-color-adjust: none;\n border-color: Highlight;\n background: Highlight;\n color: HighlightText;\n }\n ${OFF_DISABLED} {\n border-color: GrayText;\n color: GrayText;\n }\n ${FOCUSED} {\n outline-color: Highlight;\n }\n /* Forced colors keep gradients: a light fade would cover the edge chips. */\n .rail::before,\n .rail::after {\n display: none;\n }\n }\n `,\n ];\n\n /** `single` (radios: one value), `multi` (toggles: an array of values) or `links`. */\n @property({ type: String, reflect: true }) mode: ChipGroupMode = 'single';\n\n /** The group's accessible name (required), also the first part of the analytics name. */\n @property({ type: String }) label = '';\n\n /**\n * A hint shown under the chips and read with the group when focus enters it\n * (`aria-describedby` on the group). Plain text.\n */\n @property({ type: String }) description = '';\n\n /**\n * The selection: a chip's value in `single`, an array of values in `multi` (as an\n * attribute, comma-separated). Setting it does not fire `change`. Unused in `links`.\n */\n @property({\n converter: { fromAttribute: (v: string | null) => v ?? '' },\n })\n value: string | string[] = '';\n\n /**\n * The chips as data: `{ value, label, count?, href?, disabled?, swatch? }`. Wins over the children\n * while set; `undefined` goes back to them.\n */\n @property({ attribute: false }) items?: ChipItem[];\n\n /** The word after a count in each chip's accessible name: “2005, 213 items”. */\n @property({ type: String, attribute: 'count-label' }) countLabel = 'items';\n\n /** One row that scrolls sideways instead of wrapping. */\n @property({ type: Boolean, reflect: true, attribute: 'scroll' }) scrollRow = false;\n\n /** Join the chips into one segmented bar. */\n @property({ type: Boolean, reflect: true }) segmented = false;\n\n /** Query parameter that keeps the value in the address, for example `year` → `?year=2005`. */\n @property({ type: String, attribute: 'url-param' }) urlParam = '';\n\n @state() private childItems: ChipItem[] = [];\n /** `scroll`: whether more chips lie beyond the left and right edges. */\n @state() private more = { left: false, right: false };\n private resize?: ResizeObserver;\n private observed?: HTMLElement;\n\n private readonly uid = `${TAG}-${++uid}`;\n private warned = new Set<string>();\n /** The value before the address was read: what a URL without the parameter means. */\n private initial?: string | string[];\n /** Whether the parameter lives in the hash (a hash route), fixed at the first read. */\n private hashMode?: boolean;\n /** The last value this element set itself: any other change to `value` is the app's. */\n private ownValue?: string | string[];\n /** The single-select change waiting to settle: where the burst started, and the chip now. */\n private pending?: { from: string; item: ChipItem };\n private timer?: ReturnType<typeof setTimeout>;\n\n constructor() {\n super();\n new SourceChildren(\n this,\n () => this.lightDom,\n (nodes) => this.read(nodes),\n );\n }\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n installLightDomStyles(\n `${this.localName}::structure`,\n unsafeCSS(structuralRules(this.localName)),\n {\n root: node instanceof ShadowRoot || node instanceof Document ? node : undefined,\n scope: false,\n },\n );\n }\n window.addEventListener('popstate', this.onPop);\n // Moved in the page: observe the scrolling row again.\n if (this.hasUpdated) this.requestUpdate();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('popstate', this.onPop);\n // Detached, it could not report through the page (nor honour an ancestor's\n // no-analytics), and its address may belong to another route by now: drop it.\n this.cancel();\n this.resize?.disconnect();\n this.observed = undefined;\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n if (changed.has('urlParam') && this.urlParam) this.readUrl();\n if (changed.has('value') && this.value !== this.ownValue) {\n // Set by the app (or read from the address): a pending change is no longer the visitor's.\n this.cancel();\n if (this.kind === 'multi' && !Array.isArray(this.value)) this.value = this.selected;\n }\n if (!this.label.trim())\n this.warnOnce('label', 'set label: the group needs an accessible name.');\n if (!MODES.has(this.mode)) this.warnOnce('mode', 'mode must be single, multi or links.');\n }\n\n private warnOnce(kind: string, message: string): void {\n if (this.warned.has(kind)) return;\n this.warned.add(kind);\n console.warn(`${this.localName}: ${message}`);\n }\n\n private get kind(): ChipGroupMode {\n return MODES.has(this.mode) ? this.mode : 'single';\n }\n\n /** Read the chips from the children: each element with text is one chip. */\n private read(nodes: Node[]): void {\n const items: ChipItem[] = [];\n for (const n of nodes) {\n if (!(n instanceof Element)) continue;\n const label = normalize(n.textContent);\n if (!label) {\n this.warnOnce('empty', 'ignoring chips with no text.');\n continue;\n }\n const item: ChipItem = {\n value: n.getAttribute('value') ?? n.getAttribute('data-value') ?? label,\n label,\n };\n const count = n.getAttribute('data-count');\n if (count !== null && count.trim()) item.count = count.trim();\n if (n instanceof HTMLAnchorElement && n.hasAttribute('href'))\n item.href = n.getAttribute('href')!;\n if (n.hasAttribute('disabled') || n.getAttribute('aria-disabled') === 'true')\n item.disabled = true;\n const swatch = n.getAttribute('data-swatch');\n if (swatch !== null) item.swatch = swatch;\n items.push(item);\n }\n // Only a real change re-renders.\n if (JSON.stringify(items) !== JSON.stringify(this.childItems)) this.childItems = items;\n }\n\n /** What is shown: `items` while set, else the children; entries without a label left out. */\n private get chips(): ChipItem[] {\n const source = this.items ?? this.childItems;\n return source\n .filter((i) => i && normalize(i.label))\n .map((i) => ({\n ...i,\n label: normalize(i.label),\n value: String(i.value ?? normalize(i.label)),\n swatch: this.colour(i.swatch),\n }));\n }\n\n /** A valid CSS colour, else nothing (one warning). Only ever set as a style property. */\n private colour(c: unknown): string | undefined {\n const v = typeof c === 'string' ? c.trim() : '';\n if (!v && (c === undefined || c === null || c === '')) return undefined;\n if (v && CSS.supports('color', v)) return v;\n this.warnOnce('swatch', `ignoring a swatch that is not a CSS colour: ${String(c)}`);\n return undefined;\n }\n\n /** The selected values, whatever shape `value` has. */\n private get selected(): string[] {\n const v = this.value;\n if (Array.isArray(v)) return v.map(String);\n if (v === null || v === undefined) return [];\n const s = String(v);\n if (this.kind === 'multi')\n return s\n .split(',')\n .map((x) => x.trim())\n .filter(Boolean);\n return [s];\n }\n\n private get locale(): string {\n return this.closest('[lang]')?.getAttribute('lang') || 'en';\n }\n\n private formatCount(count: number | string): string {\n const n = typeof count === 'number' ? count : Number(String(count).replace(/,/g, ''));\n if (typeof count === 'string' && !/^\\s*[\\d,]+(\\.\\d+)?\\s*$/.test(count)) return count.trim();\n if (!Number.isFinite(n)) return String(count);\n try {\n return n.toLocaleString(this.locale);\n } catch {\n return n.toLocaleString('en');\n }\n }\n\n private numericCount(count: ChipItem['count']): number | undefined {\n if (count === undefined) return undefined;\n if (typeof count === 'number') return Number.isFinite(count) ? count : undefined;\n // '' and ',' are not 0.\n if (!/^\\s*\\d[\\d,]*(\\.\\d+)?\\s*$/.test(count)) return undefined;\n return Number(count.replace(/,/g, ''));\n }\n\n /* ---------- the address ---------- */\n\n private loc(): PageLocation {\n return { pathname: location.pathname, search: location.search, hash: location.hash };\n }\n\n private urlValue(): string | string[] | null {\n const loc = this.loc();\n // A hash route keeps its parameter in the hash, even once the hash has no query left.\n const raw =\n this.hashMode && !usesHashParam(loc.hash) ? null : paramFromLocation(loc, this.urlParam);\n if (raw === null) return null;\n return this.kind === 'multi'\n ? raw\n .split(',')\n .map((x) => x.trim())\n .filter(Boolean)\n : raw;\n }\n\n /** On connect (and a new `url-param`): the address wins over the markup, quietly. */\n private readUrl(): void {\n this.initial ??= Array.isArray(this.value) ? [...this.value] : this.value;\n this.hashMode ??= usesHashParam(location.hash);\n const v = this.urlValue();\n if (v !== null) this.value = v;\n }\n\n private onPop = (): void => {\n if (!this.urlParam || this.kind === 'links') return;\n this.cancel();\n this.initial ??= Array.isArray(this.value) ? [...this.value] : this.value;\n const v = this.urlValue() ?? this.initial ?? '';\n const before = this.selected.join('\\u0000');\n this.value = Array.isArray(v) ? [...v] : v;\n if (this.selected.join('\\u0000') === before) return;\n this.emitChange(true);\n };\n\n /** The value as it is written in the address. */\n private encode(v: string | string[] | undefined): string {\n if (Array.isArray(v)) return v.join(',');\n if (this.kind === 'multi')\n return String(v ?? '')\n .split(',')\n .map((x) => x.trim())\n .filter(Boolean)\n .join(',');\n return String(v ?? '');\n }\n\n /**\n * Push the value into the address. The markup's value is the address without the\n * parameter; any other value is written, an empty one as `?year=`.\n */\n private writeUrl(): void {\n if (!this.urlParam) return;\n this.initial ??= '';\n this.hashMode ??= usesHashParam(location.hash);\n const value = this.encode(this.selected);\n const id = value === this.encode(this.initial) ? null : value;\n const next = hrefWithParam(this.loc(), this.urlParam, id, this.hashMode, true);\n const now = location.pathname + location.search + location.hash;\n if (next === now) return;\n try {\n history.pushState(history.state, '', next);\n } catch {\n // A sandboxed document (an iframe srcdoc) cannot change its address.\n }\n }\n\n /* ---------- events ---------- */\n\n private emitChange(restored = false): void {\n const value = this.kind === 'multi' ? this.selected : (this.selected[0] ?? '');\n const detail: { value: string | string[]; restored?: boolean } = { value };\n if (restored) detail.restored = true;\n this.dispatchEvent(new CustomEvent('change', { detail, bubbles: true, composed: true }));\n }\n\n private send(item: ChipItem): void {\n const name = `${this.label.trim()}: ${item.label}`;\n const count = this.numericCount(item.count);\n trackEvent(this, count === undefined ? [TAG, 'change', name] : [TAG, 'change', name, count]);\n }\n\n /**\n * Multi: report the toggled chip and write the address now. Single: once changes settle\n * (arrowing through a year rail), report the chip then selected and push one history entry,\n * unless the visitor ended where they started.\n */\n private track(item: ChipItem, from: string): void {\n if (this.kind === 'multi') {\n this.writeUrl();\n this.send(item);\n return;\n }\n this.pending = { from: this.pending?.from ?? from, item };\n clearTimeout(this.timer);\n this.timer = setTimeout(() => this.flush(), chipGroupTiming.settle);\n }\n\n private flush(): void {\n const p = this.pending;\n this.cancel();\n if (!p || p.item.value === p.from || this.selected[0] !== p.item.value) return;\n this.writeUrl();\n this.send(p.item);\n }\n\n /** Forget a single-select change that has not settled, without reporting it. */\n private cancel(): void {\n clearTimeout(this.timer);\n this.timer = undefined;\n this.pending = undefined;\n }\n\n private onRadio(e: Event, item: ChipItem): void {\n // The radio's own change event must not reach the page as this element's `change` (in\n // light DOM it would bubble through the host).\n e.stopPropagation();\n const input = e.target as HTMLInputElement;\n if (!input.checked) return;\n const from = this.selected[0] ?? '';\n this.value = this.ownValue = item.value;\n this.track(item, from);\n this.emitChange();\n }\n\n private onToggle(item: ChipItem): void {\n const now = this.selected;\n const on = now.includes(item.value);\n this.value = this.ownValue = on ? now.filter((v) => v !== item.value) : [...now, item.value];\n this.track(item, '');\n this.emitChange();\n }\n\n private onSelect(e: MouseEvent, item: ChipItem, link: boolean): void {\n if (e.defaultPrevented || e.button !== 0) return;\n trackEvent(this, [TAG, 'select', this.label.trim()]);\n if (link && (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey)) return;\n const detail: { value: string; href?: string } = { value: item.value };\n if (link && item.href !== undefined) detail.href = item.href;\n const go = new CustomEvent('select', {\n detail,\n bubbles: true,\n composed: true,\n cancelable: link,\n });\n if (!this.dispatchEvent(go) && link) e.preventDefault();\n }\n\n /* ---------- render ---------- */\n\n private face(item: ChipItem, on: boolean) {\n const count = item.count === undefined ? '' : this.formatCount(item.count);\n return html`<span class=\"face\"\n >${on ? CHECK : nothing}${\n item.swatch\n ? html`<span\n class=\"swatch\"\n part=\"swatch\"\n aria-hidden=\"true\"\n data-colour=${item.swatch}\n ></span>`\n : nothing\n }<span class=\"text\">${item.label}</span>${\n count\n ? html`<span class=\"visually-hidden\">, </span><span class=\"count\">${count}</span\n ><span class=\"visually-hidden\"> ${this.countLabel}</span>`\n : nothing\n }</span\n >`;\n }\n\n private renderChip(item: ChipItem) {\n const kind = this.kind;\n if (kind === 'single') {\n const on = this.selected[0] === item.value;\n return html`<label class=\"chip\"\n ><input\n type=\"radio\"\n name=${this.uid}\n .value=${item.value}\n .checked=${on}\n ?disabled=${!!item.disabled}\n @change=${(e: Event) => this.onRadio(e, item)}\n />${this.face(item, on)}</label\n >`;\n }\n if (kind === 'multi') {\n const on = this.selected.includes(item.value);\n return html`<button\n type=\"button\"\n class=\"chip\"\n aria-pressed=${on ? 'true' : 'false'}\n ?disabled=${!!item.disabled}\n @click=${() => this.onToggle(item)}\n >\n ${this.face(item, on)}\n </button>`;\n }\n if (item.disabled)\n return html`<span class=\"chip\" role=\"link\" aria-disabled=\"true\"\n >${this.face(item, false)}</span\n >`;\n const href = item.href?.trim();\n if (href) {\n if (safeHref(href, this.ownerDocument.baseURI))\n return html`<a\n class=\"chip\"\n href=${item.href!}\n @click=${(e: MouseEvent) => this.onSelect(e, item, true)}\n >${this.face(item, false)}</a\n >`;\n this.warnOnce(\n 'href',\n 'showing a chip as text: its href is not http(s), mailto, tel or relative.',\n );\n return html`<span class=\"chip\">${this.face(item, false)}</span>`;\n }\n return html`<button\n type=\"button\"\n class=\"chip\"\n @click=${(e: MouseEvent) => this.onSelect(e, item, false)}\n >\n ${this.face(item, false)}\n </button>`;\n }\n\n /** `scroll`: which edges have more chips beyond them (in either writing direction). */\n private measure = (): void => {\n const g = this.renderRoot.querySelector<HTMLElement>('.chips.scroll');\n if (!g) return;\n const max = g.scrollWidth - g.clientWidth;\n const x = Math.abs(g.scrollLeft);\n const rtl = getComputedStyle(g).direction === 'rtl';\n const before = x > 1;\n const after = x < max - 1;\n const more = { left: rtl ? after : before, right: rtl ? before : after };\n if (more.left !== this.more.left || more.right !== this.more.right) this.more = more;\n };\n\n protected override updated(changed: PropertyValues<this>): void {\n super.updated(changed);\n // The checked colour is set as a style property, never written as CSS text.\n for (const s of this.renderRoot.querySelectorAll<HTMLElement>('.chips .swatch'))\n s.style.backgroundColor = s.dataset.colour!;\n const g = this.renderRoot.querySelector<HTMLElement>('.chips.scroll') ?? undefined;\n if (g !== this.observed) {\n this.resize?.disconnect();\n this.observed = g;\n if (g) {\n this.resize ??= new ResizeObserver(() => this.measure());\n this.resize.observe(g);\n }\n }\n // New or changed chips can widen the row without resizing it.\n if (g) requestAnimationFrame(this.measure);\n }\n\n protected override render() {\n const chips = this.chips;\n const classes = ['chips', this.scrollRow ? 'scroll' : '', this.segmented ? 'segmented' : '']\n .filter(Boolean)\n .join(' ');\n const description = normalize(this.description);\n const descId = `${this.uid}-description`;\n const hint = description\n ? html`<p class=\"description\" id=${descId} ?hidden=${!chips.length}>${description}</p>`\n : nothing;\n const row = html`<div\n class=${classes}\n role=${this.kind === 'single' ? 'radiogroup' : 'group'}\n aria-label=${this.label.trim() || nothing}\n aria-describedby=${description ? descId : nothing}\n ?hidden=${!chips.length}\n @scroll=${this.scrollRow ? this.measure : nothing}\n >\n ${chips.map((item) => this.renderChip(item))}\n </div>`;\n if (!this.scrollRow) return html`${row}${hint}`;\n return html`<div\n class=\"rail\"\n ?data-more-left=${this.more.left}\n ?data-more-right=${this.more.right}\n >\n ${row}\n </div>\n ${hint}`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { UvalibChipGroup } from './UvalibChipGroup.js';\n\ndefine('uvalib-chip-group', UvalibChipGroup);\n"],"mappings":";;;;;;AAgCA,IAAMwB,IAAM,qBACNC,oBAAQ,IAAI,IAAmB;CAAC;CAAU;CAAS;AAAO,CAAC,GAKpDC,IAAkB,EAAE,QAAQ,IAAK,GAC1CC,IAAM,GAOJC,KAAmB,MAAiB;IACtCC,EAAK;IACLA,EAAK;;;;;;;IAOLA,EAAK;;;;;;;IAOLA,EAAK;IACLA,EAAK;IACLA,EAAK;;;;;;;IAOLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;;;;;;;;;;;;;;;;;;IAkBLA,EAAK;;;;;;;;;IASLA,EAAK;;;;;;;;;;;IAWLA,EAAK;IACLA,EAAK;;;IAGLA,EAAK;;;;;;;;;;;MAWHA,EAAK;;IAEPA,EAAK;IACLA,EAAK;;;;;;IAMLA,EAAK;IACLA,EAAK;;;;;;;;;;;IAWLA,EAAK;IACLA,EAAK,YAAYA,EAAK;GAEpBC,IAAkB9B,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