@luzmo/lucero 1.0.1-alpha.15 → 1.0.1-alpha.17

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 (277) hide show
  1. package/components/accordion/index.cjs +183 -6
  2. package/components/accordion/index.js +136 -88
  3. package/components/action-bar/index.cjs +85 -4
  4. package/components/action-bar/index.js +72 -50
  5. package/components/action-button/index.cjs +205 -3
  6. package/components/action-button/index.js +167 -93
  7. package/components/action-group/index.cjs +7 -1
  8. package/components/action-group/index.js +12 -8
  9. package/components/action-group-DHp8RHDf.js +392 -0
  10. package/components/action-group-MPf19RPV.cjs +391 -0
  11. package/components/action-menu/index.cjs +91 -11
  12. package/components/action-menu/index.js +66 -47
  13. package/components/avatar/index.cjs +63 -3
  14. package/components/avatar/index.js +54 -42
  15. package/components/base-COw9n7UR.cjs +119 -0
  16. package/components/base-DmeVy0cq.js +120 -0
  17. package/components/button/index.cjs +134 -2
  18. package/components/button/index.js +106 -72
  19. package/components/button-base-7Ak55xFd.cjs +206 -0
  20. package/components/button-base-C3kf6BTK.js +207 -0
  21. package/components/button-group/index.cjs +45 -1
  22. package/components/button-group/index.js +37 -25
  23. package/components/calendar/index.cjs +632 -1
  24. package/components/calendar/index.js +637 -7
  25. package/components/checkbox/index.cjs +111 -4
  26. package/components/checkbox/index.js +98 -53
  27. package/components/checkbox-mixin-8cL-vfDy.js +84 -0
  28. package/components/checkbox-mixin-CE7dJj3J.cjs +83 -0
  29. package/components/clear-button-Co6oKSgl.js +59 -0
  30. package/components/clear-button-X_HDY2eH.cjs +58 -0
  31. package/components/close-button-DPBK6Kpu.cjs +59 -0
  32. package/components/close-button-Miw9ZjoJ.js +60 -0
  33. package/components/color-area/index.cjs +440 -13
  34. package/components/color-area/index.js +322 -187
  35. package/components/color-controller-BjDZaxhX.js +491 -0
  36. package/components/color-controller-C3c_vb2P.cjs +490 -0
  37. package/components/color-field/index.cjs +95 -2
  38. package/components/color-field/index.js +77 -41
  39. package/components/color-handle/index.cjs +64 -3
  40. package/components/color-handle/index.js +58 -37
  41. package/components/color-loupe/index.cjs +7 -1
  42. package/components/color-loupe/index.js +12 -8
  43. package/components/color-loupe-BQqNR8YD.cjs +88 -0
  44. package/components/color-loupe-B_DDFv8l.js +89 -0
  45. package/components/color-menu/index.cjs +217 -12
  46. package/components/color-menu/index.js +187 -93
  47. package/components/color-palette/index.cjs +89 -1
  48. package/components/color-palette/index.js +78 -51
  49. package/components/color-palette-group/index.cjs +259 -3
  50. package/components/color-palette-group/index.js +193 -105
  51. package/components/color-picker/index.cjs +114 -6
  52. package/components/color-picker/index.js +92 -72
  53. package/components/color-slider/index.cjs +585 -1
  54. package/components/color-slider/index.js +590 -7
  55. package/components/{directive-oAbCiebi.js → condition-attribute-with-id-Cn815e9W.js} +22 -22
  56. package/components/condition-attribute-with-id-DEc2Yjne.cjs +43 -0
  57. package/components/date-time-picker/index.cjs +1357 -31
  58. package/components/date-time-picker/index.js +951 -637
  59. package/components/dependency-manger-CcIE1uvQ.cjs +63 -0
  60. package/components/{dependency-manger-CEXvGQUV.js → dependency-manger-XHpQjFgK.js} +24 -14
  61. package/components/divider/index.cjs +54 -1
  62. package/components/divider/index.js +49 -30
  63. package/components/divider.module-Cm5LcDRV.cjs +20 -0
  64. package/components/divider.module-DauH6k2_.js +21 -0
  65. package/components/element-resolution-DCsrhGZO.cjs +112 -0
  66. package/components/element-resolution-nMlmW4Jy.js +113 -0
  67. package/components/field-group/index.cjs +7 -1
  68. package/components/field-group/index.js +12 -8
  69. package/components/field-group-DNmY8W9v.cjs +86 -0
  70. package/components/field-group-DVdAWCQF.js +87 -0
  71. package/components/field-label/index.cjs +7 -1
  72. package/components/field-label/index.js +12 -8
  73. package/components/field-label-CKH9EXpR.cjs +156 -0
  74. package/components/field-label-Dpsecoc6.js +157 -0
  75. package/components/focus-group-BqDAk9Is.js +337 -0
  76. package/components/focus-group-DFzOlalL.cjs +336 -0
  77. package/components/focus-visible-B-B8-P9R.cjs +104 -0
  78. package/components/focus-visible-BUPRWlsh.js +105 -0
  79. package/components/focusable-BPrTcZPd.cjs +262 -0
  80. package/components/focusable-ChCLg1k4.js +263 -0
  81. package/components/{directive-C7oCP5Bh.cjs → focusable-selectors-D0t_5P7C.cjs} +16 -5
  82. package/components/{focusable-selectors-B4YgbghQ.js → focusable-selectors-IltOAOd9.js} +7 -4
  83. package/components/icon/index.cjs +90 -1
  84. package/components/icon/index.js +74 -46
  85. package/components/index.cjs +174 -1
  86. package/components/index.js +174 -172
  87. package/components/infield-button/index.cjs +46 -2
  88. package/components/infield-button/index.js +41 -30
  89. package/components/label/index.cjs +37 -1
  90. package/components/label/index.js +36 -24
  91. package/components/{language-resolution-8yZa5r_P.js → language-resolution-BSGJAWiQ.js} +21 -16
  92. package/components/language-resolution-iN9EImbb.cjs +57 -0
  93. package/components/like-anchor-D62faRNG.cjs +79 -0
  94. package/components/like-anchor-v3cJ9RWM.js +80 -0
  95. package/components/manage-help-text-BYx84zZR.cjs +125 -0
  96. package/components/manage-help-text-DOuMTGht.js +126 -0
  97. package/components/menu/index.cjs +1297 -29
  98. package/components/menu/index.js +954 -499
  99. package/components/multi-language-field/index.cjs +132 -2
  100. package/components/multi-language-field/index.js +118 -88
  101. package/components/number-field/index.cjs +613 -10
  102. package/components/number-field/index.js +442 -243
  103. package/components/observe-slot-presence-9AwLGUQ_.cjs +78 -0
  104. package/components/observe-slot-presence-DcMdoumP.js +79 -0
  105. package/components/observe-slot-text-CSofZeeF.cjs +104 -0
  106. package/components/observe-slot-text-CjnkkBPn.js +105 -0
  107. package/components/options/index.cjs +693 -60
  108. package/components/options/index.js +519 -953
  109. package/components/overlay/index.cjs +367 -21
  110. package/components/overlay/index.js +273 -189
  111. package/components/overlay-CN8ISP1F.js +2485 -0
  112. package/components/overlay-LViy9VWM.cjs +2484 -0
  113. package/components/{pending-state-DTX7ggyF.js → pending-state-CXbe-Xul.js} +28 -13
  114. package/components/pending-state-e4RbXe9u.cjs +75 -0
  115. package/components/picker/index.cjs +9 -1
  116. package/components/picker/index.js +15 -11
  117. package/components/picker-DNde3awt.cjs +672 -0
  118. package/components/picker-PfUAF05y.js +673 -0
  119. package/components/picker-button/index.cjs +56 -4
  120. package/components/picker-button/index.js +45 -34
  121. package/components/platform-CxDar3Dn.cjs +68 -0
  122. package/components/platform-Cxn0WbyT.js +69 -0
  123. package/components/popover/index.cjs +7 -1
  124. package/components/popover/index.js +12 -8
  125. package/components/popover-BkbYhl3i.js +74 -0
  126. package/components/popover-BkgUf0kL.cjs +74 -0
  127. package/components/progress-circle/index.cjs +7 -1
  128. package/components/progress-circle/index.js +12 -8
  129. package/components/progress-circle-Hu_ivPHf.js +133 -0
  130. package/components/progress-circle-_Etqsj9f.cjs +132 -0
  131. package/components/radio/index.cjs +244 -2
  132. package/components/radio/index.js +192 -110
  133. package/components/{when-CDK1Tt5Y.js → random-id-BE6HA503.cjs} +7 -10
  134. package/components/{random-id-ByCz1xaq.js → random-id-BEc6QIUL.js} +3 -3
  135. package/components/roving-tabindex-AsmAh2In.cjs +95 -0
  136. package/components/roving-tabindex-DPF9NmrH.js +96 -0
  137. package/components/search/index.cjs +115 -8
  138. package/components/search/index.js +96 -66
  139. package/components/select/index.cjs +720 -51
  140. package/components/select/index.js +563 -347
  141. package/components/sized-mixin-DmkrNdWB.js +80 -0
  142. package/components/sized-mixin-UaTVa-AE.cjs +79 -0
  143. package/components/slider/index.cjs +119 -1
  144. package/components/slider/index.js +100 -1113
  145. package/components/{condition-attribute-with-id-Dv4lSRbe.js → slottable-request-event-CANixJnR.cjs} +15 -13
  146. package/components/{slottable-request-event-DggLA4Rx.js → slottable-request-event-D9WzrdWv.js} +12 -9
  147. package/components/strategies-DlMlaSJR.cjs +317 -0
  148. package/components/strategies-DlPQoTFE.js +318 -0
  149. package/components/streaming-listener-D4sHaMub.cjs +145 -0
  150. package/components/streaming-listener-cAz5zJyk.js +146 -0
  151. package/components/swatch/index.cjs +436 -7
  152. package/components/swatch/index.js +350 -205
  153. package/components/switch/index.cjs +61 -2
  154. package/components/switch/index.js +51 -34
  155. package/components/tabs/index.cjs +693 -26
  156. package/components/tabs/index.js +521 -388
  157. package/components/tags/index.cjs +201 -4
  158. package/components/tags/index.js +152 -87
  159. package/components/text-field/index.cjs +49 -3
  160. package/components/text-field/index.js +44 -30
  161. package/components/text-field-11tcnftU.cjs +338 -0
  162. package/components/text-field-Chi9J2Cz.js +339 -0
  163. package/components/text-field.module-CMBS0jSL.js +21 -0
  164. package/components/text-field.module-DIJdV_sA.cjs +20 -0
  165. package/components/toast/index.cjs +177 -12
  166. package/components/toast/index.js +145 -73
  167. package/components/tooltip/index.cjs +221 -6
  168. package/components/tooltip/index.js +155 -131
  169. package/components/tooltip/tooltip.d.ts +1 -12
  170. package/components/unit-input/index.cjs +232 -8
  171. package/components/unit-input/index.js +201 -108
  172. package/components/utils.cjs +25 -1
  173. package/components/utils.js +22 -22
  174. package/custom-elements.json +1 -1
  175. package/package.json +1 -1
  176. package/components/NumberFormatter-DewVDY5w.cjs +0 -18
  177. package/components/NumberFormatter-DgOUVrge.js +0 -136
  178. package/components/NumberParser-Dik4a0h-.cjs +0 -18
  179. package/components/NumberParser-ci9J5EKv.js +0 -173
  180. package/components/action-group-DBImibFn.js +0 -258
  181. package/components/action-group-DJGMcRHb.cjs +0 -20
  182. package/components/async-directive-BX1T1e1_.cjs +0 -22
  183. package/components/async-directive-BfcqVjDp.js +0 -82
  184. package/components/base-BjTwmyRF.cjs +0 -22
  185. package/components/base-CBCg3yyw.cjs +0 -40
  186. package/components/base-D76d76ww.js +0 -26
  187. package/components/base-WsynuqaS.js +0 -677
  188. package/components/button-base-DbkDzb71.js +0 -144
  189. package/components/button-base-XgPLmwP-.cjs +0 -25
  190. package/components/checkbox-mixin-BDN0dBtS.cjs +0 -27
  191. package/components/checkbox-mixin-Do7EgtpQ.js +0 -70
  192. package/components/class-map-Di1D_rCm.cjs +0 -22
  193. package/components/class-map-NbVXqBU0.js +0 -51
  194. package/components/clear-button-BbVqNU-g.js +0 -53
  195. package/components/clear-button-DYdeFsS8.cjs +0 -18
  196. package/components/close-button-CpfKibqg.cjs +0 -18
  197. package/components/close-button-DzOZZmkY.js +0 -51
  198. package/components/color-controller-B0uX6Zso.js +0 -3230
  199. package/components/color-controller-CoUL5f9K.cjs +0 -18
  200. package/components/color-loupe-CaA_Lfkk.cjs +0 -56
  201. package/components/color-loupe-CmMsXbjT.js +0 -81
  202. package/components/condition-attribute-with-id-DrQYZzFS.cjs +0 -18
  203. package/components/dependency-manger-C5HCkMMB.cjs +0 -18
  204. package/components/directive-helpers-Cm6gitnu.js +0 -62
  205. package/components/directive-helpers-DyIRTWwA.cjs +0 -22
  206. package/components/divider.module-DDvBo9zo.cjs +0 -18
  207. package/components/divider.module-DoQWQEIJ.js +0 -21
  208. package/components/element-resolution-BvRLGqIU.cjs +0 -18
  209. package/components/element-resolution-FCUT-wql.js +0 -91
  210. package/components/field-group-DXfBWrkO.js +0 -66
  211. package/components/field-group-DkGst3r5.cjs +0 -23
  212. package/components/field-label-CZ2zzChK.js +0 -106
  213. package/components/field-label-mO1AkUgR.cjs +0 -25
  214. package/components/flow-D-0MTYCm.js +0 -527
  215. package/components/flow-DM3dNAKs.cjs +0 -30
  216. package/components/focus-group-DHeTq18L.js +0 -218
  217. package/components/focus-group-DnxZUBhQ.cjs +0 -18
  218. package/components/focus-visible-B0P9aY_G.cjs +0 -18
  219. package/components/focus-visible-DBlJGoEW.js +0 -74
  220. package/components/focusable-BxtpnzWp.js +0 -153
  221. package/components/focusable-EbipgXRh.cjs +0 -18
  222. package/components/focusable-selectors-BgFlyFcY.cjs +0 -18
  223. package/components/if-defined-C9YGdo33.cjs +0 -22
  224. package/components/if-defined-DOaE2coe.js +0 -27
  225. package/components/index-BQoI8AD3.cjs +0 -113
  226. package/components/index-BwxgAdzi.cjs +0 -57
  227. package/components/index-Cb9zsiz6.js +0 -1490
  228. package/components/index-HjQa8tew.js +0 -1174
  229. package/components/language-resolution-DJzmyzZq.cjs +0 -18
  230. package/components/like-anchor-Bvn_vLQ8.js +0 -69
  231. package/components/like-anchor-sod1C1fR.cjs +0 -32
  232. package/components/luzmo-icons-D47EGj-3.cjs +0 -29
  233. package/components/luzmo-icons-NEyaMpEM.js +0 -229
  234. package/components/manage-help-text-DhgARkZX.cjs +0 -30
  235. package/components/manage-help-text-syYnjKGL.js +0 -92
  236. package/components/mutation-controller-DH7YOCyj.js +0 -52
  237. package/components/mutation-controller-DkOMCW-c.cjs +0 -22
  238. package/components/observe-slot-presence-CmVi0zTc.js +0 -68
  239. package/components/observe-slot-presence-bc9chhsi.cjs +0 -18
  240. package/components/observe-slot-text-BPfIQQtz.js +0 -87
  241. package/components/observe-slot-text-Ceb7SvYT.cjs +0 -18
  242. package/components/overlay-Cig9r6uU.js +0 -2747
  243. package/components/overlay-KSKMzzkh.cjs +0 -47
  244. package/components/pending-state-CaH1si5b.cjs +0 -26
  245. package/components/picker-CAYj4hBD.js +0 -461
  246. package/components/picker-apS0Zrly.cjs +0 -123
  247. package/components/platform-BM-uMWpX.js +0 -69
  248. package/components/platform-BiXhwqk3.cjs +0 -18
  249. package/components/popover-DjX0aAnY.js +0 -67
  250. package/components/popover-KFfO0IYL.cjs +0 -30
  251. package/components/progress-circle-BvRJNuNo.cjs +0 -33
  252. package/components/progress-circle-DXH9z8-6.js +0 -97
  253. package/components/query-BL-TJj7K.cjs +0 -22
  254. package/components/query-D_KR_GUc.js +0 -51
  255. package/components/query-assigned-elements-DjfhL1cl.js +0 -36
  256. package/components/query-assigned-elements-DsKsfk7G.cjs +0 -22
  257. package/components/query-assigned-nodes-BcKWmGzy.cjs +0 -22
  258. package/components/query-assigned-nodes-C76XVPWY.js +0 -36
  259. package/components/random-id-CqvckpWe.cjs +0 -18
  260. package/components/roving-tabindex-By_fCy_e.cjs +0 -18
  261. package/components/roving-tabindex-DOg4z6ZU.js +0 -66
  262. package/components/sized-mixin-CPxE5C96.cjs +0 -18
  263. package/components/sized-mixin-D4ACoVUr.js +0 -63
  264. package/components/slottable-request-event-BfUUt1Mh.cjs +0 -18
  265. package/components/state-D8JEtYqe.cjs +0 -22
  266. package/components/state-Deh-vKYE.js +0 -29
  267. package/components/strategies-9indNIEb.js +0 -195
  268. package/components/strategies-BACP6MhR.cjs +0 -18
  269. package/components/streaming-listener-B00MvALi.cjs +0 -18
  270. package/components/streaming-listener-CP-JE6Fa.js +0 -91
  271. package/components/style-map-CeilmSgs.cjs +0 -22
  272. package/components/style-map-IgqIKvlE.js +0 -53
  273. package/components/text-field-BYF2RHY8.cjs +0 -85
  274. package/components/text-field-PYafEYeO.js +0 -314
  275. package/components/text-field.module-C2KVUJcX.js +0 -21
  276. package/components/text-field.module-DXhFA9G-.cjs +0 -18
  277. package/components/when-CDZyJPvd.cjs +0 -22
