q2-tecton-elements 1.10.4 → 1.10.7

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 (196) hide show
  1. package/dist/cjs/{icons-921779df.js → icons-4595ee47.js} +61 -1
  2. package/dist/cjs/{index-f4153f5a.js → index-a55d3c34.js} +9 -0
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/q2-avatar.cjs.entry.js +1 -1
  5. package/dist/cjs/q2-btn_2.cjs.entry.js +10 -6
  6. package/dist/cjs/q2-calendar.cjs.entry.js +2902 -6078
  7. package/dist/cjs/q2-carousel-pane.cjs.entry.js +50 -7
  8. package/dist/cjs/q2-carousel.cjs.entry.js +2719 -6513
  9. package/dist/cjs/q2-checkbox-group.cjs.entry.js +2 -2
  10. package/dist/cjs/q2-checkbox.cjs.entry.js +10 -2
  11. package/dist/cjs/q2-dropdown-item.cjs.entry.js +2 -2
  12. package/dist/cjs/q2-dropdown.cjs.entry.js +8 -2
  13. package/dist/cjs/q2-editable-field.cjs.entry.js +26 -11
  14. package/dist/cjs/q2-icon.cjs.entry.js +2 -2
  15. package/dist/cjs/q2-input.cjs.entry.js +9 -7
  16. package/dist/cjs/q2-loading-element.cjs.entry.js +1 -1
  17. package/dist/cjs/q2-loc.cjs.entry.js +1 -1
  18. package/dist/cjs/q2-message.cjs.entry.js +11 -3
  19. package/dist/cjs/q2-optgroup.cjs.entry.js +2 -2
  20. package/dist/cjs/q2-option.cjs.entry.js +3 -34
  21. package/dist/cjs/q2-radio-group.cjs.entry.js +10 -2
  22. package/dist/cjs/q2-radio.cjs.entry.js +10 -2
  23. package/dist/cjs/q2-section.cjs.entry.js +9 -9
  24. package/dist/cjs/q2-select.cjs.entry.js +175 -130
  25. package/dist/cjs/q2-stepper-pane.cjs.entry.js +1 -1
  26. package/dist/cjs/q2-stepper.cjs.entry.js +10 -4
  27. package/dist/cjs/q2-tab-container.cjs.entry.js +9 -11
  28. package/dist/cjs/q2-tab-pane.cjs.entry.js +2 -2
  29. package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
  30. package/dist/cjs/q2-textarea.cjs.entry.js +8 -4
  31. package/dist/cjs/tecton-tab-pane.cjs.entry.js +2 -2
  32. package/dist/collection/components/q2-avatar/index.js +1 -1
  33. package/dist/collection/components/q2-avatar/styles.css +63 -61
  34. package/dist/collection/components/q2-btn/index.js +8 -4
  35. package/dist/collection/components/q2-btn/styles.css +96 -96
  36. package/dist/collection/components/q2-calendar/helpers.js +77 -52
  37. package/dist/collection/components/q2-calendar/index.js +248 -196
  38. package/dist/collection/components/q2-calendar/styles.css +63 -84
  39. package/dist/collection/components/q2-calendar/validation.js +100 -166
  40. package/dist/collection/components/q2-carousel/index.js +204 -266
  41. package/dist/collection/components/q2-carousel/styles.css +152 -155
  42. package/dist/collection/components/q2-carousel-pane/index.js +67 -28
  43. package/dist/collection/components/q2-carousel-pane/styles.css +82 -16
  44. package/dist/collection/components/q2-checkbox/index.js +16 -2
  45. package/dist/collection/components/q2-checkbox/styles.css +152 -176
  46. package/dist/collection/components/q2-checkbox-group/index.js +1 -1
  47. package/dist/collection/components/q2-checkbox-group/styles.css +65 -81
  48. package/dist/collection/components/q2-dropdown/index.js +15 -2
  49. package/dist/collection/components/q2-dropdown/styles.css +49 -36
  50. package/dist/collection/components/q2-dropdown-item/index.js +1 -1
  51. package/dist/collection/components/q2-dropdown-item/styles.css +48 -62
  52. package/dist/collection/components/q2-editable-field/index.js +33 -12
  53. package/dist/collection/components/q2-editable-field/styles.css +49 -50
  54. package/dist/collection/components/q2-icon/icons.js +61 -1
  55. package/dist/collection/components/q2-icon/styles.css +29 -29
  56. package/dist/collection/components/q2-input/index.js +9 -7
  57. package/dist/collection/components/q2-input/styles.css +211 -292
  58. package/dist/collection/components/q2-loading/index.js +1 -1
  59. package/dist/collection/components/q2-loading/skeleton/q2-loading-element/index.js +1 -1
  60. package/dist/collection/components/q2-loading/skeleton/q2-loading-element/styles.css +5 -6
  61. package/dist/collection/components/q2-loading/styles.css +130 -136
  62. package/dist/collection/components/q2-loc/index.js +1 -1
  63. package/dist/collection/components/q2-loc/styles.css +30 -31
  64. package/dist/collection/components/q2-message/index.js +18 -3
  65. package/dist/collection/components/q2-message/styles.css +32 -29
  66. package/dist/collection/components/q2-optgroup/index.js +1 -1
  67. package/dist/collection/components/q2-optgroup/styles.css +42 -47
  68. package/dist/collection/components/q2-option/index.js +4 -42
  69. package/dist/collection/components/q2-option/styles.css +29 -29
  70. package/dist/collection/components/q2-radio/index.js +16 -2
  71. package/dist/collection/components/q2-radio/styles.css +29 -29
  72. package/dist/collection/components/q2-radio-group/index.js +16 -2
  73. package/dist/collection/components/q2-radio-group/styles.css +67 -72
  74. package/dist/collection/components/q2-section/index.js +16 -10
  75. package/dist/collection/components/q2-section/styles.css +77 -77
  76. package/dist/collection/components/q2-select/index.js +182 -131
  77. package/dist/collection/components/q2-select/styles.css +33 -34
  78. package/dist/collection/components/q2-stepper/index.js +15 -3
  79. package/dist/collection/components/q2-stepper/styles.css +32 -32
  80. package/dist/collection/components/q2-stepper-pane/styles.css +29 -29
  81. package/dist/collection/components/q2-tab-container/index.js +7 -9
  82. package/dist/collection/components/q2-tab-container/styles.css +29 -29
  83. package/dist/collection/components/q2-tab-pane/index.js +2 -2
  84. package/dist/collection/components/q2-tab-pane/styles.css +34 -36
  85. package/dist/collection/components/q2-textarea/index.js +8 -4
  86. package/dist/collection/components/q2-textarea/styles.css +180 -228
  87. package/dist/collection/components/tecton-tab-pane/index.js +2 -2
  88. package/dist/collection/components/tecton-tab-pane/styles.css +50 -50
  89. package/dist/collection/utils/index.js +7 -0
  90. package/dist/esm/{icons-a3817842.js → icons-3ee662ea.js} +61 -1
  91. package/dist/esm/{index-476b86cc.js → index-ec6660af.js} +8 -1
  92. package/dist/esm/loader.js +1 -1
  93. package/dist/esm/q2-avatar.entry.js +1 -1
  94. package/dist/esm/q2-btn_2.entry.js +10 -6
  95. package/dist/esm/q2-calendar.entry.js +2902 -6078
  96. package/dist/esm/q2-carousel-pane.entry.js +51 -8
  97. package/dist/esm/q2-carousel.entry.js +2720 -6514
  98. package/dist/esm/q2-checkbox-group.entry.js +2 -2
  99. package/dist/esm/q2-checkbox.entry.js +10 -2
  100. package/dist/esm/q2-dropdown-item.entry.js +2 -2
  101. package/dist/esm/q2-dropdown.entry.js +8 -2
  102. package/dist/esm/q2-editable-field.entry.js +26 -11
  103. package/dist/esm/q2-icon.entry.js +2 -2
  104. package/dist/esm/q2-input.entry.js +9 -7
  105. package/dist/esm/q2-loading-element.entry.js +1 -1
  106. package/dist/esm/q2-loc.entry.js +1 -1
  107. package/dist/esm/q2-message.entry.js +11 -3
  108. package/dist/esm/q2-optgroup.entry.js +2 -2
  109. package/dist/esm/q2-option.entry.js +4 -35
  110. package/dist/esm/q2-radio-group.entry.js +10 -2
  111. package/dist/esm/q2-radio.entry.js +10 -2
  112. package/dist/esm/q2-section.entry.js +9 -9
  113. package/dist/esm/q2-select.entry.js +175 -130
  114. package/dist/esm/q2-stepper-pane.entry.js +1 -1
  115. package/dist/esm/q2-stepper.entry.js +10 -4
  116. package/dist/esm/q2-tab-container.entry.js +7 -9
  117. package/dist/esm/q2-tab-pane.entry.js +2 -2
  118. package/dist/esm/q2-tecton-elements.js +1 -1
  119. package/dist/esm/q2-textarea.entry.js +8 -4
  120. package/dist/esm/tecton-tab-pane.entry.js +2 -2
  121. package/dist/q2-tecton-elements/{p-4830affe.entry.js → p-07a5d703.entry.js} +1 -1
  122. package/dist/q2-tecton-elements/{p-84c05db6.entry.js → p-32ad664c.entry.js} +1 -1
  123. package/dist/q2-tecton-elements/p-37aba2a4.js +1 -0
  124. package/dist/q2-tecton-elements/p-4ae9d1f3.entry.js +1 -0
  125. package/dist/q2-tecton-elements/{p-67d86e3c.js → p-4cd00f1a.js} +1 -1
  126. package/dist/q2-tecton-elements/p-52f53e07.entry.js +1 -0
  127. package/dist/q2-tecton-elements/p-5559f126.entry.js +1 -0
  128. package/dist/q2-tecton-elements/p-6702eb4d.entry.js +1 -0
  129. package/dist/q2-tecton-elements/p-750bcd33.entry.js +1 -0
  130. package/dist/q2-tecton-elements/p-78642b7b.entry.js +1 -0
  131. package/dist/q2-tecton-elements/p-7e6fc65d.entry.js +1 -0
  132. package/dist/q2-tecton-elements/p-7eb39c90.entry.js +1 -0
  133. package/dist/q2-tecton-elements/p-81df91a1.entry.js +1 -0
  134. package/dist/q2-tecton-elements/{p-01e00610.entry.js → p-843b1ee9.entry.js} +1 -1
  135. package/dist/q2-tecton-elements/p-8509b171.entry.js +1 -0
  136. package/dist/q2-tecton-elements/p-8ea2c4f7.entry.js +1 -0
  137. package/dist/q2-tecton-elements/{p-d1d040ef.entry.js → p-95a73559.entry.js} +1 -1
  138. package/dist/q2-tecton-elements/p-96c9eb75.entry.js +1 -0
  139. package/dist/q2-tecton-elements/p-9b50c3c3.entry.js +1 -0
  140. package/dist/q2-tecton-elements/{p-a9bdd814.entry.js → p-a6f8d09a.entry.js} +1 -1
  141. package/dist/q2-tecton-elements/p-ab977515.entry.js +1 -0
  142. package/dist/q2-tecton-elements/{p-9314863f.entry.js → p-bb2e110a.entry.js} +1 -1
  143. package/dist/q2-tecton-elements/p-bbacb804.entry.js +1 -0
  144. package/dist/q2-tecton-elements/p-c555f1de.entry.js +1 -0
  145. package/dist/q2-tecton-elements/p-c5e55b9f.entry.js +1 -0
  146. package/dist/q2-tecton-elements/{p-4229b057.entry.js → p-df182f61.entry.js} +1 -1
  147. package/dist/q2-tecton-elements/p-fa6eea5c.entry.js +1 -0
  148. package/dist/q2-tecton-elements/{p-61c0e5fd.entry.js → p-fbf7c5e6.entry.js} +1 -1
  149. package/dist/q2-tecton-elements/p-fc804ebd.entry.js +1 -0
  150. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  151. package/dist/test/helpers.js +4 -0
  152. package/dist/types/components/q2-btn/index.d.ts +1 -0
  153. package/dist/types/components/q2-calendar/helpers.d.ts +6 -6
  154. package/dist/types/components/q2-calendar/index.d.ts +16 -17
  155. package/dist/types/components/q2-calendar/types.d.ts +9 -26
  156. package/dist/types/components/q2-calendar/validation.d.ts +27 -12
  157. package/dist/types/components/q2-carousel/index.d.ts +15 -45
  158. package/dist/types/components/q2-carousel-pane/index.d.ts +5 -2
  159. package/dist/types/components/q2-checkbox/index.d.ts +2 -0
  160. package/dist/types/components/q2-dropdown/index.d.ts +1 -0
  161. package/dist/types/components/q2-editable-field/index.d.ts +5 -1
  162. package/dist/types/components/q2-input/index.d.ts +1 -1
  163. package/dist/types/components/q2-message/index.d.ts +2 -0
  164. package/dist/types/components/q2-option/index.d.ts +0 -4
  165. package/dist/types/components/q2-radio/index.d.ts +3 -0
  166. package/dist/types/components/q2-radio-group/index.d.ts +1 -0
  167. package/dist/types/components/q2-section/index.d.ts +1 -1
  168. package/dist/types/components/q2-select/index.d.ts +10 -7
  169. package/dist/types/components/q2-stepper/index.d.ts +2 -1
  170. package/dist/types/components/q2-tab-container/index.d.ts +1 -1
  171. package/dist/types/components/q2-textarea/index.d.ts +2 -1
  172. package/dist/types/components.d.ts +3 -2
  173. package/dist/types/util.d.ts +1 -0
  174. package/dist/types/utils/index.d.ts +2 -0
  175. package/dist/types/workspace/workspace/tecton-production_release_1.10.x/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +2 -1
  176. package/package.json +4 -5
  177. package/dist/q2-tecton-elements/p-1fc4e6f6.entry.js +0 -1
  178. package/dist/q2-tecton-elements/p-25a5f691.js +0 -1
  179. package/dist/q2-tecton-elements/p-27353237.entry.js +0 -1
  180. package/dist/q2-tecton-elements/p-3e100450.entry.js +0 -1
  181. package/dist/q2-tecton-elements/p-428d15fd.entry.js +0 -1
  182. package/dist/q2-tecton-elements/p-48fc317d.entry.js +0 -1
  183. package/dist/q2-tecton-elements/p-5222b792.entry.js +0 -1
  184. package/dist/q2-tecton-elements/p-74c1a311.entry.js +0 -1
  185. package/dist/q2-tecton-elements/p-784af485.entry.js +0 -1
  186. package/dist/q2-tecton-elements/p-7c99a58b.entry.js +0 -1
  187. package/dist/q2-tecton-elements/p-7f74b629.entry.js +0 -1
  188. package/dist/q2-tecton-elements/p-831a461f.entry.js +0 -1
  189. package/dist/q2-tecton-elements/p-84c52d3b.entry.js +0 -9
  190. package/dist/q2-tecton-elements/p-997e4c7e.entry.js +0 -1
  191. package/dist/q2-tecton-elements/p-9cb0fc37.entry.js +0 -1
  192. package/dist/q2-tecton-elements/p-a224bc9c.entry.js +0 -1
  193. package/dist/q2-tecton-elements/p-d893fcf2.entry.js +0 -1
  194. package/dist/q2-tecton-elements/p-da7cca07.entry.js +0 -1
  195. package/dist/q2-tecton-elements/p-f17761da.entry.js +0 -1
  196. package/dist/q2-tecton-elements/p-f5e074f8.entry.js +0 -1
