@energinet/watt 0.0.1

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 (291) hide show
  1. package/LICENSE +201 -0
  2. package/badge/index.d.ts +17 -0
  3. package/badge/watt-badge.component.d.ts +15 -0
  4. package/breadcrumbs/index.d.ts +17 -0
  5. package/breadcrumbs/watt-breadcrumbs.component.d.ts +23 -0
  6. package/button/index.d.ts +17 -0
  7. package/button/watt-button.component.d.ts +20 -0
  8. package/card/index.d.ts +18 -0
  9. package/card/watt-card-title.component.d.ts +6 -0
  10. package/card/watt-card.component.d.ts +15 -0
  11. package/checkbox/index.d.ts +17 -0
  12. package/checkbox/watt-checkbox.component.d.ts +17 -0
  13. package/chip/index.d.ts +23 -0
  14. package/chip/watt-action-chip.component.d.ts +8 -0
  15. package/chip/watt-chip.component.d.ts +8 -0
  16. package/chip/watt-chip.directive.d.ts +16 -0
  17. package/chip/watt-date-chip.component.d.ts +29 -0
  18. package/chip/watt-date-range-chip.component.d.ts +50 -0
  19. package/chip/watt-filter-chip.component.d.ts +30 -0
  20. package/chip/watt-menu-chip.component.d.ts +30 -0
  21. package/clipboard/index.d.ts +18 -0
  22. package/clipboard/watt-clipboard-intl.service.d.ts +7 -0
  23. package/clipboard/watt-copy-to-clipboard.directive.d.ts +12 -0
  24. package/code/index.d.ts +18 -0
  25. package/code/watt-code.component.d.ts +32 -0
  26. package/code/watt-code.worker.token.d.ts +18 -0
  27. package/core/breakpoints/_breakpoints.import.scss +53 -0
  28. package/core/breakpoints/_include-media.scss +568 -0
  29. package/core/breakpoints/breakpoints-observer.d.ts +39 -0
  30. package/core/breakpoints/breakpoints.d.ts +29 -0
  31. package/core/breakpoints/index.d.ts +18 -0
  32. package/core/color/+storybook/storybook-colors-overview.component.scss +50 -0
  33. package/core/color/color-helper.service.d.ts +12 -0
  34. package/core/color/colors.d.ts +51 -0
  35. package/core/color/index.d.ts +18 -0
  36. package/core/date/dayjs.d.ts +22 -0
  37. package/core/date/index.d.ts +23 -0
  38. package/core/date/watt-danish-datetime.providers.d.ts +1 -0
  39. package/core/date/watt-date-adapter.d.ts +31 -0
  40. package/core/date/watt-date-range.d.ts +25 -0
  41. package/core/date/watt-date.pipe.d.ts +28 -0
  42. package/core/date/watt-format-date.d.ts +11 -0
  43. package/core/date/watt-locale.service.d.ts +13 -0
  44. package/core/styles/@energinet-datahub/watt/_index.scss +52 -0
  45. package/core/styles/@energinet-datahub/watt/_utils.scss +16 -0
  46. package/core/styles/@energinet-datahub/watt/theme/light-theme.scss +71 -0
  47. package/core/styles/@energinet-datahub/watt/theme/material-overwrites/datepicker.scss +69 -0
  48. package/core/styles/@energinet-datahub/watt/theme/material-overwrites/snack-bar.scss +26 -0
  49. package/core/styles/_box-sizing.scss +22 -0
  50. package/core/styles/_chips.scss +22 -0
  51. package/core/styles/_elevation.scss +18 -0
  52. package/core/styles/_hr.scss +20 -0
  53. package/core/styles/_table.scss +89 -0
  54. package/core/styles/_tokens.scss +134 -0
  55. package/core/styles/_tooltip.scss +64 -0
  56. package/core/styles/_variables.scss +106 -0
  57. package/core/styles/_vater.scss +69 -0
  58. package/core/styles/spacing/+storybook/storybook-spacing-overview.component.scss +25 -0
  59. package/core/styles/spacing/_baseline.scss +23 -0
  60. package/core/styles/spacing/_inline.scss +38 -0
  61. package/core/styles/spacing/_inset.scss +61 -0
  62. package/core/styles/spacing/_spacing.import.scss +113 -0
  63. package/core/styles/spacing/_stack.scss +38 -0
  64. package/core/styles/spacing/_variables.scss +14 -0
  65. package/core/styles/spacing/index.scss +18 -0
  66. package/core/styles/typography/+storybook/storybook-typography-overview.component.scss +78 -0
  67. package/core/styles/typography/_rem.scss +24 -0
  68. package/core/styles/typography/_typography.import.scss +195 -0
  69. package/core/styles/typography/index.scss +118 -0
  70. package/data/index.d.ts +20 -0
  71. package/data/watt-data-actions.component.d.ts +5 -0
  72. package/data/watt-data-filters.component.d.ts +5 -0
  73. package/data/watt-data-intl.service.d.ts +15 -0
  74. package/data/watt-data-table.component.d.ts +27 -0
  75. package/datetime-field/index.d.ts +17 -0
  76. package/datetime-field/watt-datetime-field.component.d.ts +39 -0
  77. package/description-list/index.d.ts +17 -0
  78. package/description-list/watt-description-list-item.component.d.ts +27 -0
  79. package/description-list/watt-description-list.component.d.ts +19 -0
  80. package/drawer/index.d.ts +21 -0
  81. package/drawer/watt-drawer-actions.component.d.ts +5 -0
  82. package/drawer/watt-drawer-content.component.d.ts +5 -0
  83. package/drawer/watt-drawer-heading.component.d.ts +5 -0
  84. package/drawer/watt-drawer-topbar.component.d.ts +5 -0
  85. package/drawer/watt-drawer.component.d.ts +61 -0
  86. package/dropdown/index.d.ts +19 -0
  87. package/dropdown/watt-dropdown-option.d.ts +22 -0
  88. package/dropdown/watt-dropdown-value.d.ts +17 -0
  89. package/dropdown/watt-dropdown.component.d.ts +195 -0
  90. package/empty-state/icons/explore.d.ts +5 -0
  91. package/empty-state/icons/no-results.d.ts +5 -0
  92. package/empty-state/icons/power.d.ts +5 -0
  93. package/empty-state/index.d.ts +20 -0
  94. package/empty-state/watt-empty-state.component.d.ts +16 -0
  95. package/expandable-card/index.d.ts +19 -0
  96. package/expandable-card/watt-expandable-card.component.d.ts +34 -0
  97. package/expansion/expansion.component.d.ts +18 -0
  98. package/expansion/index.d.ts +17 -0
  99. package/fesm2022/energinet-watt-badge.mjs +66 -0
  100. package/fesm2022/energinet-watt-badge.mjs.map +1 -0
  101. package/fesm2022/energinet-watt-breadcrumbs.mjs +116 -0
  102. package/fesm2022/energinet-watt-breadcrumbs.mjs.map +1 -0
  103. package/fesm2022/energinet-watt-button.mjs +120 -0
  104. package/fesm2022/energinet-watt-button.mjs.map +1 -0
  105. package/fesm2022/energinet-watt-card.mjs +117 -0
  106. package/fesm2022/energinet-watt-card.mjs.map +1 -0
  107. package/fesm2022/energinet-watt-checkbox.mjs +118 -0
  108. package/fesm2022/energinet-watt-checkbox.mjs.map +1 -0
  109. package/fesm2022/energinet-watt-chip.mjs +760 -0
  110. package/fesm2022/energinet-watt-chip.mjs.map +1 -0
  111. package/fesm2022/energinet-watt-clipboard.mjs +118 -0
  112. package/fesm2022/energinet-watt-clipboard.mjs.map +1 -0
  113. package/fesm2022/energinet-watt-code.mjs +119 -0
  114. package/fesm2022/energinet-watt-code.mjs.map +1 -0
  115. package/fesm2022/energinet-watt-core-breakpoints.mjs +100 -0
  116. package/fesm2022/energinet-watt-core-breakpoints.mjs.map +1 -0
  117. package/fesm2022/energinet-watt-core-color.mjs +127 -0
  118. package/fesm2022/energinet-watt-core-color.mjs.map +1 -0
  119. package/fesm2022/energinet-watt-core-date.mjs +260 -0
  120. package/fesm2022/energinet-watt-core-date.mjs.map +1 -0
  121. package/fesm2022/energinet-watt-data.mjs +286 -0
  122. package/fesm2022/energinet-watt-data.mjs.map +1 -0
  123. package/fesm2022/energinet-watt-datetime-field.mjs +233 -0
  124. package/fesm2022/energinet-watt-datetime-field.mjs.map +1 -0
  125. package/fesm2022/energinet-watt-description-list.mjs +130 -0
  126. package/fesm2022/energinet-watt-description-list.mjs.map +1 -0
  127. package/fesm2022/energinet-watt-drawer.mjs +271 -0
  128. package/fesm2022/energinet-watt-drawer.mjs.map +1 -0
  129. package/fesm2022/energinet-watt-dropdown.mjs +423 -0
  130. package/fesm2022/energinet-watt-dropdown.mjs.map +1 -0
  131. package/fesm2022/energinet-watt-empty-state.mjs +299 -0
  132. package/fesm2022/energinet-watt-empty-state.mjs.map +1 -0
  133. package/fesm2022/energinet-watt-expandable-card.mjs +151 -0
  134. package/fesm2022/energinet-watt-expandable-card.mjs.map +1 -0
  135. package/fesm2022/energinet-watt-expansion.mjs +78 -0
  136. package/fesm2022/energinet-watt-expansion.mjs.map +1 -0
  137. package/fesm2022/energinet-watt-field.mjs +249 -0
  138. package/fesm2022/energinet-watt-field.mjs.map +1 -0
  139. package/fesm2022/energinet-watt-icon-flags.mjs +376 -0
  140. package/fesm2022/energinet-watt-icon-flags.mjs.map +1 -0
  141. package/fesm2022/energinet-watt-icon.mjs +195 -0
  142. package/fesm2022/energinet-watt-icon.mjs.map +1 -0
  143. package/fesm2022/energinet-watt-modal.mjs +260 -0
  144. package/fesm2022/energinet-watt-modal.mjs.map +1 -0
  145. package/fesm2022/energinet-watt-paginator.mjs +164 -0
  146. package/fesm2022/energinet-watt-paginator.mjs.map +1 -0
  147. package/fesm2022/energinet-watt-phone-field.mjs +322 -0
  148. package/fesm2022/energinet-watt-phone-field.mjs.map +1 -0
  149. package/fesm2022/energinet-watt-picker-__shared.mjs +384 -0
  150. package/fesm2022/energinet-watt-picker-__shared.mjs.map +1 -0
  151. package/fesm2022/energinet-watt-picker-datepicker.mjs +430 -0
  152. package/fesm2022/energinet-watt-picker-datepicker.mjs.map +1 -0
  153. package/fesm2022/energinet-watt-picker-timepicker.mjs +394 -0
  154. package/fesm2022/energinet-watt-picker-timepicker.mjs.map +1 -0
  155. package/fesm2022/energinet-watt-progress-tracker.mjs +141 -0
  156. package/fesm2022/energinet-watt-progress-tracker.mjs.map +1 -0
  157. package/fesm2022/energinet-watt-query-params.mjs +95 -0
  158. package/fesm2022/energinet-watt-query-params.mjs.map +1 -0
  159. package/fesm2022/energinet-watt-radio.mjs +125 -0
  160. package/fesm2022/energinet-watt-radio.mjs.map +1 -0
  161. package/fesm2022/energinet-watt-search.mjs +126 -0
  162. package/fesm2022/energinet-watt-search.mjs.map +1 -0
  163. package/fesm2022/energinet-watt-shell.mjs +315 -0
  164. package/fesm2022/energinet-watt-shell.mjs.map +1 -0
  165. package/fesm2022/energinet-watt-slider.mjs +159 -0
  166. package/fesm2022/energinet-watt-slider.mjs.map +1 -0
  167. package/fesm2022/energinet-watt-spinner.mjs +72 -0
  168. package/fesm2022/energinet-watt-spinner.mjs.map +1 -0
  169. package/fesm2022/energinet-watt-stepper.mjs +185 -0
  170. package/fesm2022/energinet-watt-stepper.mjs.map +1 -0
  171. package/fesm2022/energinet-watt-table.mjs +423 -0
  172. package/fesm2022/energinet-watt-table.mjs.map +1 -0
  173. package/fesm2022/energinet-watt-tabs.mjs +254 -0
  174. package/fesm2022/energinet-watt-tabs.mjs.map +1 -0
  175. package/fesm2022/energinet-watt-text-field.mjs +316 -0
  176. package/fesm2022/energinet-watt-text-field.mjs.map +1 -0
  177. package/fesm2022/energinet-watt-textarea-field.mjs +136 -0
  178. package/fesm2022/energinet-watt-textarea-field.mjs.map +1 -0
  179. package/fesm2022/energinet-watt-toast.mjs +174 -0
  180. package/fesm2022/energinet-watt-toast.mjs.map +1 -0
  181. package/fesm2022/energinet-watt-tooltip.mjs +214 -0
  182. package/fesm2022/energinet-watt-tooltip.mjs.map +1 -0
  183. package/fesm2022/energinet-watt-utils-css.mjs +72 -0
  184. package/fesm2022/energinet-watt-utils-css.mjs.map +1 -0
  185. package/fesm2022/energinet-watt-utils-intersection-observer.mjs +83 -0
  186. package/fesm2022/energinet-watt-utils-intersection-observer.mjs.map +1 -0
  187. package/fesm2022/energinet-watt-utils-resize-observer.mjs +144 -0
  188. package/fesm2022/energinet-watt-utils-resize-observer.mjs.map +1 -0
  189. package/fesm2022/energinet-watt-validation-message.mjs +114 -0
  190. package/fesm2022/energinet-watt-validation-message.mjs.map +1 -0
  191. package/fesm2022/energinet-watt-validators.mjs +40 -0
  192. package/fesm2022/energinet-watt-validators.mjs.map +1 -0
  193. package/fesm2022/energinet-watt-vater.mjs +287 -0
  194. package/fesm2022/energinet-watt-vater.mjs.map +1 -0
  195. package/fesm2022/energinet-watt.mjs +47 -0
  196. package/fesm2022/energinet-watt.mjs.map +1 -0
  197. package/field/index.d.ts +20 -0
  198. package/field/watt-field-error.component.d.ts +5 -0
  199. package/field/watt-field-hint.component.d.ts +5 -0
  200. package/field/watt-field-intl.service.d.ts +8 -0
  201. package/field/watt-field.component.d.ts +42 -0
  202. package/icon/flags/index.d.ts +23 -0
  203. package/icon/flags/watt-flag-de.d.ts +5 -0
  204. package/icon/flags/watt-flag-dk.d.ts +5 -0
  205. package/icon/flags/watt-flag-fi.d.ts +5 -0
  206. package/icon/flags/watt-flag-no.d.ts +5 -0
  207. package/icon/flags/watt-flag-pl.d.ts +5 -0
  208. package/icon/flags/watt-flag-se.d.ts +5 -0
  209. package/icon/flags/watt-flag.d.ts +13 -0
  210. package/icon/icon.component.d.ts +20 -0
  211. package/icon/icons.d.ts +82 -0
  212. package/icon/index.d.ts +17 -0
  213. package/index.d.ts +33 -0
  214. package/modal/index.d.ts +18 -0
  215. package/modal/watt-modal.component.d.ts +86 -0
  216. package/modal/watt-modal.service.d.ts +62 -0
  217. package/package.json +237 -0
  218. package/paginator/index.d.ts +18 -0
  219. package/paginator/watt-paginator-intl.service.d.ts +14 -0
  220. package/paginator/watt-paginator.component.d.ts +53 -0
  221. package/phone-field/index.d.ts +18 -0
  222. package/phone-field/watt-phone-field-intl.service.d.ts +14 -0
  223. package/phone-field/watt-phone-field.component.d.ts +75 -0
  224. package/picker/__shared/index.d.ts +19 -0
  225. package/picker/__shared/placeholder-mask/watt-placeholder-mask.component.d.ts +34 -0
  226. package/picker/__shared/watt-picker-base.d.ts +201 -0
  227. package/picker/__shared/watt-picker-value.d.ts +18 -0
  228. package/picker/datepicker/index.d.ts +19 -0
  229. package/picker/datepicker/watt-datepicker-intl.service.d.ts +7 -0
  230. package/picker/datepicker/watt-datepicker.component.d.ts +149 -0
  231. package/picker/timepicker/index.d.ts +17 -0
  232. package/picker/timepicker/maskito-time-range-mask.d.ts +18 -0
  233. package/picker/timepicker/watt-timepicker.component.d.ts +132 -0
  234. package/progress-tracker/index.d.ts +20 -0
  235. package/progress-tracker/watt-progress-tracker-step.component.d.ts +10 -0
  236. package/progress-tracker/watt-progress-tracker.component.d.ts +5 -0
  237. package/query-params/index.d.ts +17 -0
  238. package/query-params/watt-query-params.directive.d.ts +27 -0
  239. package/radio/index.d.ts +17 -0
  240. package/radio/watt-radio.component.d.ts +24 -0
  241. package/search/index.d.ts +17 -0
  242. package/search/watt-search.component.d.ts +31 -0
  243. package/shell/index.d.ts +18 -0
  244. package/shell/nav-list/index.d.ts +18 -0
  245. package/shell/nav-list/watt-expand-on-active-link.directive.d.ts +26 -0
  246. package/shell/nav-list/watt-nav-list-item.component.d.ts +16 -0
  247. package/shell/nav-list/watt-nav-list.component.d.ts +12 -0
  248. package/shell/shell.component.d.ts +28 -0
  249. package/slider/index.d.ts +17 -0
  250. package/slider/watt-slider.component.d.ts +57 -0
  251. package/spinner/index.d.ts +17 -0
  252. package/spinner/watt-spinner.component.d.ts +15 -0
  253. package/stepper/index.d.ts +18 -0
  254. package/stepper/watt-stepper-step.component.d.ts +34 -0
  255. package/stepper/watt-stepper.component.d.ts +40 -0
  256. package/table/index.d.ts +18 -0
  257. package/table/watt-table-data-source.d.ts +37 -0
  258. package/table/watt-table.component.d.ts +239 -0
  259. package/tabs/index.d.ts +26 -0
  260. package/tabs/watt-link-tab.component.d.ts +7 -0
  261. package/tabs/watt-link-tabs.component.d.ts +7 -0
  262. package/tabs/watt-tab.component.d.ts +26 -0
  263. package/tabs/watt-tabs-action.component.d.ts +5 -0
  264. package/tabs/watt-tabs.component.d.ts +36 -0
  265. package/text-field/index.d.ts +17 -0
  266. package/text-field/watt-text-field.component.d.ts +77 -0
  267. package/textarea-field/index.d.ts +17 -0
  268. package/textarea-field/watt-textarea-field.component.d.ts +27 -0
  269. package/toast/index.d.ts +19 -0
  270. package/toast/watt-toast.component.d.ts +47 -0
  271. package/toast/watt-toast.service.d.ts +13 -0
  272. package/tooltip/index.d.ts +17 -0
  273. package/tooltip/watt-tooltip.component.d.ts +47 -0
  274. package/tooltip/watt-tooltip.directive.d.ts +31 -0
  275. package/utils/css/css-custom-properties.service.d.ts +10 -0
  276. package/utils/css/index.d.ts +17 -0
  277. package/utils/intersection-observer/index.d.ts +17 -0
  278. package/utils/intersection-observer/watt-intersection-observer.service.d.ts +21 -0
  279. package/utils/resize-observer/index.d.ts +18 -0
  280. package/utils/resize-observer/watt-resize-observer.directive.d.ts +35 -0
  281. package/utils/resize-observer/watt-resize-observer.service.d.ts +39 -0
  282. package/validation-message/index.d.ts +17 -0
  283. package/validation-message/watt-validation-message.component.d.ts +50 -0
  284. package/validators/index.d.ts +17 -0
  285. package/validators/watt-range.validators.d.ts +23 -0
  286. package/vater/index.d.ts +20 -0
  287. package/vater/types.d.ts +21 -0
  288. package/vater/vater-flex.component.d.ts +19 -0
  289. package/vater/vater-spacer.component.d.ts +5 -0
  290. package/vater/vater-stack.component.d.ts +14 -0
  291. package/vater/vater-utility.directive.d.ts +16 -0
