@redvars/peacock 4.2.0 → 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 (256) hide show
  1. package/dist/{BaseField-_unSNU5x.js → BaseField-CHBcjVc2.js} +3 -3
  2. package/dist/{BaseField-_unSNU5x.js.map → BaseField-CHBcjVc2.js.map} +1 -1
  3. package/dist/{BaseInput-DtZH0fPJ.js → BaseInput-DZp2O8Gh.js} +2 -2
  4. package/dist/{BaseInput-DtZH0fPJ.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-D7Nmfh1s.js → base-progress-CKQ32Ruw.js} +2 -2
  16. package/dist/{base-progress-D7Nmfh1s.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-CWQ4rQ2s.js → canvas-base-BoKef3yr.js} +2 -2
  21. package/dist/{canvas-base-CWQ4rQ2s.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-CS5yRLfE.js → cartesian-chart-DqZxnoG1.js} +2 -2
  25. package/dist/{cartesian-chart-CS5yRLfE.js.map → cartesian-chart-DqZxnoG1.js.map} +1 -1
  26. package/dist/{cb-group-base-CO30uFQZ.js → cb-group-base-Bf7iOIGS.js} +2 -2
  27. package/dist/{cb-group-base-CO30uFQZ.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-C_XKVyhf.js → chart-base-ByCJM_9C.js} +2 -2
  33. package/dist/{chart-base-C_XKVyhf.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 +24 -12
  52. package/dist/comment-composer.js.map +1 -1
  53. package/dist/condition-builder.js +3 -3
  54. package/dist/confirm-dialog.js +2 -2
  55. package/dist/copy-button.js +2 -2
  56. package/dist/currency-field.js +4 -4
  57. package/dist/custom-elements-jsdocs.json +936 -56
  58. package/dist/custom-elements.json +3486 -554
  59. package/dist/date-field.js +5 -5
  60. package/dist/date-picker.js +2 -2
  61. package/dist/date-range-field.js +5 -5
  62. package/dist/datetime-field.js +5 -5
  63. package/dist/dependency-map.js +3 -3
  64. package/dist/description-item.js +2 -2
  65. package/dist/description-list.js +2 -2
  66. package/dist/{diagram-Va096vj9.js → diagram-Cnrj-4y3.js} +2 -2
  67. package/dist/{diagram-Va096vj9.js.map → diagram-Cnrj-4y3.js.map} +1 -1
  68. package/dist/diagram-controls.js +2 -2
  69. package/dist/diagram-minimap.js +2 -2
  70. package/dist/diagram.js +4 -4
  71. package/dist/diff-viewer.js +2 -2
  72. package/dist/discussion-activity.js +2 -2
  73. package/dist/discussion-comment.js +2 -2
  74. package/dist/discussion.js +4 -4
  75. package/dist/{document-editor-Dc8JeFVB.js → document-editor-C8ThjDQ7.js} +22 -10
  76. package/dist/{document-editor-Dc8JeFVB.js.map → document-editor-C8ThjDQ7.js.map} +1 -1
  77. package/dist/document-editor.js +3 -3
  78. package/dist/draft-card.js +2 -2
  79. package/dist/erd.js +3 -3
  80. package/dist/file-upload.js +3 -3
  81. package/dist/filter-bar.js +2 -2
  82. package/dist/flow.js +4 -4
  83. package/dist/form.js +2 -2
  84. package/dist/{generative-view-BKlcuujw.js → generative-view-CQ8-g1wY.js} +2 -2
  85. package/dist/{generative-view-BKlcuujw.js.map → generative-view-CQ8-g1wY.js.map} +1 -1
  86. package/dist/generative-view.js +3 -3
  87. package/dist/highlight-Be0wu7kh.js +252 -0
  88. package/dist/highlight-Be0wu7kh.js.map +1 -0
  89. package/dist/highlight.js +6 -0
  90. package/dist/highlight.js.map +1 -0
  91. package/dist/html-editor.js +29 -12
  92. package/dist/html-editor.js.map +1 -1
  93. package/dist/{i18n-controller-DJHsE1YH.js → i18n-controller-DLJcJ5gO.js} +2 -2
  94. package/dist/{i18n-controller-DJHsE1YH.js.map → i18n-controller-DLJcJ5gO.js.map} +1 -1
  95. package/dist/image.js +2 -2
  96. package/dist/index.js +26 -16
  97. package/dist/index.js.map +1 -1
  98. package/dist/inline-edit.js +2 -2
  99. package/dist/input.js +3 -3
  100. package/dist/json-viewer.js +2 -2
  101. package/dist/kanban.js +2 -2
  102. package/dist/kbd.js +2 -2
  103. package/dist/linear-progress.js +3 -3
  104. package/dist/listbox.js +2 -2
  105. package/dist/loader-full.js +19 -9
  106. package/dist/loader-full.js.map +1 -1
  107. package/dist/loader.js +46 -9
  108. package/dist/loader.js.map +1 -1
  109. package/dist/markdown-editor.js +29 -12
  110. package/dist/markdown-editor.js.map +1 -1
  111. package/dist/mention-input.js +4 -4
  112. package/dist/modal.js +2 -2
  113. package/dist/navigation-bar.js +2 -2
  114. package/dist/navigation-drawer.js +2 -2
  115. package/dist/navigation-rail.js +2 -2
  116. package/dist/notification-center.js +2 -2
  117. package/dist/number-field.js +4 -4
  118. package/dist/page-header.js +2 -2
  119. package/dist/pagination.js +2 -2
  120. package/dist/password-field.js +4 -4
  121. package/dist/password-rules.js +2 -2
  122. package/dist/phone-field.js +4 -4
  123. package/dist/{picker-field-CUI05sWc.js → picker-field-B5xOFc3-.js} +3 -3
  124. package/dist/{picker-field-CUI05sWc.js.map → picker-field-B5xOFc3-.js.map} +1 -1
  125. package/dist/pin-input.js +4 -4
  126. package/dist/presence-indicator.js +2 -2
  127. package/dist/prompt-input.js +24 -12
  128. package/dist/prompt-input.js.map +1 -1
  129. package/dist/radio.js +3 -3
  130. package/dist/rating.js +3 -3
  131. package/dist/redvars-loader.js +2 -2
  132. package/dist/relative-time.js +2 -2
  133. package/dist/resizable-panels.js +2 -2
  134. package/dist/{rich-text-input-N_hqnXej.js → rich-text-input-C4B9D6oD.js} +21 -18
  135. package/dist/rich-text-input-C4B9D6oD.js.map +1 -0
  136. package/dist/{schema-Dy0z-80u.js → schema-CPhNrjrx.js} +2 -2
  137. package/dist/{schema-Dy0z-80u.js.map → schema-CPhNrjrx.js.map} +1 -1
  138. package/dist/search.js +3 -3
  139. package/dist/select.js +4 -4
  140. package/dist/side-sheet.js +2 -2
  141. package/dist/signature-pad.js +3 -3
  142. package/dist/site-footer-group.js +142 -0
  143. package/dist/site-footer-group.js.map +1 -0
  144. package/dist/site-footer.js +338 -0
  145. package/dist/site-footer.js.map +1 -0
  146. package/dist/site-header.js +774 -0
  147. package/dist/site-header.js.map +1 -0
  148. package/dist/site-nav-group.js +123 -0
  149. package/dist/site-nav-group.js.map +1 -0
  150. package/dist/site-nav-link.js +321 -0
  151. package/dist/site-nav-link.js.map +1 -0
  152. package/dist/site-nav-menu.js +506 -0
  153. package/dist/site-nav-menu.js.map +1 -0
  154. package/dist/site-nav-shared-BDR2HG8e.js +23 -0
  155. package/dist/site-nav-shared-BDR2HG8e.js.map +1 -0
  156. package/dist/slider.js +3 -3
  157. package/dist/snackbar.js +2 -2
  158. package/dist/sparkline.js +2 -2
  159. package/dist/split-button.js +2 -2
  160. package/dist/src/__internal/i18n/strings.d.ts +24 -1
  161. package/dist/src/__internal/rich-text/rich-text-input.d.ts +6 -1
  162. package/dist/src/carousel/carousel.d.ts +135 -0
  163. package/dist/src/carousel/index.d.ts +1 -0
  164. package/dist/src/highlight/highlight.d.ts +56 -0
  165. package/dist/src/highlight/index.d.ts +2 -0
  166. package/dist/src/highlight/matches.d.ts +9 -0
  167. package/dist/src/html-editor/html-editor.d.ts +5 -0
  168. package/dist/src/index.d.ts +9 -0
  169. package/dist/src/markdown-editor/markdown-editor.d.ts +5 -0
  170. package/dist/src/site-footer/index.d.ts +2 -0
  171. package/dist/src/site-footer/site-footer-group.d.ts +34 -0
  172. package/dist/src/site-footer/site-footer.d.ts +74 -0
  173. package/dist/src/site-header/index.d.ts +4 -0
  174. package/dist/src/site-header/site-header.d.ts +170 -0
  175. package/dist/src/site-header/site-nav-group.d.ts +32 -0
  176. package/dist/src/site-header/site-nav-link.d.ts +65 -0
  177. package/dist/src/site-header/site-nav-menu.d.ts +104 -0
  178. package/dist/src/site-header/site-nav-shared.d.ts +13 -0
  179. package/dist/src/video/index.d.ts +2 -0
  180. package/dist/src/video/video-source.d.ts +12 -0
  181. package/dist/src/video/video.d.ts +80 -0
  182. package/dist/stat.js +2 -2
  183. package/dist/status-indicator.js +2 -2
  184. package/dist/step.js +2 -2
  185. package/dist/stepper.js +2 -2
  186. package/dist/{strings-DnYjGbbc.js → strings-MXyrGrNs.js} +28 -2
  187. package/dist/strings-MXyrGrNs.js.map +1 -0
  188. package/dist/svg.js +2 -2
  189. package/dist/switch.js +3 -3
  190. package/dist/table.js +2 -2
  191. package/dist/test/carousel.test.d.ts +1 -0
  192. package/dist/test/highlight.test.d.ts +1 -0
  193. package/dist/test/site-footer.test.d.ts +1 -0
  194. package/dist/test/site-header.test.d.ts +1 -0
  195. package/dist/test/video.test.d.ts +1 -0
  196. package/dist/textarea.js +4 -4
  197. package/dist/time-field.js +5 -5
  198. package/dist/time-picker.js +2 -2
  199. package/dist/timeline-item.js +2 -2
  200. package/dist/timeline.js +2 -2
  201. package/dist/{toggle-base-CXmFSp3b.js → toggle-base-I1wE_fVe.js} +2 -2
  202. package/dist/{toggle-base-CXmFSp3b.js.map → toggle-base-I1wE_fVe.js.map} +1 -1
  203. package/dist/tour.js +2 -2
  204. package/dist/transfer-list.js +3 -3
  205. package/dist/tree-chart.js +3 -3
  206. package/dist/tree-item.js +2 -2
  207. package/dist/tree.js +2 -2
  208. package/dist/tsconfig.tsbuildinfo +1 -1
  209. package/dist/typing-indicator.js +2 -2
  210. package/dist/url-field.js +4 -4
  211. package/dist/user-menu.js +2 -2
  212. package/dist/video-IwNmHyft.js +509 -0
  213. package/dist/video-IwNmHyft.js.map +1 -0
  214. package/dist/video.js +12 -0
  215. package/dist/video.js.map +1 -0
  216. package/dist/virtual-list.js +2 -2
  217. package/dist/workflow-timeline.js +2 -2
  218. package/dist/workflow.js +3 -3
  219. package/dist/workspace-switcher.js +2 -2
  220. package/package.json +1 -1
  221. package/readme.md +5 -0
  222. package/src/__internal/i18n/strings.ts +31 -1
  223. package/src/__internal/rich-text/editor-chrome.scss +27 -10
  224. package/src/__internal/rich-text/rich-text-input.ts +17 -16
  225. package/src/carousel/carousel.scss +124 -0
  226. package/src/carousel/carousel.ts +547 -0
  227. package/src/carousel/index.ts +1 -0
  228. package/src/highlight/highlight.scss +25 -0
  229. package/src/highlight/highlight.ts +123 -0
  230. package/src/highlight/index.ts +2 -0
  231. package/src/highlight/matches.ts +94 -0
  232. package/src/html-editor/html-editor.ts +5 -0
  233. package/src/index.ts +18 -0
  234. package/src/loader.ts +36 -0
  235. package/src/markdown-editor/markdown-editor.ts +5 -0
  236. package/src/site-footer/index.ts +2 -0
  237. package/src/site-footer/site-footer-group.scss +53 -0
  238. package/src/site-footer/site-footer-group.ts +52 -0
  239. package/src/site-footer/site-footer.scss +171 -0
  240. package/src/site-footer/site-footer.ts +151 -0
  241. package/src/site-header/index.ts +8 -0
  242. package/src/site-header/site-header.scss +238 -0
  243. package/src/site-header/site-header.ts +565 -0
  244. package/src/site-header/site-nav-group.scss +29 -0
  245. package/src/site-header/site-nav-group.ts +57 -0
  246. package/src/site-header/site-nav-link.scss +154 -0
  247. package/src/site-header/site-nav-link.ts +140 -0
  248. package/src/site-header/site-nav-menu.scss +182 -0
  249. package/src/site-header/site-nav-menu.ts +336 -0
  250. package/src/site-header/site-nav-shared.ts +27 -0
  251. package/src/video/index.ts +2 -0
  252. package/src/video/video-source.ts +80 -0
  253. package/src/video/video.scss +183 -0
  254. package/src/video/video.ts +246 -0
  255. package/dist/rich-text-input-N_hqnXej.js.map +0 -1
  256. package/dist/strings-DnYjGbbc.js.map +0 -1
@@ -0,0 +1,644 @@
1
+ import { i, _ as __decorate, I as IndividualComponent, a as i$1, b, A } 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 { o } from './style-map-CHOg6N_R.js';
7
+ import { I as I18nController } from './i18n-controller-DLJcJ5gO.js';
8
+ import { i as isRtl } from './locale-DEsJZCQG.js';
9
+ import './base-Cl6v8-BZ.js';
10
+ import './directive-ZPhl09Yt.js';
11
+ import './strings-MXyrGrNs.js';
12
+
13
+ var css_248z = i`* {
14
+ box-sizing: border-box;
15
+ -webkit-tap-highlight-color: transparent;
16
+ }
17
+
18
+ .screen-reader-only {
19
+ position: absolute !important;
20
+ inline-size: 1px !important;
21
+ block-size: 1px !important;
22
+ padding: 0 !important;
23
+ margin: -1px !important;
24
+ overflow: hidden !important;
25
+ clip-path: inset(50%) !important;
26
+ white-space: nowrap !important;
27
+ border: 0 !important;
28
+ }
29
+
30
+ [hidden] {
31
+ display: none !important;
32
+ }
33
+
34
+ @media (forced-colors: active) {
35
+ .selected,
36
+ [aria-selected=true],
37
+ [aria-pressed=true],
38
+ [aria-checked=true],
39
+ [aria-current]:not([aria-current=false]) {
40
+ outline: 2px solid Highlight;
41
+ outline-offset: -2px;
42
+ }
43
+ .disabled,
44
+ [aria-disabled=true] {
45
+ color: GrayText;
46
+ }
47
+ }
48
+ :host {
49
+ display: block;
50
+ min-inline-size: 0;
51
+ }
52
+
53
+ .carousel {
54
+ display: flex;
55
+ flex-direction: column;
56
+ gap: var(--spacing-200);
57
+ }
58
+
59
+ .track {
60
+ --_gap: var(--carousel-gap, var(--spacing-200, 1rem));
61
+ display: flex;
62
+ gap: var(--_gap);
63
+ overflow-x: auto;
64
+ overscroll-behavior-x: contain;
65
+ scroll-snap-type: x mandatory;
66
+ scrollbar-width: none;
67
+ }
68
+ .track::-webkit-scrollbar {
69
+ display: none;
70
+ }
71
+
72
+ ::slotted(*) {
73
+ flex: 0 0 calc((100% - (var(--_per-view) - 1) * var(--_gap)) / var(--_per-view));
74
+ min-inline-size: 0;
75
+ box-sizing: border-box;
76
+ scroll-snap-align: start;
77
+ }
78
+
79
+ .controls {
80
+ display: flex;
81
+ align-items: center;
82
+ justify-content: center;
83
+ gap: var(--spacing-150);
84
+ }
85
+
86
+ .chevron:dir(rtl) {
87
+ transform: scaleX(-1);
88
+ }
89
+
90
+ .pickers {
91
+ display: flex;
92
+ align-items: center;
93
+ gap: var(--spacing-050);
94
+ }
95
+
96
+ .picker {
97
+ background: transparent;
98
+ border: none;
99
+ appearance: none;
100
+ margin: 0;
101
+ outline: none;
102
+ padding: 0;
103
+ position: relative;
104
+ display: grid;
105
+ place-items: center;
106
+ inline-size: 1.5rem;
107
+ block-size: 1.5rem;
108
+ border-radius: var(--shape-corner-full);
109
+ cursor: pointer;
110
+ }
111
+ .picker::before {
112
+ content: "";
113
+ inline-size: 0.625rem;
114
+ block-size: 0.625rem;
115
+ border-radius: var(--shape-corner-full);
116
+ background-color: var(--color-outline-variant);
117
+ transition: inline-size var(--duration-short4) var(--easing-standard), background-color var(--duration-short4) var(--easing-standard);
118
+ }
119
+ .picker:hover::before {
120
+ background-color: var(--color-outline);
121
+ }
122
+ .picker.current {
123
+ inline-size: 2rem;
124
+ }
125
+ .picker.current::before {
126
+ inline-size: 1.5rem;
127
+ background-color: var(--color-primary);
128
+ }
129
+ .picker:focus-visible {
130
+ outline: 2px solid var(--color-primary);
131
+ outline-offset: 0;
132
+ }
133
+
134
+ .counter {
135
+ font-family: var(--typography-label-large-font-family) !important;
136
+ font-size: var(--typography-label-large-font-size) !important;
137
+ font-weight: var(--typography-label-large-font-weight) !important;
138
+ line-height: var(--typography-label-large-line-height) !important;
139
+ letter-spacing: var(--typography-label-large-letter-spacing) !important;
140
+ min-inline-size: 4rem;
141
+ color: var(--color-on-surface-variant);
142
+ text-align: center;
143
+ font-variant-numeric: tabular-nums;
144
+ }
145
+
146
+ @media (prefers-reduced-motion: reduce) {
147
+ .picker::before {
148
+ transition: none;
149
+ }
150
+ }
151
+ @media (forced-colors: active) {
152
+ .picker::before {
153
+ background-color: ButtonText;
154
+ }
155
+ .picker.current::before {
156
+ background-color: Highlight;
157
+ }
158
+ }`;
159
+
160
+ /** A slide is never drawn narrower than this, so `per-view` drops on narrow screens. */
161
+ const MIN_SLIDE_WIDTH = 240;
162
+ /** With more pages than this, a "3 of 9" counter replaces the picker buttons. */
163
+ const MAX_PICKERS = 7;
164
+ /** How long the track must be still before a scroll counts as settled, in milliseconds. */
165
+ const SETTLE_DELAY = 100;
166
+ /** Marks a slide name the carousel wrote, so it can rewrite it and leave the app's own alone. */
167
+ const OWN_LABEL = 'data-carousel-label';
168
+ /**
169
+ * @label Carousel
170
+ * @tag wc-carousel
171
+ * @rawTag carousel
172
+ *
173
+ * @summary A row of slides shown one or a few at a time, with previous and next buttons and pickers.
174
+ * @overview
175
+ * <p>Carousel shows its children as slides, <code>per-view</code> at a time, for screenshots on a
176
+ * product page or a row of testimonials. The slides scroll with snap points, so touch swipe,
177
+ * trackpads and the scroll wheel work as they do anywhere else, and previous, next and picker
178
+ * buttons sit under them. With more than seven pages a "3 of 9" counter replaces the pickers.</p>
179
+ * <p>Each slide is never narrower than 15rem, so a carousel of three drops to two and then one as its
180
+ * container narrows. Slides out of view are <code>inert</code>, so Tab never reaches a link the
181
+ * person cannot see.</p>
182
+ * <p>Slides do not move on their own unless you set <code>autoplay</code>, and then a button to stop
183
+ * them comes first in the controls. Rotation pauses while the pointer rests on the carousel or focus
184
+ * is inside it, stops for good when the person uses any control, and does not start at all when the
185
+ * person asks for reduced motion.</p>
186
+ *
187
+ * @slot - The slides: any elements, one per slide. Give a slide an `aria-label` to name it; otherwise it is named "2 of 5".
188
+ *
189
+ * @csspart base - The carousel region.
190
+ * @csspart track - The scrolling row of slides.
191
+ * @csspart controls - The row of buttons under the slides.
192
+ *
193
+ * @cssprop --carousel-gap - Space between slides. Defaults to `--spacing-200`.
194
+ *
195
+ * @fires {CustomEvent<CarouselChangeDetail>} change - Dispatched when the slides in view change because the person used a control or scrolled, or autoplay moved on.
196
+ *
197
+ * @example
198
+ * ```html
199
+ * <wc-carousel label="Testimonials" per-view="3">
200
+ * <blockquote>We moved our incident process off spreadsheets in a week.</blockquote>
201
+ * <blockquote>Our customer portal runs on the same rules as the agents' workspace.</blockquote>
202
+ * <blockquote>Self-hosting took one command and a coffee.</blockquote>
203
+ * </wc-carousel>
204
+ * ```
205
+ * @example
206
+ * ```html
207
+ * <wc-carousel label="Product screenshots" autoplay loop>
208
+ * <img src="/img/workspace.webp" alt="The ITSM workspace" />
209
+ * <img src="/img/portal.webp" alt="The customer portal" />
210
+ * </wc-carousel>
211
+ * ```
212
+ * @tags media layout
213
+ */
214
+ let Carousel = class Carousel extends i$1 {
215
+ constructor() {
216
+ // ── Static ───────────────────────────────────────────────────────────────
217
+ super(...arguments);
218
+ // ── Properties ───────────────────────────────────────────────────────────
219
+ /** What the slides are, such as "Testimonials": the name of the carousel region. */
220
+ this.label = '';
221
+ /** How many slides show at once. Fewer show when the carousel is too narrow for them. */
222
+ this.perView = 1;
223
+ /** The first slide in view, from 0. */
224
+ this.index = 0;
225
+ /** Whether previous and next wrap around from the last page to the first and back. */
226
+ this.loop = false;
227
+ /** Whether the slides move on by themselves. A stop button comes first in the controls. */
228
+ this.autoplay = false;
229
+ /** How long each page shows while `autoplay` runs, in milliseconds. */
230
+ this.interval = 5000;
231
+ // ── State ────────────────────────────────────────────────────────────────
232
+ this.slideCount = 0;
233
+ /** How many slides fit: `per-view`, or fewer when the carousel is narrow. */
234
+ this.visible = 1;
235
+ /** Whether autoplay rotates the slides: off once the person stops it or uses a control. */
236
+ this.rotating = false;
237
+ /** Whether the pointer or focus is inside, which pauses rotation. */
238
+ this.held = false;
239
+ // ── Private fields ───────────────────────────────────────────────────────
240
+ this.i18n = new I18nController(this);
241
+ this.slides = [];
242
+ /** Whether the person started rotation with the button, so hover and focus no longer pause it. */
243
+ this.startedByPerson = false;
244
+ /** Whether the person stopped rotation or used a control, so autoplay never starts again. */
245
+ this.stoppedByPerson = false;
246
+ /** Whether the next `index` update came from scrolling, so it needs no scroll of its own. */
247
+ this.indexFromScroll = false;
248
+ /** Whether the next scroll to `index` is animated. */
249
+ this.smoothScroll = false;
250
+ this.resizeObserver = new ResizeObserver(() => this.syncVisible());
251
+ this.reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
252
+ // ── Event handlers ───────────────────────────────────────────────────────
253
+ this.handleSlotChange = (event) => {
254
+ const slot = event.target;
255
+ const slides = slot
256
+ .assignedElements()
257
+ .filter((el) => el instanceof HTMLElement);
258
+ this.slides
259
+ .filter(slide => !slides.includes(slide))
260
+ .forEach(slide => slide.removeAttribute('inert'));
261
+ this.slides = slides;
262
+ this.slideCount = slides.length;
263
+ this.syncSlides();
264
+ };
265
+ this.handleScroll = () => {
266
+ clearTimeout(this.settleTimer);
267
+ this.settleTimer = setTimeout(() => {
268
+ const index = this.clamp(this.nearestIndex());
269
+ if (index === this.index)
270
+ return;
271
+ this.indexFromScroll = true;
272
+ this.index = index;
273
+ this.dispatchChange();
274
+ }, SETTLE_DELAY);
275
+ };
276
+ // The ends' buttons are soft-disabled, which keeps them focusable but sends no click.
277
+ this.handlePrevious = () => {
278
+ this.stopRotation();
279
+ this.previous();
280
+ };
281
+ this.handleNext = () => {
282
+ this.stopRotation();
283
+ this.next();
284
+ };
285
+ this.handleRotation = () => {
286
+ if (this.rotating) {
287
+ this.stopRotation();
288
+ }
289
+ else {
290
+ this.rotating = true;
291
+ this.stoppedByPerson = false;
292
+ this.startedByPerson = true;
293
+ }
294
+ };
295
+ this.handlePointerEnter = (event) => {
296
+ if (event.pointerType === 'mouse')
297
+ this.held = true;
298
+ };
299
+ this.handlePointerLeave = () => {
300
+ if (!this.matches(':focus-within'))
301
+ this.held = false;
302
+ };
303
+ this.handleFocusIn = () => {
304
+ this.held = true;
305
+ };
306
+ this.handleFocusOut = (event) => {
307
+ const next = event.relatedTarget;
308
+ if (!next || !this.contains(next)) {
309
+ if (!this.matches(':hover'))
310
+ this.held = false;
311
+ }
312
+ };
313
+ }
314
+ // ── Lifecycle ────────────────────────────────────────────────────────────
315
+ connectedCallback() {
316
+ super.connectedCallback();
317
+ this.addEventListener('pointerenter', this.handlePointerEnter);
318
+ this.addEventListener('pointerleave', this.handlePointerLeave);
319
+ this.addEventListener('focusin', this.handleFocusIn);
320
+ this.addEventListener('focusout', this.handleFocusOut);
321
+ }
322
+ disconnectedCallback() {
323
+ this.removeEventListener('pointerenter', this.handlePointerEnter);
324
+ this.removeEventListener('pointerleave', this.handlePointerLeave);
325
+ this.removeEventListener('focusin', this.handleFocusIn);
326
+ this.removeEventListener('focusout', this.handleFocusOut);
327
+ this.resizeObserver.disconnect();
328
+ this.stopTimer();
329
+ clearTimeout(this.settleTimer);
330
+ super.disconnectedCallback();
331
+ }
332
+ willUpdate(changed) {
333
+ super.willUpdate(changed);
334
+ if (changed.has('autoplay')) {
335
+ this.rotating =
336
+ this.autoplay && !this.stoppedByPerson && !this.reducedMotion.matches;
337
+ }
338
+ const clamped = this.clamp(this.index);
339
+ if (clamped !== this.index)
340
+ this.index = clamped;
341
+ }
342
+ firstUpdated() {
343
+ if (this.track)
344
+ this.resizeObserver.observe(this.track);
345
+ }
346
+ // Untyped, because it reads private state.
347
+ updated(changed) {
348
+ super.updated(changed);
349
+ if (changed.has('index') ||
350
+ changed.has('visible') ||
351
+ changed.has('slideCount')) {
352
+ this.syncSlides();
353
+ }
354
+ if (changed.has('index') && !this.indexFromScroll) {
355
+ this.scrollToIndex(this.smoothScroll);
356
+ }
357
+ this.indexFromScroll = false;
358
+ this.smoothScroll = false;
359
+ this.syncTimer();
360
+ }
361
+ // ── Public methods ───────────────────────────────────────────────────────
362
+ /** Shows the page after the current one, or the first after the last when `loop` is set. */
363
+ next() {
364
+ this.goToPage(this.page + 1, this.loop);
365
+ }
366
+ /** Shows the page before the current one, or the last before the first when `loop` is set. */
367
+ previous() {
368
+ this.goToPage(this.page - 1, this.loop);
369
+ }
370
+ /** Scrolls the slide at `index`, from 0, into the first place in view. */
371
+ goTo(index) {
372
+ this.moveTo(index);
373
+ }
374
+ // ── Private methods ──────────────────────────────────────────────────────
375
+ /** The first slide index that still fills the view. */
376
+ get maxStart() {
377
+ return Math.max(0, this.slideCount - this.visible);
378
+ }
379
+ get pageCount() {
380
+ return Math.max(1, Math.ceil(this.slideCount / this.visible));
381
+ }
382
+ /** The page in view: the last one once the view reaches the end. */
383
+ get page() {
384
+ if (this.index >= this.maxStart)
385
+ return this.pageCount - 1;
386
+ return Math.floor(this.index / this.visible);
387
+ }
388
+ pageStart(page) {
389
+ return Math.min(page * this.visible, this.maxStart);
390
+ }
391
+ clamp(index) {
392
+ return Math.min(Math.max(0, Math.round(index) || 0), this.maxStart);
393
+ }
394
+ goToPage(page, wrap) {
395
+ const last = this.pageCount - 1;
396
+ let target = page;
397
+ if (target > last)
398
+ target = wrap ? 0 : last;
399
+ if (target < 0)
400
+ target = wrap ? last : 0;
401
+ this.moveTo(this.pageStart(target));
402
+ }
403
+ moveTo(index) {
404
+ const target = this.clamp(index);
405
+ if (target === this.index)
406
+ return;
407
+ this.smoothScroll = true;
408
+ this.index = target;
409
+ this.dispatchChange();
410
+ }
411
+ dispatchChange() {
412
+ this.dispatchEvent(new CustomEvent('change', {
413
+ detail: { index: this.index },
414
+ }));
415
+ }
416
+ syncVisible() {
417
+ const { track } = this;
418
+ if (!track)
419
+ return;
420
+ const gap = parseFloat(getComputedStyle(track).columnGap) || 0;
421
+ const fit = Math.floor((track.clientWidth + gap) / (MIN_SLIDE_WIDTH + gap));
422
+ const visible = Math.max(1, Math.min(Math.floor(this.perView) || 1, fit));
423
+ if (visible !== this.visible)
424
+ this.visible = visible;
425
+ }
426
+ /** Names each slide and makes the ones out of view inert. */
427
+ syncSlides() {
428
+ const total = String(this.slides.length);
429
+ const label = this.i18n.t('carouselSlideLabel');
430
+ this.slides.forEach((slide, i) => {
431
+ slide.setAttribute('role', 'group');
432
+ slide.setAttribute('aria-roledescription', this.i18n.t('carouselSlideRole'));
433
+ const named = slide.hasAttribute('aria-labelledby') ||
434
+ (slide.hasAttribute('aria-label') && !slide.hasAttribute(OWN_LABEL));
435
+ if (!named) {
436
+ slide.setAttribute('aria-label', label(String(i + 1), total));
437
+ slide.setAttribute(OWN_LABEL, '');
438
+ }
439
+ const inView = i >= this.index && i < this.index + this.visible;
440
+ slide.toggleAttribute('inert', !inView);
441
+ });
442
+ }
443
+ scrollToIndex(smooth) {
444
+ const { track } = this;
445
+ const slide = this.slides[this.index];
446
+ if (!track || !slide)
447
+ return;
448
+ const trackBox = track.getBoundingClientRect();
449
+ const slideBox = slide.getBoundingClientRect();
450
+ const delta = isRtl(this)
451
+ ? slideBox.right - trackBox.right
452
+ : slideBox.left - trackBox.left;
453
+ if (Math.abs(delta) < 1)
454
+ return;
455
+ track.scrollBy({
456
+ left: delta,
457
+ behavior: smooth && !this.reducedMotion.matches ? 'smooth' : 'instant',
458
+ });
459
+ }
460
+ /** The slide nearest the start edge of the track. */
461
+ nearestIndex() {
462
+ const { track } = this;
463
+ if (!track || !this.slides.length)
464
+ return 0;
465
+ const trackBox = track.getBoundingClientRect();
466
+ const rtl = isRtl(this);
467
+ let nearest = 0;
468
+ let best = Infinity;
469
+ this.slides.forEach((slide, i) => {
470
+ const box = slide.getBoundingClientRect();
471
+ const distance = Math.abs(rtl ? box.right - trackBox.right : box.left - trackBox.left);
472
+ if (distance < best) {
473
+ best = distance;
474
+ nearest = i;
475
+ }
476
+ });
477
+ return nearest;
478
+ }
479
+ get shouldRotate() {
480
+ return (this.rotating &&
481
+ this.pageCount > 1 &&
482
+ (this.startedByPerson || !this.held));
483
+ }
484
+ syncTimer() {
485
+ if (this.shouldRotate && this.isConnected) {
486
+ if (this.timer === undefined) {
487
+ this.timer = setInterval(() => this.advance(), Math.max(1000, this.interval));
488
+ }
489
+ }
490
+ else {
491
+ this.stopTimer();
492
+ }
493
+ }
494
+ stopTimer() {
495
+ clearInterval(this.timer);
496
+ this.timer = undefined;
497
+ }
498
+ advance() {
499
+ this.goToPage(this.page + 1, true);
500
+ }
501
+ /** The person took over: autoplay stops and does not start again. */
502
+ stopRotation() {
503
+ this.rotating = false;
504
+ this.stoppedByPerson = true;
505
+ this.startedByPerson = false;
506
+ }
507
+ handlePicker(page) {
508
+ this.stopRotation();
509
+ this.goToPage(page, false);
510
+ }
511
+ // ── Render helpers ───────────────────────────────────────────────────────
512
+ renderPickers() {
513
+ const pages = this.pageCount;
514
+ const { page } = this;
515
+ if (pages > MAX_PICKERS) {
516
+ return b `<span class="counter"
517
+ >${this.i18n.t('carouselCounter')(String(page + 1), String(pages))}</span
518
+ >`;
519
+ }
520
+ const picker = this.i18n.t('carouselPicker');
521
+ const total = String(this.slideCount);
522
+ return b `<div
523
+ class="pickers"
524
+ role="group"
525
+ aria-label=${this.i18n.t('chooseSlide')}
526
+ >
527
+ ${Array.from({ length: pages }, (_, p) => {
528
+ const first = this.pageStart(p);
529
+ const last = Math.min(first + this.visible, this.slideCount);
530
+ const current = p === page;
531
+ return b `<button
532
+ class=${e$1({ picker: true, current })}
533
+ type="button"
534
+ aria-label=${picker(String(first + 1), String(last), total)}
535
+ aria-current=${current ? 'true' : A}
536
+ @click=${() => this.handlePicker(p)}
537
+ ></button>`;
538
+ })}
539
+ </div>`;
540
+ }
541
+ renderControls() {
542
+ if (this.pageCount < 2)
543
+ return A;
544
+ const atStart = !this.loop && this.page === 0;
545
+ const atEnd = !this.loop && this.page === this.pageCount - 1;
546
+ return b `<div class="controls" part="controls">
547
+ ${this.autoplay
548
+ ? b `<wc-icon-button
549
+ class="rotation"
550
+ variant="text"
551
+ shape="round"
552
+ aria-label=${this.rotating
553
+ ? this.i18n.t('stopSlideRotation')
554
+ : this.i18n.t('startSlideRotation')}
555
+ @click=${this.handleRotation}
556
+ >
557
+ <wc-icon name=${this.rotating ? 'pause' : 'play_arrow'}></wc-icon>
558
+ </wc-icon-button>`
559
+ : A}
560
+ <wc-icon-button
561
+ class="previous"
562
+ variant="tonal"
563
+ shape="round"
564
+ aria-label=${this.i18n.t('previousSlide')}
565
+ ?soft-disabled=${atStart}
566
+ @click=${this.handlePrevious}
567
+ >
568
+ <wc-icon class="chevron" name="chevron_left"></wc-icon>
569
+ </wc-icon-button>
570
+ ${this.renderPickers()}
571
+ <wc-icon-button
572
+ class="next"
573
+ variant="tonal"
574
+ shape="round"
575
+ aria-label=${this.i18n.t('nextSlide')}
576
+ ?soft-disabled=${atEnd}
577
+ @click=${this.handleNext}
578
+ >
579
+ <wc-icon class="chevron" name="chevron_right"></wc-icon>
580
+ </wc-icon-button>
581
+ </div>`;
582
+ }
583
+ // ── Render ───────────────────────────────────────────────────────────────
584
+ render() {
585
+ return b `<div
586
+ class="carousel"
587
+ part="base"
588
+ role="region"
589
+ aria-roledescription=${this.i18n.t('carouselRole')}
590
+ aria-label=${this.label || A}
591
+ >
592
+ <div
593
+ class="track"
594
+ part="track"
595
+ aria-live=${this.shouldRotate ? 'off' : 'polite'}
596
+ style=${o({ '--_per-view': String(this.visible) })}
597
+ @scroll=${this.handleScroll}
598
+ >
599
+ <slot @slotchange=${this.handleSlotChange}></slot>
600
+ </div>
601
+ ${this.renderControls()}
602
+ </div>`;
603
+ }
604
+ };
605
+ Carousel.styles = [css_248z];
606
+ __decorate([
607
+ n({ reflect: true })
608
+ ], Carousel.prototype, "label", void 0);
609
+ __decorate([
610
+ n({ type: Number, attribute: 'per-view', reflect: true })
611
+ ], Carousel.prototype, "perView", void 0);
612
+ __decorate([
613
+ n({ type: Number, reflect: true })
614
+ ], Carousel.prototype, "index", void 0);
615
+ __decorate([
616
+ n({ type: Boolean, reflect: true })
617
+ ], Carousel.prototype, "loop", void 0);
618
+ __decorate([
619
+ n({ type: Boolean, reflect: true })
620
+ ], Carousel.prototype, "autoplay", void 0);
621
+ __decorate([
622
+ n({ type: Number })
623
+ ], Carousel.prototype, "interval", void 0);
624
+ __decorate([
625
+ r()
626
+ ], Carousel.prototype, "slideCount", void 0);
627
+ __decorate([
628
+ r()
629
+ ], Carousel.prototype, "visible", void 0);
630
+ __decorate([
631
+ r()
632
+ ], Carousel.prototype, "rotating", void 0);
633
+ __decorate([
634
+ r()
635
+ ], Carousel.prototype, "held", void 0);
636
+ __decorate([
637
+ e('.track')
638
+ ], Carousel.prototype, "track", void 0);
639
+ Carousel = __decorate([
640
+ IndividualComponent
641
+ ], Carousel);
642
+
643
+ export { Carousel };
644
+ //# sourceMappingURL=carousel.js.map