@vonage/vivid 4.4.0 → 4.6.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 (235) hide show
  1. package/custom-elements.json +7181 -6876
  2. package/elevation/index.cjs +1 -1
  3. package/elevation/index.js +1 -1
  4. package/index.cjs +80 -74
  5. package/index.js +23 -22
  6. package/lib/components.d.ts +1 -0
  7. package/lib/fab/fab.d.ts +1 -1
  8. package/lib/icon/icon.d.ts +1 -1
  9. package/lib/menu/menu.d.ts +2 -1
  10. package/lib/number-field/number-field.d.ts +3 -1
  11. package/lib/searchable-select/definition.d.ts +4 -0
  12. package/lib/searchable-select/locale.d.ts +6 -0
  13. package/lib/searchable-select/option-tag.d.ts +14 -0
  14. package/lib/searchable-select/option-tag.template.d.ts +4 -0
  15. package/lib/searchable-select/searchable-select.d.ts +29 -0
  16. package/lib/searchable-select/searchable-select.form-associated.d.ts +10 -0
  17. package/lib/searchable-select/searchable-select.template.d.ts +4 -0
  18. package/lib/select/select.d.ts +4 -1
  19. package/lib/tab/locale.d.ts +3 -0
  20. package/lib/tab/tab.d.ts +5 -1
  21. package/lib/tabs/tabs.d.ts +2 -0
  22. package/lib/tag/definition.d.ts +1 -0
  23. package/lib/text-field/text-field.d.ts +3 -1
  24. package/lib/video-player/video-player.d.ts +0 -1
  25. package/listbox/index.cjs +1 -1
  26. package/listbox/index.js +1 -1
  27. package/locales/de-DE.cjs +12 -0
  28. package/locales/de-DE.js +12 -0
  29. package/locales/en-GB.cjs +12 -0
  30. package/locales/en-GB.js +12 -0
  31. package/locales/en-US.cjs +12 -0
  32. package/locales/en-US.js +12 -0
  33. package/locales/ja-JP.cjs +12 -0
  34. package/locales/ja-JP.js +12 -0
  35. package/locales/zh-CN.cjs +12 -0
  36. package/locales/zh-CN.js +12 -0
  37. package/package.json +6 -1
  38. package/popup/index.cjs +1 -1
  39. package/popup/index.js +1 -1
  40. package/searchable-select/index.cjs +5 -0
  41. package/searchable-select/index.js +3 -0
  42. package/select/index.cjs +1 -1
  43. package/select/index.js +1 -1
  44. package/selectable-box/index.cjs +1 -1
  45. package/selectable-box/index.js +1 -1
  46. package/shared/anchored.js +1 -1
  47. package/shared/calendar-event.js +1 -1
  48. package/shared/definition.cjs +2 -2
  49. package/shared/definition.js +2 -2
  50. package/shared/definition11.cjs +1 -1
  51. package/shared/definition11.js +1 -1
  52. package/shared/definition12.cjs +1 -1
  53. package/shared/definition12.js +1 -1
  54. package/shared/definition13.js +1 -1
  55. package/shared/definition14.cjs +1 -1
  56. package/shared/definition14.js +1 -1
  57. package/shared/definition15.cjs +7 -8
  58. package/shared/definition15.js +2 -3
  59. package/shared/definition16.cjs +11 -7
  60. package/shared/definition16.js +10 -6
  61. package/shared/definition17.cjs +2 -2
  62. package/shared/definition17.js +2 -2
  63. package/shared/definition18.cjs +5 -6
  64. package/shared/definition18.js +3 -4
  65. package/shared/definition19.cjs +5 -6
  66. package/shared/definition19.js +3 -4
  67. package/shared/definition20.cjs +16 -38
  68. package/shared/definition20.js +17 -39
  69. package/shared/definition21.cjs +7 -6
  70. package/shared/definition21.js +8 -7
  71. package/shared/definition23.cjs +1 -1
  72. package/shared/definition23.js +2 -2
  73. package/shared/definition24.cjs +2 -2
  74. package/shared/definition24.js +2 -2
  75. package/shared/definition25.cjs +6 -7
  76. package/shared/definition25.js +2 -3
  77. package/shared/definition26.cjs +1 -1
  78. package/shared/definition26.js +2 -2
  79. package/shared/definition27.cjs +1 -1
  80. package/shared/definition27.js +1 -1
  81. package/shared/definition28.js +1 -1
  82. package/shared/definition29.cjs +8 -4
  83. package/shared/definition29.js +8 -4
  84. package/shared/definition3.cjs +1 -1
  85. package/shared/definition3.js +2 -2
  86. package/shared/definition30.cjs +4 -2
  87. package/shared/definition30.js +4 -2
  88. package/shared/definition31.cjs +1 -1
  89. package/shared/definition31.js +2 -2
  90. package/shared/definition32.cjs +1 -1
  91. package/shared/definition32.js +1 -1
  92. package/shared/definition34.cjs +2 -3
  93. package/shared/definition34.js +2 -3
  94. package/shared/definition35.cjs +21 -16
  95. package/shared/definition35.js +16 -11
  96. package/shared/definition36.cjs +50 -207
  97. package/shared/definition36.js +51 -207
  98. package/shared/definition37.js +1 -1
  99. package/shared/definition38.cjs +1 -1
  100. package/shared/definition38.js +1 -1
  101. package/shared/definition4.cjs +6 -4
  102. package/shared/definition4.js +7 -5
  103. package/shared/definition41.cjs +1 -1
  104. package/shared/definition41.js +1 -1
  105. package/shared/definition42.cjs +6 -7
  106. package/shared/definition42.js +6 -7
  107. package/shared/definition43.cjs +998 -643
  108. package/shared/definition43.js +992 -638
  109. package/shared/definition44.cjs +723 -112
  110. package/shared/definition44.js +722 -111
  111. package/shared/definition45.cjs +121 -79
  112. package/shared/definition45.js +120 -78
  113. package/shared/definition46.cjs +81 -616
  114. package/shared/definition46.js +80 -614
  115. package/shared/definition47.cjs +609 -116
  116. package/shared/definition47.js +607 -115
  117. package/shared/definition48.cjs +116 -134
  118. package/shared/definition48.js +115 -133
  119. package/shared/definition49.cjs +149 -19
  120. package/shared/definition49.js +148 -18
  121. package/shared/definition5.cjs +5 -6
  122. package/shared/definition5.js +5 -6
  123. package/shared/definition50.cjs +21 -82
  124. package/shared/definition50.js +20 -81
  125. package/shared/definition51.cjs +78 -494
  126. package/shared/definition51.js +77 -493
  127. package/shared/definition52.cjs +568 -28
  128. package/shared/definition52.js +567 -27
  129. package/shared/definition53.cjs +28 -123
  130. package/shared/definition53.js +27 -123
  131. package/shared/definition54.cjs +115 -296
  132. package/shared/definition54.js +114 -295
  133. package/shared/definition55.cjs +258 -318
  134. package/shared/definition55.js +252 -312
  135. package/shared/definition56.cjs +303 -784
  136. package/shared/definition56.js +298 -779
  137. package/shared/definition57.cjs +802 -95
  138. package/shared/definition57.js +801 -94
  139. package/shared/definition58.cjs +95 -60
  140. package/shared/definition58.js +94 -59
  141. package/shared/definition59.cjs +117 -75
  142. package/shared/definition59.js +116 -74
  143. package/shared/definition6.cjs +1 -1
  144. package/shared/definition6.js +1 -1
  145. package/shared/definition60.cjs +70 -285
  146. package/shared/definition60.js +71 -286
  147. package/shared/definition61.cjs +296 -325
  148. package/shared/definition61.js +295 -324
  149. package/shared/definition62.cjs +66160 -27
  150. package/shared/definition62.js +66159 -26
  151. package/shared/definition63.cjs +24 -1952
  152. package/shared/definition63.js +23 -1950
  153. package/shared/definition64.cjs +1976 -0
  154. package/shared/definition64.js +1971 -0
  155. package/shared/definition7.cjs +1 -1
  156. package/shared/definition7.js +1 -1
  157. package/shared/definition8.cjs +2 -3
  158. package/shared/definition8.js +3 -4
  159. package/shared/definition9.cjs +1 -1
  160. package/shared/definition9.js +1 -1
  161. package/shared/dialog/index.d.ts +1 -0
  162. package/shared/form-elements.cjs +236 -0
  163. package/shared/form-elements.js +229 -0
  164. package/shared/icon.js +1 -1
  165. package/shared/index2.cjs +6 -256
  166. package/shared/index2.js +6 -249
  167. package/shared/listbox-option.cjs +204 -0
  168. package/shared/listbox-option.js +201 -0
  169. package/shared/listbox.cjs +3 -3
  170. package/shared/listbox.js +1 -1
  171. package/shared/localization/Locale.d.ts +4 -0
  172. package/shared/localized.cjs +26 -2
  173. package/shared/localized.js +25 -2
  174. package/shared/playbackRates.cjs +13 -0
  175. package/shared/playbackRates.js +11 -0
  176. package/shared/presentationDate.cjs +11 -11
  177. package/shared/presentationDate.js +11 -11
  178. package/shared/scrollIntoView.cjs +51 -0
  179. package/shared/scrollIntoView.js +49 -0
  180. package/shared/slider.template.cjs +1 -1
  181. package/shared/slider.template.js +1 -1
  182. package/shared/text-anchor.cjs +1 -1
  183. package/shared/text-anchor.js +1 -1
  184. package/shared/text-field.cjs +1 -1
  185. package/shared/text-field.js +1 -1
  186. package/shared/utils/playbackRates.d.ts +1 -0
  187. package/shared/utils/scrollIntoView.d.ts +1 -0
  188. package/side-drawer/index.cjs +1 -1
  189. package/side-drawer/index.js +1 -1
  190. package/slider/index.cjs +1 -1
  191. package/slider/index.js +1 -1
  192. package/split-button/index.cjs +1 -1
  193. package/split-button/index.js +1 -1
  194. package/styles/core/all.css +1 -1
  195. package/styles/core/theme.css +1 -1
  196. package/styles/core/typography.css +1 -1
  197. package/styles/tokens/theme-dark.css +4 -4
  198. package/styles/tokens/theme-light.css +4 -4
  199. package/styles/tokens/vivid-2-compat.css +1 -1
  200. package/switch/index.cjs +1 -1
  201. package/switch/index.js +1 -1
  202. package/tab/index.cjs +1 -1
  203. package/tab/index.js +1 -1
  204. package/tab-panel/index.cjs +1 -1
  205. package/tab-panel/index.js +1 -1
  206. package/tabs/index.cjs +1 -1
  207. package/tabs/index.js +1 -1
  208. package/tag/index.cjs +1 -1
  209. package/tag/index.js +1 -1
  210. package/tag-group/index.cjs +1 -1
  211. package/tag-group/index.js +1 -1
  212. package/text-area/index.cjs +1 -1
  213. package/text-area/index.js +1 -1
  214. package/text-field/index.cjs +1 -1
  215. package/text-field/index.js +1 -1
  216. package/time-picker/index.cjs +1 -1
  217. package/time-picker/index.js +1 -1
  218. package/toggletip/index.cjs +1 -1
  219. package/toggletip/index.js +1 -1
  220. package/tooltip/index.cjs +1 -1
  221. package/tooltip/index.js +1 -1
  222. package/tree-item/index.cjs +1 -1
  223. package/tree-item/index.js +1 -1
  224. package/tree-view/index.cjs +1 -1
  225. package/tree-view/index.js +1 -1
  226. package/video-player/index.cjs +1 -1
  227. package/video-player/index.js +1 -1
  228. package/vivid.api.json +312 -8
  229. package/appearance-ui/index.cjs +0 -102
  230. package/appearance-ui/index.js +0 -100
  231. package/lib/appearance-ui/appearance-ui.d.ts +0 -12
  232. package/lib/appearance-ui/appearance-ui.template.d.ts +0 -4
  233. package/lib/appearance-ui/definition.d.ts +0 -3
  234. package/shared/video-player.cjs +0 -65860
  235. package/shared/video-player.js +0 -65857