@@ -1,67 +1,67 @@
1
1
  * {
2
- box-sizing: border-box;
2
+ box-sizing: border-box;
3
3
  }
4
4
 
5
5
  *:active {
6
- outline: none;
6
+ outline: none;
7
7
  }
8
8
 
9
9
  *:focus {
10
- outline: none;
11
- box-shadow: var(--const-global-focus);
10
+ outline: none;
11
+ box-shadow: var(--const-global-focus);
12
12
  }
13
13
 
14
14
  :host {
15
- box-shadow: none !important;
15
+ box-shadow: none !important;
16
16
  }
17
17
 
18
18
  ::-moz-focus-inner {
19
- border: none;
19
+ border: none;
20
20
  }
21
21
 
22
22
  input,
23
23
  textarea,
24
24
  button {
25
- font-family: inherit;
26
- font-size: inherit;
25
+ font-family: inherit;
26
+ font-size: inherit;
27
27
  }
28
28
 
29
29
  :host(.sr),
30
30
  :host(.sr) button {
31
- border: 0;
32
- clip: rect(0 0 0 0);
33
- height: 1px;
34
- margin: -1px;
35
- overflow: hidden;
36
- padding: 0;
37
- position: absolute;
38
- width: 1px;
39
- white-space: nowrap;
31
+ border: 0;
32
+ clip: rect(0 0 0 0);
33
+ height: 1px;
34
+ margin: -1px;
35
+ overflow: hidden;
36
+ padding: 0;
37
+ position: absolute;
38
+ width: 1px;
39
+ white-space: nowrap;
40
40
  }
