@oiz/stzh-components 2.6.0 → 2.7.0-alpha

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 (170) hide show
  1. package/dist/cjs/{app-globals-4dcdf160.js → app-globals-5dfa53d1.js} +2 -2
  2. package/dist/cjs/{app-globals-4dcdf160.js.map → app-globals-5dfa53d1.js.map} +1 -1
  3. package/dist/cjs/index.cjs.js.map +1 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/stzh-amount.cjs.entry.js +30 -79
  6. package/dist/cjs/stzh-amount.cjs.entry.js.map +1 -1
  7. package/dist/cjs/stzh-components.cjs.js +2 -2
  8. package/dist/cjs/stzh-datepicker_3.cjs.entry.js.map +1 -1
  9. package/dist/cjs/stzh-dropdown.cjs.entry.js +60 -25
  10. package/dist/cjs/stzh-dropdown.cjs.entry.js.map +1 -1
  11. package/dist/cjs/stzh-monthyearpicker.cjs.entry.js +191 -0
  12. package/dist/cjs/stzh-monthyearpicker.cjs.entry.js.map +1 -0
  13. package/dist/cjs/stzh-skin-portal-mitwirken.cjs.entry.js +1 -1
  14. package/dist/cjs/stzh-skin-portal-mitwirken.cjs.entry.js.map +1 -1
  15. package/dist/cjs/stzh-timepicker.cjs.entry.js +82 -0
  16. package/dist/cjs/stzh-timepicker.cjs.entry.js.map +1 -0
  17. package/dist/cjs/translation-utils-73073e44.js.map +1 -1
  18. package/dist/collection/assets/i18n/de.json +10 -7
  19. package/dist/collection/assets/i18n/en.json +8 -5
  20. package/dist/collection/collection-manifest.json +2 -0
  21. package/dist/collection/components/stzh-amount/stzh-amount.js +32 -85
  22. package/dist/collection/components/stzh-amount/stzh-amount.js.map +1 -1
  23. package/dist/collection/components/stzh-amount/stzh-amount.localization.js.map +1 -1
  24. package/dist/collection/components/stzh-amount/stzh-amount.stories.js +1 -1
  25. package/dist/collection/components/stzh-datepicker/stzh-datepicker.js +1 -1
  26. package/dist/collection/components/stzh-datepicker/stzh-datepicker.js.map +1 -1
  27. package/dist/collection/components/stzh-datepicker/stzh-datepicker.stories.js +3 -0
  28. package/dist/collection/components/stzh-dropdown/stzh-dropdown.css +32 -20
  29. package/dist/collection/components/stzh-dropdown/stzh-dropdown.js +40 -9
  30. package/dist/collection/components/stzh-dropdown/stzh-dropdown.js.map +1 -1
  31. package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.css +123 -0
  32. package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.js +724 -0
  33. package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.js.map +1 -0
  34. package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.localization.js +2 -0
  35. package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.localization.js.map +1 -0
  36. package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.stories.js +61 -0
  37. package/dist/collection/components/stzh-skin-portal-mitwirken/stzh-skin-portal-mitwirken.css +1 -1
  38. package/dist/collection/components/stzh-timepicker/stzh-timepicker.css +109 -0
  39. package/dist/collection/components/stzh-timepicker/stzh-timepicker.js +438 -0
  40. package/dist/collection/components/stzh-timepicker/stzh-timepicker.js.map +1 -0
  41. package/dist/collection/components/stzh-timepicker/stzh-timepicker.localization.js +2 -0
  42. package/dist/collection/components/stzh-timepicker/stzh-timepicker.localization.js.map +1 -0
  43. package/dist/collection/components/stzh-timepicker/stzh-timepicker.stories.js +45 -0
  44. package/dist/collection/index.js.map +1 -1
  45. package/dist/collection/libraries/tom-select/cjs/tom-select.complete.js +47 -18
  46. package/dist/collection/libraries/tom-select/cjs/tom-select.js +47 -18
  47. package/dist/collection/libraries/tom-select/cjs/tom-select.popular.js +47 -18
  48. package/dist/collection/libraries/tom-select/esm/tom-select.complete.js +47 -18
  49. package/dist/collection/libraries/tom-select/esm/tom-select.js +47 -18
  50. package/dist/collection/libraries/tom-select/esm/tom-select.popular.js +47 -18
  51. package/dist/collection/libraries/tom-select/js/tom-select.base.js +47 -18
  52. package/dist/collection/libraries/tom-select/js/tom-select.base.min.js +16 -17
  53. package/dist/collection/libraries/tom-select/js/tom-select.complete.js +47 -18
  54. package/dist/collection/libraries/tom-select/js/tom-select.complete.min.js +12 -13
  55. package/dist/collection/libraries/tom-select/js/tom-select.popular.js +47 -18
  56. package/dist/collection/libraries/tom-select/js/tom-select.popular.min.js +21 -22
  57. package/dist/collection/utils/translation-utils.js.map +1 -1
  58. package/dist/components/index.js +1 -1
  59. package/dist/components/index2.js.map +1 -1
  60. package/dist/components/stzh-amount.js +40 -83
  61. package/dist/components/stzh-amount.js.map +1 -1
  62. package/dist/components/stzh-buttongroup.js +1 -31
  63. package/dist/components/stzh-buttongroup.js.map +1 -1
  64. package/dist/components/stzh-buttongroup2.js +35 -0
  65. package/dist/components/stzh-buttongroup2.js.map +1 -0
  66. package/dist/components/stzh-datepicker2.js.map +1 -1
  67. package/dist/components/stzh-dropdown2.js +61 -25
  68. package/dist/components/stzh-dropdown2.js.map +1 -1
  69. package/dist/components/stzh-monthyearpicker.d.ts +11 -0
  70. package/dist/components/stzh-monthyearpicker.js +251 -0
  71. package/dist/components/stzh-monthyearpicker.js.map +1 -0
  72. package/dist/components/stzh-skin-portal-mitwirken.js +1 -1
  73. package/dist/components/stzh-skin-portal-mitwirken.js.map +1 -1
  74. package/dist/components/stzh-timepicker.d.ts +11 -0
  75. package/dist/components/stzh-timepicker.js +132 -0
  76. package/dist/components/stzh-timepicker.js.map +1 -0
  77. package/dist/components/translation-utils.js.map +1 -1
  78. package/dist/esm/{app-globals-91875913.js → app-globals-862dc6d0.js} +2 -2
  79. package/dist/esm/{app-globals-91875913.js.map → app-globals-862dc6d0.js.map} +1 -1
  80. package/dist/esm/index.js.map +1 -1
  81. package/dist/esm/loader.js +2 -2
  82. package/dist/esm/stzh-amount.entry.js +30 -79
  83. package/dist/esm/stzh-amount.entry.js.map +1 -1
  84. package/dist/esm/stzh-components.js +2 -2
  85. package/dist/esm/stzh-datepicker_3.entry.js.map +1 -1
  86. package/dist/esm/stzh-dropdown.entry.js +60 -25
  87. package/dist/esm/stzh-dropdown.entry.js.map +1 -1
  88. package/dist/esm/stzh-monthyearpicker.entry.js +187 -0
  89. package/dist/esm/stzh-monthyearpicker.entry.js.map +1 -0
  90. package/dist/esm/stzh-skin-portal-mitwirken.entry.js +1 -1
  91. package/dist/esm/stzh-skin-portal-mitwirken.entry.js.map +1 -1
  92. package/dist/esm/stzh-timepicker.entry.js +78 -0
  93. package/dist/esm/stzh-timepicker.entry.js.map +1 -0
  94. package/dist/esm/translation-utils-2623783f.js.map +1 -1
  95. package/dist/esm-es5/{app-globals-91875913.js → app-globals-862dc6d0.js} +2 -2
  96. package/dist/esm-es5/{app-globals-91875913.js.map → app-globals-862dc6d0.js.map} +1 -1
  97. package/dist/esm-es5/index.js.map +1 -1
  98. package/dist/esm-es5/loader.js +1 -1
  99. package/dist/esm-es5/loader.js.map +1 -1
  100. package/dist/esm-es5/stzh-amount.entry.js +1 -1
  101. package/dist/esm-es5/stzh-amount.entry.js.map +1 -1
  102. package/dist/esm-es5/stzh-components.js +1 -1
  103. package/dist/esm-es5/stzh-components.js.map +1 -1
  104. package/dist/esm-es5/stzh-datepicker_3.entry.js.map +1 -1
  105. package/dist/esm-es5/stzh-dropdown.entry.js +2 -2
  106. package/dist/esm-es5/stzh-dropdown.entry.js.map +1 -1
  107. package/dist/esm-es5/stzh-monthyearpicker.entry.js +2 -0
  108. package/dist/esm-es5/stzh-monthyearpicker.entry.js.map +1 -0
  109. package/dist/esm-es5/stzh-skin-portal-mitwirken.entry.js +1 -1
  110. package/dist/esm-es5/stzh-skin-portal-mitwirken.entry.js.map +1 -1
  111. package/dist/esm-es5/stzh-timepicker.entry.js +2 -0
  112. package/dist/esm-es5/stzh-timepicker.entry.js.map +1 -0
  113. package/dist/esm-es5/translation-utils-2623783f.js.map +1 -1
  114. package/dist/stzh-components/assets/i18n/de.json +10 -7
  115. package/dist/stzh-components/assets/i18n/en.json +8 -5
  116. package/dist/stzh-components/index.esm.js.map +1 -1
  117. package/dist/stzh-components/p-14e782cb.entry.js +2 -0
  118. package/dist/stzh-components/{p-85504842.entry.js.map → p-14e782cb.entry.js.map} +1 -1
  119. package/dist/stzh-components/p-1678e09c.system.js +2 -0
  120. package/dist/stzh-components/{p-3e10addb.system.js.map → p-1678e09c.system.js.map} +1 -1
  121. package/dist/stzh-components/p-25a09313.js.map +1 -1
  122. package/dist/stzh-components/{p-61b66e55.system.js → p-3b4833a0.system.js} +2 -2
  123. package/dist/stzh-components/{p-61b66e55.system.js.map → p-3b4833a0.system.js.map} +1 -1
  124. package/dist/stzh-components/p-51f1714c.system.entry.js +2 -0
  125. package/dist/stzh-components/p-51f1714c.system.entry.js.map +1 -0
  126. package/dist/stzh-components/p-5aa96b49.system.entry.js +2 -0
  127. package/dist/stzh-components/p-5aa96b49.system.entry.js.map +1 -0
  128. package/dist/stzh-components/p-82e886d4.entry.js.map +1 -1
  129. package/dist/stzh-components/p-9f31cf7d.entry.js +2 -0
  130. package/dist/stzh-components/p-9f31cf7d.entry.js.map +1 -0
  131. package/dist/stzh-components/p-9fe69be8.system.entry.js +2 -0
  132. package/dist/stzh-components/{p-479a02fb.system.entry.js.map → p-9fe69be8.system.entry.js.map} +1 -1
  133. package/dist/stzh-components/p-a408bfba.system.js.map +1 -1
  134. package/dist/stzh-components/p-ad33db31.entry.js +2 -0
  135. package/dist/stzh-components/p-ad33db31.entry.js.map +1 -0
  136. package/dist/stzh-components/p-b5cda655.entry.js +2 -0
  137. package/dist/stzh-components/p-b5cda655.entry.js.map +1 -0
  138. package/dist/stzh-components/{p-362af013.js → p-bc82ed48.js} +2 -2
  139. package/dist/stzh-components/{p-362af013.js.map → p-bc82ed48.js.map} +1 -1
  140. package/dist/stzh-components/p-c0f971f2.entry.js +9 -0
  141. package/dist/stzh-components/p-c0f971f2.entry.js.map +1 -0
  142. package/dist/stzh-components/p-c901fe72.system.entry.js +9 -0
  143. package/dist/stzh-components/p-c901fe72.system.entry.js.map +1 -0
  144. package/dist/stzh-components/p-e8545386.system.entry.js +2 -0
  145. package/dist/stzh-components/p-e8545386.system.entry.js.map +1 -0
  146. package/dist/stzh-components/p-eaa65f52.system.js.map +1 -1
  147. package/dist/stzh-components/p-f2d74491.system.entry.js.map +1 -1
  148. package/dist/stzh-components/stzh-components.css +1 -1
  149. package/dist/stzh-components/stzh-components.esm.js +1 -1
  150. package/dist/stzh-components/stzh-components.esm.js.map +1 -1
  151. package/dist/stzh-components/stzh-components.js +1 -1
  152. package/dist/types/components/stzh-amount/stzh-amount.localization.d.ts +0 -2
  153. package/dist/types/components/stzh-monthyearpicker/stzh-monthyearpicker.localization.d.ts +5 -0
  154. package/dist/types/components/stzh-timepicker/stzh-timepicker.localization.d.ts +2 -0
  155. package/dist/types/components.d.ts +428 -6
  156. package/dist/types/index.d.ts +14 -0
  157. package/dist/types/utils/translation-utils.d.ts +1 -0
  158. package/dist/vscode-data.json +263 -1
  159. package/package.json +1 -1
  160. package/dist/stzh-components/p-1cc48f98.entry.js +0 -9
  161. package/dist/stzh-components/p-1cc48f98.entry.js.map +0 -1
  162. package/dist/stzh-components/p-3e10addb.system.js +0 -2
  163. package/dist/stzh-components/p-479a02fb.system.entry.js +0 -2
  164. package/dist/stzh-components/p-67b11b03.system.entry.js +0 -2
  165. package/dist/stzh-components/p-67b11b03.system.entry.js.map +0 -1
  166. package/dist/stzh-components/p-6bb83b30.system.entry.js +0 -9
  167. package/dist/stzh-components/p-6bb83b30.system.entry.js.map +0 -1
  168. package/dist/stzh-components/p-85504842.entry.js +0 -2
  169. package/dist/stzh-components/p-c94f7331.entry.js +0 -2
  170. package/dist/stzh-components/p-c94f7331.entry.js.map +0 -1
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface StzhMonthyearpicker extends Components.StzhMonthyearpicker, HTMLElement {}
4
+ export const StzhMonthyearpicker: {
5
+ prototype: StzhMonthyearpicker;
6
+ new (): StzhMonthyearpicker;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,251 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { f as fetchTranslations } from './translation-utils.js';
3
+ import { d as defineCustomElement$4 } from './stzh-dropdown2.js';
4
+ import { d as defineCustomElement$3 } from './stzh-icon2.js';
5
+ import { d as defineCustomElement$2 } from './stzh-popover2.js';
6
+
7
+ const stzhMonthyearpickerCss = ".sc-stzh-monthyearpicker-h{font-family:var(--stzh-font-family-regular);font-weight:var(--stzh-font-weight-regular);font-style:normal;color:var(--stzh-base-color);-webkit-box-sizing:border-box;box-sizing:border-box;display:block}[hidden].sc-stzh-monthyearpicker-h{display:none}.sc-stzh-monthyearpicker-h *.sc-stzh-monthyearpicker,.sc-stzh-monthyearpicker-h *.sc-stzh-monthyearpicker::before,.sc-stzh-monthyearpicker-h *.sc-stzh-monthyearpicker::after{-webkit-box-sizing:border-box;box-sizing:border-box;text-underline-offset:var(--stzh-link-text-underline-offset);text-decoration-thickness:var(--stzh-link-text-decoration-thickness)}.sc-stzh-monthyearpicker-h{width:100%;--separator-height:var(--stzh-form-input-height)}[size=small].sc-stzh-monthyearpicker-h{--separator-height:var(--stzh-form-input-small-height)}.stzh-monthyearpicker__wrapper.sc-stzh-monthyearpicker{display:-ms-flexbox;display:flex;-ms-flex-align:start;align-items:flex-start}.stzh-monthyearpicker__separator.sc-stzh-monthyearpicker{font-size:var(--stzh-font-milli-font-size);line-height:var(--stzh-font-milli-text-line-height);letter-spacing:var(--stzh-font-curve---text-letter-spacing);margin-left:var(--stzh-space-medium);margin-right:var(--stzh-space-medium);height:var(--separator-height);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}";
8
+
9
+ const StzhMonthyearpicker$1 = /*@__PURE__*/ proxyCustomElement(class StzhMonthyearpicker extends HTMLElement {
10
+ constructor() {
11
+ super();
12
+ this.__registerHost();
13
+ this.stzhChange = createEvent(this, "stzhChange", 7);
14
+ this.onRootFocus = () => {
15
+ if (this.monthsDropdown) {
16
+ this.monthsDropdown.setFocus();
17
+ }
18
+ };
19
+ this.onMonthsDropdownChange = (event) => {
20
+ const year = this.value.split("-")[0] || "0000";
21
+ const month = event.detail.value || "00";
22
+ this.onChange(year, month);
23
+ };
24
+ this.onYearsDropdownChange = (event) => {
25
+ const year = event.detail.value || "0000";
26
+ const month = this.value.split("-")[1] || "00";
27
+ this.onChange(year, month);
28
+ };
29
+ this.months = undefined;
30
+ this.years = undefined;
31
+ this.min = undefined;
32
+ this.max = undefined;
33
+ this.minYear = undefined;
34
+ this.maxYear = undefined;
35
+ this.format = "default";
36
+ this.name = "";
37
+ this.value = "0000-00";
38
+ this.popoverPlacement = "bottom";
39
+ this.monthLabel = "";
40
+ this.yearLabel = "";
41
+ this.readonly = false;
42
+ this.disabled = false;
43
+ this.required = false;
44
+ this.showMarker = false;
45
+ this.size = "default";
46
+ this.descriptionMonth = undefined;
47
+ this.descriptionYear = undefined;
48
+ this.descriptionLongMonth = undefined;
49
+ this.descriptionLongYear = undefined;
50
+ this.errorMonth = undefined;
51
+ this.errorYear = undefined;
52
+ this.invalidMonth = false;
53
+ this.invalidYear = false;
54
+ this.a11yDescribedbyMonth = "";
55
+ this.a11yDescribedbyYear = "";
56
+ this.localization = undefined;
57
+ }
58
+ monthsWatcher(newValue) {
59
+ if (typeof newValue === "string") {
60
+ this._months = JSON.parse(newValue);
61
+ }
62
+ else {
63
+ this._months = newValue;
64
+ }
65
+ this.updateMonthOptions();
66
+ }
67
+ yearsWatcher(newValue) {
68
+ if (typeof newValue === "string") {
69
+ this._years = JSON.parse(newValue);
70
+ }
71
+ else {
72
+ this._years = newValue;
73
+ }
74
+ this.updateYearOptions();
75
+ }
76
+ minMaxWatcher() {
77
+ this.updateMonthOptions();
78
+ this.updateYearOptions();
79
+ }
80
+ onChange(year, month) {
81
+ this.value = `${year}-${month}`;
82
+ this.stzhChange.emit({
83
+ component: "stzh-monthyearpicker",
84
+ value: this.value,
85
+ valueMonth: month,
86
+ valueYear: year
87
+ });
88
+ }
89
+ updateMonthOptions() {
90
+ const options = [];
91
+ let months = [];
92
+ if (this._months) {
93
+ months = this._months;
94
+ }
95
+ else {
96
+ const currentYear = Number(this.value.split("-")[0] || "0000");
97
+ let minMonth = 1;
98
+ let maxMonth = 12;
99
+ if (this.min) {
100
+ const minDate = new Date(this.min);
101
+ if (currentYear === minDate.getFullYear()) {
102
+ minMonth = minDate.getMonth() + 1;
103
+ }
104
+ }
105
+ if (this.max) {
106
+ const maxDate = new Date(this.max);
107
+ if (currentYear === maxDate.getFullYear()) {
108
+ maxMonth = maxDate.getMonth() + 1;
109
+ }
110
+ }
111
+ for (let i = minMonth; i <= maxMonth; i++) {
112
+ months.push(i);
113
+ }
114
+ }
115
+ months.forEach((month) => {
116
+ const paddedMonth = ("00" + month).slice(-2);
117
+ const monthName = this.localization.$globals.monthNames[month - 1];
118
+ options.push({
119
+ text: this.format === "creditcard"
120
+ ? `${paddedMonth} (${monthName})`
121
+ : monthName,
122
+ value: paddedMonth
123
+ });
124
+ });
125
+ this.dropdownMonthOptions = options;
126
+ }
127
+ updateYearOptions() {
128
+ const options = [];
129
+ let years = [];
130
+ if (this._years) {
131
+ years = this._years;
132
+ }
133
+ else {
134
+ const currentMonth = Number(this.value.split("-")[1] || "00");
135
+ const yearNow = new Date().getFullYear();
136
+ let minYear = this.minYear || (yearNow - 10);
137
+ let maxYear = this.maxYear || (yearNow + 10);
138
+ if (this.min) {
139
+ const minDate = new Date(this.min);
140
+ if (currentMonth && currentMonth < minDate.getMonth() + 1) {
141
+ minYear = minDate.getFullYear() + 1;
142
+ }
143
+ else {
144
+ minYear = minDate.getFullYear();
145
+ }
146
+ }
147
+ if (this.max) {
148
+ const maxDate = new Date(this.max);
149
+ if (currentMonth && currentMonth > maxDate.getMonth() + 1) {
150
+ maxYear = maxDate.getFullYear() - 1;
151
+ }
152
+ else {
153
+ maxYear = maxDate.getFullYear();
154
+ }
155
+ }
156
+ for (let i = minYear; i <= maxYear; i++) {
157
+ years.push(i);
158
+ }
159
+ }
160
+ years.forEach((year) => {
161
+ options.push({ text: year, value: year });
162
+ });
163
+ this.dropdownYearOptions = options;
164
+ }
165
+ async componentWillLoad() {
166
+ if (!this.localization) {
167
+ this.localization = await fetchTranslations(this.element, "monthyearpicker");
168
+ }
169
+ this.monthsWatcher(this.months);
170
+ this.yearsWatcher(this.years);
171
+ }
172
+ render() {
173
+ const classes = {
174
+ "stzh-monthyearpicker": true
175
+ };
176
+ return (h(Host, { tabindex: this.disabled ? null : "-1", onFocus: this.onRootFocus }, h("div", { class: classes }, h("input", { type: "hidden", name: this.name, value: this.value }), h("div", { class: "stzh-monthyearpicker__wrapper" }, h("stzh-dropdown", { name: `${this.name}-month`, class: "stzh-monthyearpicker__months-dropdown", label: this.monthLabel || this.localization.monthLabel, ref: (el) => (this.monthsDropdown = el), onStzhChange: this.onMonthsDropdownChange, options: this.dropdownMonthOptions, items: [this.value.split("-")[1]], required: this.required, disabled: this.disabled, size: this.size, showMarker: this.showMarker, popoverPlacement: this.popoverPlacement, description: this.descriptionMonth, descriptionLong: this.descriptionLongMonth, error: this.errorMonth, a11yDescribedby: this.a11yDescribedbyMonth, invalid: this.invalidMonth }), h("div", { class: "stzh-monthyearpicker__separator" }, "/"), h("stzh-dropdown", { name: `${this.name}-year`, class: "stzh-monthyearpicker__years-dropdown", label: this.yearLabel || this.localization.yearLabel, onStzhChange: this.onYearsDropdownChange, options: this.dropdownYearOptions, items: [this.value.split("-")[0]], required: this.required, disabled: this.disabled, size: this.size, showMarker: this.showMarker, popoverPlacement: this.popoverPlacement, description: this.descriptionYear, descriptionLong: this.descriptionLongYear, error: this.errorYear, a11yDescribedby: this.a11yDescribedbyYear, invalid: this.invalidYear })))));
177
+ }
178
+ get element() { return this; }
179
+ static get watchers() { return {
180
+ "months": ["monthsWatcher"],
181
+ "years": ["yearsWatcher"],
182
+ "value": ["minMaxWatcher"],
183
+ "min": ["minMaxWatcher"],
184
+ "max": ["minMaxWatcher"]
185
+ }; }
186
+ static get style() { return stzhMonthyearpickerCss; }
187
+ }, [2, "stzh-monthyearpicker", {
188
+ "months": [1],
189
+ "years": [1],
190
+ "min": [1],
191
+ "max": [1],
192
+ "minYear": [2, "min-year"],
193
+ "maxYear": [2, "max-year"],
194
+ "format": [513],
195
+ "name": [513],
196
+ "value": [1025],
197
+ "popoverPlacement": [513, "popover-placement"],
198
+ "monthLabel": [1, "month-label"],
199
+ "yearLabel": [1, "year-label"],
200
+ "readonly": [516],
201
+ "disabled": [516],
202
+ "required": [516],
203
+ "showMarker": [516, "show-marker"],
204
+ "size": [513],
205
+ "descriptionMonth": [1, "description-month"],
206
+ "descriptionYear": [1, "description-year"],
207
+ "descriptionLongMonth": [1, "description-long-month"],
208
+ "descriptionLongYear": [1, "description-long-year"],
209
+ "errorMonth": [1, "error-month"],
210
+ "errorYear": [1, "error-year"],
211
+ "invalidMonth": [516, "invalid-month"],
212
+ "invalidYear": [516, "invalid-year"],
213
+ "a11yDescribedbyMonth": [1, "a11y-describedby"],
214
+ "a11yDescribedbyYear": [1, "a11y-describedby"],
215
+ "localization": [16]
216
+ }]);
217
+ function defineCustomElement$1() {
218
+ if (typeof customElements === "undefined") {
219
+ return;
220
+ }
221
+ const components = ["stzh-monthyearpicker", "stzh-dropdown", "stzh-icon", "stzh-popover"];
222
+ components.forEach(tagName => { switch (tagName) {
223
+ case "stzh-monthyearpicker":
224
+ if (!customElements.get(tagName)) {
225
+ customElements.define(tagName, StzhMonthyearpicker$1);
226
+ }
227
+ break;
228
+ case "stzh-dropdown":
229
+ if (!customElements.get(tagName)) {
230
+ defineCustomElement$4();
231
+ }
232
+ break;
233
+ case "stzh-icon":
234
+ if (!customElements.get(tagName)) {
235
+ defineCustomElement$3();
236
+ }
237
+ break;
238
+ case "stzh-popover":
239
+ if (!customElements.get(tagName)) {
240
+ defineCustomElement$2();
241
+ }
242
+ break;
243
+ } });
244
+ }
245
+
246
+ const StzhMonthyearpicker = StzhMonthyearpicker$1;
247
+ const defineCustomElement = defineCustomElement$1;
248
+
249
+ export { StzhMonthyearpicker, defineCustomElement };
250
+
251
+ //# sourceMappingURL=stzh-monthyearpicker.js.map
@@ -0,0 +1 @@
1
+ {"file":"stzh-monthyearpicker.js","mappings":";;;;;;AAAA,MAAM,sBAAsB,GAAG,2zCAA2zC;;MC2B70CA,qBAAmB;;;;;IA0ItB,gBAAW,GAAG;MACpB,IAAI,IAAI,CAAC,cAAc,EAAE;QACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;OAChC;KACF,CAAA;IAEO,2BAAsB,GAAG,CAAC,KAA2C;MAC3E,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC;MAChD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC;MACzC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;KAC5B,CAAA;IAEO,0BAAqB,GAAG,CAAC,KAA2C;MAC1E,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC;MAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;MAC/C,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;KAC5B,CAAA;;;;;;;kBAxH2D,SAAS;gBAG7B,EAAE;iBAGD,SAAS;4BAGyE,QAAQ;sBAGtG,EAAE;qBAGH,EAAE;oBAGe,KAAK;oBAGL,KAAK;oBAGL,KAAK;sBAGH,KAAK;gBAGC,SAAS;;;;;;;wBAqBb,KAAK;uBAGN,KAAK;gCAGmB,EAAE;+BAGH,EAAE;;;EAWzE,aAAa,CAAC,QAA2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":["./src/components/stzh-monthyearpicker/stzh-monthyearpicker.scss?tag=stzh-monthyearpicker&encapsulation=scoped","./src/components/stzh-monthyearpicker/stzh-monthyearpicker.tsx"],"sourcesContent":[":host {\n width: 100%;\n --separator-height: #{$formInputHeight};\n\n &[size=\"small\"] {\n --separator-height: #{$formInputHeightSmall};\n }\n}\n\n.stzh-monthyearpicker {\n &__wrapper {\n display: flex;\n align-items: flex-start;\n }\n\n &__separator {\n @include fontSize('milli');\n margin-left: space('medium');\n margin-right: space('medium');\n height: var(--separator-height);\n display: flex;\n align-items: center;\n }\n}\n","import {\n Component,\n Prop,\n Host,\n Element,\n h,\n Event,\n EventEmitter,\n Watch,\n} from \"@stencil/core\";\n\nimport {\n StzhDropdownOption,\n StzhDropdownChangeEvent,\n StzhMonthyearpickerChangeEvent\n} from \"../../index\";\n\nimport { fetchTranslations } from \"../../utils/translation-utils\";\nimport { StzhMonthyearpickerLocalizedText } from \"./stzh-monthyearpicker.localization\";\n\n/**\n */\n@Component({\n tag: \"stzh-monthyearpicker\",\n styleUrl: \"stzh-monthyearpicker.scss\",\n scoped: true\n})\nexport class StzhMonthyearpicker {\n /** Set which months to show (overwrites months from min/max) */\n @Prop() months: number[] | string;\n private _months: number[];\n\n /** Set which years to show (overwrites years from min/max) */\n @Prop() years: number[] | string;\n private _years: number[];\n\n /**\n * Minimum month and year allowed to be picked in `YYYY-MM` format.\n * This setting can be used alone or together with the `max` property.\n */\n @Prop() min: string;\n\n /**\n * Maximum month and year allowed to be picked in `YYYY-MM` format.\n * This setting can be used alone or together with the `min` property.\n */\n @Prop() max: string;\n\n /**\n * Minimum year (will be overwritten if `min` is used).\n * This setting can be used alone or together with the `maxYear` property.\n */\n @Prop() minYear: number;\n\n /**\n * Maximum year (will be overwritten if `max` is used).\n * This setting can be used alone or together with the `minYear` property.\n */\n @Prop() maxYear: number;\n\n /** Picker format. */\n @Prop({ reflect: true }) format: \"default\" | \"creditcard\" = \"default\";\n\n /** Name of the hidden date picker input. */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** Value of hidden input (current selected year and month YYYY-MM). */\n @Prop({ mutable: true }) value: string = \"0000-00\";\n\n /** Popover placement for the dropdown (if applicable) */\n @Prop({ reflect: true }) popoverPlacement: \"bottom\" | \"bottom-end\" | \"bottom-center\" | \"top\" | \"top-end\" | \"top-center\" = \"bottom\";\n\n /** Month dropdown label */\n @Prop() monthLabel: string = \"\";\n\n /** Year dropdown label */\n @Prop() yearLabel: string = \"\";\n\n /** Whether the element is readonly or not */\n @Prop({ reflect: true }) readonly: boolean = false;\n\n /** Whether the element is disabled or not */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Required status */\n @Prop({ reflect: true }) required: boolean = false;\n\n /** Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show nothing */\n @Prop({ reflect: true }) showMarker: boolean = false;\n\n /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" = \"default\";\n\n /** Description message for month */\n @Prop() descriptionMonth: string;\n\n /** Description message for year */\n @Prop() descriptionYear: string;\n\n /** Long description message appearing in a popover for month */\n @Prop() descriptionLongMonth: string;\n\n /** Long description message appearing in a popover for year */\n @Prop() descriptionLongYear: string;\n\n /** One or multiple error message for month */\n @Prop() errorMonth: string | string[];\n\n /** One or multiple error message for year */\n @Prop() errorYear: string | string[];\n\n /** Invalid status for month */\n @Prop({ reflect: true }) invalidMonth: boolean = false;\n\n /** Invalid status for year */\n @Prop({ reflect: true }) invalidYear: boolean = false;\n\n /** Id of the element which describes the month dropdown */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedbyMonth: string = \"\";\n\n /** Id of the element which describes the year dropdown */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedbyYear: string = \"\";\n\n /** Translation strings. */\n @Prop() localization: StzhMonthyearpickerLocalizedText;\n\n /** Monthyearpicker change event */\n @Event() stzhChange: EventEmitter<StzhMonthyearpickerChangeEvent>;\n\n @Element() element: HTMLStzhMonthyearpickerElement;\n\n @Watch(\"months\")\n monthsWatcher(newValue: number[] | string) {\n if (typeof newValue === \"string\") {\n this._months = JSON.parse(newValue);\n } else {\n this._months = newValue;\n }\n\n this.updateMonthOptions();\n }\n\n @Watch(\"years\")\n yearsWatcher(newValue: number[] | string) {\n if (typeof newValue === \"string\") {\n this._years = JSON.parse(newValue);\n } else {\n this._years = newValue;\n }\n\n this.updateYearOptions();\n }\n\n @Watch(\"value\")\n @Watch(\"min\")\n @Watch(\"max\")\n minMaxWatcher() {\n this.updateMonthOptions();\n this.updateYearOptions();\n }\n\n private monthsDropdown: HTMLStzhDropdownElement;\n private dropdownMonthOptions: StzhDropdownOption[];\n private dropdownYearOptions: StzhDropdownOption[];\n\n private onRootFocus = () => {\n if (this.monthsDropdown) {\n this.monthsDropdown.setFocus();\n }\n }\n\n private onMonthsDropdownChange = (event: CustomEvent<StzhDropdownChangeEvent>) => {\n const year = this.value.split(\"-\")[0] || \"0000\";\n const month = event.detail.value || \"00\";\n this.onChange(year, month);\n }\n\n private onYearsDropdownChange = (event: CustomEvent<StzhDropdownChangeEvent>) => {\n const year = event.detail.value || \"0000\";\n const month = this.value.split(\"-\")[1] || \"00\";\n this.onChange(year, month);\n }\n\n private onChange(year, month) {\n this.value = `${year}-${month}`;\n this.stzhChange.emit({\n component: \"stzh-monthyearpicker\",\n value: this.value,\n valueMonth: month,\n valueYear: year\n });\n }\n\n private updateMonthOptions() {\n const options = [];\n let months = [];\n\n if (this._months) {\n months = this._months;\n } else {\n const currentYear = Number(this.value.split(\"-\")[0] || \"0000\");\n\n let minMonth = 1;\n let maxMonth = 12;\n\n if (this.min) {\n const minDate = new Date(this.min);\n\n if (currentYear === minDate.getFullYear()) {\n minMonth = minDate.getMonth() + 1;\n }\n }\n\n if (this.max) {\n const maxDate = new Date(this.max);\n\n if (currentYear === maxDate.getFullYear()) {\n maxMonth = maxDate.getMonth() + 1;\n }\n }\n\n for (let i = minMonth; i <= maxMonth; i++) {\n months.push(i);\n }\n }\n\n months.forEach((month) => {\n const paddedMonth = (\"00\" + month).slice(-2);\n const monthName = this.localization.$globals.monthNames[month - 1];\n\n options.push({\n text: this.format === \"creditcard\"\n ? `${paddedMonth} (${monthName})`\n : monthName,\n value: paddedMonth\n });\n });\n\n this.dropdownMonthOptions = options;\n }\n\n private updateYearOptions(): void {\n const options = [];\n let years = [];\n\n if (this._years) {\n years = this._years;\n } else {\n const currentMonth = Number(this.value.split(\"-\")[1] || \"00\");\n\n const yearNow = new Date().getFullYear();\n let minYear = this.minYear || (yearNow - 10);\n let maxYear = this.maxYear || (yearNow + 10);\n\n if (this.min) {\n const minDate = new Date(this.min);\n\n if (currentMonth && currentMonth < minDate.getMonth() + 1) {\n minYear = minDate.getFullYear() + 1;\n } else {\n minYear = minDate.getFullYear();\n }\n }\n\n if (this.max) {\n const maxDate = new Date(this.max);\n\n if (currentMonth && currentMonth > maxDate.getMonth() + 1) {\n maxYear = maxDate.getFullYear() - 1;\n } else {\n maxYear = maxDate.getFullYear();\n }\n }\n\n for (let i = minYear; i <= maxYear; i++) {\n years.push(i);\n }\n }\n\n years.forEach((year) => {\n options.push({ text: year, value: year });\n });\n\n this.dropdownYearOptions = options;\n }\n\n async componentWillLoad() {\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"monthyearpicker\");\n }\n\n this.monthsWatcher(this.months);\n this.yearsWatcher(this.years);\n }\n\n render() {\n const classes = {\n \"stzh-monthyearpicker\": true\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n <div class={classes}>\n <input\n type=\"hidden\"\n name={this.name}\n value={this.value}\n />\n\n <div class=\"stzh-monthyearpicker__wrapper\">\n <stzh-dropdown\n name={`${this.name}-month`}\n class=\"stzh-monthyearpicker__months-dropdown\"\n label={this.monthLabel || this.localization.monthLabel}\n ref={(el) => (this.monthsDropdown = el as HTMLStzhDropdownElement)}\n onStzhChange={this.onMonthsDropdownChange}\n options={this.dropdownMonthOptions}\n items={[this.value.split(\"-\")[1]]}\n required={this.required}\n disabled={this.disabled}\n size={this.size}\n showMarker={this.showMarker}\n popoverPlacement={this.popoverPlacement}\n description={this.descriptionMonth}\n descriptionLong={this.descriptionLongMonth}\n error={this.errorMonth}\n a11yDescribedby={this.a11yDescribedbyMonth}\n invalid={this.invalidMonth}\n ></stzh-dropdown>\n\n <div class=\"stzh-monthyearpicker__separator\">/</div>\n\n <stzh-dropdown\n name={`${this.name}-year`}\n class=\"stzh-monthyearpicker__years-dropdown\"\n label={this.yearLabel || this.localization.yearLabel}\n onStzhChange={this.onYearsDropdownChange}\n options={this.dropdownYearOptions}\n items={[this.value.split(\"-\")[0]]}\n required={this.required}\n disabled={this.disabled}\n size={this.size}\n showMarker={this.showMarker}\n popoverPlacement={this.popoverPlacement}\n description={this.descriptionYear}\n descriptionLong={this.descriptionLongYear}\n error={this.errorYear}\n a11yDescribedby={this.a11yDescribedbyYear}\n invalid={this.invalidYear}\n ></stzh-dropdown>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}