@@ -0,0 +1,394 @@
1
+ import * as i3 from '@angular/cdk/overlay';
2
+ import { OverlayModule } from '@angular/cdk/overlay';
3
+ import * as i0 from '@angular/core';
4
+ import { inject, ElementRef, ChangeDetectorRef, DestroyRef, HostBinding, ViewChild, Input, ViewEncapsulation, Component } from '@angular/core';
5
+ import { NgControl } from '@angular/forms';
6
+ import * as i1 from '@angular/material/datepicker';
7
+ import { MatDatepickerModule } from '@angular/material/datepicker';
8
+ import { MatFormFieldControl } from '@angular/material/form-field';
9
+ import * as i2 from '@angular/material/input';
10
+ import { MatInputModule } from '@angular/material/input';
11
+ import { Subject } from 'rxjs';
12
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
13
+ import { maskitoTimeOptionsGenerator } from '@maskito/kit';
14
+ import { WattButtonComponent } from '@energinet/watt/button';
15
+ import { WattFieldComponent } from '@energinet/watt/field';
16
+ import { WattSliderComponent } from '@energinet/watt/slider';
17
+ import { MASKITO_DEFAULT_OPTIONS } from '@maskito/core';
18
+ import { WattPickerBase, WattPlaceholderMaskComponent } from '@energinet/watt/picker/__shared';
19
+
20
+ //#region License
21
+ /**
22
+ * @license
23
+ * Copyright 2020 Energinet DataHub A/S
24
+ *
25
+ * Licensed under the Apache License, Version 2.0 (the "License2");
26
+ * you may not use this file except in compliance with the License.
27
+ * You may obtain a copy of the License at
28
+ *
29
+ * http://www.apache.org/licenses/LICENSE-2.0
30
+ *
31
+ * Unless required by applicable law or agreed to in writing, software
32
+ * distributed under the License is distributed on an "AS IS" BASIS,
33
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
+ * See the License for the specific language governing permissions and
35
+ * limitations under the License.
36
+ */
37
+ //#endregion
38
+ const TIME_FIXED_CHARACTERS = [':', '.'];
39
+ const SEPARATOR = ' - ';
40
+ function maskitoTimeRangeOptionsGenerator() {
41
+ return {
42
+ ...MASKITO_DEFAULT_OPTIONS,
43
+ mask: [
44
+ ...Array.from('HH:MM').map((char) => (TIME_FIXED_CHARACTERS.includes(char) ? char : /\d/)),
45
+ ...Array.from(SEPARATOR),
46
+ ...Array.from('HH:MM').map((char) => (TIME_FIXED_CHARACTERS.includes(char) ? char : /\d/)),
47
+ ],
48
+ preprocessors: [
49
+ ({ elementState, data }, actionType) => {
50
+ if (actionType !== 'insert' || data.length > 1) {
51
+ return {
52
+ elementState,
53
+ data,
54
+ };
55
+ }
56
+ if (Number.parseInt(data) > 2 && isFirstHourSegment(elementState)) {
57
+ return {
58
+ elementState: {
59
+ selection: elementState.selection,
60
+ value: elementState.value + '0' + data,
61
+ },
62
+ data: '0' + data,
63
+ };
64
+ }
65
+ if (Number.parseInt(data) > 5 &&
66
+ (elementState.value.length === 3 || elementState.value.length === 10)) {
67
+ return {
68
+ elementState: {
69
+ selection: elementState.selection,
70
+ value: elementState.value + '0' + data,
71
+ },
72
+ data: '0' + data,
73
+ };
74
+ }
75
+ return {
76
+ elementState,
77
+ data,
78
+ };
79
+ },
80
+ ],
81
+ overwriteMode: 'replace',
82
+ };
83
+ }
84
+ function isFirstHourSegment(elementState) {
85
+ if (elementState.value.length === 0) {
86
+ return true;
87
+ }
88
+ if (elementState.value.endsWith(SEPARATOR)) {
89
+ return elementState.value.length === 8;
90
+ }
91
+ if (elementState.value.endsWith(' -')) {
92
+ return elementState.value.length === 7;
93
+ }
94
+ if (elementState.value.endsWith(' ')) {
95
+ return elementState.value.length === 6;
96
+ }
97
+ return elementState.value.length === 5;
98
+ }
99
+
100
+ //#region License
101
+ /**
102
+ * @license
103
+ * Copyright 2020 Energinet DataHub A/S
104
+ *
105
+ * Licensed under the Apache License, Version 2.0 (the "License2");
106
+ * you may not use this file except in compliance with the License.
107
+ * You may obtain a copy of the License at
108
+ *
109
+ * http://www.apache.org/licenses/LICENSE-2.0
110
+ *
111
+ * Unless required by applicable law or agreed to in writing, software
112
+ * distributed under the License is distributed on an "AS IS" BASIS,
113
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114
+ * See the License for the specific language governing permissions and
115
+ * limitations under the License.
116
+ */
117
+ //#endregion
118
+ // Constants for working with time intervals
119
+ const minutesInADay = 24 * 60;
120
+ const quartersInADay = minutesInADay / 15;
121
+ // Show slider initially as "00:00 - 23:59"
122
+ const initialSliderValue = { min: 0, max: minutesInADay - 1 };
123
+ /** Converts string time format (HH:MM) to number of minutes. */
124
+ function timeToMinutes(value) {
125
+ const [hours, minutes] = value.split(':');
126
+ return Number(hours) * 60 + Number(minutes);
127
+ }
128
+ /** Converts number of minutes to string time format (HH:MM). */
129
+ function minutesToTime(value) {
130
+ const hours = `${Math.floor(value / 60)}`;
131
+ const minutes = `${value % 60}`;
132
+ return `${hours.padStart(2, '0')}:${minutes.padStart(2, '0')}`;
133
+ }
134
+ /**
135
+ * Usage:
136
+ * `import { WattTimepickerComponent } from '@energinet-datahub/watt/timepicker';`
137
+ *
138
+ * IMPORTANT:
139
+ * The styling is calculated based on our monospaced font.
140
+ */
141
+ class WattTimepickerComponent extends WattPickerBase {
142
+ elementRef = inject(ElementRef);
143
+ changeDetectionRef = inject(ChangeDetectorRef);
144
+ ngControl = inject(NgControl, { optional: true, self: true });
145
+ label = '';
146
+ /**
147
+ * Text to display on label for time range slider.
148
+ */
149
+ sliderLabel = '';
150
+ /**
151
+ * @ignore
152
+ */
153
+ input;
154
+ /**
155
+ * @ignore
156
+ */
157
+ startInput;
158
+ /**
159
+ * @ignore
160
+ */
161
+ endInput;
162
+ /**
163
+ * @ignore
164
+ */
165
+ sliderId = `${this.id}-slider`;
166
+ /**
167
+ * Used for defining a relationship between the time picker and
168
+ * the slider overlay (since the DOM hierarchy cannot be used).
169
+ * @ignore
170
+ */
171
+ get ariaOwns() {
172
+ // Only range input has slider
173
+ return this.range && this.sliderOpen ? this.sliderId : undefined;
174
+ }
175
+ /**
176
+ * @ignore
177
+ */
178
+ hoursMinutesPlaceholder = 'HH:MM';
179
+ /**
180
+ * @ignore
181
+ */
182
+ rangeSeparator = ' - ';
183
+ /**
184
+ * @ignore
185
+ */
186
+ rangePlaceholder = this.hoursMinutesPlaceholder + this.rangeSeparator + this.hoursMinutesPlaceholder;
187
+ /**
188
+ * @ignore
189
+ */
190
+ _placeholder = this.hoursMinutesPlaceholder;
191
+ /**
192
+ * Whether the slider is open.
193
+ * @ignore
194
+ */
195
+ sliderOpen = false;
196
+ /**
197
+ * @ignore
198
+ */
199
+ sliderSteps = [...Array(quartersInADay).keys()].map((x) => x * 15).concat(minutesInADay - 1);
200
+ /**
201
+ * @ignore
202
+ */
203
+ sliderChange$ = new Subject();
204
+ /**
205
+ * @ignore
206
+ */
207
+ get sliderValue() {
208
+ if (this.value?.start && this.value?.end) {
209
+ return {
210
+ min: timeToMinutes(this.value.start),
211
+ max: timeToMinutes(this.value.end),
212
+ };
213
+ }
214
+ // Retain last slider value if input value is incomplete
215
+ return initialSliderValue;
216
+ }
217
+ /**
218
+ * Toggles the visibility of the slider overlay.
219
+ * @ignore
220
+ */
221
+ toggleSlider() {
222
+ this.sliderOpen = !this.sliderOpen;
223
+ }
224
+ /**
225
+ * Override to automatically close the slider overlay on blur.
226
+ * @ignore
227
+ */
228
+ onFocusOut(event) {
229
+ super.onFocusOut(event);
230
+ if (!this.focused)
231
+ this.sliderOpen = false;
232
+ }
233
+ /**
234
+ * @ignore
235
+ */
236
+ inputMask = maskitoTimeOptionsGenerator({ mode: 'HH:MM' });
237
+ /**
238
+ * @ignore
239
+ */
240
+ rangeInputMask = maskitoTimeRangeOptionsGenerator();
241
+ /**
242
+ * @ignore
243
+ */
244
+ destroyRef = inject(DestroyRef);
245
+ constructor() {
246
+ super(`watt-timepicker-${WattTimepickerComponent.nextId++}`);
247
+ }
248
+ /**
249
+ * @ignore
250
+ */
251
+ initSingleInput() {
252
+ if (this.initialValue) {
253
+ this.input.nativeElement.value = this.initialValue;
254
+ this.input.nativeElement.dispatchEvent(new InputEvent('input'));
255
+ }
256
+ }
257
+ /**
258
+ * @ignore
259
+ */
260
+ inputChanged(value) {
261
+ const time = value.slice(0, this.hoursMinutesPlaceholder.length);
262
+ if (time.length === 0) {
263
+ this.control?.setValue(null);
264
+ return;
265
+ }
266
+ if (time.length !== this.hoursMinutesPlaceholder.length) {
267
+ return;
268
+ }
269
+ this.control?.setValue(time);
270
+ }
271
+ /**
272
+ * @ignore
273
+ */
274
+ rangeInputChanged(value) {
275
+ const start = value.slice(0, this.hoursMinutesPlaceholder.length);
276
+ if (start.length !== this.hoursMinutesPlaceholder.length) {
277
+ this.control?.setValue({ start: '', end: '' });
278
+ return;
279
+ }
280
+ if (value.length < this.rangePlaceholder.length) {
281
+ this.control?.setValue({ start, end: '' });
282
+ return;
283
+ }
284
+ let end = value.slice(this.hoursMinutesPlaceholder.length + this.rangeSeparator.length);
285
+ if (timeToMinutes(end) > timeToMinutes(start)) {
286
+ this.control?.setValue({ start, end });
287
+ }
288
+ else {
289
+ end = minutesToTime(timeToMinutes(start) + 1);
290
+ this.setRangeValueAndNotify(start, end);
291
+ }
292
+ }
293
+ /**
294
+ * @ignore
295
+ */
296
+ initRangeInput() {
297
+ if (this.initialValue) {
298
+ const { start, end } = this.initialValue;
299
+ this.setRangeValueAndNotify(start, end);
300
+ }
301
+ else {
302
+ this.control?.setValue({ start: '', end: '' });
303
+ }
304
+ this.sliderChange$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((sliderValue) => {
305
+ const start = minutesToTime(sliderValue.min);
306
+ const end = minutesToTime(sliderValue.max);
307
+ if (end > start) {
308
+ this.setRangeValueAndNotify(start, end);
309
+ }
310
+ });
311
+ }
312
+ /**
313
+ * @ignore
314
+ */
315
+ setRangeValueAndNotify(start, end) {
316
+ this.control?.setValue({ start, end });
317
+ this.input.nativeElement.value = start + this.rangeSeparator + end;
318
+ this.input.nativeElement.dispatchEvent(new InputEvent('input'));
319
+ }
320
+ /**
321
+ * @ignore
322
+ */
323
+ setSingleValue(value, input) {
324
+ input.value = value ?? '';
325
+ }
326
+ /**
327
+ * @ignore
328
+ */
329
+ setRangeValue(value, startInput, endInput) {
330
+ const { start, end } = value;
331
+ if (start) {
332
+ startInput.value = start;
333
+ }
334
+ if (end) {
335
+ endInput.value = end;
336
+ }
337
+ }
338
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattTimepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
339
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattTimepickerComponent, isStandalone: true, selector: "watt-timepicker", inputs: { label: "label", sliderLabel: "sliderLabel" }, host: { properties: { "attr.aria-owns": "this.ariaOwns" } }, providers: [{ provide: MatFormFieldControl, useExisting: WattTimepickerComponent }], viewQueries: [{ propertyName: "input", first: true, predicate: ["timeInput"], descendants: true }, { propertyName: "startInput", first: true, predicate: ["startTimeInput"], descendants: true }, { propertyName: "endInput", first: true, predicate: ["endTimeInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<watt-field [id]=\"id\" [control]=\"control\" [label]=\"label\">\n @if (!range) {\n <input\n inert\n matInput\n aria-label=\"time-input\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [disabled]=\"disabled\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n />\n <input #timeInput class=\"mask-input\" [disabled]=\"disabled\" />\n <watt-placeholder-mask\n [primaryInputElement]=\"timeInput\"\n [mask]=\"inputMask\"\n [placeholder]=\"hoursMinutesPlaceholder\"\n (maskApplied)=\"inputChanged($event)\"\n />\n } @else {\n <mat-date-range-input\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n [disabled]=\"disabled\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n >\n <input\n inert\n aria-label=\"start-time-input\"\n matStartDate\n #startTimeInput\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n <input\n inert\n aria-label=\"end-time-input\"\n matEndDate\n #endTimeInput\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n </mat-date-range-input>\n <input #timeInput class=\"mask-input\" [disabled]=\"disabled\" />\n <watt-placeholder-mask\n [primaryInputElement]=\"timeInput\"\n [mask]=\"rangeInputMask\"\n [placeholder]=\"rangePlaceholder\"\n (maskApplied)=\"rangeInputChanged($event)\"\n />\n\n <watt-button\n variant=\"icon\"\n icon=\"time\"\n [disabled]=\"disabled\"\n [attr.aria-pressed]=\"sliderOpen\"\n (click)=\"toggleSlider()\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n />\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"sliderOpen\"\n [cdkConnectedOverlayOffsetY]=\"12\"\n >\n <div\n [id]=\"sliderId\"\n role=\"dialog\"\n class=\"watt-timepicker-slider\"\n tabindex=\"-1\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n >\n <span class=\"watt-label\">{{ sliderLabel }}</span>\n <watt-slider\n [min]=\"sliderSteps[0]\"\n [max]=\"sliderSteps[sliderSteps.length - 1]\"\n [step]=\"1\"\n [value]=\"sliderValue\"\n (valueChange)=\"sliderChange$.next($event)\"\n />\n </div>\n </ng-template>\n }\n\n <ng-content />\n <ng-content ngProjectAs=\"watt-field-hint\" select=\"watt-field-hint\" />\n <ng-content ngProjectAs=\"watt-field-error\" select=\"watt-field-error\" />\n</watt-field>\n", styles: ["watt-timepicker{display:flex;align-items:center;width:100%}watt-timepicker watt-button[variant=icon]{margin-left:auto}watt-timepicker watt-button[variant=icon] .watt-button--icon{height:42px}watt-timepicker mat-datepicker,watt-timepicker mat-date-range-picker{display:none}watt-timepicker input.mat-date-range-input-inner,watt-timepicker input.mat-mdc-input-element,watt-timepicker .mat-date-range-input-mirror,watt-timepicker input.mask-input{font-family:Droid Sans Mono,monospace}watt-timepicker input.mat-date-range-input-inner,watt-timepicker input.mat-mdc-input-element,watt-timepicker input.mask-input{border:none;caret-color:var(--watt-color-neutral-black);letter-spacing:-.03em;-webkit-background-clip:text;-moz-background-clip:text;background-clip:text;color:transparent}watt-timepicker input.mask-input{color:#000}watt-timepicker input.mask-input{position:absolute;min-width:100%;padding:2px 1px}watt-timepicker input.mask-input:focus-visible{outline:none}watt-timepicker .mat-date-range-input-container{align-items:initial}watt-timepicker .mat-date-range-input-start-wrapper,watt-timepicker .mat-date-range-input-end-wrapper{max-width:calc(50% - var(--watt-space-s));overflow:visible;position:relative}watt-timepicker .mat-date-range-input-separator{display:flex;align-items:center}watt-timepicker .mat-date-range-input-separator-hidden,watt-timepicker .mat-date-range-input-separator{opacity:0!important}watt-timepicker .mat-date-range-input-inner::-webkit-input-placeholder{color:var(--watt-color-neutral-grey-500)!important;-webkit-text-fill-color:var(--watt-color-neutral-grey-500)}.watt-timepicker-slider{width:340px;padding:var(--watt-space-s) 12px var(--watt-space-m);background:var(--watt-color-neutral-white);box-shadow:0 1px 6px #0b3c5d1f,0 4px 18px 3px #2e323414;border-radius:3px}\n"], dependencies: [{ kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i1.MatDateRangeInput, selector: "mat-date-range-input", inputs: ["rangePicker", "required", "dateFilter", "min", "max", "disabled", "separator", "comparisonStart", "comparisonEnd"], exportAs: ["matDateRangeInput"] }, { kind: "directive", type: i1.MatStartDate, selector: "input[matStartDate]", outputs: ["dateChange", "dateInput"] }, { kind: "directive", type: i1.MatEndDate, selector: "input[matEndDate]", outputs: ["dateChange", "dateInput"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i3.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i3.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "component", type: WattButtonComponent, selector: "watt-button", inputs: ["icon", "variant", "type", "formId", "disabled", "loading"] }, { kind: "component", type: WattSliderComponent, selector: "watt-slider", inputs: ["min", "max", "step", "value"], outputs: ["valueChange"] }, { kind: "component", type: WattFieldComponent, selector: "watt-field", inputs: ["control", "label", "id", "chipMode", "tooltip", "placeholder", "anchorName"] }, { kind: "component", type: WattPlaceholderMaskComponent, selector: "watt-placeholder-mask", inputs: ["primaryInputElement", "secondaryInputElement", "mask", "placeholder"], outputs: ["maskApplied"] }], encapsulation: i0.ViewEncapsulation.None });
340
+ }
341
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattTimepickerComponent, decorators: [{
342
+ type: Component,
343
+ args: [{ selector: 'watt-timepicker', providers: [{ provide: MatFormFieldControl, useExisting: WattTimepickerComponent }], encapsulation: ViewEncapsulation.None, imports: [
344
+ MatDatepickerModule,
345
+ MatInputModule,
346
+ OverlayModule,
347
+ WattButtonComponent,
348
+ WattSliderComponent,
349
+ WattFieldComponent,
350
+ WattPlaceholderMaskComponent,
351
+ ], template: "<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<watt-field [id]=\"id\" [control]=\"control\" [label]=\"label\">\n @if (!range) {\n <input\n inert\n matInput\n aria-label=\"time-input\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [disabled]=\"disabled\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n />\n <input #timeInput class=\"mask-input\" [disabled]=\"disabled\" />\n <watt-placeholder-mask\n [primaryInputElement]=\"timeInput\"\n [mask]=\"inputMask\"\n [placeholder]=\"hoursMinutesPlaceholder\"\n (maskApplied)=\"inputChanged($event)\"\n />\n } @else {\n <mat-date-range-input\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n [disabled]=\"disabled\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n >\n <input\n inert\n aria-label=\"start-time-input\"\n matStartDate\n #startTimeInput\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n <input\n inert\n aria-label=\"end-time-input\"\n matEndDate\n #endTimeInput\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n </mat-date-range-input>\n <input #timeInput class=\"mask-input\" [disabled]=\"disabled\" />\n <watt-placeholder-mask\n [primaryInputElement]=\"timeInput\"\n [mask]=\"rangeInputMask\"\n [placeholder]=\"rangePlaceholder\"\n (maskApplied)=\"rangeInputChanged($event)\"\n />\n\n <watt-button\n variant=\"icon\"\n icon=\"time\"\n [disabled]=\"disabled\"\n [attr.aria-pressed]=\"sliderOpen\"\n (click)=\"toggleSlider()\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n />\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"sliderOpen\"\n [cdkConnectedOverlayOffsetY]=\"12\"\n >\n <div\n [id]=\"sliderId\"\n role=\"dialog\"\n class=\"watt-timepicker-slider\"\n tabindex=\"-1\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n >\n <span class=\"watt-label\">{{ sliderLabel }}</span>\n <watt-slider\n [min]=\"sliderSteps[0]\"\n [max]=\"sliderSteps[sliderSteps.length - 1]\"\n [step]=\"1\"\n [value]=\"sliderValue\"\n (valueChange)=\"sliderChange$.next($event)\"\n />\n </div>\n </ng-template>\n }\n\n <ng-content />\n <ng-content ngProjectAs=\"watt-field-hint\" select=\"watt-field-hint\" />\n <ng-content ngProjectAs=\"watt-field-error\" select=\"watt-field-error\" />\n</watt-field>\n", styles: ["watt-timepicker{display:flex;align-items:center;width:100%}watt-timepicker watt-button[variant=icon]{margin-left:auto}watt-timepicker watt-button[variant=icon] .watt-button--icon{height:42px}watt-timepicker mat-datepicker,watt-timepicker mat-date-range-picker{display:none}watt-timepicker input.mat-date-range-input-inner,watt-timepicker input.mat-mdc-input-element,watt-timepicker .mat-date-range-input-mirror,watt-timepicker input.mask-input{font-family:Droid Sans Mono,monospace}watt-timepicker input.mat-date-range-input-inner,watt-timepicker input.mat-mdc-input-element,watt-timepicker input.mask-input{border:none;caret-color:var(--watt-color-neutral-black);letter-spacing:-.03em;-webkit-background-clip:text;-moz-background-clip:text;background-clip:text;color:transparent}watt-timepicker input.mask-input{color:#000}watt-timepicker input.mask-input{position:absolute;min-width:100%;padding:2px 1px}watt-timepicker input.mask-input:focus-visible{outline:none}watt-timepicker .mat-date-range-input-container{align-items:initial}watt-timepicker .mat-date-range-input-start-wrapper,watt-timepicker .mat-date-range-input-end-wrapper{max-width:calc(50% - var(--watt-space-s));overflow:visible;position:relative}watt-timepicker .mat-date-range-input-separator{display:flex;align-items:center}watt-timepicker .mat-date-range-input-separator-hidden,watt-timepicker .mat-date-range-input-separator{opacity:0!important}watt-timepicker .mat-date-range-input-inner::-webkit-input-placeholder{color:var(--watt-color-neutral-grey-500)!important;-webkit-text-fill-color:var(--watt-color-neutral-grey-500)}.watt-timepicker-slider{width:340px;padding:var(--watt-space-s) 12px var(--watt-space-m);background:var(--watt-color-neutral-white);box-shadow:0 1px 6px #0b3c5d1f,0 4px 18px 3px #2e323414;border-radius:3px}\n"] }]
352
+ }], ctorParameters: () => [], propDecorators: { label: [{
353
+ type: Input
354
+ }], sliderLabel: [{
355
+ type: Input
356
+ }], input: [{
357
+ type: ViewChild,
358
+ args: ['timeInput']
359
+ }], startInput: [{
360
+ type: ViewChild,
361
+ args: ['startTimeInput']
362
+ }], endInput: [{
363
+ type: ViewChild,
364
+ args: ['endTimeInput']
365
+ }], ariaOwns: [{
366
+ type: HostBinding,
367
+ args: ['attr.aria-owns']
368
+ }] } });
369
+
370
+ //#region License
371
+ /**
372
+ * @license
373
+ * Copyright 2020 Energinet DataHub A/S
374
+ *
375
+ * Licensed under the Apache License, Version 2.0 (the "License2");
376
+ * you may not use this file except in compliance with the License.
377
+ * You may obtain a copy of the License at
378
+ *
379
+ * http://www.apache.org/licenses/LICENSE-2.0
380
+ *
381
+ * Unless required by applicable law or agreed to in writing, software
382
+ * distributed under the License is distributed on an "AS IS" BASIS,
383
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
384
+ * See the License for the specific language governing permissions and
385
+ * limitations under the License.
386
+ */
387
+ //#endregion
388
+
389
+ /**
390
+ * Generated bundle index. Do not edit.
391
+ */
392
+
393
+ export { WattTimepickerComponent };
394
+ //# sourceMappingURL=energinet-watt-picker-timepicker.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"energinet-watt-picker-timepicker.mjs","sources":["../../../libs/watt/package/picker/timepicker/maskito-time-range-mask.ts","../../../libs/watt/package/picker/timepicker/watt-timepicker.component.ts","../../../libs/watt/package/picker/timepicker/watt-timepicker.component.html","../../../libs/watt/package/picker/timepicker/index.ts","../../../libs/watt/package/picker/timepicker/energinet-watt-picker-timepicker.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { MASKITO_DEFAULT_OPTIONS, MaskitoOptions } from '@maskito/core';\nimport { ElementState } from '@maskito/core/src/lib/types';\n\nconst TIME_FIXED_CHARACTERS = [':', '.'];\n\nconst SEPARATOR = ' - ';\n\nexport function maskitoTimeRangeOptionsGenerator(): Required<MaskitoOptions> {\n return {\n ...MASKITO_DEFAULT_OPTIONS,\n mask: [\n ...Array.from('HH:MM').map((char) => (TIME_FIXED_CHARACTERS.includes(char) ? char : /\\d/)),\n ...Array.from(SEPARATOR),\n ...Array.from('HH:MM').map((char) => (TIME_FIXED_CHARACTERS.includes(char) ? char : /\\d/)),\n ],\n preprocessors: [\n ({ elementState, data }, actionType) => {\n if (actionType !== 'insert' || data.length > 1) {\n return {\n elementState,\n data,\n };\n }\n if (Number.parseInt(data) > 2 && isFirstHourSegment(elementState)) {\n return {\n elementState: {\n selection: elementState.selection,\n value: elementState.value + '0' + data,\n },\n data: '0' + data,\n };\n }\n if (\n Number.parseInt(data) > 5 &&\n (elementState.value.length === 3 || elementState.value.length === 10)\n ) {\n return {\n elementState: {\n selection: elementState.selection,\n value: elementState.value + '0' + data,\n },\n data: '0' + data,\n };\n }\n return {\n elementState,\n data,\n };\n },\n ],\n overwriteMode: 'replace',\n };\n}\nfunction isFirstHourSegment(elementState: ElementState) {\n if (elementState.value.length === 0) {\n return true;\n }\n if (elementState.value.endsWith(SEPARATOR)) {\n return elementState.value.length === 8;\n }\n if (elementState.value.endsWith(' -')) {\n return elementState.value.length === 7;\n }\n if (elementState.value.endsWith(' ')) {\n return elementState.value.length === 6;\n }\n return elementState.value.length === 5;\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { OverlayModule } from '@angular/cdk/overlay';\nimport {\n ChangeDetectorRef,\n Component,\n DestroyRef,\n ElementRef,\n HostBinding,\n Input,\n ViewChild,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { MatDatepickerModule } from '@angular/material/datepicker';\nimport { MatFormFieldControl } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { Subject } from 'rxjs';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { maskitoTimeOptionsGenerator } from '@maskito/kit';\n\nimport { WattButtonComponent } from '@energinet/watt/button';\nimport { WattDateRange } from '@energinet/watt/core/date';\nimport { WattFieldComponent } from '@energinet/watt/field';\nimport { WattSliderComponent, WattSliderValue } from '@energinet/watt/slider';\n\nimport { maskitoTimeRangeOptionsGenerator } from './maskito-time-range-mask';\nimport {\n WattPickerBase,\n WattPickerValue,\n WattPlaceholderMaskComponent,\n} from '@energinet/watt/picker/__shared';\n\n// Constants for working with time intervals\nconst minutesInADay = 24 * 60;\nconst quartersInADay = minutesInADay / 15;\n\n// Show slider initially as \"00:00 - 23:59\"\nconst initialSliderValue: WattSliderValue = { min: 0, max: minutesInADay - 1 };\n\n/** Converts string time format (HH:MM) to number of minutes. */\nfunction timeToMinutes(value: string): number {\n const [hours, minutes] = value.split(':');\n return Number(hours) * 60 + Number(minutes);\n}\n\n/** Converts number of minutes to string time format (HH:MM). */\nfunction minutesToTime(value: number): string {\n const hours = `${Math.floor(value / 60)}`;\n const minutes = `${value % 60}`;\n return `${hours.padStart(2, '0')}:${minutes.padStart(2, '0')}`;\n}\n/**\n * Usage:\n * `import { WattTimepickerComponent } from '@energinet-datahub/watt/timepicker';`\n *\n * IMPORTANT:\n * The styling is calculated based on our monospaced font.\n */\n@Component({\n selector: 'watt-timepicker',\n templateUrl: './watt-timepicker.component.html',\n styleUrls: ['./watt-timepicker.component.scss'],\n providers: [{ provide: MatFormFieldControl, useExisting: WattTimepickerComponent }],\n encapsulation: ViewEncapsulation.None,\n imports: [\n MatDatepickerModule,\n MatInputModule,\n OverlayModule,\n\n WattButtonComponent,\n WattSliderComponent,\n WattFieldComponent,\n WattPlaceholderMaskComponent,\n ],\n})\nexport class WattTimepickerComponent extends WattPickerBase {\n protected override elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n protected override changeDetectionRef = inject(ChangeDetectorRef);\n protected override ngControl = inject(NgControl, { optional: true, self: true });\n @Input() label = '';\n /**\n * Text to display on label for time range slider.\n */\n @Input()\n sliderLabel = '';\n\n /**\n * @ignore\n */\n @ViewChild('timeInput')\n input!: ElementRef;\n\n /**\n * @ignore\n */\n @ViewChild('startTimeInput')\n startInput!: ElementRef;\n\n /**\n * @ignore\n */\n @ViewChild('endTimeInput')\n endInput!: ElementRef;\n\n /**\n * @ignore\n */\n sliderId = `${this.id}-slider`;\n\n /**\n * Used for defining a relationship between the time picker and\n * the slider overlay (since the DOM hierarchy cannot be used).\n * @ignore\n */\n @HostBinding('attr.aria-owns')\n get ariaOwns() {\n // Only range input has slider\n return this.range && this.sliderOpen ? this.sliderId : undefined;\n }\n /**\n * @ignore\n */\n hoursMinutesPlaceholder = 'HH:MM';\n /**\n * @ignore\n */\n rangeSeparator = ' - ';\n /**\n * @ignore\n */\n rangePlaceholder =\n this.hoursMinutesPlaceholder + this.rangeSeparator + this.hoursMinutesPlaceholder;\n /**\n * @ignore\n */\n protected _placeholder = this.hoursMinutesPlaceholder;\n\n /**\n * Whether the slider is open.\n * @ignore\n */\n sliderOpen = false;\n\n /**\n * @ignore\n */\n sliderSteps = [...Array(quartersInADay).keys()].map((x) => x * 15).concat(minutesInADay - 1);\n\n /**\n * @ignore\n */\n sliderChange$ = new Subject<WattSliderValue>();\n\n /**\n * @ignore\n */\n get sliderValue(): WattSliderValue {\n if (this.value?.start && this.value?.end) {\n return {\n min: timeToMinutes(this.value.start),\n max: timeToMinutes(this.value.end),\n };\n }\n\n // Retain last slider value if input value is incomplete\n return initialSliderValue;\n }\n\n /**\n * Toggles the visibility of the slider overlay.\n * @ignore\n */\n toggleSlider() {\n this.sliderOpen = !this.sliderOpen;\n }\n\n /**\n * Override to automatically close the slider overlay on blur.\n * @ignore\n */\n override onFocusOut(event: FocusEvent) {\n super.onFocusOut(event);\n if (!this.focused) this.sliderOpen = false;\n }\n\n /**\n * @ignore\n */\n inputMask = maskitoTimeOptionsGenerator({ mode: 'HH:MM' });\n /**\n * @ignore\n */\n rangeInputMask = maskitoTimeRangeOptionsGenerator();\n /**\n * @ignore\n */\n destroyRef = inject(DestroyRef);\n\n constructor() {\n super(`watt-timepicker-${WattTimepickerComponent.nextId++}`);\n }\n\n /**\n * @ignore\n */\n protected initSingleInput() {\n if (this.initialValue) {\n (this.input.nativeElement as HTMLInputElement).value = this.initialValue as string;\n this.input.nativeElement.dispatchEvent(new InputEvent('input'));\n }\n }\n\n /**\n * @ignore\n */\n inputChanged(value: string) {\n const time = value.slice(0, this.hoursMinutesPlaceholder.length);\n if (time.length === 0) {\n this.control?.setValue(null);\n return;\n }\n if (time.length !== this.hoursMinutesPlaceholder.length) {\n return;\n }\n this.control?.setValue(time);\n }\n\n /**\n * @ignore\n */\n rangeInputChanged(value: string) {\n const start = value.slice(0, this.hoursMinutesPlaceholder.length);\n if (start.length !== this.hoursMinutesPlaceholder.length) {\n this.control?.setValue({ start: '', end: '' });\n return;\n }\n if (value.length < this.rangePlaceholder.length) {\n this.control?.setValue({ start, end: '' });\n return;\n }\n let end = value.slice(this.hoursMinutesPlaceholder.length + this.rangeSeparator.length);\n if (timeToMinutes(end) > timeToMinutes(start)) {\n this.control?.setValue({ start, end });\n } else {\n end = minutesToTime(timeToMinutes(start) + 1);\n this.setRangeValueAndNotify(start, end);\n }\n }\n\n /**\n * @ignore\n */\n protected initRangeInput() {\n if (this.initialValue) {\n const { start, end } = this.initialValue as WattDateRange;\n this.setRangeValueAndNotify(start, end);\n } else {\n this.control?.setValue({ start: '', end: '' });\n }\n this.sliderChange$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((sliderValue) => {\n const start = minutesToTime(sliderValue.min);\n const end = minutesToTime(sliderValue.max);\n if (end > start) {\n this.setRangeValueAndNotify(start, end);\n }\n });\n }\n\n /**\n * @ignore\n */\n setRangeValueAndNotify(start: string, end: string | null) {\n this.control?.setValue({ start, end });\n (this.input.nativeElement as HTMLInputElement).value = start + this.rangeSeparator + end;\n this.input.nativeElement.dispatchEvent(new InputEvent('input'));\n }\n\n /**\n * @ignore\n */\n protected setSingleValue(\n value: Exclude<WattPickerValue, WattDateRange>,\n input: HTMLInputElement\n ) {\n input.value = value ?? '';\n }\n\n /**\n * @ignore\n */\n protected setRangeValue(\n value: WattDateRange,\n startInput: HTMLInputElement,\n endInput: HTMLInputElement\n ) {\n const { start, end } = value;\n\n if (start) {\n startInput.value = start;\n }\n\n if (end) {\n endInput.value = end;\n }\n }\n}\n","<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<watt-field [id]=\"id\" [control]=\"control\" [label]=\"label\">\n @if (!range) {\n <input\n inert\n matInput\n aria-label=\"time-input\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [disabled]=\"disabled\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n />\n <input #timeInput class=\"mask-input\" [disabled]=\"disabled\" />\n <watt-placeholder-mask\n [primaryInputElement]=\"timeInput\"\n [mask]=\"inputMask\"\n [placeholder]=\"hoursMinutesPlaceholder\"\n (maskApplied)=\"inputChanged($event)\"\n />\n } @else {\n <mat-date-range-input\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n [disabled]=\"disabled\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n >\n <input\n inert\n aria-label=\"start-time-input\"\n matStartDate\n #startTimeInput\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n <input\n inert\n aria-label=\"end-time-input\"\n matEndDate\n #endTimeInput\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n </mat-date-range-input>\n <input #timeInput class=\"mask-input\" [disabled]=\"disabled\" />\n <watt-placeholder-mask\n [primaryInputElement]=\"timeInput\"\n [mask]=\"rangeInputMask\"\n [placeholder]=\"rangePlaceholder\"\n (maskApplied)=\"rangeInputChanged($event)\"\n />\n\n <watt-button\n variant=\"icon\"\n icon=\"time\"\n [disabled]=\"disabled\"\n [attr.aria-pressed]=\"sliderOpen\"\n (click)=\"toggleSlider()\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n />\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"sliderOpen\"\n [cdkConnectedOverlayOffsetY]=\"12\"\n >\n <div\n [id]=\"sliderId\"\n role=\"dialog\"\n class=\"watt-timepicker-slider\"\n tabindex=\"-1\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n >\n <span class=\"watt-label\">{{ sliderLabel }}</span>\n <watt-slider\n [min]=\"sliderSteps[0]\"\n [max]=\"sliderSteps[sliderSteps.length - 1]\"\n [step]=\"1\"\n [value]=\"sliderValue\"\n (valueChange)=\"sliderChange$.next($event)\"\n />\n </div>\n </ng-template>\n }\n\n <ng-content />\n <ng-content ngProjectAs=\"watt-field-hint\" select=\"watt-field-hint\" />\n <ng-content ngProjectAs=\"watt-field-error\" select=\"watt-field-error\" />\n</watt-field>\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nexport { WattTimepickerComponent } from './watt-timepicker.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAIA,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;AAExC,MAAM,SAAS,GAAG,KAAK;SAEP,gCAAgC,GAAA;IAC9C,OAAO;AACL,QAAA,GAAG,uBAAuB;AAC1B,QAAA,IAAI,EAAE;AACJ,YAAA,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,MAAM,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AAC1F,YAAA,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;AACxB,YAAA,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,MAAM,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AAC3F,SAAA;AACD,QAAA,aAAa,EAAE;YACb,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,UAAU,KAAI;gBACrC,IAAI,UAAU,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC9C,OAAO;wBACL,YAAY;wBACZ,IAAI;qBACL;;AAEH,gBAAA,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,YAAY,CAAC,EAA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AA,EAAA;wDAMQ,KAAK,EAAA,CAAA;sBAAb;gBAKD,WAAW,EAAA,CAAA;sBADV;gBAOD,KAAK,EAAA,CAAA;sBADJ,SAAS;uBAAC,WAAW;gBAOtB,UAAU,EAAA,CAAA;sBADT,SAAS;uBAAC,gBAAgB;gBAO3B,QAAQ,EAAA,CAAA;sBADP,SAAS;uBAAC,cAAc;gBAcrB,QAAQ,EAAA,CAAA;sBADX,WAAW;uBAAC,gBAAgB;;;AEpI/B;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
@@ -0,0 +1,141 @@
1
+ import * as i0 from '@angular/core';
2
+ import { ViewEncapsulation, ChangeDetectionStrategy, Component, input, computed } from '@angular/core';
3
+ import { VaterStackComponent } from '@energinet/watt/vater';
4
+ import { WattIconComponent } from '@energinet/watt/icon';
5
+ import { WattSpinnerComponent } from '@energinet/watt/spinner';
6
+
7
+ //#region License
8
+ /**
9
+ * @license
10
+ * Copyright 2020 Energinet DataHub A/S
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License2");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ //#endregion
25
+ class WattProgressTrackerComponent {
26
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattProgressTrackerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
27
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: WattProgressTrackerComponent, isStandalone: true, selector: "watt-progress-tracker", ngImport: i0, template: `<vater-stack direction="row"><ng-content /></vater-stack>`, isInline: true, styles: ["watt-progress-tracker{display:block}\n"], dependencies: [{ kind: "component", type: VaterStackComponent, selector: "vater-stack, [vater-stack]", inputs: ["align", "direction", "gap", "justify", "offset"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
28
+ }
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattProgressTrackerComponent, decorators: [{
30
+ type: Component,
31
+ args: [{ imports: [VaterStackComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: 'watt-progress-tracker', template: `<vater-stack direction="row"><ng-content /></vater-stack>`, styles: ["watt-progress-tracker{display:block}\n"] }]
32
+ }] });
33
+
34
+ //#region License
35
+ /**
36
+ * @license
37
+ * Copyright 2020 Energinet DataHub A/S
38
+ *
39
+ * Licensed under the Apache License, Version 2.0 (the "License2");
40
+ * you may not use this file except in compliance with the License.
41
+ * You may obtain a copy of the License at
42
+ *
43
+ * http://www.apache.org/licenses/LICENSE-2.0
44
+ *
45
+ * Unless required by applicable law or agreed to in writing, software
46
+ * distributed under the License is distributed on an "AS IS" BASIS,
47
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
48
+ * See the License for the specific language governing permissions and
49
+ * limitations under the License.
50
+ */
51
+ //#endregion
52
+ class WattProgressTrackerStepComponent {
53
+ status = input.required();
54
+ label = input();
55
+ current = input(false);
56
+ ariaCurrent = computed(() => (this.current() ? 'step' : false));
57
+ class = computed(() => `watt-progress-tracker-step-${this.status()}`);
58
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattProgressTrackerStepComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
59
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattProgressTrackerStepComponent, isStandalone: true, selector: "watt-progress-tracker-step", inputs: { status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, current: { classPropertyName: "current", publicName: "current", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.role": "current() ? \"status\" : \"presentation\"", "attr.class": "class()", "attr.aria-current": "ariaCurrent()", "attr.aria-label": "label()" } }, ngImport: i0, template: `
60
+ <div class="watt-progress-tracker-step-icon">
61
+ @switch (status()) {
62
+ @case ('running') {
63
+ <watt-spinner [diameter]="26" [strokeWidth]="2" />
64
+ }
65
+ @case ('skipped') {
66
+ <watt-icon name="horizontalRule" size="xs" />
67
+ }
68
+ @case ('canceled') {
69
+ <watt-icon name="close" size="xs" />
70
+ }
71
+ @case ('failed') {
72
+ <watt-icon name="priorityHigh" size="xs" />
73
+ }
74
+ @case ('succeeded') {
75
+ <watt-icon name="checkmark" size="xs" />
76
+ }
77
+ }
78
+ </div>
79
+ <div class="watt-progress-tracker-step-text"><ng-content /></div>
80
+ `, isInline: true, styles: [".watt-progress-tracker-step-pending{--watt-progress-tracker-step-text-color: var(--watt-color-neutral-grey-600);--watt-progress-tracker-step-bridge-color: var(--watt-color-neutral-grey-600);--watt-progress-tracker-step-fill-color: transparent}.watt-progress-tracker-step-running{--watt-progress-tracker-step-text-color: var(--watt-color-neutral-grey-900);--watt-progress-tracker-step-bridge-color: var(--watt-color-primary);--watt-progress-tracker-step-fill-color: transparent}.watt-progress-tracker-step-skipped{--watt-progress-tracker-step-text-color: var(--watt-color-neutral-grey-400);--watt-progress-tracker-step-bridge-color: var(--watt-color-neutral-grey-400);--watt-progress-tracker-step-fill-color: transparent}.watt-progress-tracker-step-canceled{--watt-progress-tracker-step-text-color: var(--watt-color-neutral-grey-600);--watt-progress-tracker-step-icon-color: var(--watt-color-neutral-white);--watt-progress-tracker-step-bridge-color: var(--watt-color-neutral-grey-600);--watt-progress-tracker-step-fill-color: var(--watt-color-neutral-grey-600)}.watt-progress-tracker-step-failed{--watt-progress-tracker-step-text-color: var(--watt-color-state-danger);--watt-progress-tracker-step-icon-color: var(--watt-color-neutral-white);--watt-progress-tracker-step-bridge-color: var(--watt-color-state-danger);--watt-progress-tracker-step-fill-color: var(--watt-color-state-danger)}.watt-progress-tracker-step-succeeded{--watt-progress-tracker-step-text-color: var(--watt-color-neutral-grey-900);--watt-progress-tracker-step-icon-color: var(--watt-color-neutral-white);--watt-progress-tracker-step-bridge-color: var(--watt-color-primary);--watt-progress-tracker-step-fill-color: var(--watt-color-primary)}watt-progress-tracker-step{display:contents;--watt-progress-tracker-step-icon-color: var(--watt-progress-tracker-step-text-color)}watt-progress-tracker-step:not(:first-child):before{content:\"\";display:block;width:100%;min-width:var(--watt-space-m);height:1px;margin:0 var(--watt-space-s);background-color:var(--watt-progress-tracker-step-bridge-color)}.watt-progress-tracker-step-icon{display:flex;align-items:center;justify-content:center;width:var(--watt-space-ml);height:var(--watt-space-ml);min-width:var(--watt-space-ml);min-height:var(--watt-space-ml);border-radius:50%;border:1px solid var(--watt-progress-tracker-step-bridge-color);background-color:var(--watt-progress-tracker-step-fill-color)}.watt-progress-tracker-step-icon watt-icon{color:var(--watt-progress-tracker-step-icon-color)}.watt-progress-tracker-step-running .watt-progress-tracker-step-icon{border:none}.watt-progress-tracker-step-text{color:var(--watt-typography-headline-color);font-size:1rem;line-height:1.5rem;font-weight:600;text-transform:none;letter-spacing:0;margin-left:var(--watt-space-s);color:var(--watt-progress-tracker-step-text-color);white-space:nowrap}\n"], dependencies: [{ kind: "component", type: WattIconComponent, selector: "watt-icon", inputs: ["name", "label", "size", "state"] }, { kind: "component", type: WattSpinnerComponent, selector: "watt-spinner", inputs: ["diameter", "strokeWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
81
+ }
82
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattProgressTrackerStepComponent, decorators: [{
83
+ type: Component,
84
+ args: [{ imports: [WattIconComponent, WattSpinnerComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: 'watt-progress-tracker-step', host: {
85
+ '[attr.role]': 'current() ? "status" : "presentation"',
86
+ '[attr.class]': 'class()',
87
+ '[attr.aria-current]': 'ariaCurrent()',
88
+ '[attr.aria-label]': 'label()',
89
+ }, template: `
90
+ <div class="watt-progress-tracker-step-icon">
91
+ @switch (status()) {
92
+ @case ('running') {
93
+ <watt-spinner [diameter]="26" [strokeWidth]="2" />
94
+ }
95
+ @case ('skipped') {
96
+ <watt-icon name="horizontalRule" size="xs" />
97
+ }
98
+ @case ('canceled') {
99
+ <watt-icon name="close" size="xs" />
100
+ }
101
+ @case ('failed') {
102
+ <watt-icon name="priorityHigh" size="xs" />
103
+ }
104
+ @case ('succeeded') {
105
+ <watt-icon name="checkmark" size="xs" />
106
+ }
107
+ }
108
+ </div>
109
+ <div class="watt-progress-tracker-step-text"><ng-content /></div>
110
+ `, styles: [".watt-progress-tracker-step-pending{--watt-progress-tracker-step-text-color: var(--watt-color-neutral-grey-600);--watt-progress-tracker-step-bridge-color: var(--watt-color-neutral-grey-600);--watt-progress-tracker-step-fill-color: transparent}.watt-progress-tracker-step-running{--watt-progress-tracker-step-text-color: var(--watt-color-neutral-grey-900);--watt-progress-tracker-step-bridge-color: var(--watt-color-primary);--watt-progress-tracker-step-fill-color: transparent}.watt-progress-tracker-step-skipped{--watt-progress-tracker-step-text-color: var(--watt-color-neutral-grey-400);--watt-progress-tracker-step-bridge-color: var(--watt-color-neutral-grey-400);--watt-progress-tracker-step-fill-color: transparent}.watt-progress-tracker-step-canceled{--watt-progress-tracker-step-text-color: var(--watt-color-neutral-grey-600);--watt-progress-tracker-step-icon-color: var(--watt-color-neutral-white);--watt-progress-tracker-step-bridge-color: var(--watt-color-neutral-grey-600);--watt-progress-tracker-step-fill-color: var(--watt-color-neutral-grey-600)}.watt-progress-tracker-step-failed{--watt-progress-tracker-step-text-color: var(--watt-color-state-danger);--watt-progress-tracker-step-icon-color: var(--watt-color-neutral-white);--watt-progress-tracker-step-bridge-color: var(--watt-color-state-danger);--watt-progress-tracker-step-fill-color: var(--watt-color-state-danger)}.watt-progress-tracker-step-succeeded{--watt-progress-tracker-step-text-color: var(--watt-color-neutral-grey-900);--watt-progress-tracker-step-icon-color: var(--watt-color-neutral-white);--watt-progress-tracker-step-bridge-color: var(--watt-color-primary);--watt-progress-tracker-step-fill-color: var(--watt-color-primary)}watt-progress-tracker-step{display:contents;--watt-progress-tracker-step-icon-color: var(--watt-progress-tracker-step-text-color)}watt-progress-tracker-step:not(:first-child):before{content:\"\";display:block;width:100%;min-width:var(--watt-space-m);height:1px;margin:0 var(--watt-space-s);background-color:var(--watt-progress-tracker-step-bridge-color)}.watt-progress-tracker-step-icon{display:flex;align-items:center;justify-content:center;width:var(--watt-space-ml);height:var(--watt-space-ml);min-width:var(--watt-space-ml);min-height:var(--watt-space-ml);border-radius:50%;border:1px solid var(--watt-progress-tracker-step-bridge-color);background-color:var(--watt-progress-tracker-step-fill-color)}.watt-progress-tracker-step-icon watt-icon{color:var(--watt-progress-tracker-step-icon-color)}.watt-progress-tracker-step-running .watt-progress-tracker-step-icon{border:none}.watt-progress-tracker-step-text{color:var(--watt-typography-headline-color);font-size:1rem;line-height:1.5rem;font-weight:600;text-transform:none;letter-spacing:0;margin-left:var(--watt-space-s);color:var(--watt-progress-tracker-step-text-color);white-space:nowrap}\n"] }]
111
+ }] });
112
+
113
+ //#region License
114
+ /**
115
+ * @license
116
+ * Copyright 2020 Energinet DataHub A/S
117
+ *
118
+ * Licensed under the Apache License, Version 2.0 (the "License2");
119
+ * you may not use this file except in compliance with the License.
120
+ * You may obtain a copy of the License at
121
+ *
122
+ * http://www.apache.org/licenses/LICENSE-2.0
123
+ *
124
+ * Unless required by applicable law or agreed to in writing, software
125
+ * distributed under the License is distributed on an "AS IS" BASIS,
126
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
127
+ * See the License for the specific language governing permissions and
128
+ * limitations under the License.
129
+ */
130
+ //#endregion
131
+ const WATT_PROGRESS_TRACKER = [
132
+ WattProgressTrackerComponent,
133
+ WattProgressTrackerStepComponent,
134
+ ];
135
+
136
+ /**
137
+ * Generated bundle index. Do not edit.
138
+ */
139
+
140
+ export { WATT_PROGRESS_TRACKER, WattProgressTrackerComponent, WattProgressTrackerStepComponent };
141
+ //# sourceMappingURL=energinet-watt-progress-tracker.mjs.map