@redvars/peacock 4.2.1 → 4.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 (244) hide show
  1. package/dist/{BaseField-D8ByB0l3.js → BaseField-CHBcjVc2.js} +3 -3
  2. package/dist/{BaseField-D8ByB0l3.js.map → BaseField-CHBcjVc2.js.map} +1 -1
  3. package/dist/{BaseInput-xCHvT4AN.js → BaseInput-DZp2O8Gh.js} +2 -2
  4. package/dist/{BaseInput-xCHvT4AN.js.map → BaseInput-DZp2O8Gh.js.map} +1 -1
  5. package/dist/ai-badge.js +2 -2
  6. package/dist/ai-summary.js +2 -2
  7. package/dist/alert.js +2 -2
  8. package/dist/anchor-nav.js +2 -2
  9. package/dist/app-shell.js +2 -2
  10. package/dist/assistant-panel.js +2 -2
  11. package/dist/assistant-step.js +2 -2
  12. package/dist/assistant-steps.js +2 -2
  13. package/dist/avatar-group.js +2 -2
  14. package/dist/banner.js +2 -2
  15. package/dist/{base-progress-DxNgAQtw.js → base-progress-CKQ32Ruw.js} +2 -2
  16. package/dist/{base-progress-DxNgAQtw.js.map → base-progress-CKQ32Ruw.js.map} +1 -1
  17. package/dist/bottom-sheet.js +2 -2
  18. package/dist/breadcrumb.js +2 -2
  19. package/dist/calendar.js +2 -2
  20. package/dist/{canvas-base-DHKf2CmA.js → canvas-base-BoKef3yr.js} +2 -2
  21. package/dist/{canvas-base-DHKf2CmA.js.map → canvas-base-BoKef3yr.js.map} +1 -1
  22. package/dist/carousel.js +644 -0
  23. package/dist/carousel.js.map +1 -0
  24. package/dist/{cartesian-chart-G6VX1aKk.js → cartesian-chart-DqZxnoG1.js} +2 -2
  25. package/dist/{cartesian-chart-G6VX1aKk.js.map → cartesian-chart-DqZxnoG1.js.map} +1 -1
  26. package/dist/{cb-group-base-CZLzCnXK.js → cb-group-base-Bf7iOIGS.js} +2 -2
  27. package/dist/{cb-group-base-CZLzCnXK.js.map → cb-group-base-Bf7iOIGS.js.map} +1 -1
  28. package/dist/cb-group.js +3 -3
  29. package/dist/cb-rule.js +3 -3
  30. package/dist/chart-area.js +4 -4
  31. package/dist/chart-bar.js +4 -4
  32. package/dist/{chart-base-DREru2P0.js → chart-base-ByCJM_9C.js} +2 -2
  33. package/dist/{chart-base-DREru2P0.js.map → chart-base-ByCJM_9C.js.map} +1 -1
  34. package/dist/chart-doughnut.js +3 -3
  35. package/dist/chart-line.js +4 -4
  36. package/dist/chart-pie.js +3 -3
  37. package/dist/chat-event.js +2 -2
  38. package/dist/chat-message.js +2 -2
  39. package/dist/chat-thread.js +2 -2
  40. package/dist/checkbox-group.js +3 -3
  41. package/dist/checkbox.js +3 -3
  42. package/dist/chip-set.js +2 -2
  43. package/dist/chip.js +2 -2
  44. package/dist/circular-progress.js +3 -3
  45. package/dist/citation.js +2 -2
  46. package/dist/code-editor.js +3 -3
  47. package/dist/code-highlighter.js +2 -2
  48. package/dist/color-field.js +4 -4
  49. package/dist/color-picker.js +2 -2
  50. package/dist/command-palette.js +2 -2
  51. package/dist/comment-composer.js +4 -4
  52. package/dist/condition-builder.js +3 -3
  53. package/dist/confirm-dialog.js +2 -2
  54. package/dist/copy-button.js +2 -2
  55. package/dist/currency-field.js +4 -4
  56. package/dist/custom-elements-jsdocs.json +902 -74
  57. package/dist/custom-elements.json +2842 -1
  58. package/dist/date-field.js +5 -5
  59. package/dist/date-picker.js +2 -2
  60. package/dist/date-range-field.js +5 -5
  61. package/dist/datetime-field.js +5 -5
  62. package/dist/dependency-map.js +3 -3
  63. package/dist/description-item.js +2 -2
  64. package/dist/description-list.js +2 -2
  65. package/dist/{diagram-CHF70xTL.js → diagram-Cnrj-4y3.js} +2 -2
  66. package/dist/{diagram-CHF70xTL.js.map → diagram-Cnrj-4y3.js.map} +1 -1
  67. package/dist/diagram-controls.js +2 -2
  68. package/dist/diagram-minimap.js +2 -2
  69. package/dist/diagram.js +4 -4
  70. package/dist/diff-viewer.js +2 -2
  71. package/dist/discussion-activity.js +2 -2
  72. package/dist/discussion-comment.js +2 -2
  73. package/dist/discussion.js +4 -4
  74. package/dist/{document-editor-Cb9fCxvA.js → document-editor-C8ThjDQ7.js} +2 -2
  75. package/dist/{document-editor-Cb9fCxvA.js.map → document-editor-C8ThjDQ7.js.map} +1 -1
  76. package/dist/document-editor.js +3 -3
  77. package/dist/draft-card.js +2 -2
  78. package/dist/erd.js +3 -3
  79. package/dist/file-upload.js +3 -3
  80. package/dist/filter-bar.js +2 -2
  81. package/dist/flow.js +4 -4
  82. package/dist/form.js +2 -2
  83. package/dist/{generative-view-C4fJ2zI7.js → generative-view-CQ8-g1wY.js} +2 -2
  84. package/dist/{generative-view-C4fJ2zI7.js.map → generative-view-CQ8-g1wY.js.map} +1 -1
  85. package/dist/generative-view.js +3 -3
  86. package/dist/highlight-Be0wu7kh.js +252 -0
  87. package/dist/highlight-Be0wu7kh.js.map +1 -0
  88. package/dist/highlight.js +6 -0
  89. package/dist/highlight.js.map +1 -0
  90. package/dist/html-editor.js +4 -4
  91. package/dist/{i18n-controller-CH4e9sju.js → i18n-controller-DLJcJ5gO.js} +2 -2
  92. package/dist/{i18n-controller-CH4e9sju.js.map → i18n-controller-DLJcJ5gO.js.map} +1 -1
  93. package/dist/image.js +2 -2
  94. package/dist/index.js +26 -16
  95. package/dist/index.js.map +1 -1
  96. package/dist/inline-edit.js +2 -2
  97. package/dist/input.js +3 -3
  98. package/dist/json-viewer.js +2 -2
  99. package/dist/kanban.js +2 -2
  100. package/dist/kbd.js +2 -2
  101. package/dist/linear-progress.js +3 -3
  102. package/dist/listbox.js +2 -2
  103. package/dist/loader-full.js +19 -9
  104. package/dist/loader-full.js.map +1 -1
  105. package/dist/loader.js +46 -9
  106. package/dist/loader.js.map +1 -1
  107. package/dist/markdown-editor.js +4 -4
  108. package/dist/mention-input.js +4 -4
  109. package/dist/modal.js +2 -2
  110. package/dist/navigation-bar.js +2 -2
  111. package/dist/navigation-drawer.js +2 -2
  112. package/dist/navigation-rail.js +2 -2
  113. package/dist/notification-center.js +2 -2
  114. package/dist/number-field.js +4 -4
  115. package/dist/page-header.js +2 -2
  116. package/dist/pagination.js +2 -2
  117. package/dist/password-field.js +4 -4
  118. package/dist/password-rules.js +2 -2
  119. package/dist/phone-field.js +4 -4
  120. package/dist/{picker-field-loXW-xrW.js → picker-field-B5xOFc3-.js} +3 -3
  121. package/dist/{picker-field-loXW-xrW.js.map → picker-field-B5xOFc3-.js.map} +1 -1
  122. package/dist/pin-input.js +4 -4
  123. package/dist/presence-indicator.js +2 -2
  124. package/dist/prompt-input.js +4 -4
  125. package/dist/radio.js +3 -3
  126. package/dist/rating.js +3 -3
  127. package/dist/redvars-loader.js +2 -2
  128. package/dist/relative-time.js +2 -2
  129. package/dist/resizable-panels.js +2 -2
  130. package/dist/{rich-text-input-B5j0eqCJ.js → rich-text-input-C4B9D6oD.js} +3 -3
  131. package/dist/{rich-text-input-B5j0eqCJ.js.map → rich-text-input-C4B9D6oD.js.map} +1 -1
  132. package/dist/{schema-BJzlGRP1.js → schema-CPhNrjrx.js} +2 -2
  133. package/dist/{schema-BJzlGRP1.js.map → schema-CPhNrjrx.js.map} +1 -1
  134. package/dist/search.js +3 -3
  135. package/dist/select.js +4 -4
  136. package/dist/side-sheet.js +2 -2
  137. package/dist/signature-pad.js +3 -3
  138. package/dist/site-footer-group.js +142 -0
  139. package/dist/site-footer-group.js.map +1 -0
  140. package/dist/site-footer.js +338 -0
  141. package/dist/site-footer.js.map +1 -0
  142. package/dist/site-header.js +774 -0
  143. package/dist/site-header.js.map +1 -0
  144. package/dist/site-nav-group.js +123 -0
  145. package/dist/site-nav-group.js.map +1 -0
  146. package/dist/site-nav-link.js +321 -0
  147. package/dist/site-nav-link.js.map +1 -0
  148. package/dist/site-nav-menu.js +506 -0
  149. package/dist/site-nav-menu.js.map +1 -0
  150. package/dist/site-nav-shared-BDR2HG8e.js +23 -0
  151. package/dist/site-nav-shared-BDR2HG8e.js.map +1 -0
  152. package/dist/slider.js +3 -3
  153. package/dist/snackbar.js +2 -2
  154. package/dist/sparkline.js +2 -2
  155. package/dist/split-button.js +2 -2
  156. package/dist/src/__internal/i18n/strings.d.ts +24 -0
  157. package/dist/src/carousel/carousel.d.ts +135 -0
  158. package/dist/src/carousel/index.d.ts +1 -0
  159. package/dist/src/highlight/highlight.d.ts +56 -0
  160. package/dist/src/highlight/index.d.ts +2 -0
  161. package/dist/src/highlight/matches.d.ts +9 -0
  162. package/dist/src/index.d.ts +9 -0
  163. package/dist/src/site-footer/index.d.ts +2 -0
  164. package/dist/src/site-footer/site-footer-group.d.ts +34 -0
  165. package/dist/src/site-footer/site-footer.d.ts +74 -0
  166. package/dist/src/site-header/index.d.ts +4 -0
  167. package/dist/src/site-header/site-header.d.ts +170 -0
  168. package/dist/src/site-header/site-nav-group.d.ts +32 -0
  169. package/dist/src/site-header/site-nav-link.d.ts +65 -0
  170. package/dist/src/site-header/site-nav-menu.d.ts +104 -0
  171. package/dist/src/site-header/site-nav-shared.d.ts +13 -0
  172. package/dist/src/video/index.d.ts +2 -0
  173. package/dist/src/video/video-source.d.ts +12 -0
  174. package/dist/src/video/video.d.ts +80 -0
  175. package/dist/stat.js +2 -2
  176. package/dist/status-indicator.js +2 -2
  177. package/dist/step.js +2 -2
  178. package/dist/stepper.js +2 -2
  179. package/dist/{strings-o6v6Hrmn.js → strings-MXyrGrNs.js} +28 -1
  180. package/dist/strings-MXyrGrNs.js.map +1 -0
  181. package/dist/svg.js +2 -2
  182. package/dist/switch.js +3 -3
  183. package/dist/table.js +2 -2
  184. package/dist/test/carousel.test.d.ts +1 -0
  185. package/dist/test/highlight.test.d.ts +1 -0
  186. package/dist/test/site-footer.test.d.ts +1 -0
  187. package/dist/test/site-header.test.d.ts +1 -0
  188. package/dist/test/video.test.d.ts +1 -0
  189. package/dist/textarea.js +4 -4
  190. package/dist/time-field.js +5 -5
  191. package/dist/time-picker.js +2 -2
  192. package/dist/timeline-item.js +2 -2
  193. package/dist/timeline.js +2 -2
  194. package/dist/{toggle-base-BSzBnLZN.js → toggle-base-I1wE_fVe.js} +2 -2
  195. package/dist/{toggle-base-BSzBnLZN.js.map → toggle-base-I1wE_fVe.js.map} +1 -1
  196. package/dist/tour.js +2 -2
  197. package/dist/transfer-list.js +3 -3
  198. package/dist/tree-chart.js +3 -3
  199. package/dist/tree-item.js +2 -2
  200. package/dist/tree.js +2 -2
  201. package/dist/tsconfig.tsbuildinfo +1 -1
  202. package/dist/typing-indicator.js +2 -2
  203. package/dist/url-field.js +4 -4
  204. package/dist/user-menu.js +2 -2
  205. package/dist/video-IwNmHyft.js +509 -0
  206. package/dist/video-IwNmHyft.js.map +1 -0
  207. package/dist/video.js +12 -0
  208. package/dist/video.js.map +1 -0
  209. package/dist/virtual-list.js +2 -2
  210. package/dist/workflow-timeline.js +2 -2
  211. package/dist/workflow.js +3 -3
  212. package/dist/workspace-switcher.js +2 -2
  213. package/package.json +1 -1
  214. package/readme.md +5 -0
  215. package/src/__internal/i18n/strings.ts +31 -0
  216. package/src/carousel/carousel.scss +124 -0
  217. package/src/carousel/carousel.ts +547 -0
  218. package/src/carousel/index.ts +1 -0
  219. package/src/highlight/highlight.scss +25 -0
  220. package/src/highlight/highlight.ts +123 -0
  221. package/src/highlight/index.ts +2 -0
  222. package/src/highlight/matches.ts +94 -0
  223. package/src/index.ts +18 -0
  224. package/src/loader.ts +36 -0
  225. package/src/site-footer/index.ts +2 -0
  226. package/src/site-footer/site-footer-group.scss +53 -0
  227. package/src/site-footer/site-footer-group.ts +52 -0
  228. package/src/site-footer/site-footer.scss +171 -0
  229. package/src/site-footer/site-footer.ts +151 -0
  230. package/src/site-header/index.ts +8 -0
  231. package/src/site-header/site-header.scss +238 -0
  232. package/src/site-header/site-header.ts +565 -0
  233. package/src/site-header/site-nav-group.scss +29 -0
  234. package/src/site-header/site-nav-group.ts +57 -0
  235. package/src/site-header/site-nav-link.scss +154 -0
  236. package/src/site-header/site-nav-link.ts +140 -0
  237. package/src/site-header/site-nav-menu.scss +182 -0
  238. package/src/site-header/site-nav-menu.ts +336 -0
  239. package/src/site-header/site-nav-shared.ts +27 -0
  240. package/src/video/index.ts +2 -0
  241. package/src/video/video-source.ts +80 -0
  242. package/src/video/video.scss +183 -0
  243. package/src/video/video.ts +246 -0
  244. package/dist/strings-o6v6Hrmn.js.map +0 -1