@@ -1,12 +1,221 @@
1
1
  'use strict';
2
2
 
3
3
  const index = require('./index.cjs');
4
- const definition = require('./definition63.cjs');
5
- const anchored = require('./anchored.cjs');
4
+ const definition$1 = require('./definition56.cjs');
5
+ const definition = require('./definition64.cjs');
6
+ const definition$2 = require('./definition11.cjs');
7
+ const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
8
+ const index$1 = require('./index2.cjs');
9
+ const scrollIntoView = require('./scrollIntoView.cjs');
10
+ const formAssociated = require('./form-associated.cjs');
11
+ const formElements = require('./form-elements.cjs');
12
+ const trappedFocus = require('./trapped-focus.cjs');
13
+ const localized = require('./localized.cjs');
14
+ const ref = require('./ref.cjs');
15
+ const slotted = require('./slotted.cjs');
6
16
  const when = require('./when.cjs');
17
+ const repeat = require('./repeat.cjs');
7
18
  const classNames = require('./class-names.cjs');
8
19
 
9
- const styles = ":host{display:var(--_popup-display, inline)}:host([slotted-anchor]){--_popup-display: contents}.content-wrapper{width:var(--toggletip-inline-size, auto);padding:16px;max-inline-size:var(--toggletip-max-inline-size, 30ch)}.headline{font:var(--vvd-typography-base-bold)}.action-items{display:flex;justify-content:flex-end;gap:10px}::slotted([slot=action-items]){margin-block-start:16px}";
20
+ const styles = ":host{display:inline-block}.base,.control{inline-size:100%}.dialog{display:inline-flex;flex-direction:column}.dialog .footer{display:flex;align-items:center;justify-content:flex-end;padding:8px;border-top:1px solid var(--vvd-color-neutral-200);gap:8px}.time-pickers{display:flex;overflow:hidden;justify-content:center;padding:4px;block-size:188px;gap:4px}.time-pickers .picker{position:relative;display:flex;overflow:hidden;flex-direction:column;padding:0;border-radius:4px;margin:0;gap:4px;inline-size:50px;list-style:none;scrollbar-width:thin}.time-pickers .picker:hover{overflow-y:auto}.time-pickers .picker:after{display:block;flex-shrink:0;block-size:156px;content:\"\"}.time-pickers .picker:focus-visible{--focus-stroke-gap-color: transparent;--focus-inset: -2px;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}.time-pickers .item{--_connotation-color-primary: var(--vvd-time-picker-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-firm: var(--vvd-time-picker-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-time-picker-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-time-picker-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-dim: var(--vvd-time-picker-accent-dim, var(--vvd-color-neutral-200));--_connotation-color-pale: var(--vvd-time-picker-accent-pale, var(--vvd-color-neutral-300))}.time-pickers .item{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.time-pickers .item:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.time-pickers .item:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.time-pickers .item:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.time-pickers .item:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.time-pickers .item:where(.selected):where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: transparent}.time-pickers .item{display:flex;flex-shrink:0;align-items:center;justify-content:center;border-radius:4px;background-color:var(--_appearance-color-fill);block-size:28px;color:var(--_appearance-color-text);cursor:pointer;font:var(--vvd-typography-base);inline-size:50px}";
21
+
22
+ class _TimePicker extends index.FoundationElement {
23
+ }
24
+ class FormAssociatedTimePicker extends formAssociated.FormAssociated(_TimePicker) {
25
+ constructor() {
26
+ super(...arguments);
27
+ this.proxy = document.createElement("input");
28
+ }
29
+ }
30
+
31
+ const isValidTimeStr = (timeStr) => {
32
+ const parts = timeStr.split(":");
33
+ if (parts.length !== 3) {
34
+ return false;
35
+ }
36
+ const [hours, minutes, seconds] = parts;
37
+ if (hours.length !== 2 || minutes.length !== 2 || seconds.length !== 2) {
38
+ return false;
39
+ }
40
+ const hoursNum = parseInt(hours, 10);
41
+ const minutesNum = parseInt(minutes, 10);
42
+ const secondsNum = parseInt(seconds, 10);
43
+ if (isNaN(hoursNum) || isNaN(minutesNum) || isNaN(secondsNum)) {
44
+ return false;
45
+ }
46
+ if (hoursNum < 0 || hoursNum > 23) {
47
+ return false;
48
+ }
49
+ if (minutesNum < 0 || minutesNum > 59) {
50
+ return false;
51
+ }
52
+ if (secondsNum < 0 || secondsNum > 59) {
53
+ return false;
54
+ }
55
+ return true;
56
+ };
57
+ const parseTimePart = (partStr) => Number.parseInt(partStr, 10);
58
+ const formatTimePart = (part) => part.toString().padStart(2, "0");
59
+ const parseTimeStr = (timeStr) => {
60
+ const [hoursStr, minutesStr, secondsStr] = timeStr.split(":");
61
+ const hours = parseTimePart(hoursStr);
62
+ const minutes = parseTimePart(minutesStr);
63
+ const seconds = parseTimePart(secondsStr);
64
+ return {
65
+ hourStr: hoursStr,
66
+ hours,
67
+ minuteStr: minutesStr,
68
+ minutes,
69
+ secondStr: secondsStr,
70
+ seconds,
71
+ meridiem: hours < 12 ? "AM" : "PM"
72
+ };
73
+ };
74
+ const hoursAs12hClock = (hour) => hour % 12 || 12;
75
+
76
+ const formatPresentationTime = (timeStr, includeSeconds, use12HourClock) => {
77
+ const time = parseTimeStr(timeStr);
78
+ const hoursStr = formatTimePart(
79
+ use12HourClock ? hoursAs12hClock(time.hours) : time.hours
80
+ );
81
+ let result = `${hoursStr}:${time.minuteStr}`;
82
+ if (includeSeconds) {
83
+ result += `:${time.secondStr}`;
84
+ }
85
+ if (use12HourClock) {
86
+ result += ` ${time.meridiem}`;
87
+ }
88
+ return result;
89
+ };
90
+ const isDigit = (char) => char >= "0" && char <= "9";
91
+ const parsePresentationTime = (input, use12HourClock) => {
92
+ const cleanedInput = input.toLowerCase();
93
+ const numerals = [];
94
+ let meridiem;
95
+ for (let i = 0; i < cleanedInput.length; i++) {
96
+ const char = cleanedInput[i];
97
+ if (char === "a" && cleanedInput[i + 1] === "m") {
98
+ i++;
99
+ meridiem = "AM";
100
+ }
101
+ if (char === "p" && cleanedInput[i + 1] === "m") {
102
+ i++;
103
+ meridiem = "PM";
104
+ }
105
+ if (isDigit(char)) {
106
+ let numeral = char;
107
+ while (isDigit(cleanedInput[i + 1])) {
108
+ i++;
109
+ numeral += cleanedInput[i];
110
+ }
111
+ numerals.push(Number.parseInt(numeral, 10));
112
+ }
113
+ }
114
+ if (numerals.length === 0 || numerals.length > 3) {
115
+ throw new Error("Invalid time format");
116
+ }
117
+ if (meridiem && (numerals[0] < 1 || numerals[0] > 12)) {
118
+ throw new Error("Invalid time format");
119
+ }
120
+ if (meridiem || use12HourClock) {
121
+ if (numerals[0] === 12) {
122
+ numerals[0] = 0;
123
+ }
124
+ }
125
+ if (meridiem === "PM") {
126
+ numerals[0] = numerals[0] + 12;
127
+ }
128
+ const [hours, minutes = 0, seconds = 0] = numerals;
129
+ if (hours > 23 || minutes > 59 || seconds > 59) {
130
+ throw new Error("Invalid value");
131
+ }
132
+ return [hours, minutes, seconds].map(formatTimePart).join(":");
133
+ };
134
+
135
+ const fallsIntoMeridiem = (meridiem, hour) => meridiem === "AM" && hour < 12 || meridiem === "PM" && hour >= 12;
136
+ const getHoursOptions = (min, max, forMeridiem) => {
137
+ const result = [];
138
+ const minHour = min ? parseTimeStr(min).hours : 0;
139
+ const maxHour = max ? parseTimeStr(max).hours : 23;
140
+ for (let i = minHour; i <= maxHour; i++) {
141
+ if (forMeridiem && !fallsIntoMeridiem(forMeridiem, i)) {
142
+ continue;
143
+ }
144
+ result.push({
145
+ value: formatTimePart(i),
146
+ label: formatTimePart(forMeridiem ? hoursAs12hClock(i) : i)
147
+ });
148
+ }
149
+ return result;
150
+ };
151
+ const getMinutesOptions = (step, value, min, max) => {
152
+ const result = [];
153
+ let minMinute = 0;
154
+ let maxMinute = 59;
155
+ if (min) {
156
+ const { hourStr: minHourStr, minutes: minMinutes } = parseTimeStr(min);
157
+ if (value && parseTimeStr(value).hourStr === minHourStr) {
158
+ minMinute = minMinutes;
159
+ }
160
+ }
161
+ if (max) {
162
+ const { hourStr: maxHourStr, minutes: maxMinutes } = parseTimeStr(max);
163
+ if (value && parseTimeStr(value).hourStr === maxHourStr) {
164
+ maxMinute = maxMinutes;
165
+ }
166
+ }
167
+ for (let i = minMinute; i <= maxMinute; i += Math.max(1, step ?? 1)) {
168
+ const minutes = formatTimePart(i);
169
+ result.push({
170
+ value: minutes,
171
+ label: minutes
172
+ });
173
+ }
174
+ return result;
175
+ };
176
+ const getSecondsOptions = (step, value, min, max) => {
177
+ const result = [];
178
+ let minSecond = 0;
179
+ let maxSecond = 59;
180
+ if (min) {
181
+ const minTime = parseTimeStr(min);
182
+ if (value && (parseTimeStr(value).hourStr === minTime.hourStr && parseTimeStr(value).minuteStr) === minTime.minuteStr) {
183
+ minSecond = minTime.seconds;
184
+ }
185
+ }
186
+ if (max) {
187
+ const maxTime = parseTimeStr(max);
188
+ if (value && (parseTimeStr(value).hourStr === maxTime.hourStr && parseTimeStr(value).minuteStr) === maxTime.minuteStr) {
189
+ maxSecond = maxTime.seconds;
190
+ }
191
+ }
192
+ for (let i = minSecond; i <= maxSecond; i += Math.max(1, step)) {
193
+ const seconds = formatTimePart(i);
194
+ result.push({
195
+ value: seconds,
196
+ label: seconds
197
+ });
198
+ }
199
+ return result;
200
+ };
201
+ const getMeridiesOptions = (min, max) => {
202
+ const result = [];
203
+ const hideAM = min ? parseTimeStr(min).meridiem === "PM" : false;
204
+ if (!hideAM) {
205
+ result.push({
206
+ value: "AM",
207
+ label: "AM"
208
+ });
209
+ }
210
+ const hidePM = max ? parseTimeStr(max).meridiem === "AM" : false;
211
+ if (!hidePM) {
212
+ result.push({
213
+ value: "PM",
214
+ label: "PM"
215
+ });
216
+ }
217
+ return result;
218
+ };
10
219
 