41
41
 
42
42
  .sr,
43
43
  .sr button {
44
- border: 0;
45
- clip: rect(0 0 0 0);
46
- height: 1px;
47
- margin: -1px;
48
- overflow: hidden;
49
- padding: 0;
50
- position: absolute;
51
- width: 1px;
52
- white-space: nowrap;
44
+ border: 0;
45
+ clip: rect(0 0 0 0);
46
+ height: 1px;
47
+ margin: -1px;
48
+ overflow: hidden;
49
+ padding: 0;
50
+ position: absolute;
51
+ width: 1px;
52
+ white-space: nowrap;
53
53
  }
54
54
 
55
55
  .hidden {
56
- display: none;
56
+ display: none;
57
57
  }
58
58
 
59
59
  :host([hidden]) {
60
- display: none;
60
+ display: none;
61
61
  }
62
62
 
63
63
  .invisible {
64
- visibility: hidden;
64
+ visibility: hidden;
65
65
  }
66
66
 
67
67
  .q2-element-dropdown {
@@ -79,10 +79,10 @@ button {
79
79
  opacity: 0;
80
80
  visibility: hidden;
81
81
  transition: opacity var(--app-tween-1);
82
- border-radius: var(--tct-dropdown-element-br, 0);
83
- --comp-scrollbar-size: var(--tct-scrollbar-size, var(--app-scale-1x, 5px));
84
- --comp-scrollbar-border-radius: var(--tct-scrollbar-border-radius, var(--app-border-radius-1, 3px));
85
- --comp-scrollbar-color: var(--tct-scrollbar-color, var(--t-a11y-gray-color, #747474));
82
+ border-radius: var(--tct-dropdown-border-radius, --t-dropdown-border-radius, 0);
83
+ --comp-scrollbar-size: var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));
84
+ --comp-scrollbar-border-radius: var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 3px)));
85
+ --comp-scrollbar-color: var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));
86
86
  scrollbar-width: thin;