@@ -0,0 +1,774 @@
1
+ import { i, _ as __decorate, I as IndividualComponent, a as i$1, A, b } from './IndividualComponent-BK7XZjE2.js';
2
+ import { n } from './property-B2TG3KEE.js';
3
+ import { r } from './state-BCeDVCI9.js';
4
+ import { e } from './query-CHb9Ft_d.js';
5
+ import { e as e$1 } from './class-map-NDIkZErE.js';
6
+ import { I as I18nController } from './i18n-controller-DLJcJ5gO.js';
7
+ import { O as OverlayController } from './overlay-controller-BOk-kfil.js';
8
+ import { SiteNavMenu } from './site-nav-menu.js';
9
+ import { SiteNavGroup } from './site-nav-group.js';
10
+ import { SiteNavLink } from './site-nav-link.js';
11
+ import { s as syncCollapsed, N as NAV_PARTS } from './site-nav-shared-BDR2HG8e.js';
12
+ import './base-Cl6v8-BZ.js';
13
+ import './directive-ZPhl09Yt.js';
14
+ import './strings-MXyrGrNs.js';
15
+ import './locale-DEsJZCQG.js';
16
+ import './if-defined-D9DEJR_6.js';
17
+
18
+ var css_248z = i`* {
19
+ box-sizing: border-box;
20
+ -webkit-tap-highlight-color: transparent;
21
+ }
22
+
23
+ .screen-reader-only {
24
+ position: absolute !important;
25
+ inline-size: 1px !important;
26
+ block-size: 1px !important;
27
+ padding: 0 !important;
28
+ margin: -1px !important;
29
+ overflow: hidden !important;
30
+ clip-path: inset(50%) !important;
31
+ white-space: nowrap !important;
32
+ border: 0 !important;
33
+ }
34
+
35
+ [hidden] {
36
+ display: none !important;
37
+ }
38
+
39
+ @media (forced-colors: active) {
40
+ .selected,
41
+ [aria-selected=true],
42
+ [aria-pressed=true],
43
+ [aria-checked=true],
44
+ [aria-current]:not([aria-current=false]) {
45
+ outline: 2px solid Highlight;
46
+ outline-offset: -2px;
47
+ }
48
+ .disabled,
49
+ [aria-disabled=true] {
50
+ color: GrayText;
51
+ }
52
+ }
53
+ :host {
54
+ display: block;
55
+ position: relative;
56
+ z-index: var(--site-header-z-index, 10);
57
+ color: var(--color-on-surface);
58
+ --_height: var(--site-header-height, 4rem);
59
+ --_background: var(--site-header-background, var(--color-surface));
60
+ }
61
+
62
+ :host([sticky]) {
63
+ position: sticky;
64
+ inset-block-start: 0;
65
+ transition: transform var(--duration-medium2, 300ms) var(--easing-standard, ease);
66
+ }
67
+
68
+ :host([data-scrolled-away]) {
69
+ transform: translateY(-100%);
70
+ }
71
+
72
+ .skip-link {
73
+ font-family: var(--typography-label-large-font-family) !important;
74
+ font-size: var(--typography-label-large-font-size) !important;
75
+ font-weight: var(--typography-label-large-font-weight) !important;
76
+ line-height: var(--typography-label-large-line-height) !important;
77
+ letter-spacing: var(--typography-label-large-letter-spacing) !important;
78
+ position: absolute;
79
+ inset-block-start: var(--spacing-100);
80
+ inset-inline-start: var(--spacing-100);
81
+ z-index: 2;
82
+ padding: var(--spacing-100) var(--spacing-200);
83
+ border-radius: var(--shape-corner-full);
84
+ background-color: var(--color-inverse-surface);
85
+ color: var(--color-inverse-on-surface);
86
+ text-decoration: none;
87
+ }
88
+ .skip-link:not(:focus) {
89
+ clip-path: inset(50%);
90
+ inline-size: 1px;
91
+ block-size: 1px;
92
+ overflow: hidden;
93
+ white-space: nowrap;
94
+ padding: 0;
95
+ }
96
+ .skip-link:focus-visible {
97
+ outline: 2px solid var(--color-primary);
98
+ outline-offset: 2px;
99
+ }
100
+
101
+ .bar {
102
+ background-color: var(--_background);
103
+ border-block-end: 1px solid var(--color-outline-variant);
104
+ }
105
+
106
+ :host([sticky]) .bar {
107
+ box-shadow: var(--elevation-level1);
108
+ }
109
+
110
+ .inner {
111
+ position: relative;
112
+ display: flex;
113
+ align-items: center;
114
+ gap: var(--spacing-300);
115
+ max-inline-size: var(--site-header-max-width, none);
116
+ block-size: var(--_height);
117
+ margin-inline: auto;
118
+ padding-inline: var(--spacing-400);
119
+ box-sizing: content-box;
120
+ }
121
+
122
+ .compact .inner {
123
+ gap: var(--spacing-100);
124
+ padding-inline: var(--spacing-200);
125
+ }
126
+
127
+ .brand {
128
+ display: flex;
129
+ flex: none;
130
+ align-items: center;
131
+ min-inline-size: 0;
132
+ }
133
+ .brand ::slotted(a) {
134
+ font-family: var(--typography-title-medium-font-family);
135
+ font-size: var(--typography-title-medium-font-size);
136
+ font-weight: var(--typography-title-medium-font-weight);
137
+ line-height: var(--typography-title-medium-line-height);
138
+ letter-spacing: var(--typography-title-medium-letter-spacing);
139
+ display: inline-flex;
140
+ align-items: center;
141
+ gap: var(--spacing-100);
142
+ color: inherit;
143
+ font-weight: var(--font-weight-bold);
144
+ text-decoration: none;
145
+ border-radius: var(--shape-corner-small);
146
+ }
147
+ .brand ::slotted(a:focus-visible) {
148
+ outline: 2px solid var(--color-primary);
149
+ outline-offset: 2px;
150
+ }
151
+
152
+ .nav {
153
+ display: flex;
154
+ flex: none;
155
+ align-items: center;
156
+ gap: var(--spacing-050);
157
+ }
158
+
159
+ .spacer {
160
+ flex: 1;
161
+ }
162
+
163
+ .actions,
164
+ .end {
165
+ display: flex;
166
+ flex: none;
167
+ align-items: center;
168
+ gap: var(--spacing-100);
169
+ }
170
+ .actions[hidden],
171
+ .end[hidden] {
172
+ display: none;
173
+ }
174
+
175
+ .drawer {
176
+ position: fixed;
177
+ inset-block: 0;
178
+ inset-inline-start: 0;
179
+ inset-inline-end: auto;
180
+ display: none;
181
+ flex-direction: column;
182
+ inline-size: min(var(--site-header-drawer-width, 22.5rem), 100vw - 3.5rem);
183
+ max-inline-size: none;
184
+ block-size: 100dvh;
185
+ max-block-size: none;
186
+ margin: 0;
187
+ padding: 0;
188
+ border: none;
189
+ border-start-end-radius: var(--shape-corner-large);
190
+ border-end-end-radius: var(--shape-corner-large);
191
+ background-color: var(--color-surface-container-low);
192
+ color: var(--color-on-surface-variant);
193
+ box-shadow: var(--elevation-level1);
194
+ overflow-y: auto;
195
+ }
196
+ .drawer[open] {
197
+ display: flex;
198
+ animation: site-header-slide-in var(--duration-medium2, 300ms) var(--easing-emphasized-decelerate, ease-out);
199
+ }
200
+ .drawer:dir(rtl)[open] {
201
+ animation-name: site-header-slide-in-rtl;
202
+ }
203
+ .drawer::backdrop {
204
+ background: color-mix(in srgb, var(--color-scrim, black) 32%, transparent);
205
+ }
206
+
207
+ .drawer-header {
208
+ display: flex;
209
+ justify-content: flex-end;
210
+ padding: var(--spacing-100);
211
+ }
212
+
213
+ .drawer-nav {
214
+ display: flex;
215
+ flex-direction: column;
216
+ gap: var(--spacing-025);
217
+ padding-inline: var(--spacing-150);
218
+ }
219
+
220
+ .drawer-actions {
221
+ display: flex;
222
+ flex-direction: column;
223
+ gap: var(--spacing-100);
224
+ margin-block-start: auto;
225
+ padding: var(--spacing-200) var(--spacing-300) var(--spacing-300);
226
+ border-block-start: 1px solid var(--color-outline-variant);
227
+ }
228
+ .drawer-actions[hidden] {
229
+ display: none;
230
+ }
231
+ .drawer-actions ::slotted(*) {
232
+ inline-size: 100%;
233
+ }
234
+
235
+ @keyframes site-header-slide-in {
236
+ from {
237
+ transform: translateX(-100%);
238
+ }
239
+ }
240
+ @keyframes site-header-slide-in-rtl {
241
+ from {
242
+ transform: translateX(100%);
243
+ }
244
+ }
245
+ @media (prefers-reduced-motion: reduce) {
246
+ :host([sticky]) {
247
+ transition: none;
248
+ }
249
+ .drawer[open] {
250
+ animation: none;
251
+ }
252
+ }
253
+ @media (forced-colors: active) {
254
+ .bar {
255
+ border-block-end-color: CanvasText;
256
+ }
257
+ .drawer {
258
+ border-inline-end: 1px solid CanvasText;
259
+ }
260
+ .skip-link:focus {
261
+ outline: 2px solid Highlight;
262
+ }
263
+ }`;
264
+
265
+ /**
266
+ * @label Site Header
267
+ * @tag wc-site-header
268
+ * @rawTag site-header
269
+ *
270
+ * @summary The top navigation bar of a website or portal: brand, links, menus and actions.
271
+ * @overview
272
+ * <p>Site header is the banner of a site: the brand at the start, the site's navigation, and actions
273
+ * such as Sign in or a call to action at the end. It is for websites and portals. For an
274
+ * application's own chrome use <code>wc-app-bar</code>, and for a bar at the bottom of a phone
275
+ * screen <code>wc-navigation-bar</code>.</p>
276
+ * <p>Put <code>wc-site-nav-link</code> elements in it for destinations and
277
+ * <code>wc-site-nav-menu</code> elements for sections with several pages. A menu is a disclosure
278
+ * button that opens a panel of links, as a list or, with <code>layout="columns"</code>, as columns
279
+ * of <code>wc-site-nav-group</code> with a featured card. These are links and disclosure buttons,
280
+ * not an ARIA menu, so Tab moves through them as through any links.</p>
281
+ * <p>When the header is narrower than <code>collapse-at</code> (720px by default), or too narrow
282
+ * for the bar's content to fit, the links and
283
+ * menus move into a drawer that slides in from the start edge, opened by a menu button. The
284
+ * <code>actions</code> slot moves to the bottom of the drawer; the <code>end</code> slot stays in
285
+ * the bar, for something that must always show, such as a user menu or one short button.</p>
286
+ * <p>A visually hidden <em>Skip to main content</em> link is the first focusable element. It moves
287
+ * focus to <code>skip-target</code> (<code>#main</code> by default).</p>
288
+ *
289
+ * @slot brand - The site's logo and name, usually a link to the home page.
290
+ * @slot - The navigation: `wc-site-nav-link` and `wc-site-nav-menu` elements.
291
+ * @slot actions - Buttons at the end of the bar, such as Sign in and a call to action. They move to the bottom of the drawer when the header is collapsed.
292
+ * @slot end - Content that always stays in the bar, such as a `wc-user-menu`, a search button or one short call to action.
293
+ *
294
+ * @fires {CustomEvent} open - Dispatched when the navigation drawer opens on a narrow header.
295
+ * @fires {CustomEvent<{reason: 'escape' | 'light-dismiss' | 'action' | 'api'}>} close - Dispatched when the navigation drawer closes: Escape, a click on the scrim, choosing a link, or `hideDrawer()` (and widening the header past `collapse-at`).
296
+ *
297
+ * @csspart bar - The `<header>` bar.
298
+ * @csspart nav - The navigation landmark in the bar.
299
+ * @csspart skip-link - The skip link.
300
+ * @csspart menu-button - The button that opens the drawer.
301
+ * @csspart drawer - The drawer `<dialog>` on a narrow header.
302
+ *
303
+ * @cssprop --site-header-height - Height of the bar. Defaults to 4rem.
304
+ * @cssprop --site-header-background - Background of the bar. Defaults to `--color-surface`.
305
+ * @cssprop --site-header-max-width - Width the bar's content is centred in, for a full-bleed background with a narrower content column. Defaults to `none`.
306
+ * @cssprop --site-header-z-index - Stacking order of the header and its panels. Defaults to 10.
307
+ * @cssprop --site-header-drawer-width - Width of the drawer. Defaults to 22.5rem.
308
+ *
309
+ * @example
310
+ * ```html
311
+ * <wc-site-header>
312
+ * <a slot="brand" href="/">Redvars</a>
313
+ * <wc-site-nav-menu label="Solutions">
314
+ * <wc-site-nav-link href="/itsm">IT service management</wc-site-nav-link>
315
+ * <wc-site-nav-link href="/support">Customer support</wc-site-nav-link>
316
+ * </wc-site-nav-menu>
317
+ * <wc-site-nav-link href="/docs" current>Docs</wc-site-nav-link>
318
+ * <wc-site-nav-link href="/pricing">Pricing</wc-site-nav-link>
319
+ * <wc-link-button slot="actions" variant="text" href="/sign-in">Sign in</wc-link-button>
320
+ * <wc-link-button slot="actions" href="/waitlist">Join the waitlist</wc-link-button>
321
+ * </wc-site-header>
322
+ * ```
323
+ * @example
324
+ * ```html
325
+ * <wc-site-header sticky hide-on-scroll>
326
+ * <a slot="brand" href="/p/support">Acme Support</a>
327
+ * <wc-site-nav-link href="/p/support" current>Home</wc-site-nav-link>
328
+ * <wc-site-nav-link href="/p/support/tickets">My tickets</wc-site-nav-link>
329
+ * <wc-user-menu slot="end" name="Ada Lovelace"></wc-user-menu>
330
+ * </wc-site-header>
331
+ * ```
332
+ * @tags navigation layout
333
+ */
334
+ let SiteHeader = class SiteHeader extends i$1 {
335
+ constructor() {
336
+ // ── Static ───────────────────────────────────────────────────────────────
337
+ super(...arguments);
338
+ // ── Properties ───────────────────────────────────────────────────────────
339
+ /** Accessible name of the navigation landmark. Defaults to Peacock's "Main navigation". */
340
+ this.label = '';
341
+ /** Header width in pixels below which the navigation moves into a drawer. The header also collapses whenever the bar's content does not fit. */
342
+ this.collapseAt = 720;
343
+ /** Keeps the header at the top of the viewport while the page scrolls. */
344
+ this.sticky = false;
345
+ /** With `sticky`, slides the header away while scrolling down and back while scrolling up. */
346
+ this.hideOnScroll = false;
347
+ /** Selector of the element the skip link moves focus to. */
348
+ this.skipTarget = '#main';
349
+ /** Opens a menu's panel when a mouse rests on it, as well as on click. */
350
+ this.openOnHover = false;
351
+ /** Whether the navigation drawer is open. Only has an effect while the header is collapsed. */
352
+ this.drawerOpen = false;
353
+ // ── State ────────────────────────────────────────────────────────────────
354
+ /** Whether the header is narrower than `collapse-at`. */
355
+ this.compact = false;
356
+ /** Whether the header has slid away while scrolling down. */
357
+ this.scrolledAway = false;
358
+ /** Which slots have content. */
359
+ this.filled = { nav: false, actions: false, end: false };
360
+ // ── Private fields ───────────────────────────────────────────────────────
361
+ /** Peacock's strings for the skip link, the menu button and the landmark. */
362
+ this.i18n = new I18nController(this);
363
+ this.overlay = new OverlayController(this, {
364
+ surface: () => this.dialogElement,
365
+ modal: true,
366
+ initialFocus: () => {
367
+ const links = Array.from(this.querySelectorAll('wc-site-nav-link')).filter(link => !link.closest('wc-site-nav-menu:not([open])'));
368
+ return (links.find(link => link.current) ??
369
+ this.querySelector(':scope > wc-site-nav-link, :scope > wc-site-nav-menu'));
370
+ },
371
+ requestClose: reason => this.closeDrawer(reason),
372
+ });
373
+ /** Watches the children, since a slot that is not rendered fires no `slotchange`. */
374
+ this.childObserver = new MutationObserver(() => {
375
+ this.syncSlots();
376
+ syncCollapsed(this, this.compact);
377
+ });
378
+ /** The last measured width of the header. */
379
+ this.width = 0;
380
+ /** The header width the bar's content needs, measured while it was last shown wide. */
381
+ this.neededWidth = 0;
382
+ /** Scroll position at the last scroll event, to tell the direction. */
383
+ this.lastScrollY = 0;
384
+ /** Why the drawer is closing, for the next `close` event. */
385
+ this.closeReason = 'api';
386
+ /** Reads which slots have content from the light DOM, so it does not depend on what is rendered. */
387
+ this.syncSlots = () => {
388
+ const children = Array.from(this.children);
389
+ const filled = {
390
+ nav: children.some(child => !child.hasAttribute('slot')),
391
+ actions: children.some(child => child.getAttribute('slot') === 'actions'),
392
+ end: children.some(child => child.getAttribute('slot') === 'end'),
393
+ };
394
+ if (filled.nav !== this.filled.nav ||
395
+ filled.actions !== this.filled.actions ||
396
+ filled.end !== this.filled.end) {
397
+ this.filled = filled;
398
+ }
399
+ };
400
+ this.handleScroll = () => {
401
+ const y = window.scrollY;
402
+ const delta = y - this.lastScrollY;
403
+ this.lastScrollY = y;
404
+ if (!this.sticky || !this.hideOnScroll || this.drawerShown)
405
+ return;
406
+ if (delta < 0 || y <= this.offsetHeight) {
407
+ this.scrolledAway = false;
408
+ return;
409
+ }
410
+ // Never slide away from under focus or an open panel.
411
+ const busy = this.matches(':focus-within') ||
412
+ !!this.querySelector(`${NAV_PARTS.menu}[open]`);
413
+ if (delta > 0 && !busy)
414
+ this.scrolledAway = true;
415
+ };
416
+ }
417
+ // ── Lifecycle ────────────────────────────────────────────────────────────
418
+ connectedCallback() {
419
+ super.connectedCallback();
420
+ this.syncSlots();
421
+ this.childObserver.observe(this, {
422
+ childList: true,
423
+ attributes: true,
424
+ attributeFilter: ['slot'],
425
+ });
426
+ if (typeof ResizeObserver !== 'undefined') {
427
+ this.resizeObserver = new ResizeObserver(entries => {
428
+ const entry = entries[entries.length - 1];
429
+ if (!entry)
430
+ return;
431
+ this.width = entry.contentRect.width;
432
+ if (!this.compact)
433
+ this.measureFit();
434
+ this.syncCompact();
435
+ });
436
+ this.resizeObserver.observe(this);
437
+ // On the next task: measuring here could resize what is observed in the same frame.
438
+ this.contentObserver = new ResizeObserver(() => {
439
+ clearTimeout(this.fitTimer);
440
+ this.fitTimer = setTimeout(() => {
441
+ if (!this.isConnected || this.compact)
442
+ return;
443
+ this.measureFit();
444
+ this.syncCompact();
445
+ });
446
+ });
447
+ }
448
+ window.addEventListener('scroll', this.handleScroll, { passive: true });
449
+ }
450
+ disconnectedCallback() {
451
+ this.resizeObserver?.disconnect();
452
+ this.resizeObserver = undefined;
453
+ this.contentObserver?.disconnect();
454
+ this.contentObserver = undefined;
455
+ clearTimeout(this.fitTimer);
456
+ this.childObserver.disconnect();
457
+ window.removeEventListener('scroll', this.handleScroll);
458
+ super.disconnectedCallback();
459
+ }
460
+ willUpdate(changed) {
461
+ // Measure now on the first render, so a narrow screen never flashes the wide bar.
462
+ if (!this.hasUpdated || changed.has('collapseAt')) {
463
+ this.width = this.getBoundingClientRect().width;
464
+ this.syncCompact();
465
+ }
466
+ // Widening past `collapse-at` closes the drawer; the bar shows the links instead.
467
+ if (changed.has('compact') &&
468
+ changed.get('compact') === true &&
469
+ !this.compact &&
470
+ this.drawerOpen) {
471
+ this.closeReason = 'api';
472
+ this.drawerOpen = false;
473
+ }
474
+ if (!this.hideOnScroll || !this.sticky)
475
+ this.scrolledAway = false;
476
+ }
477
+ updated(changed) {
478
+ if (changed.has('compact')) {
479
+ syncCollapsed(this, this.compact);
480
+ this.close();
481
+ }
482
+ if (!this.compact) {
483
+ this.renderRoot
484
+ .querySelectorAll('.brand, .nav, .actions, .end')
485
+ .forEach(part => this.contentObserver?.observe(part));
486
+ this.measureFit();
487
+ this.syncCompact();
488
+ }
489
+ this.toggleAttribute('data-scrolled-away', this.scrolledAway);
490
+ if (changed.has('drawerOpen') || changed.has('compact')) {
491
+ this.overlay.sync(this.drawerShown);
492
+ }
493
+ const shown = this.drawerShown;
494
+ if (this.announcedOpen === undefined) {
495
+ // `drawer-open` set in markup is not a user action.
496
+ this.announcedOpen = shown;
497
+ return;
498
+ }
499
+ if (shown === this.announcedOpen)
500
+ return;
501
+ this.announcedOpen = shown;
502
+ if (shown) {
503
+ this.dispatchEvent(new CustomEvent('open', { bubbles: true, composed: true }));
504
+ }
505
+ else {
506
+ this.dispatchEvent(new CustomEvent('close', {
507
+ detail: { reason: this.closeReason },
508
+ bubbles: true,
509
+ composed: true,
510
+ }));
511
+ }
512
+ this.closeReason = 'api';
513
+ }
514
+ // ── Public methods ───────────────────────────────────────────────────────
515
+ /** Whether the header is narrower than `collapse-at`, with its navigation in the drawer. */
516
+ get collapsed() {
517
+ return this.compact;
518
+ }
519
+ /** Opens the navigation drawer (while collapsed). */
520
+ showDrawer() {
521
+ this.drawerOpen = true;
522
+ }
523
+ /** Closes the navigation drawer. */
524
+ hideDrawer() {
525
+ this.closeDrawer('api');
526
+ }
527
+ /** Closes every open menu panel in the bar. */
528
+ close() {
529
+ if (this.compact)
530
+ return;
531
+ for (const menu of this.querySelectorAll(NAV_PARTS.menu)) {
532
+ menu.open = false;
533
+ }
534
+ }
535
+ // ── Private methods ──────────────────────────────────────────────────────
536
+ /** Whether the drawer is showing right now. */
537
+ get drawerShown() {
538
+ return this.compact && this.drawerOpen;
539
+ }
540
+ closeDrawer(reason) {
541
+ if (!this.drawerOpen)
542
+ return;
543
+ this.closeReason = reason;
544
+ this.drawerOpen = false;
545
+ }
546
+ syncCompact() {
547
+ if (this.width <= 0)
548
+ return;
549
+ this.compact = this.width < Math.max(this.collapseAt, this.neededWidth);
550
+ }
551
+ /**
552
+ * Measures the width the wide bar's content needs: the brand, links, actions and end at their
553
+ * natural widths, with the gaps and padding. The header collapses below it, as below
554
+ * `collapse-at`, so links never run into the actions.
555
+ */
556
+ measureFit() {
557
+ const inner = this.renderRoot.querySelector('.inner');
558
+ if (!inner || !inner.clientWidth)
559
+ return;
560
+ const style = getComputedStyle(inner);
561
+ const gap = parseFloat(style.columnGap) || 0;
562
+ const padding = (parseFloat(style.paddingInlineStart) || 0) +
563
+ (parseFloat(style.paddingInlineEnd) || 0);
564
+ const parts = Array.from(inner.children).filter((part) => part instanceof HTMLElement &&
565
+ !part.hidden &&
566
+ getComputedStyle(part).display !== 'none');
567
+ const content = parts.reduce((sum, part) => part.classList.contains('spacer')
568
+ ? sum
569
+ : sum + part.getBoundingClientRect().width, 0);
570
+ const needed = content + gap * Math.max(0, parts.length - 1) + padding;
571
+ // In header widths, since a max-width can make the bar narrower than the header.
572
+ this.neededWidth = Math.ceil(needed + (this.width - inner.clientWidth));
573
+ }
574
+ /**
575
+ * Fragment links do not reach elements inside shadow roots, so move focus directly. The target is
576
+ * looked for beside the header first, for a header in an app's own shadow root, then in the page.
577
+ */
578
+ handleSkipClick(event) {
579
+ let target = null;
580
+ try {
581
+ const root = this.getRootNode();
582
+ target =
583
+ root.querySelector(this.skipTarget) ??
584
+ document.querySelector(this.skipTarget);
585
+ }
586
+ catch {
587
+ target = null;
588
+ }
589
+ if (!target)
590
+ return;
591
+ event.preventDefault();
592
+ if (target.tabIndex < 0 && !target.hasAttribute('tabindex')) {
593
+ target.setAttribute('tabindex', '-1');
594
+ }
595
+ target.focus();
596
+ }
597
+ handleMenuButtonClick() {
598
+ if (this.drawerOpen)
599
+ this.hideDrawer();
600
+ else
601
+ this.showDrawer();
602
+ }
603
+ handleCloseButtonClick() {
604
+ this.closeDrawer('action');
605
+ }
606
+ /** Choosing a link in the drawer closes it. */
607
+ handleDrawerLinkClick(event) {
608
+ const link = event
609
+ .composedPath()
610
+ .find(target => target instanceof Element && target.matches(NAV_PARTS.link));
611
+ if (link)
612
+ this.closeDrawer('action');
613
+ }
614
+ /** The native Escape `cancel`: keep `drawer-open` in charge. */
615
+ handleCancel(event) {
616
+ event.preventDefault();
617
+ this.closeDrawer('escape');
618
+ }
619
+ /** The browser closed the dialog on its own: keep `drawer-open` in step. */
620
+ handleNativeClose(event) {
621
+ if (event.target !== this.dialogElement)
622
+ return;
623
+ if (this.overlay.takeOwnClose())
624
+ return;
625
+ this.closeDrawer('escape');
626
+ }
627
+ /** A click outside the drawer's box lands on its backdrop: a light dismiss. */
628
+ handleDialogClick(event) {
629
+ const dialog = this.dialogElement;
630
+ if (!dialog)
631
+ return;
632
+ if (event.target !== dialog) {
633
+ this.handleDrawerLinkClick(event);
634
+ return;
635
+ }
636
+ const rect = dialog.getBoundingClientRect();
637
+ const inside = event.clientX >= rect.left &&
638
+ event.clientX <= rect.right &&
639
+ event.clientY >= rect.top &&
640
+ event.clientY <= rect.bottom;
641
+ if (!inside)
642
+ this.closeDrawer('light-dismiss');
643
+ }
644
+ // ── Render helpers ───────────────────────────────────────────────────────
645
+ renderMenuButton() {
646
+ if (!this.compact || !this.filled.nav)
647
+ return A;
648
+ return b `<wc-icon-button
649
+ class="menu-button"
650
+ part="menu-button"
651
+ variant="text"
652
+ shape="round"
653
+ aria-label=${this.i18n.t('openMenu')}
654
+ aria-expanded=${String(this.drawerOpen)}
655
+ aria-controls="drawer"
656
+ @click=${this.handleMenuButtonClick}
657
+ >
658
+ <wc-icon name="menu"></wc-icon>
659
+ </wc-icon-button>`;
660
+ }
661
+ renderDrawer() {
662
+ if (!this.compact)
663
+ return A;
664
+ const label = this.label || this.i18n.t('mainNavigation');
665
+ // The scrim click has its keyboard equivalent in Escape, which the overlay controller handles.
666
+ /* eslint-disable lit-a11y/click-events-have-key-events */
667
+ return b `<dialog
668
+ id="drawer"
669
+ class="drawer"
670
+ part="drawer"
671
+ aria-label=${label}
672
+ @cancel=${this.handleCancel}
673
+ @close=${this.handleNativeClose}
674
+ @click=${this.handleDialogClick}
675
+ >
676
+ <div class="drawer-header">
677
+ <wc-icon-button
678
+ class="close-button"
679
+ variant="text"
680
+ shape="round"
681
+ aria-label=${this.i18n.t('close')}
682
+ @click=${this.handleCloseButtonClick}
683
+ >
684
+ <wc-icon name="close"></wc-icon>
685
+ </wc-icon-button>
686
+ </div>
687
+ <nav class="drawer-nav" aria-label=${label}>
688
+ <slot @slotchange=${this.syncSlots}></slot>
689
+ </nav>
690
+ <div class="drawer-actions" ?hidden=${!this.filled.actions}>
691
+ <slot name="actions" @slotchange=${this.syncSlots}></slot>
692
+ </div>
693
+ </dialog>`;
694
+ /* eslint-enable lit-a11y/click-events-have-key-events */
695
+ }
696
+ // ── Render ───────────────────────────────────────────────────────────────
697
+ render() {
698
+ const label = this.label || this.i18n.t('mainNavigation');
699
+ return b `
700
+ <a
701
+ class="skip-link"
702
+ part="skip-link"
703
+ href=${this.skipTarget}
704
+ @click=${this.handleSkipClick}
705
+ >${this.i18n.t('skipToMainContent')}</a
706
+ >
707
+ <header
708
+ class=${e$1({ bar: true, compact: this.compact })}
709
+ part="bar"
710
+ >
711
+ <div class="inner">
712
+ <div class="brand"><slot name="brand"></slot></div>
713
+ ${this.compact
714
+ ? b `<span class="spacer"></span>`
715
+ : b `<nav class="nav" part="nav" aria-label=${label}>
716
+ <slot @slotchange=${this.syncSlots}></slot>
717
+ </nav>
718
+ <span class="spacer"></span>
719
+ <div class="actions" ?hidden=${!this.filled.actions}>
720
+ <slot name="actions" @slotchange=${this.syncSlots}></slot>
721
+ </div>`}
722
+ <div class="end" ?hidden=${!this.filled.end}>
723
+ <slot name="end" @slotchange=${this.syncSlots}></slot>
724
+ </div>
725
+ ${this.renderMenuButton()}
726
+ </div>
727
+ </header>
728
+ ${this.renderDrawer()}
729
+ `;
730
+ }
731
+ };
732
+ SiteHeader.styles = [css_248z];
733
+ SiteHeader.Menu = SiteNavMenu;
734
+ SiteHeader.Group = SiteNavGroup;
735
+ SiteHeader.Link = SiteNavLink;
736
+ __decorate([
737
+ n()
738
+ ], SiteHeader.prototype, "label", void 0);
739
+ __decorate([
740
+ n({ type: Number, attribute: 'collapse-at' })
741
+ ], SiteHeader.prototype, "collapseAt", void 0);
742
+ __decorate([
743
+ n({ type: Boolean, reflect: true })
744
+ ], SiteHeader.prototype, "sticky", void 0);
745
+ __decorate([
746
+ n({ type: Boolean, reflect: true, attribute: 'hide-on-scroll' })
747
+ ], SiteHeader.prototype, "hideOnScroll", void 0);
748
+ __decorate([
749
+ n({ attribute: 'skip-target' })
750
+ ], SiteHeader.prototype, "skipTarget", void 0);
751
+ __decorate([
752
+ n({ type: Boolean, reflect: true, attribute: 'open-on-hover' })
753
+ ], SiteHeader.prototype, "openOnHover", void 0);
754
+ __decorate([
755
+ n({ type: Boolean, reflect: true, attribute: 'drawer-open' })
756
+ ], SiteHeader.prototype, "drawerOpen", void 0);
757
+ __decorate([
758
+ r()
759
+ ], SiteHeader.prototype, "compact", void 0);
760
+ __decorate([
761
+ r()
762
+ ], SiteHeader.prototype, "scrolledAway", void 0);
763
+ __decorate([
764
+ r()
765
+ ], SiteHeader.prototype, "filled", void 0);
766
+ __decorate([
767
+ e('.drawer')
768
+ ], SiteHeader.prototype, "dialogElement", void 0);
769
+ SiteHeader = __decorate([
770
+ IndividualComponent
771
+ ], SiteHeader);
772
+
773
+ export { SiteHeader };
774
+ //# sourceMappingURL=site-header.js.map