11
220
  var __defProp = Object.defineProperty;
12
221
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -25,132 +234,630 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
25
234
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
26
235
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
27
236
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
28
- var _ANCHOR_ARIA_LABEL_SUFFIX, _Toggletip_instances, setupAnchor_fn, updateAnchor_fn, cleanupAnchor_fn, _openIfClosed, updateListeners_fn, _closeOnClickOutside, _closeOnEscape;
29
- let Toggletip = class extends index.FoundationElement {
237
+ var _getFocusableEls, _TimePicker_instances, updateValueDueToUserInteraction_fn, _onFocusIn, _onFocusOut, _dismissOnClickOutside, openPopupIfPossible_fn, scrollToItem_fn;
238
+ const ValidTimeFilter = {
239
+ fromView: (value) => {
240
+ if (value && isValidTimeStr(value)) {
241
+ return value;
242
+ }
243
+ return "";
244
+ },
245
+ toView(value) {
246
+ return value;
247
+ }
248
+ };
249
+ let TimePicker = class extends FormAssociatedTimePicker {
30
250
  constructor() {
31
- super(...arguments);
32
- __privateAdd(this, _Toggletip_instances);
33
- __privateAdd(this, _ANCHOR_ARIA_LABEL_SUFFIX, " ; Show more information");
34
- this.alternate = false;
35
- this.placement = "right";
36
- this.open = false;
37
- __privateAdd(this, _openIfClosed, () => {
38
- if (!this.open) index.DOM.queueUpdate(() => this.open = true);
251
+ super();
252
+ __privateAdd(this, _TimePicker_instances);
253
+ this.readOnly = false;
254
+ this.minutesStep = null;
255
+ this.secondsStep = null;
256
+ __privateAdd(this, _getFocusableEls, () => this.shadowRoot.querySelectorAll(`
257
+ .dialog [tabindex="0"],
258
+ .dialog .vwc-button:not(:disabled)
259
+ `));
260
+ __privateAdd(this, _onFocusIn, () => {
261
+ this.$emit("focus", void 0, { bubbles: false });
39
262
  });
40
- __privateAdd(this, _closeOnClickOutside, (e) => {
41
- const clickedOutside = !this.contains(e.target);
42
- const clickedOnAnchor = this._anchorEl?.contains(e.target);
43
- if (clickedOutside || clickedOnAnchor) this.open = false;
263
+ __privateAdd(this, _onFocusOut, () => {
264
+ this.$emit("blur", void 0, { bubbles: false });
44
265
  });
45
- __privateAdd(this, _closeOnEscape, (e) => {
46
- if (e.key === "Escape") this.open = false;
266
+ this._popupOpen = false;
267
+ __privateAdd(this, _dismissOnClickOutside, (event) => {
268
+ if (!this._popupOpen) {
269
+ return;
270
+ }
271
+ const path = event.composedPath();
272
+ const elementsToIgnoreClicksOn = [this._dialogEl, this._clockButtonEl];
273
+ if (!elementsToIgnoreClicksOn.some((element) => path.includes(element))) {
274
+ this._closePopup(false);
275
+ }
47
276
  });
277
+ this._presentationValue = "";
278
+ this.value = "";
279
+ this.min = "";
280
+ this.max = "";
281
+ this.proxy.type = "time";
282
+ this.proxy.step = "1";
48
283
  }
49
- openChanged(oldValue, newValue) {
50
- if (oldValue === void 0) return;
51
- if (newValue) {
52
- this.setAttribute("role", "status");
53
- } else {
54
- this.removeAttribute("role");
284
+ /**
285
+ * @internal
286
+ */
287
+ readOnlyChanged() {
288
+ if (this.proxy instanceof HTMLInputElement) {
289
+ this.proxy.readOnly = this.readOnly;
290
+ this.validate();
55
291
  }
56
- __privateMethod(this, _Toggletip_instances, updateListeners_fn).call(this);
57
- if (this._anchorEl) {
58
- __privateMethod(this, _Toggletip_instances, updateAnchor_fn).call(this, this._anchorEl);
292
+ }
293
+ /**
294
+ * @internal
295
+ */
296
+ minChanged(_, newMin) {
297
+ if (this.proxy instanceof HTMLInputElement) {
298
+ this.proxy.min = newMin;
299
+ this.validate();
300
+ }
301
+ }
302
+ /**
303
+ * @internal
304
+ */
305
+ maxChanged(_, newMax) {
306
+ if (this.proxy instanceof HTMLInputElement) {
307
+ this.proxy.max = newMax;
308
+ this.validate();
309
+ }
310
+ }
311
+ // --- Core ---
312
+ /**
313
+ * @internal
314
+ */
315
+ get _displaySeconds() {
316
+ return this.secondsStep !== null;
317
+ }
318
+ /**
319
+ * @internal
320
+ */
321
+ get _use12hClock() {
322
+ return this.clock ? this.clock === "12h" : this.locale.timePicker.defaultTo12HourClock;
323
+ }
324
+ /**
325
+ * @internal
326
+ */
327
+ valueChanged(previous, next) {
328
+ super.valueChanged(previous, next);
329
+ if (this.value) {
330
+ if (!isValidTimeStr(this.value)) {
331
+ this.value = "";
332
+ return;
333
+ }
334
+ this._presentationValue = formatPresentationTime(
335
+ this.value,
336
+ this._displaySeconds,
337
+ this._use12hClock
338
+ );
339
+ } else {
340
+ this._presentationValue = "";
59
341
  }
60
342
  }
61
343
  connectedCallback() {
62
344
  super.connectedCallback();
63
- __privateMethod(this, _Toggletip_instances, updateListeners_fn).call(this);
345
+ document.addEventListener("click", __privateGet(this, _dismissOnClickOutside));
346
+ this.addEventListener("focusin", __privateGet(this, _onFocusIn));
347
+ this.addEventListener("focusout", __privateGet(this, _onFocusOut));
64
348
  }
65
349
  disconnectedCallback() {
66
350
  super.disconnectedCallback();
67
- __privateMethod(this, _Toggletip_instances, updateListeners_fn).call(this);
351
+ document.removeEventListener("click", __privateGet(this, _dismissOnClickOutside));
352
+ this.removeEventListener("focusin", __privateGet(this, _onFocusIn));
353
+ this.removeEventListener("focusout", __privateGet(this, _onFocusOut));
68
354
  }
69
355
  /**
70
356
  * @internal
71
357
  */
72
- _anchorElChanged(oldValue, newValue) {
73
- if (oldValue) __privateMethod(this, _Toggletip_instances, cleanupAnchor_fn).call(this, oldValue);
74
- if (newValue) __privateMethod(this, _Toggletip_instances, setupAnchor_fn).call(this, newValue);
358
+ _closePopup(restoreFocusToTextField = true) {
359
+ this._popupOpen = false;
360
+ if (restoreFocusToTextField) {
361
+ this._textFieldEl.focus();
362
+ }
363
+ }
364
+ /**
365
+ * On keydown anywhere in the time picker.
366
+ * @internal
367
+ */
368
+ _onBaseKeyDown(event) {
369
+ if (index$1.handleEscapeKeyAndStopPropogation(event)) {
370
+ this._closePopup();
371
+ return false;
372
+ }
373
+ if (this._trappedFocus(event, __privateGet(this, _getFocusableEls))) {
374
+ return false;
375
+ }
376
+ return true;
377
+ }
378
+ /**
379
+ * @internal
380
+ */
381
+ _presentationValueChanged() {
382
+ this.dirtyValue = true;
383
+ this.validate();
384
+ }
385
+ /**
386
+ * @internal
387
+ */
388
+ get _textFieldPlaceholder() {
389
+ let format = "hh:mm";
390
+ if (this._displaySeconds) {
391
+ format += ":ss";
392
+ }
393
+ if (this._use12hClock) {
394
+ format += " aa";
395
+ }
396
+ return format;
397
+ }
398
+ /**
399
+ * @internal
400
+ */
401
+ _onTextFieldInput(event) {
402
+ const textField = event.currentTarget;
403
+ this._presentationValue = textField.value;
404
+ }
405
+ /**
406
+ * @internal
407
+ */
408
+ _onTextFieldChange() {
409
+ if (this._presentationValue === "") {
410
+ __privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, "");
411
+ return;
412
+ }
413
+ try {
414
+ __privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, parsePresentationTime(this._presentationValue, this._use12hClock));
415
+ } catch (_) {
416
+ return;
417
+ }
418
+ }
419
+ // --- Clock button ---
420
+ /**
421
+ * @internal
422
+ */
423
+ get _clockButtonLabel() {
424
+ if (this.value) {
425
+ return this.locale.timePicker.changeTimeLabel(
426
+ formatPresentationTime(
427
+ this.value,
428
+ this._displaySeconds,
429
+ this._use12hClock
430
+ )
431
+ );
432
+ }
433
+ return this.locale.timePicker.chooseTimeLabel;
434
+ }
435
+ /**
436
+ * @internal
437
+ */
438
+ _onClockButtonClick() {
439
+ if (this._popupOpen) {
440
+ this._closePopup();
441
+ } else {
442
+ __privateMethod(this, _TimePicker_instances, openPopupIfPossible_fn).call(this);
443
+ index.DOM.processUpdates();
444
+ if (this._selectedHour) {
445
+ __privateMethod(this, _TimePicker_instances, scrollToItem_fn).call(this, "hours", this._selectedHour, "start");
446
+ }
447
+ if (this._selectedMinute) {
448
+ __privateMethod(this, _TimePicker_instances, scrollToItem_fn).call(this, "minutes", this._selectedMinute, "start");
449
+ }
450
+ if (this._displaySeconds && this._selectedSecond) {
451
+ __privateMethod(this, _TimePicker_instances, scrollToItem_fn).call(this, "seconds", this._selectedSecond, "start");
452
+ }
453
+ if (this._use12hClock && this._selectedMeridiem) {
454
+ __privateMethod(this, _TimePicker_instances, scrollToItem_fn).call(this, "meridies", this._selectedMeridiem, "start");
455
+ }
456
+ __privateGet(this, _getFocusableEls).call(this)[0].focus();
457
+ }
458
+ }
459
+ // --- Pickers ---
460
+ /**
461
+ * @internal
462
+ */
463
+ get _hours() {
464
+ return getHoursOptions(
465
+ this.min,
466
+ this.max,
467
+ this._use12hClock ? this._selectedMeridiem ?? this._meridies[0].value : void 0
468
+ );
469
+ }
470
+ /**
471
+ * @internal
472
+ */
473
+ get _selectedHour() {
474
+ return this.value ? parseTimeStr(this.value).hourStr : void 0;
475
+ }
476
+ /**
477
+ * @internal
478
+ */
479
+ set _selectedHour(value) {
480
+ if (this.value) {
481
+ const { minuteStr, secondStr } = parseTimeStr(this.value);
482
+ this.value = `${value}:${minuteStr}:${secondStr}`;
483
+ } else {
484
+ this.value = `${value}:00:00`;
485
+ }
486
+ }
487
+ /**
488
+ * @internal
489
+ */
490
+ get _minutes() {
491
+ return getMinutesOptions(this.minutesStep, this.value, this.min, this.max);
492
+ }
493
+ /**
494
+ * @internal
495
+ */
496
+ get _selectedMinute() {
497
+ return this.value ? parseTimeStr(this.value).minuteStr : void 0;
498
+ }
499
+ /**
500
+ * @internal
501
+ */
502
+ set _selectedMinute(value) {
503
+ if (this.value) {
504
+ const { hourStr, secondStr } = parseTimeStr(this.value);
505
+ this.value = `${hourStr}:${value}:${secondStr}`;
506
+ } else {
507
+ this.value = `00:${value}:00`;
508
+ }
509
+ }
510
+ /**
511
+ * @internal
512
+ */
513
+ get _seconds() {
514
+ return getSecondsOptions(this.secondsStep, this.value, this.min, this.max);
515
+ }
516
+ /**
517
+ * @internal
518
+ */
519
+ get _selectedSecond() {
520
+ return this.value ? parseTimeStr(this.value).secondStr : void 0;
521
+ }
522
+ /**
523
+ * @internal
524
+ */
525
+ set _selectedSecond(value) {
526
+ if (this.value) {
527
+ const { hourStr, minuteStr } = parseTimeStr(this.value);
528
+ this.value = `${hourStr}:${minuteStr}:${value}`;
529
+ } else {
530
+ this.value = `00:00:${value}`;
531
+ }
532
+ }
533
+ /**
534
+ * @internal
535
+ */
536
+ get _meridies() {
537
+ return getMeridiesOptions(this.min, this.max);
538
+ }
539
+ /**
540
+ * @internal
541
+ */
542
+ get _selectedMeridiem() {
543
+ return this.value ? parseTimeStr(this.value).meridiem : void 0;
544
+ }
545
+ /**
546
+ * @internal
547
+ */
548
+ set _selectedMeridiem(value) {
549
+ if (this.value) {
550
+ const { hours, minuteStr, secondStr } = parseTimeStr(this.value);
551
+ let adjustedHours = hours;
552
+ if (value === "AM" && hours >= 12) {
553
+ adjustedHours -= 12;
554
+ } else if (value === "PM" && hours < 12) {
555
+ adjustedHours += 12;
556
+ }
557
+ this.value = `${formatTimePart(adjustedHours)}:${minuteStr}:${secondStr}`;
558
+ } else {
559
+ if (value === "AM") {
560
+ this.value = "00:00:00";
561
+ } else {
562
+ this.value = "12:00:00";
563
+ }
564
+ }
565
+ }
566
+ /**
567
+ * @internal
568
+ */
569
+ _onPickerKeyDown(picker, options, selectedValue, setSelectedValue, event) {
570
+ const offset = {
571
+ ArrowUp: -1,
572
+ ArrowDown: 1
573
+ }[event.key];
574
+ if (offset) {
575
+ event.preventDefault();
576
+ const index = options.findIndex((h) => h.value === selectedValue);
577
+ const newRawIndex = index === -1 ? 0 : index + offset;
578
+ const newIndex = (newRawIndex + options.length) % options.length;
579
+ const newValue = options[newIndex].value;
580
+ setSelectedValue(newValue);
581
+ __privateMethod(this, _TimePicker_instances, scrollToItem_fn).call(this, picker, newValue, "nearest");
582
+ __privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, this.value);
583
+ }
584
+ return true;
585
+ }
586
+ /**
587
+ * @internal
588
+ */
589
+ _onPickerItemClick(picker, setSelectedValue, value) {
590
+ setSelectedValue(value);
591
+ __privateMethod(this, _TimePicker_instances, scrollToItem_fn).call(this, picker, value, "start");
592
+ __privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, this.value);
593
+ const nextPickerEl = this.shadowRoot.querySelector(
594
+ `#${picker} + .picker`
595
+ );
596
+ if (nextPickerEl) {
597
+ nextPickerEl.focus();
598
+ } else {
599
+ this._closePopup();
600
+ }
601
+ }
602
+ // --- Dialog footer ---
603
+ /**
604
+ * @internal
605
+ */
606
+ _onOkClick() {
607
+ this._closePopup();
608
+ }
609
+ /**
610
+ * @internal
611
+ */
612
+ _onClearClick() {
613
+ __privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, "");
614
+ this._closePopup();
615
+ }
616
+ // --- Validation ---
617
+ /**
618
+ * @internal
619
+ */
620
+ validate() {
621
+ if (this.proxy) {
622
+ this.proxy.setCustomValidity(this._getCustomValidationError() ?? "");
623
+ }
624
+ super.validate(this._textFieldEl?.querySelector("input") ?? void 0);
625
+ }
626
+ /**
627
+ * @internal
628
+ */
629
+ _getCustomValidationError() {
630
+ if (this._isPresentationValueInvalid()) {
631
+ return this.locale.timePicker.invalidTimeError;
632
+ }
633
+ return null;
634
+ }
635
+ /**
636
+ * @internal
637
+ */
638
+ _isPresentationValueInvalid() {
639
+ if (this._presentationValue === "") {
640
+ return false;
641
+ }
642
+ try {
643
+ parsePresentationTime(this._presentationValue, this._use12hClock);
644
+ return false;
645
+ } catch (_) {
646
+ return true;
647
+ }
75
648
  }
76
649
  };
77
- _ANCHOR_ARIA_LABEL_SUFFIX = new WeakMap();
78
- _Toggletip_instances = new WeakSet();
79
- setupAnchor_fn = function(a) {
80
- a.addEventListener("click", __privateGet(this, _openIfClosed), true);
81
- a.ariaLabel = (a.ariaLabel ?? "") + __privateGet(this, _ANCHOR_ARIA_LABEL_SUFFIX);
82
- __privateMethod(this, _Toggletip_instances, updateAnchor_fn).call(this, a);
83
- };
84
- updateAnchor_fn = function(a) {
85
- a.setAttribute("aria-expanded", this.open.toString());
650
+ _getFocusableEls = new WeakMap();
651
+ _TimePicker_instances = new WeakSet();
652
+ updateValueDueToUserInteraction_fn = function(newValue) {
653
+ this.value = newValue;
654
+ this.$emit("change");
655
+ this.$emit("input");
86
656
  };
87
- cleanupAnchor_fn = function(a) {
88
- a.removeEventListener("click", __privateGet(this, _openIfClosed), true);
89
- if (a.ariaLabel)
90
- a.ariaLabel = a.ariaLabel.replace(__privateGet(this, _ANCHOR_ARIA_LABEL_SUFFIX), "");
657
+ _onFocusIn = new WeakMap();
658
+ _onFocusOut = new WeakMap();
659
+ _dismissOnClickOutside = new WeakMap();
660
+ openPopupIfPossible_fn = function() {
661
+ if (!this.readOnly) {
662
+ this._popupOpen = true;
663
+ }
91
664
  };
92
- _openIfClosed = new WeakMap();
93
- updateListeners_fn = function() {
94
- document.removeEventListener("click", __privateGet(this, _closeOnClickOutside));
95
- document.removeEventListener("keydown", __privateGet(this, _closeOnEscape));
96
- if (this.open && this.isConnected) {
97
- document.addEventListener("click", __privateGet(this, _closeOnClickOutside));
98
- document.addEventListener("keydown", __privateGet(this, _closeOnEscape));
665
+ scrollToItem_fn = function(picker, selectedValue, position) {
666
+ const element = this.shadowRoot.querySelector(
667
+ `#${picker}-${selectedValue}`
668
+ );
669
+ if (!element) {
670
+ return;
99
671
  }
672
+ scrollIntoView.scrollIntoView(element, element.parentElement, position);
100
673
  };
101
- _closeOnClickOutside = new WeakMap();
102
- _closeOnEscape = new WeakMap();
674
+ __decorateClass([
675
+ index.attr({ attribute: "readonly", mode: "boolean" })
676
+ ], TimePicker.prototype, "readOnly", 2);
677
+ __decorateClass([
678
+ index.attr({ attribute: "minutes-step", converter: index.nullableNumberConverter })
679
+ ], TimePicker.prototype, "minutesStep", 2);
680
+ __decorateClass([
681
+ index.attr({ attribute: "seconds-step", converter: index.nullableNumberConverter })
682
+ ], TimePicker.prototype, "secondsStep", 2);
103
683
  __decorateClass([
104
684
  index.attr
105
- ], Toggletip.prototype, "headline", 2);
685
+ ], TimePicker.prototype, "clock", 2);
106
686
  __decorateClass([
107
- index.attr({ mode: "boolean" })
108
- ], Toggletip.prototype, "alternate", 2);
687
+ index.attr({ converter: ValidTimeFilter })
688
+ ], TimePicker.prototype, "min", 2);
109
689
  __decorateClass([
110
- index.attr({ mode: "fromView" })
111
- ], Toggletip.prototype, "placement", 2);
690
+ index.attr({ converter: ValidTimeFilter })
691
+ ], TimePicker.prototype, "max", 2);
112
692
  __decorateClass([
113
- index.attr({ mode: "boolean" })
114
- ], Toggletip.prototype, "open", 2);
115
- Toggletip = __decorateClass([
116
- anchored.anchored
117
- ], Toggletip);
693
+ index.observable
694
+ ], TimePicker.prototype, "_popupOpen", 2);
695
+ __decorateClass([
696
+ index.observable
697
+ ], TimePicker.prototype, "_presentationValue", 2);
698
+ TimePicker = __decorateClass([
699
+ formElements.errorText,
700
+ formElements.formElements
701
+ ], TimePicker);
702
+ applyMixinsWithObservables.applyMixinsWithObservables(
703
+ TimePicker,
704
+ localized.Localized,
705
+ formElements.FormElementHelperText,
706
+ trappedFocus.TrappedFocus
707
+ );
118
708
 
119
- const getClasses = (_) => classNames.classNames("control");
120
- const ToggletipTemplate = (context) => {
121
- const popup = context.tagFor(definition.Popup);
122
- const anchorSlotTemplate = anchored.anchorSlotTemplateFactory();
709
+ const renderPicker = (id, getLabel, getSelected, setSelected, getOptions) => {
123
710
  return index.html`
124
- ${anchorSlotTemplate}
125
- <${popup}
126
- class="${getClasses}"
127
- arrow
128
- :anchor="${(x) => x._anchorEl}"
129
- :open="${(x) => x.open}"
130
- ?alternate="${(x) => !x.alternate}"
131
- placement="${(x) => x.placement}"
132
- exportparts="vvd-theme-alternate"
711
+ <ul
712
+ id="${id}"
713
+ class="picker"
714
+ role="listbox"
715
+ tabindex="0"
716
+ aria-label="${getLabel}"
717
+ aria-activedescendant="${(x) => getSelected(x) ? `${id}-${getSelected(x)}` : void 0}"
718
+ @keydown="${(x, c) => x._onPickerKeyDown(
719
+ id,
720
+ getOptions(x),
721
+ getSelected(x),
722
+ setSelected(x),
723
+ c.event
724
+ )}"
133
725
  >
134
- <div class="content-wrapper">
135
- ${when.when(
136
- (x) => x.headline,
137
- index.html`<header class="headline">${(x) => x.headline}</header>`
726
+ ${repeat.repeat(
727
+ getOptions,
728
+ index.html`
729
+ <li
730
+ id="${(x) => `${id}-${x.value}`}"
731
+ class="${(x, c) => classNames.classNames("item", [
732
+ "selected",
733
+ getSelected(c.parent) === x.value
734
+ ])}"
735
+ role="option"
736
+ aria-selected="${(x, c) => getSelected(c.parent) === x.value}"
737
+ @click="${(x, c) => c.parent._onPickerItemClick(id, setSelected(c.parent), x.value)}"
738
+ >
739
+ ${(x) => x.label}
740
+ </li>
741
+ `
138
742
  )}
139
- <slot></slot>
140
- <footer class="action-items"><slot name="action-items"></slot></footer>
141
- </div>
142
- </${popup}>
743
+ </ul>
143
744
  `;
144
745
  };
