@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,568 @@
1
+ // _ _ _ _ _
2
+ // (_) | | | | | (_)
3
+ // _ _ __ ___| |_ _ __| | ___ _ __ ___ ___ __| |_ __ _
4
+ // | | '_ \ / __| | | | |/ _` |/ _ \ | '_ ` _ \ / _ \/ _` | |/ _` |
5
+ // | | | | | (__| | |_| | (_| | __/ | | | | | | __/ (_| | | (_| |
6
+ // |_|_| |_|\___|_|\__,_|\__,_|\___| |_| |_| |_|\___|\__,_|_|\__,_|
7
+ //
8
+ // Simple, elegant and maintainable media queries in Sass
9
+ // v2.0.0
10
+ //
11
+ // https://eduardoboucas.github.io/include-media
12
+ //
13
+ // Authors: Eduardo Boucas (@eduardoboucas)
14
+ // Kitty Giraudel (@kittygiraudel)
15
+ //
16
+ // This project is licensed under the terms of the MIT license
17
+ @charset "UTF-8";
18
+
19
+ ////
20
+ /// include-media library public configuration
21
+ /// @author Eduardo Boucas
22
+ /// @access public
23
+ ////
24
+ @use "sass:math";
25
+ @use "sass:map";
26
+ @use "sass:list";
27
+ @use "sass:string";
28
+ @use "sass:meta";
29
+
30
+ ///
31
+ /// Creates a list of global breakpoints
32
+ ///
33
+ /// @example scss - Creates a single breakpoint with the label `phone`
34
+ /// $breakpoints: ('phone': 320px);
35
+ ///
36
+ $breakpoints: (
37
+ "phone": 320px,
38
+ "tablet": 768px,
39
+ "desktop": 1024px,
40
+ ) !default;
41
+
42
+ ///
43
+ /// Creates a list of static expressions or media types
44
+ ///
45
+ /// @example scss - Creates a single media type (screen)
46
+ /// $media-expressions: ('screen': 'screen');
47
+ ///
48
+ /// @example scss - Creates a static expression with logical disjunction (OR operator)
49
+ /// $media-expressions: (
50
+ /// 'retina2x': '(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)'
51
+ /// );
52
+ ///
53
+ $media-expressions: (
54
+ "screen": "screen",
55
+ "print": "print",
56
+ "handheld": "handheld",
57
+ "landscape": "(orientation: landscape)",
58
+ "portrait": "(orientation: portrait)",
59
+ "retina2x":
60
+ "(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 2dppx)",
61
+ "retina3x":
62
+ "(-webkit-min-device-pixel-ratio: 3), (min-resolution: 350dpi), (min-resolution: 3dppx)",
63
+ ) !default;
64
+
65
+ ///
66
+ /// Defines a number to be added or subtracted from each unit when declaring breakpoints with exclusive intervals
67
+ ///
68
+ /// @example scss - Interval for pixels is defined as `1` by default
69
+ /// @include media('>128px') {}
70
+ ///
71
+ /// /* Generates: */
72
+ /// @media (min-width: 129px) {}
73
+ ///
74
+ /// @example scss - Interval for ems is defined as `0.01` by default
75
+ /// @include media('>20em') {}
76
+ ///
77
+ /// /* Generates: */
78
+ /// @media (min-width: 20.01em) {}
79
+ ///
80
+ /// @example scss - Interval for rems is defined as `0.1` by default, to be used with `font-size: 62.5%;`
81
+ /// @include media('>2.0rem') {}
82
+ ///
83
+ /// /* Generates: */
84
+ /// @media (min-width: 2.1rem) {}
85
+ ///
86
+ $unit-intervals: (
87
+ "px": 1,
88
+ "em": 0.01,
89
+ "rem": 0.1,
90
+ "": 0,
91
+ ) !default;
92
+
93
+ ///
94
+ /// Defines whether support for media queries is available, useful for creating separate stylesheets
95
+ /// for browsers that don't support media queries.
96
+ ///
97
+ /// @example scss - Disables support for media queries
98
+ /// $im-media-support: false;
99
+ /// @include media('>=tablet') {
100
+ /// .foo {
101
+ /// color: tomato;
102
+ /// }
103
+ /// }
104
+ ///
105
+ /// /* Generates: */
106
+ /// .foo {
107
+ /// color: tomato;
108
+ /// }
109
+ ///
110
+ $im-media-support: true !default;
111
+
112
+ ///
113
+ /// Selects which breakpoint to emulate when support for media queries is disabled. Media queries that start at or
114
+ /// intercept the breakpoint will be displayed, any others will be ignored.
115
+ ///
116
+ /// @example scss - This media query will show because it intercepts the static breakpoint
117
+ /// $im-media-support: false;
118
+ /// $im-no-media-breakpoint: 'desktop';
119
+ /// @include media('>=tablet') {
120
+ /// .foo {
121
+ /// color: tomato;
122
+ /// }
123
+ /// }
124
+ ///
125
+ /// /* Generates: */
126
+ /// .foo {
127
+ /// color: tomato;
128
+ /// }
129
+ ///
130
+ /// @example scss - This media query will NOT show because it does not intercept the desktop breakpoint
131
+ /// $im-media-support: false;
132
+ /// $im-no-media-breakpoint: 'tablet';
133
+ /// @include media('>=desktop') {
134
+ /// .foo {
135
+ /// color: tomato;
136
+ /// }
137
+ /// }
138
+ ///
139
+ /// /* No output */
140
+ ///
141
+ $im-no-media-breakpoint: "desktop" !default;
142
+
143
+ ///
144
+ /// Selects which media expressions are allowed in an expression for it to be used when media queries
145
+ /// are not supported.
146
+ ///
147
+ /// @example scss - This media query will show because it intercepts the static breakpoint and contains only accepted media expressions
148
+ /// $im-media-support: false;
149
+ /// $im-no-media-breakpoint: 'desktop';
150
+ /// $im-no-media-expressions: ('screen');
151
+ /// @include media('>=tablet', 'screen') {
152
+ /// .foo {
153
+ /// color: tomato;
154
+ /// }
155
+ /// }
156
+ ///
157
+ /// /* Generates: */
158
+ /// .foo {
159
+ /// color: tomato;
160
+ /// }
161
+ ///
162
+ /// @example scss - This media query will NOT show because it intercepts the static breakpoint but contains a media expression that is not accepted
163
+ /// $im-media-support: false;
164
+ /// $im-no-media-breakpoint: 'desktop';
165
+ /// $im-no-media-expressions: ('screen');
166
+ /// @include media('>=tablet', 'retina2x') {
167
+ /// .foo {
168
+ /// color: tomato;
169
+ /// }
170
+ /// }
171
+ ///
172
+ /// /* No output */
173
+ ///
174
+ $im-no-media-expressions: ("screen", "portrait", "landscape") !default;
175
+
176
+ ////
177
+ /// Determines whether a list of conditions is intercepted by the static breakpoint.
178
+ /// @access private
179
+ ////
180
+
181
+ ///
182
+ /// Determines whether a list of conditions is intercepted by the static breakpoint.
183
+ ///
184
+ /// @param {Arglist} $conditions - Media query conditions
185
+ ///
186
+ /// @return {Boolean} - Returns true if the conditions are intercepted by the static breakpoint
187
+ ///
188
+ @function im-intercepts-static-breakpoint($conditions...) {
189
+ $no-media-breakpoint-value: map.get($breakpoints, $im-no-media-breakpoint);
190
+
191
+ @if not $no-media-breakpoint-value {
192
+ @error '#{$im-no-media-breakpoint}` is not a valid breakpoint.';
193
+ }
194
+
195
+ @each $condition in $conditions {
196
+ @if not map.has-key($media-expressions, $condition) {
197
+ $operator: get-expression-operator($condition);
198
+ $prefix: get-expression-prefix($operator);
199
+ $value: get-expression-value($condition, $operator);
200
+
201
+ @if ($prefix == "max" and $value <= $no-media-breakpoint-value) or
202
+ ($prefix == "min" and $value > $no-media-breakpoint-value)
203
+ {
204
+ @return false;
205
+ }
206
+ } @else if not list.index($im-no-media-expressions, $condition) {
207
+ @return false;
208
+ }
209
+ }
210
+
211
+ @return true;
212
+ }
213
+
214
+ ////
215
+ /// Parsing engine
216
+ /// @author Kitty Giraudel
217
+ /// @access private
218
+ ////
219
+
220
+ ///
221
+ /// Get operator of an expression
222
+ ///
223
+ /// @param {String} $expression - Expression to extract operator from
224
+ ///
225
+ /// @return {String} - Any of `>=`, `>`, `<=`, `<`, `≥`, `≤`
226
+ ///
227
+ @function get-expression-operator($expression) {
228
+ @each $operator in (">=", ">", "<=", "<", "≥", "≤") {
229
+ @if string.index($expression, $operator) {
230
+ @return $operator;
231
+ }
232
+ }
233
+
234
+ @error 'No operator found in `#{$expression}`.';
235
+ }
236
+
237
+ ///
238
+ /// Get dimension of an expression, based on a found operator
239
+ ///
240
+ /// @param {String} $expression - Expression to extract dimension from
241
+ /// @param {String} $operator - Operator from `$expression`
242
+ ///
243
+ /// @return {String} - `width` or `height` (or potentially anything else)
244
+ ///
245
+ @function get-expression-dimension($expression, $operator) {
246
+ $operator-index: string.index($expression, $operator);
247
+ $parsed-dimension: string.slice($expression, 0, $operator-index - 1);
248
+ $parsed-dimension: str-trim($parsed-dimension);
249
+ $dimension: "width";
250
+
251
+ @if string.length($parsed-dimension) > 0 {
252
+ $dimension: $parsed-dimension;
253
+ }
254
+
255
+ @return $dimension;
256
+ }
257
+
258
+ ///
259
+ /// Get dimension prefix based on an operator
260
+ ///
261
+ /// @param {String} $operator - Operator
262
+ ///
263
+ /// @return {String} - `min` or `max`
264
+ ///
265
+ @function get-expression-prefix($operator) {
266
+ @return if(list.index(("<", "<=", "≤"), $operator), "max", "min");
267
+ }
268
+
269
+ ///
270
+ /// Get value of an expression, based on a found operator
271
+ ///
272
+ /// @param {String} $expression - Expression to extract value from
273
+ /// @param {String} $operator - Operator from `$expression`
274
+ ///
275
+ /// @return {Number} - A numeric value
276
+ ///
277
+ @function get-expression-value($expression, $operator) {
278
+ $operator-index: string.index($expression, $operator);
279
+ $value: string.slice($expression, $operator-index + string.length($operator));
280
+ $trimmedValue: str-trim($value);
281
+
282
+ @if map.has-key($breakpoints, $trimmedValue) {
283
+ $value: map.get($breakpoints, $trimmedValue);
284
+ } @else {
285
+ $value: to-number($trimmedValue);
286
+ }
287
+
288
+ $interval: map.get($unit-intervals, math.unit($value));
289
+
290
+ @if not $interval {
291
+ @error 'Unknown unit `#{math.unit($value)}`.';
292
+ }
293
+
294
+ @if $operator == ">" {
295
+ $value: $value + $interval;
296
+ } @else if $operator == "<" {
297
+ $value: $value - $interval;
298
+ }
299
+
300
+ @return $value;
301
+ }
302
+
303
+ ///
304
+ /// Parse an expression to return a valid media-query expression
305
+ ///
306
+ /// @param {String} $expression - Expression to parse
307
+ ///
308
+ /// @return {String} - Valid media query
309
+ ///
310
+ @function parse-expression($expression) {
311
+ // If it is part of $media-expressions, it has no operator
312
+ // then there is no need to go any further, just return the value
313
+ @if map.has-key($media-expressions, $expression) {
314
+ @return map.get($media-expressions, $expression);
315
+ }
316
+
317
+ $operator: get-expression-operator($expression);
318
+ $dimension: get-expression-dimension($expression, $operator);
319
+ $prefix: get-expression-prefix($operator);
320
+ $value: get-expression-value($expression, $operator);
321
+
322
+ @return "(#{$prefix}-#{$dimension}: #{$value})";
323
+ }
324
+
325
+ ///
326
+ /// Slice `$list` between `$start` and `$end` indexes
327
+ ///
328
+ /// @access private
329
+ ///
330
+ /// @param {List} $list - List to slice
331
+ /// @param {Number} $start [1] - Start index
332
+ /// @param {Number} $end [length($list)] - End index
333
+ ///
334
+ /// @return {List} Sliced list
335
+ ///
336
+ @function slice($list, $start: 1, $end: list.length($list)) {
337
+ @if list.length($list) < 1 or $start > $end {
338
+ @return ();
339
+ }
340
+
341
+ $result: ();
342
+
343
+ @for $i from $start through $end {
344
+ $result: list.append($result, list.nth($list, $i), comma);
345
+ }
346
+
347
+ @return $result;
348
+ }
349
+
350
+ ////
351
+ /// String to number converter
352
+ /// @author Kitty Giraudel
353
+ /// @access private
354
+ ////
355
+
356
+ ///
357
+ /// Casts a string into a number
358
+ ///
359
+ /// @param {String | Number} $value - Value to be parsed
360
+ ///
361
+ /// @return {Number}
362
+ ///
363
+
364
+ @function to-number($value) {
365
+ @if meta.type-of($value) == "number" {
366
+ @return $value;
367
+ } @else if meta.type-of($value) != "string" {
368
+ @error 'Value for `to-number` should be a number or a string.';
369
+ }
370
+
371
+ $first-character: string.slice($value, 1, 1);
372
+ $result: 0;
373
+ $digits: 0;
374
+ $minus: ($first-character == "-");
375
+ $numbers: (
376
+ "0": 0,
377
+ "1": 1,
378
+ "2": 2,
379
+ "3": 3,
380
+ "4": 4,
381
+ "5": 5,
382
+ "6": 6,
383
+ "7": 7,
384
+ "8": 8,
385
+ "9": 9,
386
+ );
387
+
388
+ // Remove +/- sign if present at first character
389
+ @if ($first-character == "+" or $first-character == "-") {
390
+ $value: string.slice($value, 2);
391
+ }
392
+
393
+ @for $i from 1 through string.length($value) {
394
+ $character: string.slice($value, $i, $i);
395
+
396
+ @if not(list.index(map.keys($numbers), $character) or $character == ".") {
397
+ @return to-length(if($minus, -$result, $result), string.slice($value, $i));
398
+ }
399
+
400
+ @if $character == "." {
401
+ $digits: 1;
402
+ } @else if $digits == 0 {
403
+ $result: $result * 10 + map.get($numbers, $character);
404
+ } @else {
405
+ $digits: $digits * 10;
406
+ $result: $result + math.div(map.get($numbers, $character), $digits);
407
+ }
408
+ }
409
+
410
+ @return if($minus, -$result, $result);
411
+ }
412
+
413
+ ///
414
+ /// Add `$unit` to `$value`
415
+ ///
416
+ /// @param {Number} $value - Value to add unit to
417
+ /// @param {String} $unit - String representation of the unit
418
+ ///
419
+ /// @return {Number} - `$value` expressed in `$unit`
420
+ ///
421
+ @function to-length($value, $unit) {
422
+ $units: (
423
+ "px": 1px,
424
+ "cm": 1cm,
425
+ "mm": 1mm,
426
+ "%": 1%,
427
+ "ch": 1ch,
428
+ "pc": 1pc,
429
+ "in": 1in,
430
+ "em": 1em,
431
+ "rem": 1rem,
432
+ "pt": 1pt,
433
+ "ex": 1ex,
434
+ "vw": 1vw,
435
+ "vh": 1vh,
436
+ "vmin": 1vmin,
437
+ "vmax": 1vmax,
438
+ );
439
+
440
+ @if not list.index(map.keys($units), $unit) {
441
+ @error 'Invalid unit `#{$unit}`.';
442
+ }
443
+
444
+ @return $value * map.get($units, $unit);
445
+ }
446
+
447
+ ////
448
+ /// String trim
449
+ /// @author Jack McNicol
450
+ /// @access private
451
+ ////
452
+
453
+ ///
454
+ /// Trims a string of leading and trailing spaces
455
+ ///
456
+ /// @param {String} $string - Value to be trimmed
457
+ ///
458
+ /// @return {String}
459
+ ///
460
+
461
+ @function str-trim($string) {
462
+ @if (string.slice($string, 1, 1) == " ") {
463
+ @return str-trim(string.slice($string, 2));
464
+ } @else if (string.slice($string, string.length($string), -1) == " ") {
465
+ @return str-trim(string.slice($string, 1, -2));
466
+ } @else {
467
+ @return $string;
468
+ }
469
+ }
470
+
471
+ ///
472
+ /// This mixin aims at redefining the configuration just for the scope of
473
+ /// the call. It is helpful when having a component needing an extended
474
+ /// configuration such as custom breakpoints (referred to as tweakpoints)
475
+ /// for instance.
476
+ ///
477
+ /// @author Kitty Giraudel
478
+ ///
479
+ /// @param {Map} $tweakpoints [()] - Map of tweakpoints to be merged with `$breakpoints`
480
+ /// @param {Map} $tweak-media-expressions [()] - Map of tweaked media expressions to be merged with `$media-expression`
481
+ ///
482
+ /// @example scss - Extend the global breakpoints with a tweakpoint
483
+ /// @include media-context(('custom': 678px)) {
484
+ /// .foo {
485
+ /// @include media('>phone', '<=custom') {
486
+ /// // ...
487
+ /// }
488
+ /// }
489
+ /// }
490
+ ///
491
+ /// @example scss - Extend the global media expressions with a custom one
492
+ /// @include media-context($tweak-media-expressions: ('all': 'all')) {
493
+ /// .foo {
494
+ /// @include media('all', '>phone') {
495
+ /// // ...
496
+ /// }
497
+ /// }
498
+ /// }
499
+ ///
500
+ /// @example scss - Extend both configuration maps
501
+ /// @include media-context(('custom': 678px), ('all': 'all')) {
502
+ /// .foo {
503
+ /// @include media('all', '>phone', '<=custom') {
504
+ /// // ...
505
+ /// }
506
+ /// }
507
+ /// }
508
+ ///
509
+ @mixin media-context($tweakpoints: (), $tweak-media-expressions: ()) {
510
+ // Save global configuration
511
+ $global-breakpoints: $breakpoints;
512
+ $global-media-expressions: $media-expressions;
513
+
514
+ // Update global configuration
515
+ $breakpoints: map.merge($breakpoints, $tweakpoints) !global;
516
+ $media-expressions: map.merge($media-expressions, $tweak-media-expressions) !global;
517
+
518
+ @content;
519
+
520
+ // Restore global configuration
521
+ $breakpoints: $global-breakpoints !global;
522
+ $media-expressions: $global-media-expressions !global;
523
+ }
524
+
525
+ ////
526
+ /// include-media public exposed API
527
+ /// @author Eduardo Boucas
528
+ /// @access public
529
+ ////
530
+
531
+ ///
532
+ /// Generates a media query based on a list of conditions
533
+ ///
534
+ /// @param {Arglist} $conditions - Media query conditions
535
+ ///
536
+ /// @example scss - With a single set breakpoint
537
+ /// @include media('>phone') { }
538
+ ///
539
+ /// @example scss - With two set breakpoints
540
+ /// @include media('>phone', '<=tablet') { }
541
+ ///
542
+ /// @example scss - With custom values
543
+ /// @include media('>=358px', '<850px') { }
544
+ ///
545
+ /// @example scss - With set breakpoints with custom values
546
+ /// @include media('>desktop', '<=1350px') { }
547
+ ///
548
+ /// @example scss - With a static expression
549
+ /// @include media('retina2x') { }
550
+ ///
551
+ /// @example scss - Mixing everything
552
+ /// @include media('>=350px', '<tablet', 'retina3x') { }
553
+ ///
554
+ @mixin media($conditions...) {
555
+ @if ($im-media-support and list.length($conditions) == 0) or
556
+ (not $im-media-support and im-intercepts-static-breakpoint($conditions...))
557
+ {
558
+ @content;
559
+ } @else if ($im-media-support and list.length($conditions) > 0) {
560
+ @media #{string.unquote(parse-expression(list.nth($conditions, 1)))} {
561
+ // Recursive call
562
+ $sliced-conditions: slice($conditions, 2);
563
+ @include media($sliced-conditions...) {
564
+ @content;
565
+ }
566
+ }
567
+ }
568
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Energinet DataHub A/S
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License2");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { BreakpointObserver } from '@angular/cdk/layout';
18
+ import { Observable } from 'rxjs';
19
+ import { WattBreakpointType } from './breakpoints';
20
+ import * as i0 from "@angular/core";
21
+ export interface WattBreakpointState {
22
+ /** Whether the breakpoint is currently matching. */
23
+ matches: boolean;
24
+ /**
25
+ * A key boolean pair for each query provided to the observe method,
26
+ * with its current matched state.
27
+ */
28
+ breakpoints: {
29
+ [key: string]: boolean;
30
+ };
31
+ }
32
+ export declare class WattBreakpointsObserver {
33
+ private breakpointObserver;
34
+ constructor(breakpointObserver: BreakpointObserver);
35
+ observe(breakpoints: WattBreakpointType | WattBreakpointType[]): Observable<WattBreakpointState>;
36
+ isMatched(breakpoint: WattBreakpointType): boolean;
37
+ static ɵfac: i0.ɵɵFactoryDeclaration<WattBreakpointsObserver, never>;
38
+ static ɵprov: i0.ɵɵInjectableDeclaration<WattBreakpointsObserver>;
39
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Energinet DataHub A/S
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License2");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * NOTE: Keep in sync with ./_breakpoints.scss
19
+ * NOTE: We don't use CSS Custom Properties for our breakpoints,
20
+ * because they can't be used in media queries and we don't want those changed on the fly
21
+ */
22
+ export declare const WattBreakpoint: {
23
+ XSmall: "(max-width: 599.98px)";
24
+ Small: "(min-width: 600px) and (max-width: 959.98px)";
25
+ Medium: "(min-width: 960px) and (max-width: 1279.98px)";
26
+ Large: "(min-width: 1280px) and (max-width: 1919.98px)";
27
+ XLarge: "(min-width: 1920px)";
28
+ };
29
+ export type WattBreakpointType = keyof typeof WattBreakpoint;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Energinet DataHub A/S
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License2");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export { WattBreakpointsObserver, WattBreakpointState } from './breakpoints-observer';
18
+ export { WattBreakpoint } from './breakpoints';