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