746
+ const TimePickerTemplate = (context, _) => {
747
+ const popupTag = context.tagFor(definition.Popup);
748
+ const textFieldTag = context.tagFor(definition$1.TextField);
749
+ const buttonTag = context.tagFor(definition$2.Button);
750
+ return index.html`<div class="base" @keydown="${(x, { event }) => x._onBaseKeyDown(event)}">
751
+ <${textFieldTag} id="text-field"
752
+ ${ref.ref("_textFieldEl")}
753
+ class="control"
754
+ label="${(x) => x.label}"
755
+ helper-text="${(x) => x.helperText}"
756
+ error-text="${(x) => x.errorValidationMessage}"
757
+ placeholder="${(x) => x._textFieldPlaceholder}"
758
+ current-value="${(x) => x._presentationValue}"
759
+ ?disabled="${(x) => x.disabled}"
760
+ ?readonly="${(x) => x.readOnly}"
761
+ @input="${(x, c) => x._onTextFieldInput(c.event)}"
762
+ @change="${(x) => x._onTextFieldChange()}"
763
+ >
764
+ <slot
765
+ slot="${(x) => x._helperTextSlottedContent?.length ? "helper-text" : void 0}"
766
+ name="helper-text"
767
+ ${slotted.slotted("_helperTextSlottedContent")}
768
+ ></slot>
769
+ <${buttonTag}
770
+ id="clock-button"
771
+ ${ref.ref("_clockButtonEl")}
772
+ slot="action-items"
773
+ size="condensed"
774
+ icon="clock-line"
775
+ appearance="ghost"
776
+ ?disabled="${(x) => x.disabled || x.readOnly}"
777
+ aria-label="${(x) => x._clockButtonLabel}"
778
+ @click="${(x) => x._onClockButtonClick()}"
779
+ ></${buttonTag}>
780
+ </${textFieldTag}>
781
+ <${popupTag}
782
+ ?open="${(x) => x._popupOpen}"
783
+ :anchor="${(x) => x._textFieldEl}"
784
+ placement="bottom-start"
785
+ class="popup">
786
+ <div class="dialog" role="dialog" ${ref.ref(
787
+ "_dialogEl"
788
+ )} aria-modal="true" aria-label="${(x) => x.locale.timePicker.chooseTimeLabel}">
789
+ <div class="time-pickers">
790
+ ${renderPicker(
791
+ "hours",
792
+ (x) => x.locale.timePicker.hoursLabel,
793
+ (x) => x._selectedHour,
794
+ (x) => (v) => x._selectedHour = v,
795
+ (x) => x._hours
796
+ )}
797
+ ${renderPicker(
798
+ "minutes",
799
+ (x) => x.locale.timePicker.minutesLabel,
800
+ (x) => x._selectedMinute,
801
+ (x) => (v) => x._selectedMinute = v,
802
+ (x) => x._minutes
803
+ )}
804
+ ${when.when(
805
+ (x) => x._displaySeconds,
806
+ renderPicker(
807
+ "seconds",
808
+ (x) => x.locale.timePicker.secondsLabel,
809
+ (x) => x._selectedSecond,
810
+ (x) => (v) => x._selectedSecond = v,
811
+ (x) => x._seconds
812
+ )
813
+ )}
814
+ ${when.when(
815
+ (x) => x._use12hClock,
816
+ renderPicker(
817
+ "meridies",
818
+ (x) => x.locale.timePicker.meridiesLabel,
819
+ (x) => x._selectedMeridiem,
820
+ (x) => (v) => x._selectedMeridiem = v,
821
+ (x) => x._meridies
822
+ )
823
+ )}
824
+ </div>
825
+ <div class="footer">
826
+ <${buttonTag}
827
+ class="vwc-button"
828
+ size="condensed"
829
+ label="${(x) => x.locale.timePicker.clearLabel}"
830
+ @click="${(x) => x._onClearClick()}"
831
+ ></${buttonTag}>
832
+ <${buttonTag}
833
+ class="vwc-button"
834
+ size="condensed"
835
+ appearance="filled"
836
+ label="${(x) => x.locale.timePicker.okLabel}"
837
+ @click="${(x) => x._onOkClick()}"
838
+ ></${buttonTag}>
839
+ </div>
840
+ </div>
841
+ </${popupTag}>
842
+ </div>`;
843
+ };
145
844
 
146
- const toggletipDefinition = Toggletip.compose({
147
- baseName: "toggletip",
148
- template: ToggletipTemplate,
149
- styles
845
+ const timePickerDefinition = TimePicker.compose({
846
+ baseName: "time-picker",
847
+ template: TimePickerTemplate,
848
+ styles,
849
+ shadowOptions: {
850
+ delegatesFocus: true
851
+ }
150
852
  });
151
- const toggletipRegistries = [toggletipDefinition(), ...definition.popupRegistries];
152
- const registerToggletip = index.registerFactory(toggletipRegistries);
853
+ const timePickerRegistries = [
854
+ timePickerDefinition(),
855
+ ...definition$1.textFieldRegistries,
856
+ ...definition.popupRegistries,
857
+ ...definition$2.buttonRegistries
858
+ ];
859
+ const registerTimePicker = index.registerFactory(timePickerRegistries);
153
860
 
154
- exports.registerToggletip = registerToggletip;
155
- exports.toggletipDefinition = toggletipDefinition;
156
- exports.toggletipRegistries = toggletipRegistries;
861
+ exports.registerTimePicker = registerTimePicker;
862
+ exports.timePickerDefinition = timePickerDefinition;
863
+ exports.timePickerRegistries = timePickerRegistries;