@@ -15,4 +15,635 @@
15
15
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16
16
  * SOFTWARE.
17
17
  * */
18
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-BQoI8AD3.cjs");exports.LuzmoCalendar=e.LuzmoCalendar;
18
+ "use strict";
19
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
20
+ const date = require("@internationalized/date");
21
+ const number = require("@internationalized/number");
22
+ const lit = require("lit");
23
+ const classMap_js = require("lit/directives/class-map.js");
24
+ const ifDefined_js = require("lit/directives/if-defined.js");
25
+ const base = require("../base-COw9n7UR.cjs");
26
+ const sizedMixin = require("../sized-mixin-UaTVa-AE.cjs");
27
+ require("../action-button/index.cjs");
28
+ require("../icon/index.cjs");
29
+ const icons = require("@luzmo/icons");
30
+ const decorators_js = require("lit/decorators.js");
31
+ const styles = ':host{inline-size:var(--luzmo-calendar-width, var(--calendar-width));display:inline-block}.header{inline-size:100%;align-items:center;display:flex}.title{color:var(--highcontrast-calendar-date-text-color, var(--luzmo-calendar-date-text-color, var(--calendar-date-text-color)));font-size:var(--luzmo-calendar-title-text-size, var(--calendar-title-text-size));font-weight:var(--luzmo-calendar-title-font-weight, var(--calendar-title-font-weight));line-height:var(--luzmo-calendar-title-height, var(--calendar-title-height));text-align:center;white-space:nowrap;text-overflow:ellipsis;flex-grow:1;order:1;margin:0;overflow:hidden}.nextMonth,.prevMonth{transform:var(--logical-rotation)}.nextMonth:not([disabled]),.prevMonth:not([disabled]){color:var(--highcontrast-calendar-button-icon-color, var(--luzmo-calendar-button-icon-color, var(--calendar-button-icon-color)))}.prevMonth{order:0}.nextMonth{order:2}.dayOfWeek{inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));color:var(--highcontrast-calendar-day-title-text-color, var(--luzmo-calendar-day-title-text-color, var(--calendar-day-title-text-color)));font-size:var(--luzmo-calendar-day-title-text-size, var(--calendar-day-title-text-size));font-weight:var(--luzmo-calendar-day-title-text-font-weight, var(--calendar-day-title-text-font-weight));text-transform:uppercase;cursor:default;flex-direction:column;justify-content:flex-end;display:flex;border-block-end:none!important;-webkit-text-decoration:none!important;text-decoration:none!important}:host([title]) .dayOfWeek{text-decoration:underline;letter-spacing:var(--luzmo-calendar-title-text-letter-spacing, var(--calendar-title-text-letter-spacing));border-block-end:none;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.body{outline:none}.table{table-layout:fixed;border-collapse:collapse;border-spacing:0;-webkit-user-select:none;user-select:none}.table-cell{text-align:center;box-sizing:initial;block-size:var(--luzmo-calendar-day-height, var(--calendar-day-height));inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));padding:var(--luzmo-calendar-day-padding, var(--calendar-day-padding));position:relative}.table-cell:focus{outline:0}.date{box-sizing:border-box;block-size:var(--luzmo-calendar-day-height, var(--calendar-day-height));inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));margin:var(--luzmo-calendar-day-padding, var(--calendar-day-padding));border-radius:var(--luzmo-calendar-day-border-radius, var(--calendar-day-border-radius));border:var(--luzmo-calendar-day-border-size, var(--calendar-day-border-size)) solid transparent;font-size:var(--luzmo-calendar-day-text-size, var(--calendar-day-text-size));line-height:calc(var(--luzmo-calendar-day-width, var(--calendar-day-width)) - var(--luzmo-calendar-day-border-size, var(--calendar-day-border-size)) * 2);white-space:nowrap;cursor:pointer;display:block;position:absolute;inset-block-start:0;inset-inline-start:0}.date:lang(ja),.date:lang(ko),.date:lang(zh){font-size:var(--luzmo-calendar-day-text-size-han, var(--calendar-day-text-size-han))}.date.is-disabled{cursor:default;pointer-events:none}.date.is-outsideMonth{display:none}.date:before{content:"";box-sizing:border-box;inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));block-size:var(--luzmo-calendar-day-height, var(--calendar-day-height));border-radius:var(--luzmo-calendar-day-border-radius, var(--calendar-day-border-radius));border:var(--luzmo-calendar-day-border-size, var(--calendar-day-border-size)) solid transparent;position:absolute;inset-block-start:calc(50% - var(--luzmo-calendar-day-width, var(--calendar-day-width)) / 2);inset-inline-start:calc(50% - var(--luzmo-calendar-day-width, var(--calendar-day-width)) / 2)}.date.is-selected:not(.is-range-selection){font-weight:var(--luzmo-calendar-day-text-font-weight-selected, var(--calendar-day-text-font-weight-selected))}.date.is-selected:not(.is-range-selection):before{display:none}.date.is-today{font-weight:var(--luzmo-calendar-day-today-text-font-weight, var(--calendar-day-today-text-font-weight))}.date.is-range-selection{margin:var(--luzmo-calendar-day-padding, var(--calendar-day-padding)) 0;border-width:var(--luzmo-calendar-border-width-reset, var(--calendar-border-width-reset));line-height:var(--luzmo-calendar-day-height, var(--calendar-day-height));border-radius:var(--luzmo-calendar-border-radius-reset, var(--calendar-border-radius-reset));inline-size:calc(var(--luzmo-calendar-day-width, var(--calendar-day-width)) + var(--luzmo-calendar-day-padding, var(--calendar-day-padding)) * 2)}.date.is-range-selection.is-range-end,.date.is-range-selection.is-range-start,.date.is-range-selection.is-selection-end,.date.is-range-selection.is-selection-start{inline-size:calc(var(--luzmo-calendar-day-width, var(--calendar-day-width)) + var(--luzmo-calendar-day-padding, var(--calendar-day-padding)))}.date.is-range-selection.is-selection-end,.date.is-range-selection.is-selection-start{font-weight:var(--luzmo-calendar-day-text-font-weight-cap-selected, var(--calendar-day-text-font-weight-cap-selected))}.date.is-range-selection.is-selection-end:after,.date.is-range-selection.is-selection-start:after{block-size:var(--luzmo-calendar-day-height, var(--calendar-day-height));inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));border-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));content:"";display:block;position:absolute;inset-block-start:0}.date.is-range-selection.is-range-start,.date.is-range-selection.is-selection-start{border-start-start-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));border-end-start-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));margin-inline-start:var(--luzmo-calendar-day-padding, var(--calendar-day-padding));padding-inline-end:var(--luzmo-calendar-day-padding, var(--calendar-day-padding))}.date.is-range-selection.is-range-start:after,.date.is-range-selection.is-range-start:before,.date.is-range-selection.is-selection-start:after,.date.is-range-selection.is-selection-start:before{inset-inline-start:0}.date.is-range-selection.is-range-end,.date.is-range-selection.is-selection-end{border-start-end-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));border-end-end-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));margin-inline-end:var(--luzmo-calendar-day-padding, var(--calendar-day-padding));padding-inline-start:var(--luzmo-calendar-day-padding, var(--calendar-day-padding))}.date.is-range-selection.is-range-end:after,.date.is-range-selection.is-range-end:before,.date.is-range-selection.is-selection-end:after,.date.is-range-selection.is-selection-end:before{inset-inline:auto 0}.date.is-range-selection.is-range-start.is-range-end,.date.is-range-selection.is-selection-end.is-range-start,.date.is-range-selection.is-selection-start.is-range-end,.date.is-range-selection.is-selection-start.is-selection-end{inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));border-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width))}.date{color:var(--highcontrast-calendar-day-text-color, var(--luzmo-calendar-day-text-color, var(--calendar-day-text-color)))}.date:active{background-color:var(--highcontrast-calendar-day-background-color-down, var(--luzmo-calendar-day-background-color-down, var(--calendar-day-background-color-down)))}.date.is-selected{color:var(--highcontrast-calendar-day-text-color-selected, var(--luzmo-calendar-day-text-color-selected, var(--calendar-day-text-color-selected)));background:var(--highcontrast-calendar-day-background-color-selected, var(--luzmo-calendar-day-background-color-selected, var(--calendar-day-background-color-selected)))}.date.is-selected:not(.is-range-selection){background:var(--highcontrast-calendar-day-background-color-cap-selected, var(--luzmo-calendar-day-background-color-cap-selected, var(--calendar-day-background-color-cap-selected)));color:var(--highcontrast-calendar-day-text-color-cap-selected, var(--luzmo-calendar-day-text-color-cap-selected, var(--calendar-day-text-color-cap-selected)));border-color:var(--highcontrast-calendar-day-border-color-cap-selected, var(--luzmo-calendar-day-border-color-cap-selected, var(--calendar-day-border-color-cap-selected)))}.date.is-today{color:var(--highcontrast-calendar-day-today-text-color, var(--luzmo-calendar-day-today-text-color, var(--calendar-day-today-text-color)));background-color:var(--highcontrast-calendar-day-today-background-color, var(--luzmo-calendar-day-today-background-color, var(--calendar-day-today-background-color)))}.date.is-today,.date.is-today:before{border-color:var(--highcontrast-calendar-day-today-border-color, var(--luzmo-calendar-day-today-border-color, var(--calendar-day-today-border-color)))}@media (hover: hover){.date:hover{color:var(--highcontrast-calendar-day-text-color-hover, var(--luzmo-calendar-day-text-color-hover, var(--calendar-day-text-color-hover)))}.date:hover:not(.is-selection-end,.is-selection-start):before{background:var(--highcontrast-calendar-day-background-color-hover, var(--luzmo-calendar-day-background-color-hover, var(--calendar-day-background-color-hover)))}.date.is-range-selection:hover:before,.date.is-selected:hover:not(.is-selection-end,.is-selection-start):before{background:var(--highcontrast-calendar-day-background-color-selected-hover, var(--luzmo-calendar-day-background-color-selected-hover, var(--calendar-day-background-color-selected-hover)))}.date.is-today.is-selected:not(.is-range-selection):hover:before{background:var(--highcontrast-calendar-day-today-background-color-selected-hover, var(--luzmo-calendar-day-today-background-color-selected-hover, var(--calendar-day-today-background-color-selected-hover)))}}.date.is-today.is-disabled{color:var(--highcontrast-calendar-day-today-text-color-disabled, var(--luzmo-calendar-day-today-text-color-disabled, var(--calendar-day-today-text-color-disabled)))}.date.is-today.is-disabled,.date.is-today.is-disabled:before{border-color:var(--highcontrast-calendar-day-today-border-color-disabled, var(--luzmo-calendar-day-today-border-color-disabled, var(--calendar-day-today-border-color-disabled)))}.table-cell:focus-within .date:not(.is-range-selection){background:var(--highcontrast-calendar-day-background-color-key-focus, var(--luzmo-calendar-day-background-color-key-focus, var(--calendar-day-background-color-key-focus)));color:var(--highcontrast-calendar-day-text-color-key-focus, var(--luzmo-calendar-day-text-color-key-focus, var(--calendar-day-text-color-key-focus)))}.table-cell:focus-within .date.is-selected:not(.is-range-selection),.table-cell:focus-within .date.is-today:not(.is-range-selection),.table-cell:focus-within .date:not(.is-range-selection),.table-cell:focus-within .date:not(.is-range-selection):active{border-color:var(--highcontrast-calendar-day-border-color-key-focus, var(--luzmo-calendar-day-border-color-key-focus, var(--calendar-day-border-color-key-focus)))}.table-cell:focus-within .date.is-selected:not(.is-range-selection),.table-cell:focus-within .date:not(.is-range-selection):active{color:var(--highcontrast-calendar-day-text-color-selected, var(--luzmo-calendar-day-text-color-selected, var(--calendar-day-text-color-selected)));background:var(--highcontrast-calendar-day-background-color-cap-selected, var(--luzmo-calendar-day-background-color-cap-selected, var(--calendar-day-background-color-cap-selected)));border-color:var(--highcontrast-calendar-day-border-color-key-focus, var(--luzmo-calendar-day-border-color-cap-selected-focus, var(--calendar-day-border-color-cap-selected-focus)))}.table-cell:focus-within .date.is-range-selection:before,.table-cell:focus-within .date.is-selected:before{background:var(--highcontrast-calendar-day-background-color-selected-hover, var(--luzmo-calendar-day-background-color-selected-hover, var(--calendar-day-background-color-selected-hover)))}.table-cell:focus-within .date:before{border-color:var(--highcontrast-calendar-day-border-color-key-focus, var(--luzmo-calendar-day-border-color-key-focus, var(--calendar-day-border-color-key-focus)))}.date.is-disabled{color:var(--highcontrast-calendar-day-text-color-disabled, var(--luzmo-calendar-day-text-color-disabled, var(--calendar-day-text-color-disabled)))}.date.is-selection-end,.date.is-selection-start{color:var(--highcontrast-calendar-day-text-color-cap-selected, var(--luzmo-calendar-day-text-color-cap-selected, var(--calendar-day-text-color-cap-selected)))}.date.is-selection-end:after,.date.is-selection-start:after{background-color:var(--highcontrast-calendar-day-background-color-selected, var(--luzmo-calendar-day-background-color-selected, var(--calendar-day-background-color-selected)))}.date.is-selection-end.is-disabled,.date.is-selection-start.is-disabled{color:var(--highcontrast-calendar-day-text-color-disabled, var(--luzmo-calendar-day-text-color-disabled, var(--calendar-day-text-color-disabled)))}@media (forced-colors: active){.nextMonth,.prevMonth{--highcontrast-calendar-button-icon-color: ButtonText}.date{--highcontrast-calendar-day-background-color-cap-selected: Highlight;--highcontrast-calendar-day-background-color-down: ButtonFace;--highcontrast-calendar-day-background-color-hover: Transparent;--highcontrast-calendar-day-background-color-key-focus: ButtonFace;--highcontrast-calendar-day-background-color-selected-hover: Transparent;--highcontrast-calendar-day-background-color-selected: Highlight;--highcontrast-calendar-day-border-color-key-focus: ButtonText;--highcontrast-calendar-day-text-color-cap-selected: HighlightText;--highcontrast-calendar-day-text-color-disabled: GrayText;--highcontrast-calendar-day-text-color-hover: ButtonText;--highcontrast-calendar-day-text-color-key-focus: ButtonText;--highcontrast-calendar-day-text-color-selected: HighlightText;--highcontrast-calendar-day-text-color: CanvasText;--highcontrast-calendar-date-text-color: CanvasText;--highcontrast-calendar-day-title-text-color: CanvasText;--highcontrast-calendar-day-today-background-color-selected-hover: Highlight;--highcontrast-calendar-day-today-border-color-disabled: GrayText;--highcontrast-calendar-day-today-border-color: ButtonText;--highcontrast-calendar-day-today-text-color-disabled: GrayText;--highcontrast-calendar-day-today-text-color: ButtonText;forced-color-adjust:none}.date.is-range-selection.is-today{color:HighlightText}.date.is-range-selection.is-selection-end:after,.date.is-range-selection.is-selection-start:after{content:none}.date.is-disabled.is-range-selection,.date.is-disabled.is-selected{background:Highlight;color:HighlightText}}:host{--calendar-background-color: var(--luzmo-background-color-white)}:host{font-family:var(--luzmo-font-family);--calendar-day-width: var(--luzmo-component-height);--calendar-day-height: var(--luzmo-component-height);--calendar-border-radius-reset: 0;--calendar-border-width-reset: 0;--calendar-day-border-size: var(--luzmo-border-width);--calendar-margin-y: calc(var(--luzmo-spacing) * 3);--calendar-margin-x: var(--luzmo-component-height);--calendar-day-padding: var(--luzmo-spacing-2);--calendar-width: calc( (var(--calendar-day-width) + var(--calendar-day-padding) * 2) * 7 );--calendar-title-text-letter-spacing: .06em;--calendar-day-title-text-font-weight: bold;--calendar-day-title-text-color: var(--luzmo-font-color-disabled);--calendar-title-height: var(--luzmo-component-height);--calendar-title-font-weight: bold;--calendar-title-text-size: var(--luzmo-font-size);--calendar-day-title-text-size: var(--luzmo-font-size);--calendar-day-text-size-han: var(--luzmo-font-size);--calendar-date-text-color: var(--luzmo-font-color);--calendar-day-text-color: var(--luzmo-font-color);--calendar-day-text-size: var(--luzmo-font-size);--calendar-day-border-radius: var(--luzmo-border-radius);--calendar-day-text-color-selected: var(--luzmo-primary-inverse-color);--calendar-day-text-color-hover: var(--luzmo-font-color-hover);--calendar-day-text-color-cap-selected: var(--luzmo-primary-inverse-color);--calendar-day-border-color-cap-selected: var(--luzmo-primary);--calendar-day-border-color-cap-selected-focus: var(--luzmo-primary-focus);--calendar-day-text-font-weight-selected: var(--bold-font-weight);--calendar-day-text-font-weight-cap-selected: var(--bold-font-weight);--calendar-day-today-text-color: var(--luzmo-primary);--calendar-day-today-background-color: var(--luzmo-background-color-hover);--calendar-day-today-text-font-weight: normal;--calendar-day-today-border-color: transparent;--calendar-day-today-text-color-disabled: var(--luzmo-font-color-disabled);--calendar-day-today-border-color-disabled: transparent;--calendar-day-text-color-disabled: var(--luzmo-font-color-disabled);--calendar-day-text-color-key-focus: var(--luzmo-primary-down);--calendar-day-background-color-cap-selected: var(--luzmo-primary);--calendar-button-icon-color: var(--luzmo-font-color)}:host:dir(rtl),:host([dir=rtl]){--logical-rotation: matrix(-1, 0, 0, 1, 0, 0)}:host([size=s]){--calendar-day-width: var(--luzmo-component-height-s);--calendar-day-height: var(--luzmo-component-height-s);--calendar-day-border-radius: var(--luzmo-border-radius-s);--calendar-title-height: var(--luzmo-component-height-s);--calendar-title-text-size: var(--luzmo-font-size-s);--calendar-day-title-text-size: var(--luzmo-font-size-s);--calendar-day-text-size-han: var(--luzmo-font-size-s);--calendar-day-text-size: var(--luzmo-font-size-s)}:host([size=l]){--calendar-day-width: var(--luzmo-component-height-l);--calendar-day-height: var(--luzmo-component-height-l);--calendar-day-border-radius: var(--luzmo-border-radius-l);--calendar-title-height: var(--luzmo-component-height-l);--calendar-title-text-size: var(--luzmo-font-size-l);--calendar-day-title-text-size: var(--luzmo-font-size-l);--calendar-day-text-size-han: var(--luzmo-font-size-l);--calendar-day-text-size: var(--luzmo-font-size-l)}:host([size=xl]){--calendar-day-width: var(--luzmo-component-height-xl);--calendar-day-height: var(--luzmo-component-height-xl);--calendar-day-border-radius: var(--luzmo-border-radius-xl);--calendar-title-height: var(--luzmo-component-height-xl);--calendar-title-text-size: var(--luzmo-font-size-xl);--calendar-day-title-text-size: var(--luzmo-font-size-xl);--calendar-day-text-size-han: var(--luzmo-font-size-xl);--calendar-day-text-size: var(--luzmo-font-size-xl)}.table-cell span[role=button]{border-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width))}';
32
+ var __defProp = Object.defineProperty;
33
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
34
+ var __decorateClass = (decorators, target, key, kind) => {
35
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
36
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
37
+ if (decorator = decorators[i])
38
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
39
+ if (kind && result) __defProp(target, key, result);
40
+ return result;
41
+ };
42
+ const DAYS_PER_WEEK = 7;
43
+ class LuzmoCalendar extends sizedMixin.SizedMixin(base.LuzmoElement, {
44
+ validSizes: ["s", "m", "l", "xl"],
45
+ noDefaultSize: true
46
+ }) {
47
+ constructor() {
48
+ super();
49
+ this.disabled = false;
50
+ this.labels = {
51
+ previous: "Previous",
52
+ next: "Next",
53
+ today: "Today",
54
+ selected: "Selected"
55
+ };
56
+ this.currentDate = this.today;
57
+ this.timeZone = date.getLocalTimeZone();
58
+ this.weekdays = [];
59
+ this.currentMonthDates = [];
60
+ this._isDateFocusIntent = false;
61
+ this.numberFormatter = new number.NumberFormatter(this._language);
62
+ this.setNumberFormatter();
63
+ this.setWeekdays();
64
+ this.setCurrentMonthDates();
65
+ }
66
+ /**
67
+ * The styles of the calendar
68
+ * @internal
69
+ */
70
+ static get styles() {
71
+ return [lit.unsafeCSS(styles)];
72
+ }
73
+ /**
74
+ * The language used to format the dates and weekdays.
75
+ * @internal
76
+ */
77
+ get _language() {
78
+ try {
79
+ if (this.language) {
80
+ const locale = new Intl.Locale(this.language);
81
+ return locale.language;
82
+ }
83
+ return "en";
84
+ } catch {
85
+ return "en";
86
+ }
87
+ }
88
+ /**
89
+ * The current date in the calendar
90
+ * @internal
91
+ */
92
+ get today() {
93
+ return date.today(this.timeZone);
94
+ }
95
+ set isDateFocusIntent(value) {
96
+ if (this._isDateFocusIntent === value) return;
97
+ this._isDateFocusIntent = value;
98
+ this.requestUpdate("isDateFocusIntent", !value);
99
+ }
100
+ /**
101
+ * @internal
102
+ */
103
+ get isDateFocusIntent() {
104
+ return this._isDateFocusIntent;
105
+ }
106
+ setDateFocusIntent() {
107
+ this.isDateFocusIntent = true;
108
+ }
109
+ resetDateFocusIntent() {
110
+ this.isDateFocusIntent = false;
111
+ }
112
+ connectedCallback() {
113
+ super.connectedCallback();
114
+ document.addEventListener("mousedown", this.resetDateFocusIntent);
115
+ }
116
+ disconnectedCallback() {
117
+ super.disconnectedCallback();
118
+ document.removeEventListener("mousedown", this.resetDateFocusIntent);
119
+ }
120
+ /**
121
+ * Resets the component's value
122
+ */
123
+ clear() {
124
+ this._value = void 0;
125
+ }
126
+ willUpdate(changedProperties) {
127
+ if (changedProperties.has("language")) {
128
+ this.setNumberFormatter();
129
+ this.setWeekdays();
130
+ this.setCurrentMonthDates();
131
+ }
132
+ const changesMin = changedProperties.has("min");
133
+ const changesMax = changedProperties.has("max");
134
+ const changesValue = changedProperties.has("value");
135
+ const changesDates = changesMin || changesMax || changesValue;
136
+ if (changesDates) {
137
+ this.convertToCalendarDates();
138
+ this.checkDatePropsCompliance(changesMin || changesMax);
139
+ this.updateCurrentDate();
140
+ }
141
+ const previousDate = changedProperties.get("currentDate");
142
+ const changesMonth = changedProperties.has("currentDate") && (!previousDate || !date.isSameMonth(previousDate, this.currentDate));
143
+ if (changesMonth) {
144
+ this.setCurrentMonthDates();
145
+ this.setAttribute("aria-label", this.monthAndYear);
146
+ }
147
+ }
148
+ updated(changedProperties) {
149
+ if (changedProperties.has("currentDate") && this.isDateFocusIntent)
150
+ this.focusCurrentDate();
151
+ }
152
+ /**
153
+ * Focuses the tabbable day element in the calendar represented by the current date.
154
+ * Useful while navigating through the calendar as the focus might be lost when the month changes.
155
+ */
156
+ focusCurrentDate() {
157
+ var _a;
158
+ const elementToFocus = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector(
159
+ 'td span[tabindex="0"]'
160
+ );
161
+ if (elementToFocus) elementToFocus.focus();
162
+ }
163
+ convertToCalendarDates() {
164
+ this._min = this.min ? date.parseDate(this.min) : void 0;
165
+ this._max = this.max ? date.parseDate(this.max) : void 0;
166
+ this._value = this.value ? date.parseDate(this.value) : void 0;
167
+ const era = "AD";
168
+ this._min = this._min && date.toCalendarDate(this._min).set({ era });
169
+ this._max = this._max && date.toCalendarDate(this._max).set({ era });
170
+ this._value = this._value && date.toCalendarDate(this._value).set({ era });
171
+ }
172
+ /**
173
+ * Validates the component's date properties (min, max and value) compliance with one another.
174
+ * If the [min, max] constraint interval is invalid, both properties are reset.
175
+ * If the value is not within the [min, max] (valid) interval, it is reset.
176
+ *
177
+ * @param checkInterval - Whether to check the [min, max] interval
178
+ */
179
+ checkDatePropsCompliance(checkInterval) {
180
+ if (checkInterval && this._min && this._max) {
181
+ const isValidInterval = this._min.compare(this._max) < 0;
182
+ if (!isValidInterval) {
183
+ if (console.warn)
184
+ console.warn(
185
+ this,
186
+ `<${this.localName}> expects the 'min' to be less than 'max'. Please ensure that 'min' property's date is earlier than 'max' property's date.`
187
+ );
188
+ this._min = void 0;
189
+ this._max = void 0;
190
+ }
191
+ }
192
+ if (this._value && this.isNonCompliantDate(this._value)) {
193
+ if (console.warn)
194
+ console.warn(
195
+ this,
196
+ `<${this.localName}> expects the preselected value to comply with the min and max constraints. Please ensure that 'value' property's date is in between the dates for the 'min' and 'max' properties.`
197
+ );
198
+ this._value = void 0;
199
+ }
200
+ }
201
+ updateCurrentDate() {
202
+ if (this._value) {
203
+ this.currentDate = this._value;
204
+ return;
205
+ }
206
+ const isTodayNonCompliant = this.isNonCompliantDate(this.today);
207
+ if (isTodayNonCompliant) {
208
+ if (this._min) this.currentDate = this._min;
209
+ else if (this._max) this.currentDate = this._max;
210
+ } else this.currentDate = this.today;
211
+ }
212
+ /**
213
+ * Whether the date is non-compliant with the min and max constraints
214
+ */
215
+ isNonCompliantDate(date2) {
216
+ return Boolean(
217
+ this._min && date2.compare(this._min) < 0 || this._max && date2.compare(this._max) > 0
218
+ );
219
+ }
220
+ render() {
221
+ return lit.html` ${this.renderCalendarHeader()}${this.renderCalendarGrid()} `;
222
+ }
223
+ /**
224
+ * The month and year of the calendar
225
+ * @internal
226
+ */
227
+ get monthAndYear() {
228
+ return this.formatDate(this.currentDate, {
229
+ month: "long",
230
+ year: "numeric"
231
+ });
232
+ }
233
+ renderCalendarHeader() {
234
+ return lit.html`
235
+ <div class="header" @focusin=${this.resetDateFocusIntent}>
236
+ <h2
237
+ class="title"
238
+ aria-live="polite"
239
+ aria-atomic="true"
240
+ data-test-id="calendar-title"
241
+ >
242
+ ${this.monthAndYear}
243
+ </h2>
244
+
245
+ <luzmo-action-button
246
+ quiet
247
+ size="s"
248
+ label=${this.labels.previous}
249
+ class="prevMonth"
250
+ data-test-id="prev-btn"
251
+ ?disabled=${this.isPreviousMonthDisabled}
252
+ @click=${this.handlePreviousMonth}
253
+ >
254
+ <div slot="icon">
255
+ <slot name="prev-icon">
256
+ <luzmo-icon
257
+ block
258
+ .size=${this.size}
259
+ .icon=${icons.luzmoAngleLeft}
260
+ ></luzmo-icon>
261
+ </slot>
262
+ </div>
263
+ </luzmo-action-button>
264
+
265
+ <luzmo-action-button
266
+ quiet
267
+ size="s"
268
+ label=${this.labels.next}
269
+ class="nextMonth"
270
+ data-test-id="next-btn"
271
+ ?disabled=${this.isNextMonthDisabled}
272
+ @click=${this.handleNextMonth}
273
+ >
274
+ <div slot="icon">
275
+ <slot name="next-icon">
276
+ <luzmo-icon
277
+ block
278
+ .size=${this.size}
279
+ .icon=${icons.luzmoAngleRight}
280
+ ></luzmo-icon>
281
+ </slot>
282
+ </div>
283
+ </luzmo-action-button>
284
+ </div>
285
+ `;
286
+ }
287
+ /**
288
+ * Whether the previous month is disabled
289
+ * @internal
290
+ */
291
+ get isPreviousMonthDisabled() {
292
+ if (this.disabled) return true;
293
+ const currentMonthStart = date.startOfMonth(this.currentDate);
294
+ const previousMonthStart = currentMonthStart.subtract({ months: 1 });
295
+ return currentMonthStart.era !== previousMonthStart.era || date.isSameDay(currentMonthStart, previousMonthStart);
296
+ }
297
+ /**
298
+ * Whether the next month is disabled
299
+ * @internal
300
+ */
301
+ get isNextMonthDisabled() {
302
+ if (this.disabled) return true;
303
+ const currentMonthEnd = date.endOfMonth(this.currentDate);
304
+ const nextMonthEnd = currentMonthEnd.add({ months: 1 });
305
+ return currentMonthEnd.era !== nextMonthEnd.era || date.isSameDay(currentMonthEnd, nextMonthEnd);
306
+ }
307
+ handlePreviousMonth() {
308
+ let newCurrentDate = date.startOfMonth(this.currentDate).subtract({
309
+ months: 1
310
+ });
311
+ if (this._value && date.isSameMonth(newCurrentDate, this._value))
312
+ newCurrentDate = this._value;
313
+ else if (date.isSameMonth(newCurrentDate, this.today))
314
+ newCurrentDate = this.today;
315
+ this.currentDate = newCurrentDate;
316
+ }
317
+ handleNextMonth() {
318
+ let newCurrentDate = date.startOfMonth(this.currentDate).add({
319
+ months: 1
320
+ });
321
+ if (this._value && date.isSameMonth(newCurrentDate, this._value))
322
+ newCurrentDate = this._value;
323
+ else if (date.isSameMonth(newCurrentDate, this.today))
324
+ newCurrentDate = this.today;
325
+ this.currentDate = newCurrentDate;
326
+ }
327
+ renderCalendarGrid() {
328
+ return lit.html`
329
+ <table
330
+ role="grid"
331
+ aria-readonly="true"
332
+ aria-disabled=${this.disabled}
333
+ role="presentation"
334
+ class="table body"
335
+ @keydown=${this.handleKeydown}
336
+ >
337
+ ${this.renderCalendarTableHead()} ${this.renderCalendarTableBody()}
338
+ </table>
339
+ `;
340
+ }
341
+ renderCalendarTableHead() {
342
+ return lit.html`
343
+ <thead role="presentation">
344
+ <tr role="row">
345
+ ${this.renderWeekdayColumns()}
346
+ </tr>
347
+ </thead>
348
+ `;
349
+ }
350
+ renderWeekdayColumns() {
351
+ return this.weekdays.map((weekday) => this.renderWeekdayColumn(weekday));
352
+ }
353
+ renderWeekdayColumn(weekday) {
354
+ return lit.html`
355
+ <th role="columnheader" scope="col" class="table-cell">
356
+ <abbr class="dayOfWeek" title=${weekday.long}> ${weekday.narrow} </abbr>
357
+ </th>
358
+ `;
359
+ }
360
+ renderCalendarTableBody() {
361
+ return lit.html`
362
+ <tbody role="presentation">
363
+ ${this.renderCalendarWeeks()}
364
+ </tbody>
365
+ `;
366
+ }
367
+ renderCalendarWeeks() {
368
+ return this.currentMonthDates.map(
369
+ (week) => lit.html`
370
+ <tr role="row">
371
+ ${this.renderDatesInWeek(week)}
372
+ </tr>
373
+ `
374
+ );
375
+ }
376
+ renderDatesInWeek(week) {
377
+ return week.map((date2) => this.renderCalendarTableCell(date2));
378
+ }
379
+ parseDateCellProperties(calendarDate) {
380
+ const props = {
381
+ isOutsideMonth: false,
382
+ isSelected: false,
383
+ isToday: false,
384
+ isDisabled: false,
385
+ isTabbable: false
386
+ };
387
+ props.isOutsideMonth = calendarDate.month !== this.currentDate.month;
388
+ if (props.isOutsideMonth) return props;
389
+ props.isDisabled = this.disabled || this.isMinLimitReached(calendarDate) || this.isMaxLimitReached(calendarDate);
390
+ props.isToday = date.isSameDay(calendarDate, this.today);
391
+ if (props.isDisabled) return props;
392
+ props.isTabbable = date.isSameDay(calendarDate, this.currentDate);
393
+ props.isSelected = Boolean(
394
+ this._value && date.isSameDay(this._value, calendarDate)
395
+ );
396
+ return props;
397
+ }
398
+ renderCalendarTableCell(calendarDate) {
399
+ const { isOutsideMonth, isSelected, isToday, isDisabled, isTabbable } = this.parseDateCellProperties(calendarDate);
400
+ const dayClasses = {
401
+ date: true,
402
+ "is-outsideMonth": isOutsideMonth,
403
+ "is-selected": isSelected,
404
+ "is-today": isToday,
405
+ "is-disabled": isDisabled
406
+ };
407
+ let currentDayLabelPrefix = "";
408
+ if (isToday) currentDayLabelPrefix = `${this.labels.today}, `;
409
+ else if (isSelected) currentDayLabelPrefix = `${this.labels.selected}, `;
410
+ const currentDayLabel = currentDayLabelPrefix + this.formatDate(calendarDate, {
411
+ weekday: "long",
412
+ year: "numeric",
413
+ month: "long",
414
+ day: "numeric"
415
+ });
416
+ return lit.html`
417
+ <td role="gridcell" class="table-cell">
418
+ <span
419
+ role="button"
420
+ tabindex=${ifDefined_js.ifDefined(
421
+ isOutsideMonth ? void 0 : isTabbable ? "0" : "-1"
422
+ )}
423
+ aria-label=${currentDayLabel}
424
+ aria-disabled=${isOutsideMonth || isDisabled}
425
+ data-value=${calendarDate.toString()}
426
+ @mousedown=${this.handleDaySelect}
427
+ >
428
+ <span role="presentation" class=${classMap_js.classMap(dayClasses)}>
429
+ ${this.formatNumber(calendarDate.day)}
430
+ </span>
431
+ </span>
432
+ </td>
433
+ `;
434
+ }
435
+ handleKeydown(event) {
436
+ this.setDateFocusIntent();
437
+ switch (event.code) {
438
+ case "ArrowLeft": {
439
+ this.moveToPreviousDay();
440
+ break;
441
+ }
442
+ case "ArrowDown": {
443
+ this.moveToNextWeek();
444
+ break;
445
+ }
446
+ case "ArrowRight": {
447
+ this.moveToNextDay();
448
+ break;
449
+ }
450
+ case "ArrowUp": {
451
+ this.moveToPreviousWeek();
452
+ break;
453
+ }
454
+ case "Space":
455
+ case "Enter": {
456
+ this.handleDaySelect(event);
457
+ break;
458
+ }
459
+ }
460
+ }
461
+ handleDaySelect(event) {
462
+ if (this.disabled) {
463
+ event.preventDefault();
464
+ return;
465
+ }
466
+ const cellButton = event.target.closest(
467
+ 'span[role="button"]'
468
+ );
469
+ const dateString = cellButton && cellButton.dataset.value;
470
+ if (!dateString) return;
471
+ const calendarDateEngaged = date.parseDate(dateString);
472
+ const isAlreadySelected = this._value && date.isSameDay(this._value, calendarDateEngaged);
473
+ if (isAlreadySelected || this.isMinLimitReached(calendarDateEngaged) || this.isMaxLimitReached(calendarDateEngaged)) {
474
+ event.preventDefault();
475
+ return;
476
+ }
477
+ this._value = calendarDateEngaged;
478
+ this.value = calendarDateEngaged.toString();
479
+ this.dispatchEvent(
480
+ new CustomEvent("change", {
481
+ bubbles: true,
482
+ composed: true,
483
+ cancelable: true,
484
+ detail: {
485
+ value: this.value
486
+ }
487
+ })
488
+ );
489
+ }
490
+ moveToPreviousDay() {
491
+ const previousDay = this.currentDate.subtract({ days: 1 });
492
+ if (this.canMoveBackToDate(previousDay)) this.currentDate = previousDay;
493
+ }
494
+ moveToNextDay() {
495
+ const nextDay = this.currentDate.add({ days: 1 });
496
+ if (this.canMoveForwardToDate(nextDay)) this.currentDate = nextDay;
497
+ }
498
+ moveToPreviousWeek() {
499
+ const previousWeek = this.currentDate.subtract({ weeks: 1 });
500
+ if (this.canMoveBackToDate(previousWeek)) {
501
+ this.currentDate = previousWeek;
502
+ return;
503
+ }
504
+ let dayToFocus = previousWeek.add({ days: 1 });
505
+ while (!this.canMoveBackToDate(dayToFocus)) {
506
+ dayToFocus = dayToFocus.add({ days: 1 });
507
+ }
508
+ this.currentDate = dayToFocus;
509
+ }
510
+ moveToNextWeek() {
511
+ const nextWeek = this.currentDate.add({ weeks: 1 });
512
+ if (this.canMoveForwardToDate(nextWeek)) {
513
+ this.currentDate = nextWeek;
514
+ return;
515
+ }
516
+ let dayToFocus = nextWeek.subtract({ days: 1 });
517
+ while (!this.canMoveForwardToDate(dayToFocus)) {
518
+ dayToFocus = dayToFocus.subtract({ days: 1 });
519
+ }
520
+ this.currentDate = dayToFocus;
521
+ }
522
+ canMoveBackToDate(previousDate) {
523
+ if (this.isMinLimitReached(previousDate)) return false;
524
+ return date.isSameMonth(this.currentDate, previousDate) || !this.isPreviousMonthDisabled;
525
+ }
526
+ canMoveForwardToDate(nextDate) {
527
+ if (this.isMaxLimitReached(nextDate)) return false;
528
+ return date.isSameMonth(this.currentDate, nextDate) || !this.isNextMonthDisabled;
529
+ }
530
+ /**
531
+ * Defines the array with data for the days of the week, starting on the first day of the week according to the
532
+ * defined location (Sunday, Monday, etc.)
533
+ */
534
+ setWeekdays() {
535
+ const weekStart = date.startOfWeek(this.currentDate, this._language);
536
+ this.weekdays = [...Array.from({ length: DAYS_PER_WEEK }).keys()].map(
537
+ (dayIndex) => {
538
+ const date2 = weekStart.add({ days: dayIndex });
539
+ return {
540
+ narrow: this.formatDate(date2, { weekday: "narrow" }),
541
+ long: this.formatDate(date2, { weekday: "long" })
542
+ };
543
+ }
544
+ );
545
+ }
546
+ /**
547
+ * Defines the 2D-array with the dates of the current month
548
+ */
549
+ setCurrentMonthDates() {
550
+ const numberOfWeeks = date.getWeeksInMonth(this.currentDate, this._language);
551
+ const newCurrentMonthDates = Array.from({
552
+ length: numberOfWeeks
553
+ });
554
+ for (const weekIndex of Array.from({ length: numberOfWeeks }).keys())
555
+ newCurrentMonthDates[weekIndex] = this.getDatesInWeek(
556
+ this.currentDate,
557
+ weekIndex
558
+ );
559
+ this.currentMonthDates = newCurrentMonthDates;
560
+ }
561
+ /**
562
+ * Returns an array with all days of the week in a specific month, corresponding to the given index,
563
+ * starting with the first day of the week according to the language
564
+ *
565
+ * @param weekIndex - The index of the week
566
+ */
567
+ getDatesInWeek(monthDate, weekIndex) {
568
+ const dates = [];
569
+ let date$1 = date.startOfWeek(
570
+ date.startOfMonth(monthDate).add({
571
+ weeks: weekIndex
572
+ }),
573
+ this._language
574
+ );
575
+ while (dates.length < DAYS_PER_WEEK) {
576
+ dates.push(date$1);
577
+ const nextDate = date$1.add({ days: 1 });
578
+ if (date.isSameDay(date$1, nextDate)) break;
579
+ date$1 = nextDate;
580
+ }
581
+ return dates;
582
+ }
583
+ isMinLimitReached(calendarDate) {
584
+ return Boolean(this._min && calendarDate.compare(this._min) < 0);
585
+ }
586
+ isMaxLimitReached(calendarDate) {
587
+ return Boolean(this._max && calendarDate.compare(this._max) > 0);
588
+ }
589
+ /**
590
+ * Formats a `CalendarDate` object using the current language and the provided date format options
591
+ *
592
+ * @param calendarDate - The `CalendarDate` object that will be formatted
593
+ * @param options - All date format options that will be used by the formatter
594
+ */
595
+ formatDate(calendarDate, options) {
596
+ return new date.DateFormatter(this._language, options).format(
597
+ calendarDate.toDate(this.timeZone)
598
+ );
599
+ }
600
+ setNumberFormatter() {
601
+ this.numberFormatter = new number.NumberFormatter(this._language);
602
+ }
603
+ formatNumber(number2) {
604
+ return this.numberFormatter.format(number2);
605
+ }
606
+ }
607
+ __decorateClass([
608
+ decorators_js.property({ type: String })
609
+ ], LuzmoCalendar.prototype, "value", 2);
610
+ __decorateClass([
611
+ decorators_js.property({ type: String })
612
+ ], LuzmoCalendar.prototype, "min", 2);
613
+ __decorateClass([
614
+ decorators_js.property({ type: String })
615
+ ], LuzmoCalendar.prototype, "max", 2);
616
+ __decorateClass([
617
+ decorators_js.property({ type: Boolean, reflect: true })
618
+ ], LuzmoCalendar.prototype, "disabled", 2);
619
+ __decorateClass([
620
+ decorators_js.property({ type: String, reflect: true })
621
+ ], LuzmoCalendar.prototype, "language", 2);
622
+ __decorateClass([
623
+ decorators_js.property({ type: Object })
624
+ ], LuzmoCalendar.prototype, "labels", 2);
625
+ __decorateClass([
626
+ decorators_js.state()
627
+ ], LuzmoCalendar.prototype, "currentDate", 2);
628
+ __decorateClass([
629
+ decorators_js.state()
630
+ ], LuzmoCalendar.prototype, "_value", 2);
631
+ __decorateClass([
632
+ decorators_js.state()
633
+ ], LuzmoCalendar.prototype, "_min", 2);
634
+ __decorateClass([
635
+ decorators_js.state()
636
+ ], LuzmoCalendar.prototype, "_max", 2);
637
+ __decorateClass([
638
+ decorators_js.state()
639
+ ], LuzmoCalendar.prototype, "weekdays", 2);
640
+ __decorateClass([
641
+ decorators_js.state()
642
+ ], LuzmoCalendar.prototype, "currentMonthDates", 2);
643
+ __decorateClass([
644
+ decorators_js.state()
645
+ ], LuzmoCalendar.prototype, "isDateFocusIntent", 1);
646
+ if (!customElements.get("luzmo-calendar")) {
647
+ customElements.define("luzmo-calendar", LuzmoCalendar);
648
+ }
649
+ exports.LuzmoCalendar = LuzmoCalendar;