87
87
  scrollbar-color: var(--comp-scrollbar-color) transparent;
88
88
  }
@@ -111,7 +111,6 @@ button {
111
111
  overflow: auto;
112
112
  opacity: 1;
113
113
  visibility: visible;
114
- margin-bottom: var(--app-scale-2);
115
114
  }
116
115
 
117
116
  :host([alignment=right]) .q2-element-dropdown {
@@ -148,11 +147,11 @@ q2-input {
148
147
  }
149
148
 
150
149
  .calendar-label {
151
- font-size: var(--tct-calendar-label-font-size, 16px);
150
+ font-size: var(--tct-calendar-label-font-size, var(--t-calendar-label-font-size, 16px));
152
151
  flex: 1 1;
153
152
  flex-basis: calc(100% - var-list(--tct-btn-icon-width, 44px));
154
153
  margin: 0;
155
- padding: var(--tct-calendar-label-vertical-padding, var(--tct-scale-2, var(--app-scale-2, 10px))) 0;
154
+ padding: var(--tct-calendar-label-vertical-padding, var(--t-calendar-label-vertical-padding, var(--tct-scale-2, var(--app-scale-2, 10px)))) 0;
156
155
  }
157
156
 
158
157
  .calendar-hint {
@@ -165,8 +164,8 @@ q2-input {
165
164
  display: flex;
166
165
  justify-content: center;
167
166
  align-items: center;
168
- font-size: var(--tct-calendar-month-font-size, 16px);
169
- font-weight: var(--tct-calendar-month-font-weight, 600);
167
+ font-size: var(--tct-calendar-month-font-size, var(--t-calendar-month-font-size, 16px));
168
+ font-weight: var(--tct-calendar-month-font-weight, var(--t-calendar-month-font-weight, 600));
170
169
  }
171
170
 
172
171
  .cal-month-text {
@@ -179,51 +178,39 @@ q2-input {
179
178
  display: inline-block;
180
179
  }
181
180
 
182
- .cal-days {
183
- display: flex;
184
- flex-wrap: wrap;
185
- padding-bottom: 2px;
186
- }
187
-
188
- .cal-day,
189
- .cal-days > div {
190
- flex: 0 0 14.285714%;
191
- }
192
-
193
- .cal-day-heading {
194
- font-size: var(--tct-calendar-day-heading-font-size, inherit);
195
- font-weight: var(--tct-calendar-day-heading-font-weight, 600);
181
+ table {
182
+ width: 100%;
183
+ margin-bottom: 2px;
196
184
  }
197
185
 
198
- .is-valid:hover {
199
- background-color: var(--tct-calendar-day-hover-bg, var(--tct-gray-14, var(--app-gray14, var(--tct-gray-l4, var(--app-gray-l4, #f2f2f2)))));
200
- color: var(--tct-calendar-day-hover-font-color, inherit);
186
+ th {
187
+ font-size: var(--tct-calendar-day-heading-font-size, var(--t-calendar-day-heading-font-size, inherit));
188
+ font-weight: var(--tct-calendar-day-heading-font-weight, var(--t-calendar-day-heading-font-weight, 600));
189
+ width: 14.285714%;
201
190
  }
202
191
 
203
- .is-valid.is-selected {
204
- background-color: var(--tct-calendar-day-selected-bg, var(--tct-calendar-day-hover-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l4, var(--app-gray-l4, #f2f2f2))))));
205
- color: var(--tct-calendar-day-selected-font-color, var(--tct-calendar-day-hover-font-color, inherit));
206
- box-shadow: inset 2px 2px var(--tct-calenday-day-selected-outline-color, var(--tct-stoplight-info, var(--const-stoplight-info, #0079c1))), inset -2px -2px var(--tct-calenday-day-selected-outline-color, var(--tct-stoplight-info, var(--const-stoplight-info, #0079c1)));
192
+ td {
193
+ height: 44px;
194
+ cursor: pointer;
207
195
  }
208
-
209
- .cal-day.is-unavailable {
196
+ td.is-unavailable {
210
197
  border: 1px solid var(--tct-input-error-border-color, var(--const-stoplight-alert, #c30000));
211
198
  }
212
-
213
- .date-details {
214
- display: flex;
215
- height: 44px;
216
- flex-direction: column;
217
- justify-content: center;
218
- align-items: center;
199
+ td.is-valid:hover {
200
+ background-color: var(--tct-calendar-day-hover-bg, var(--t-calendar-day-hover-bg, var(--tct-gray-14, var(--app-gray14, var(--tct-gray-l4, var(--app-gray-l4, #f2f2f2))))));
201
+ color: var(--tct-calendar-day-hover-font-color, var(--t-calendar-day-hover-font-color, inherit));
219
202
  }
220
-
221
- .is-today span {
222
- display: block;
203
+ td[aria-hidden], td[aria-disabled] {
204
+ pointer-events: none;
205
+ cursor: not-allowed;
223
206
  }
224
-
225
- .is-today .date-details {
226
- justify-content: flex-start;
207
+ td[aria-disabled] {
208
+ opacity: var(--tct-calendar-day-disabled-opacity, var(--t-calendar-day-disabled-opacity, var(--app-disabled-opacity, 0.4)));
209
+ }
210
+ td[aria-selected] {
211
+ background-color: var(--tct-calendar-day-selected-bg, var(--t-calendar-day-selected-bg, var(--tct-calendar-day-hover-bg, var(--t-calendar-day-hover-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l4, var(--app-gray-l4, #f2f2f2))))))));
212
+ color: var(--tct-calendar-day-selected-font-color, var(--t-calendar-day-selected-font-color, var(--tct-calendar-day-hover-font-color, var(--t-calendar-day-hover-font-color, inherit))));
213
+ box-shadow: inset 2px 2px var(--tct-calendar-day-selected-outline-color, var(--t-calendar-day-selected-outline-color, var(--tct-stoplight-info, var(--const-stoplight-info, #0079c1)))), inset -2px -2px var(--tct-calendar-day-selected-outline-color, var(--t-calendar-day-selected-outline-color, var(--tct-stoplight-info, var(--const-stoplight-info, #0079c1))));
227
214
  }
228
215
 
229
216
  .today-decorator {
@@ -233,17 +220,9 @@ q2-input {
233
220
  height: 12px;
234
221
  }
235
222
 
236
- .activity-decorator {
237
- width: var(--tct-scale-1, var(--app-scale-1, 5px));
238
- height: var(--tct-scale-1, var(--app-scale-1, 5px));
239
- border-radius: 50%;
240
- margin: 0 auto;
241
- background-color: var(--tct-calendar-activity-indicator-color, var(--tct-stoplight-info, var(--const-stoplight-info, #0079c1)));
242
- }
243
-
244
223
  .calendar-disclaimer {
245
- font-size: var(--tct-calendar-disclaimer-font-size, var(--tct-font-size-small, var(--app-font-size-small, 12px)));
246
- border-top: 1px solid var(--tct-calendar-disclaimer-border-color, var(--tct-gray-13, var(--t-gray-13, var(--tct-gray-l3, var(--app-gray-l3, #e6e6e6)))));
224
+ font-size: var(--tct-calendar-disclaimer-font-size, var(--t-calendar-disclaimer-font-size, var(--tct-font-size-small, var(--app-font-size-small, 12px))));
225
+ border-top: 1px solid var(--tct-calendar-disclaimer-border-color, var(--t-calendar-disclaimer-border-color, var(--tct-gray-13, var(--t-gray-13, var(--tct-gray-l3, var(--app-gray-l3, #e6e6e6))))));
247
226
  padding: var(--tct-calendar-disclaimer-padding, var(--tct-scale-2, var(--app-scale-2, 10px)));
248
227
  text-align: left;
249
228
  }
@@ -1,14 +1,11 @@
1
1
  import { firstDayOfWeekInMonth } from './helpers';
2
- import moment from 'moment';
3
- function generateDatesFromMonthYear(month, year) {
4
- const startingMoment = moment(`${year}-${month >= 9 ? month + 1 : `0${month + 1}`}-01`, 'YYYY-MM-DD');
5
- const lastDayOfMonth = startingMoment.daysInMonth();
6
- let datesArr = [startingMoment];
7
- while (datesArr.length < lastDayOfMonth) {
8
- const lastDayInList = datesArr[datesArr.length - 1];
9
- datesArr = datesArr.concat(lastDayInList.clone().add(1, 'day'));
10
- }
11
- return datesArr;
2
+ import { getDaysInMonth, isSameDay, isBefore, isAfter, isValid as isValidDate } from 'date-fns';
3
+ export function generateDatesFromMonthYear(month, year) {
4
+ const daysInMonth = getDaysInMonth(new Date(year, month));
5
+ return [...Array(daysInMonth).keys()].reduce((acc, stepIndex) => {
6
+ acc.push(new Date(year, month, stepIndex + 1));
7
+ return acc;
8
+ }, []);
12
9
  }
13
10
  export function getValidDaysOfWeek(checksum = 127) {
14
11
  const sunValid = checksum & 1;
@@ -19,173 +16,110 @@ export function getValidDaysOfWeek(checksum = 127) {
19
16
  const friValid = checksum & 32;
20
17
  const satValid = checksum & 64;
21
18
  const ret = [];
22
- if (checksum > 0) {
23
- if (sunValid) {
24
- ret.push(0);
25
- }
26
- if (monValid) {
27
- ret.push(1);
28
- }
29
- if (tuesValid) {
30
- ret.push(2);
31
- }
32
- if (wedsValid) {
33
- ret.push(3);
34
- }
35
- if (thursValid) {
36
- ret.push(4);
37
- }
38
- if (friValid) {
39
- ret.push(5);
40
- }
41
- if (satValid) {
42
- ret.push(6);
43
- }
44
- }
19
+ if (checksum <= 0)
20
+ return ret;
21
+ if (sunValid)
22
+ ret.push(0);
23
+ if (monValid)
24
+ ret.push(1);
25
+ if (tuesValid)
26
+ ret.push(2);
27
+ if (wedsValid)
28
+ ret.push(3);
29
+ if (thursValid)
30
+ ret.push(4);
31
+ if (friValid)
32
+ ret.push(5);
33
+ if (satValid)
34
+ ret.push(6);
45
35
  return ret;
46
36
  }
47
37
  export function validateAgainstChecksum(validDaysOfWeek, newDate) {
48
- return validDaysOfWeek.includes(newDate.day());
38
+ return validDaysOfWeek.includes(newDate.getDay());
49
39
  }
50
- export function validateAgainstBlacklist(invalidDateMoments, newDate) {
51
- return !invalidDateMoments.some(date => date && date.isSame(newDate, 'day'));
40
+ export function validateAgainstBlacklist(invalidDates, newDate) {
41
+ return !validateAgainstWhitelist(invalidDates, newDate);
52
42
  }
53
- export function validateAgainstWhitelist(validDateMoments, newDate) {
54
- return validDateMoments.some(date => date && date.isSame(newDate, 'day'));
43
+ export function validateAgainstWhitelist(validDates, newDate) {
44
+ return validDates.some(validDate => isSameDay(validDate, newDate));
55
45
  }
56
- const META_DATA_STUB = () => {
57
- return ['', '', false];
58
- };
59
- export function buildDates(validDaysOfWeek, validDateMoments, invalidDateMoments, selectedMonthYear, currentSelection, daysOfWeek, dateValidators, typedValue) {
60
- const validationFns = [];
61
- if (validDateMoments === null || validDateMoments === void 0 ? void 0 : validDateMoments.length) {
62
- validationFns.push(validateAgainstWhitelist.bind(null, validDateMoments));
46
+ export function buildDates(validDaysOfWeek, validDates, invalidDates, selectedMonthYear, currentSelection, dateValidators, typedValue) {
47
+ const validationFns = [baseValidation.bind(null, dateValidators, new Date())];
48
+ if (validDates === null || validDates === void 0 ? void 0 : validDates.length) {
49
+ validationFns.push(validateAgainstWhitelist.bind(null, validDates));
63
50
  }
64
51
  else {
65
52
  validationFns.push(validateAgainstChecksum.bind(null, validDaysOfWeek));
66
53
  }
67
- validationFns.push(validateAgainstBlacklist.bind(null, invalidDateMoments));
68
- return generateDateList(selectedMonthYear, currentSelection, daysOfWeek, dateValidators, validationFns, typedValue, META_DATA_STUB);
69
- }
70
- export function generateDateList({ monthIndex, selectedMonth: month, selectedYear: year }, currentSelection, daysOfWeek, dateValidators, validationFns, typedValue, genMetaData) {
71
- const totalValidationFns = [baseValidation.bind(null, dateValidators, moment())].concat(validationFns);
72
- const startOfMonthEmpties = addEmptiesMonthStart(firstDayOfWeekInMonth(monthIndex, year));
73
- const typedDate = new Date(typedValue);
74
- const datesInMonth = generateDatesFromMonthYear(monthIndex, year).map((momentDate, dateIndex) => {
75
- const dayIndexOfWeek = momentDate.day();
76
- const isInvalid = totalValidationFns.some(fn => !fn(momentDate));
77
- const [metaDataTop, metaDataBottom, isActivityDate] = genMetaData(momentDate);
78
- const [isStartDate, isEndDate, isToday, isSelected] = applyDateClasses(momentDate, dateValidators, currentSelection);
79
- const isFirst = isFirstDayOfWeek(dayIndexOfWeek);
80
- const isLast = isLastDayOfWeek(dayIndexOfWeek);
81
- const dayOfWeek = daysOfWeek[dayIndexOfWeek];
82
- const classList = generateClassesForCalDay(!isInvalid, isFirst, isLast, isSelected, isEndDate, isStartDate, isToday, typedDate.toString() === 'Invalid Date');
83
- return {
84
- isValid: !isInvalid,
85
- isEmpty: false,
86
- dateString: momentDate.format('YYYY-MM-DD'),
87
- integer: dateIndex + 1,
88
- month,
89
- year,
90
- dayOfWeek,
91
- metaDataTop,
92
- metaDataBottom,
93
- isActivityDate,
94
- isStartDate,
95
- isEndDate,
96
- isSelected,
97
- isToday,
98
- isFirst,
99
- isLast,
100
- classList
101
- };
54
+ validationFns.push(validateAgainstBlacklist.bind(null, invalidDates));
55
+ return generateDateList(selectedMonthYear, currentSelection, dateValidators, validationFns, typedValue);
56
+ }
57
+ export function generateDateList({ monthIndex, selectedYear }, currentSelection, dateValidators, validationFns, typedValue) {
58
+ const isIncompleteDate = !isValidDate(new Date(typedValue));
59
+ const datesInMonth = generateDatesFromMonthYear(monthIndex, selectedYear).map((dayInMonth, dateIndex) => {
60
+ const isInvalid = validationFns.some(fn => !fn(dayInMonth));
61
+ const dayState = getDayState(dayInMonth, dateValidators, currentSelection);
62
+ const classList = generateClassesForCalDay(Object.assign(Object.assign({}, dayState), { isInvalid,
63
+ isIncompleteDate }));
64
+ return Object.assign(Object.assign({}, dayState), { isValid: !isInvalid, date: dayInMonth, integer: dateIndex + 1, isEmpty: false, isActivity: false, classList });
102
65
  });
66
+ const startOfMonthEmpties = addEmptiesMonthStart(firstDayOfWeekInMonth(monthIndex, selectedYear));
103
67
  const endOfMonthEmpties = addEmptiesMonthEnd((startOfMonthEmpties.length + datesInMonth.length) % 7);
104
- return startOfMonthEmpties.concat(datesInMonth, endOfMonthEmpties);
105
- }
106
- function baseValidation(dateValidators, now, newDate) {
107
- const inValidatedByStartDate = (dateValidators.startDate && dateValidators.startDate.isAfter(newDate, 'day')) || false;
108
- const inValidatedByCutoffTime = (dateValidators.cutOffTime &&
109
- now.isSame(newDate, 'day') &&
110
- now.isAfter(dateValidators.cutOffTime)) ||
111
- false;
112
- const inValidatedByEndDate = (dateValidators.endDate && dateValidators.endDate.isBefore(newDate, 'day')) || false;
113
- return !(inValidatedByStartDate || inValidatedByCutoffTime || inValidatedByEndDate);
114
- }
115
- function applyDateClasses(dateObjMoment, dateValidators, newDateMoment) {
116
- const isSelected = newDateMoment && newDateMoment.isSame(dateObjMoment, 'day');
117
- const isToday = dateObjMoment.isSame(moment(), 'day');
118
- const isStartDate = dateObjMoment.isSame(dateValidators.startDate, 'day');
119
- const isEndDate = dateObjMoment.isSame(dateValidators.endDate, 'day');
120
- return [isStartDate, isEndDate, isToday, isSelected];
121
- }
122
- function generateClassesForCalDay(isValid, isFirst, isLast, isSelected, isEndDate, isStartDate, isToday, isIncompleteDate) {
123
- const isValidClass = isValid ? ' is-valid' : '';
124
- const isFirstClass = isFirst ? ' is-first' : '';
125
- const isLastClass = isLast ? ' is-last' : '';
126
- const isSelectedClass = isSelected ? ' is-selected' : '';
127
- const isEndDateClass = isEndDate ? ' is-end-date' : '';
128
- const isStartDateClass = isStartDate ? ' is-start-date' : '';
129
- const isTodayClass = isToday ? ' is-today' : '';
130
- const isUnAvailableClass = isSelected && !isValid && !isIncompleteDate ? ' is-unavailable' : '';
131
- const classList = `${isValidClass}${isFirstClass}${isLastClass}${isSelectedClass}${isEndDateClass}${isStartDateClass}${isTodayClass}${isUnAvailableClass}`;
132
- return classList;
133
- }
134
- function addEmptiesMonthStart(monthStartDay) {
135
- return _addEmptyDates(0, monthStartDay);
136
- }
137
- function addEmptiesMonthEnd(monthEndDay) {
138
- if (monthEndDay > 0) {
139
- return _addEmptyDates(monthEndDay, 7);
140
- }
141
- else {
68
+ return [...startOfMonthEmpties, ...datesInMonth, ...endOfMonthEmpties];
69
+ }
70
+ export function baseValidation(dateValidators, now, newDate) {
71
+ const isNewDateBeforeStartDate = isAfter(dateValidators === null || dateValidators === void 0 ? void 0 : dateValidators.startDate, newDate);
72
+ const isNewDateAfterEndDate = isBefore(dateValidators === null || dateValidators === void 0 ? void 0 : dateValidators.endDate, newDate);
73
+ const isNowAfterCutoffTime = isSameDay(now, newDate) && isAfter(now, dateValidators === null || dateValidators === void 0 ? void 0 : dateValidators.cutOffTime);
74
+ return !(isNewDateBeforeStartDate || isNowAfterCutoffTime || isNewDateAfterEndDate);
75
+ }
76
+ export function getDayState(dayInMonth, dateValidators, currentDate) {
77
+ if (!currentDate)
78
+ currentDate = new Date();
79
+ const isSelected = currentDate && isSameDay(currentDate, dayInMonth);
80
+ const isToday = isSameDay(dayInMonth, new Date());
81
+ const isStartDate = isSameDay(dayInMonth, dateValidators === null || dateValidators === void 0 ? void 0 : dateValidators.startDate);
82
+ const isEndDate = isSameDay(dayInMonth, dateValidators === null || dateValidators === void 0 ? void 0 : dateValidators.endDate);
83
+ return { isSelected, isToday, isStartDate, isEndDate };
84
+ }
85
+ export function generateClassesForCalDay({ isInvalid, isSelected, isEndDate, isStartDate, isToday, isIncompleteDate }) {
86
+ const classes = [];
87
+ if (!isInvalid)
88
+ classes.push('is-valid');
89
+ if (isSelected)
90
+ classes.push('is-selected');
91
+ if (isEndDate)
92
+ classes.push('is-end-date');
93
+ if (isStartDate)
94
+ classes.push('is-start-date');
95
+ if (isToday)
96
+ classes.push('is-today');
97
+ if (isSelected && isInvalid && !isIncompleteDate)
98
+ classes.push('is-unavailable');
99
+ return classes.join(' ');
100
+ }
101
+ export function addEmptiesMonthStart(monthStartDayOfWeek) {
102
+ return addEmptyDates(0, monthStartDayOfWeek);
103
+ }
104
+ export function addEmptiesMonthEnd(monthEndDayOfWeek) {
105
+ if (monthEndDayOfWeek === 0)
142
106
  return [];
143
- }
144
- }
145
- function _addEmptyDates(from, to) {
146
- // 7 & 0 are both Sunday reseting to 0 to set up loop
147
- const fromDate = from === 7 ? 0 : from;
148
- const dates = [];
149
- for (let i = fromDate; i < to; i++) {
150
- const newDate = {
151
- dateString: '',
152
- integer: '&nbsp;',
153
- year: -1,
154
- month: '',
155
- isEmpty: true,
156
- isActivityDate: false,
157
- isFirst: false,
158
- isLast: false,
159
- isValid: false,
160
- isToday: false,
161
- isSelected: false,
162
- isRepeatDate: false,
163
- isStartDate: false,
164
- isEndDate: false,
165
- metaDataTop: '',
166
- metaDataBottom: '',
167
- dayOfWeek: '',
168
- classList: ''
169
- };
170
- processCount(newDate, i);
171
- dates.push(newDate);
172
- }
173
- return dates;
174
- }
175
- function isFirstDayOfWeek(dayCount) {
176
- return dayCount === 0 || dayCount % 7 === 0;
177
- }
178
- function isLastDayOfWeek(dayCount) {
179
- return dayCount % 7 === 6;
180
- }
181
- function processCount(newCalendarDate, count) {
182
- let returnCount = count;
183
- if (count === 0 || count % 7 === 0) {
184
- newCalendarDate.isFirst = true;
185
- returnCount = 0;
186
- }
187
- else if (count % 7 === 6) {
188
- newCalendarDate.isLast = true;
189
- }
190
- return returnCount;
107
+ return addEmptyDates(monthEndDayOfWeek, 7);
108
+ }
109
+ export const emptyDate = {
110
+ date: null,
111
+ integer: null,
112
+ isActivity: false,
113
+ isEmpty: true,
114
+ isValid: false,
115
+ isToday: false,
116
+ isSelected: false,
117
+ isStartDate: false,
118
+ isEndDate: false,
119
+ classList: ''
120
+ };
121
+ export function addEmptyDates(from, to) {
122
+ if (from === 7)
123
+ from = 0;
124
+ return [...Array(to - from).keys()].map(() => (Object.assign({}, emptyDate)));
191
125
  }