@haiilo/catalyst 5.3.0 → 5.4.0

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 (169) hide show
  1. package/dist/catalyst/catalyst.css +56 -39
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/catalyst.esm.js.map +1 -1
  4. package/dist/catalyst/index.cdn.js +1 -0
  5. package/dist/catalyst/index.esm.js +2 -2
  6. package/dist/catalyst/index.esm.js.map +1 -1
  7. package/dist/catalyst/p-34e0cbba.entry.js +10 -0
  8. package/dist/catalyst/p-34e0cbba.entry.js.map +1 -0
  9. package/dist/catalyst/{p-d1fb9d96.js → p-ce6a1db2.js} +1 -1
  10. package/dist/catalyst/p-ce6a1db2.js.map +1 -0
  11. package/dist/catalyst/p-cf32399c.js +2 -0
  12. package/dist/catalyst/p-cf32399c.js.map +1 -0
  13. package/dist/catalyst/scss/_snippets/_checkbox-hint.scss +20 -0
  14. package/dist/catalyst/scss/utils/_border.scss +14 -0
  15. package/dist/catalyst/scss/utils/_media.mixins.scss +0 -1
  16. package/dist/catalyst/scss/utils/_typography.mixins.scss +1 -0
  17. package/dist/cjs/{cat-alert_25.cjs.entry.js → cat-alert_27.cjs.entry.js} +3628 -185
  18. package/dist/cjs/cat-alert_27.cjs.entry.js.map +1 -0
  19. package/dist/cjs/{cat-icon-registry-671af264.js → cat-icon-registry-228164a1.js} +43 -2
  20. package/dist/cjs/cat-icon-registry-228164a1.js.map +1 -0
  21. package/dist/cjs/catalyst.cjs.js +3 -3
  22. package/dist/cjs/catalyst.cjs.js.map +1 -1
  23. package/dist/cjs/{index-01312a2e.js → index-4258b31e.js} +8 -1
  24. package/dist/{catalyst/p-d1fb9d96.js.map → cjs/index-4258b31e.js.map} +1 -1
  25. package/dist/cjs/index.cjs.js +2 -2
  26. package/dist/cjs/index.cjs.js.map +1 -1
  27. package/dist/cjs/loader.cjs.js +3 -3
  28. package/dist/cjs/loader.cjs.js.map +1 -1
  29. package/dist/collection/collection-manifest.json +4 -2
  30. package/dist/collection/components/cat-alert/cat-alert.js +5 -5
  31. package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
  32. package/dist/collection/components/cat-button/cat-button.css +7 -7
  33. package/dist/collection/components/cat-button/cat-button.js +6 -24
  34. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  35. package/dist/collection/components/cat-checkbox/cat-checkbox.css +24 -1
  36. package/dist/collection/components/cat-checkbox/cat-checkbox.js +8 -4
  37. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  38. package/dist/collection/components/cat-datepicker/cat-datepicker.css +381 -0
  39. package/dist/collection/components/cat-datepicker/cat-datepicker.js +873 -0
  40. package/dist/collection/components/cat-datepicker/cat-datepicker.js.map +1 -0
  41. package/dist/collection/components/cat-datepicker/datepicker-type.js +8 -0
  42. package/dist/collection/components/cat-datepicker/datepicker-type.js.map +1 -0
  43. package/dist/collection/components/cat-datepicker/dayjs.config.js +8 -0
  44. package/dist/collection/components/cat-datepicker/dayjs.config.js.map +1 -0
  45. package/dist/collection/components/cat-datepicker/vanillajs-datepicker.config.js +46 -0
  46. package/dist/collection/components/cat-datepicker/vanillajs-datepicker.config.js.map +1 -0
  47. package/dist/collection/components/cat-dropdown/cat-dropdown.css +1 -0
  48. package/dist/collection/components/cat-dropdown/cat-dropdown.js +12 -5
  49. package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
  50. package/dist/collection/components/cat-form-group/cat-form-group.js +1 -1
  51. package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
  52. package/dist/collection/components/cat-icon/cat-icon-registry.js +29 -1
  53. package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
  54. package/dist/collection/components/cat-input/cat-input.css +384 -11
  55. package/dist/collection/components/cat-input/cat-input.js +8 -4
  56. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  57. package/dist/collection/components/cat-notification/cat-notification.js +1 -1
  58. package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
  59. package/dist/collection/components/cat-pagination/cat-pagination.js +28 -6
  60. package/dist/collection/components/cat-pagination/cat-pagination.js.map +1 -1
  61. package/dist/collection/components/cat-radio/cat-radio.css +24 -1
  62. package/dist/collection/components/cat-radio/cat-radio.js +8 -4
  63. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
  64. package/dist/collection/components/cat-radio-group/cat-radio-group.js +7 -3
  65. package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
  66. package/dist/collection/components/cat-scrollable/cat-scrollable.css +1 -4
  67. package/dist/collection/components/cat-select/cat-select.css +8 -11
  68. package/dist/collection/components/cat-select/cat-select.js +43 -18
  69. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  70. package/dist/collection/components/cat-skeleton/cat-skeleton.css +1 -1
  71. package/dist/collection/components/cat-textarea/cat-textarea.css +9 -12
  72. package/dist/collection/components/cat-textarea/cat-textarea.js +8 -4
  73. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  74. package/dist/collection/components/cat-timepicker/cat-timepicker.css +5 -0
  75. package/dist/collection/components/cat-timepicker/cat-timepicker.js +668 -0
  76. package/dist/collection/components/cat-timepicker/cat-timepicker.js.map +1 -0
  77. package/dist/collection/components/cat-toggle/cat-toggle.css +24 -1
  78. package/dist/collection/components/cat-toggle/cat-toggle.js +8 -4
  79. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  80. package/dist/collection/components/cat-tooltip/cat-tooltip.css +1 -1
  81. package/dist/collection/index.cdn.js +1 -0
  82. package/dist/collection/scss/_snippets/_checkbox-hint.scss +20 -0
  83. package/dist/collection/scss/utils/_border.scss +14 -0
  84. package/dist/collection/scss/utils/_media.mixins.scss +0 -1
  85. package/dist/collection/scss/utils/_typography.mixins.scss +1 -0
  86. package/dist/components/cat-alert.js +5 -5
  87. package/dist/components/cat-alert.js.map +1 -1
  88. package/dist/components/cat-button2.js +7 -9
  89. package/dist/components/cat-button2.js.map +1 -1
  90. package/dist/components/cat-checkbox2.js +2 -2
  91. package/dist/components/cat-checkbox2.js.map +1 -1
  92. package/dist/components/cat-datepicker.d.ts +11 -0
  93. package/dist/components/cat-datepicker.js +3210 -0
  94. package/dist/components/cat-datepicker.js.map +1 -0
  95. package/dist/components/cat-dropdown2.js +182 -57
  96. package/dist/components/cat-dropdown2.js.map +1 -1
  97. package/dist/components/cat-form-group.js +1 -1
  98. package/dist/components/cat-form-group.js.map +1 -1
  99. package/dist/components/cat-icon-registry.js +42 -1
  100. package/dist/components/cat-icon-registry.js.map +1 -1
  101. package/dist/components/cat-input.js +1 -226
  102. package/dist/components/cat-input.js.map +1 -1
  103. package/dist/components/cat-input2.js +230 -0
  104. package/dist/components/cat-input2.js.map +1 -0
  105. package/dist/components/cat-pagination.js +10 -5
  106. package/dist/components/cat-pagination.js.map +1 -1
  107. package/dist/components/cat-radio-group.js.map +1 -1
  108. package/dist/components/cat-radio.js +2 -2
  109. package/dist/components/cat-radio.js.map +1 -1
  110. package/dist/components/cat-scrollable2.js +7 -5
  111. package/dist/components/cat-scrollable2.js.map +1 -1
  112. package/dist/components/cat-select-demo.js +2 -2
  113. package/dist/components/cat-select-demo.js.map +1 -1
  114. package/dist/components/cat-select2.js +37 -16
  115. package/dist/components/cat-select2.js.map +1 -1
  116. package/dist/components/cat-skeleton2.js +1 -1
  117. package/dist/components/cat-skeleton2.js.map +1 -1
  118. package/dist/components/cat-textarea.js +3 -3
  119. package/dist/components/cat-textarea.js.map +1 -1
  120. package/dist/components/cat-timepicker.d.ts +11 -0
  121. package/dist/components/cat-timepicker.js +258 -0
  122. package/dist/components/cat-timepicker.js.map +1 -0
  123. package/dist/components/cat-toggle.js +2 -2
  124. package/dist/components/cat-toggle.js.map +1 -1
  125. package/dist/components/cat-tooltip.js +1 -1
  126. package/dist/components/cat-tooltip.js.map +1 -1
  127. package/dist/components/floating-ui.dom.esm.js +64 -62
  128. package/dist/components/floating-ui.dom.esm.js.map +1 -1
  129. package/dist/components/index.js +1 -1
  130. package/dist/components/index.js.map +1 -1
  131. package/dist/esm/{cat-alert_25.entry.js → cat-alert_27.entry.js} +3627 -186
  132. package/dist/esm/cat-alert_27.entry.js.map +1 -0
  133. package/dist/esm/{cat-icon-registry-d6b80490.js → cat-icon-registry-4bd597f4.js} +43 -2
  134. package/dist/esm/cat-icon-registry-4bd597f4.js.map +1 -0
  135. package/dist/esm/catalyst.js +4 -4
  136. package/dist/esm/catalyst.js.map +1 -1
  137. package/dist/esm/{index-fc2f91a4.js → index-636ce8d6.js} +8 -1
  138. package/dist/esm/index-636ce8d6.js.map +1 -0
  139. package/dist/esm/index.js +3 -3
  140. package/dist/esm/index.js.map +1 -1
  141. package/dist/esm/loader.js +4 -4
  142. package/dist/esm/loader.js.map +1 -1
  143. package/dist/types/components/cat-button/cat-button.d.ts +0 -5
  144. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +1 -1
  145. package/dist/types/components/cat-datepicker/cat-datepicker.d.ts +187 -0
  146. package/dist/types/components/cat-datepicker/datepicker-type.d.ts +7 -0
  147. package/dist/types/components/cat-datepicker/datepicker.d.ts +1 -0
  148. package/dist/types/components/cat-datepicker/dayjs.config.d.ts +3 -0
  149. package/dist/types/components/cat-datepicker/vanillajs-datepicker.config.d.ts +4 -0
  150. package/dist/types/components/cat-input/cat-input.d.ts +1 -1
  151. package/dist/types/components/cat-pagination/cat-pagination.d.ts +6 -0
  152. package/dist/types/components/cat-radio/cat-radio.d.ts +1 -1
  153. package/dist/types/components/cat-radio-group/cat-radio-group.d.ts +1 -1
  154. package/dist/types/components/cat-select/cat-select.d.ts +6 -1
  155. package/dist/types/components/cat-textarea/cat-textarea.d.ts +1 -1
  156. package/dist/types/components/cat-timepicker/cat-timepicker.d.ts +158 -0
  157. package/dist/types/components/cat-toggle/cat-toggle.d.ts +1 -1
  158. package/dist/types/components.d.ts +532 -17
  159. package/package.json +22 -18
  160. package/dist/catalyst/p-ba081831.entry.js +0 -10
  161. package/dist/catalyst/p-ba081831.entry.js.map +0 -1
  162. package/dist/catalyst/p-ccfebe33.js +0 -2
  163. package/dist/catalyst/p-ccfebe33.js.map +0 -1
  164. package/dist/cjs/cat-alert_25.cjs.entry.js.map +0 -1
  165. package/dist/cjs/cat-icon-registry-671af264.js.map +0 -1
  166. package/dist/cjs/index-01312a2e.js.map +0 -1
  167. package/dist/esm/cat-alert_25.entry.js.map +0 -1
  168. package/dist/esm/cat-icon-registry-d6b80490.js.map +0 -1
  169. package/dist/esm/index-fc2f91a4.js.map +0 -1
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-01312a2e.js');
6
- const catIconRegistry = require('./cat-icon-registry-671af264.js');
5
+ const index = require('./index-4258b31e.js');
6
+ const catIconRegistry = require('./cat-icon-registry-228164a1.js');
7
7
 
8
8
  function setAttributeDefault(host, attr, value) {
9
9
  if (!host.hostElement.hasAttribute(attr) && value != null) {
@@ -17,11 +17,11 @@ const CatAlert = class {
17
17
  constructor(hostRef) {
18
18
  index.registerInstance(this, hostRef);
19
19
  this.mapIcon = new Map([
20
- ['primary', 'star-circle-filled'],
21
- ['secondary', 'clock-filled'],
22
- ['success', 'check-circle-filled'],
23
- ['warning', 'danger-filled'],
24
- ['danger', 'cross-circle-filled']
20
+ ['primary', '$cat:alert-primary'],
21
+ ['secondary', '$cat:alert-secondary'],
22
+ ['success', '$cat:alert-success'],
23
+ ['warning', '$cat:alert-warning'],
24
+ ['danger', '$cat:alert-danger']
25
25
  ]);
26
26
  this.mapRole = new Map([
27
27
  ['primary', 'status'],
@@ -260,7 +260,7 @@ function createEmptyStyleRule(query) {
260
260
  }
261
261
  }
262
262
 
263
- const catButtonCss = ":host{display:inline-block;max-width:100%;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}.cat-button{position:relative;font:inherit;display:flex;align-items:center;justify-content:center;border:none;border-radius:var(--cat-border-radius-m, 0.25rem);text-decoration:none;width:100%;box-sizing:border-box;cursor:pointer;transition:color 0.13s linear, border-color 0.13s linear, background-color 0.13s linear, box-shadow 0.13s linear}.cat-button:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-button-content{word-wrap:break-word;word-break:break-word}.cat-button-ellipsed .cat-button-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.cat-button-disabled{cursor:not-allowed}.cat-button-round{border-radius:10rem}.cat-button-loading{cursor:default}.cat-button-loading cat-spinner{position:absolute}.cat-button-loading>*:not(cat-spinner){visibility:hidden}.cat-group-button-first{border-top-right-radius:0;border-bottom-right-radius:0}.cat-group-button-middle{border-radius:0}.cat-group-button-last{border-top-left-radius:0;border-bottom-left-radius:0}.cat-group-button:hover{z-index:1}.cat-group-button:focus-visible{z-index:2}.cat-button-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.cat-button-filled.cat-button-disabled{--bg:242, 244, 247;--fill:var(--cat-font-color-muted, 81, 92, 108)}.cat-button-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--base), 0.2);color:rgb(var(--text))}.cat-button-outlined.cat-button-disabled{--base:var(--cat-font-color-muted, 81, 92, 108);--text:var(--cat-font-color-muted, 81, 92, 108)}.cat-button-outlined:hover:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-outlined.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-outlined:active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-text{background-color:transparent;color:rgb(var(--text));text-decoration:var(--cat-link-button-decoration, none)}.cat-button-text.cat-button-disabled{--text:var(--cat-font-color-muted, 81, 92, 108)}.cat-button-text:hover:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:var(--cat-link-button-decoration-hover, none);background-color:rgba(var(--base), 0.1)}.cat-button-text.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:var(--cat-link-button-decoration-hover, none);background-color:rgba(var(--base), 0.1)}.cat-button-primary{--bg:var(--cat-primary-bg, 0, 129, 148);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 0, 129, 148);--base:var(--cat-primary-text, 0, 129, 148)}.cat-button-primary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-hover, 1, 115, 132);--fill:var(--cat-primary-fill-hover, 255, 255, 255);--text:var(--cat-primary-text-hover, 1, 115, 132)}.cat-button-primary.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-primary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-active, 2, 99, 113);--fill:var(--cat-primary-fill-active, 255, 255, 255);--text:var(--cat-primary-text-active, 2, 99, 113)}.cat-button-secondary{--bg:var(--cat-secondary-bg, 105, 118, 135);--fill:var(--cat-secondary-fill, 255, 255, 255);--text:var(--cat-secondary-text, 0, 0, 0);--base:var(--cat-secondary-bg, 105, 118, 135)}.cat-button-secondary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-secondary-bg-hover, 105, 118, 135);--fill:var(--cat-secondary-fill-hover, 255, 255, 255);--text:var(--cat-secondary-text-hover, 0, 0, 0)}.cat-button-secondary.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-secondary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-secondary-bg-active, 105, 118, 135);--fill:var(--cat-secondary-fill-active, 255, 255, 255);--text:var(--cat-secondary-text-active, 0, 0, 0)}.cat-button-success{--bg:var(--cat-success-bg-, 0, 132, 88);--fill:var(--cat-success-fill, 255, 255, 255);--text:var(--cat-success-text, 0, 132, 88);--base:var(--cat-success-text, 0, 132, 88)}.cat-button-success:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-success-bg-hover, 0, 117, 78);--fill:var(--cat-success-fill-hover, 255, 255, 255);--text:var(--cat-success-text-hover, 0, 117, 78)}.cat-button-success.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-success:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-success-bg-active, 0, 105, 70);--fill:var(--cat-success-fill-active, 255, 255, 255);--text:var(--cat-success-text-active, 0, 105, 70)}.cat-button-warning{--bg:var(--cat-warning-bg, 255, 206, 128);--fill:var(--cat-warning-fill, 0, 0, 0);--text:var(--cat-warning-text, 159, 97, 0);--base:var(--cat-warning-text, 159, 97, 0)}.cat-button-warning:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-warning-bg-hover, 255, 214, 148);--fill:var(--cat-warning-fill-hover, 0, 0, 0);--text:var(--cat-warning-text-hover, 159, 97, 0)}.cat-button-warning.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-warning:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-warning-bg-active, 255, 222, 168);--fill:var(--cat-warning-fill-active, 0, 0, 0);--text:var(--cat-warning-text-active, 159, 97, 0)}.cat-button-danger{--bg:var(--cat-danger-bg, 217, 52, 13);--fill:var(--cat-danger-fill, 255, 255, 255);--text:var(--cat-danger-text, 217, 52, 13);--base:var(--cat-danger-text, 217, 52, 13)}.cat-button-danger:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-danger-bg-hover, 194, 46, 11);--fill:var(--cat-danger-fill-hover, 255, 255, 255);--text:var(--cat-danger-text-hover, 194, 46, 11)}.cat-button-danger.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-danger:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-danger-bg-active, 174, 42, 10);--fill:var(--cat-danger-fill-active, 255, 255, 255);--text:var(--cat-danger-text-active, 174, 42, 10)}:host(.cat-button-pull:not([size])){margin:-0.625rem -0.75rem}:host(.cat-button-pull-h:not([size])){margin-left:-0.75rem;margin-right:-0.75rem}:host(.cat-button-pull-v:not([size])){margin-top:-0.625rem;margin-bottom:-0.625rem}:host(.cat-button-pull-t:not([size])){margin-top:-0.625rem}:host(.cat-button-pull-l:not([size])){margin-left:-0.75rem}:host(.cat-button-pull-b:not([size])){margin-bottom:-0.625rem}:host(.cat-button-pull-r:not([size])){margin-right:-0.75rem}.cat-button-xs{min-width:1.5rem;padding:0.25rem 0.25rem;font-size:0.875rem;line-height:1rem;gap:0.25rem}.cat-button-xs.cat-button-icon{width:1.5rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=xs]){margin:-0.25rem -0.25rem}:host(.cat-button-pull-h[size=xs]){margin-left:-0.25rem;margin-right:-0.25rem}:host(.cat-button-pull-v[size=xs]){margin-top:-0.25rem;margin-bottom:-0.25rem}:host(.cat-button-pull-t[size=xs]){margin-top:-0.25rem}:host(.cat-button-pull-l[size=xs]){margin-left:-0.25rem}:host(.cat-button-pull-b[size=xs]){margin-bottom:-0.25rem}:host(.cat-button-pull-r[size=xs]){margin-right:-0.25rem}.cat-button-s{min-width:2rem;padding:0.375rem 0.5rem;font-size:0.9375rem;line-height:1.25rem;gap:0.25rem}.cat-button-s cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-s.cat-button-icon{width:2rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=s]){margin:-0.375rem -0.5rem}:host(.cat-button-pull-h[size=s]){margin-left:-0.5rem;margin-right:-0.5rem}:host(.cat-button-pull-v[size=s]){margin-top:-0.375rem;margin-bottom:-0.375rem}:host(.cat-button-pull-t[size=s]){margin-top:-0.375rem}:host(.cat-button-pull-l[size=s]){margin-left:-0.5rem}:host(.cat-button-pull-b[size=s]){margin-bottom:-0.375rem}:host(.cat-button-pull-r[size=s]){margin-right:-0.5rem}.cat-button-m{min-width:2.5rem;padding:0.625rem 0.75rem;font-size:0.9375rem;line-height:1.25rem;gap:0.25rem}.cat-button-m cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-m.cat-button-icon{width:2.5rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=m]){margin:-0.625rem -0.75rem}:host(.cat-button-pull-h[size=m]){margin-left:-0.75rem;margin-right:-0.75rem}:host(.cat-button-pull-v[size=m]){margin-top:-0.625rem;margin-bottom:-0.625rem}:host(.cat-button-pull-t[size=m]){margin-top:-0.625rem}:host(.cat-button-pull-l[size=m]){margin-left:-0.75rem}:host(.cat-button-pull-b[size=m]){margin-bottom:-0.625rem}:host(.cat-button-pull-r[size=m]){margin-right:-0.75rem}.cat-button-l{min-width:3rem;padding:0.875rem 1rem;font-size:0.9375rem;line-height:1.25rem;gap:0.25rem}.cat-button-l cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-l.cat-button-icon{width:3rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=l]){margin:-0.875rem -1rem}:host(.cat-button-pull-h[size=l]){margin-left:-1rem;margin-right:-1rem}:host(.cat-button-pull-v[size=l]){margin-top:-0.875rem;margin-bottom:-0.875rem}:host(.cat-button-pull-t[size=l]){margin-top:-0.875rem}:host(.cat-button-pull-l[size=l]){margin-left:-1rem}:host(.cat-button-pull-b[size=l]){margin-bottom:-0.875rem}:host(.cat-button-pull-r[size=l]){margin-right:-1rem}.cat-button-xl{min-width:3.5rem;padding:1rem 1.25rem;font-size:1.125rem;line-height:1.5rem;gap:0.25rem}.cat-button-xl.cat-button-icon{width:3.5rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=xl]){margin:-1rem -1.25rem}:host(.cat-button-pull-h[size=xl]){margin-left:-1.25rem;margin-right:-1.25rem}:host(.cat-button-pull-v[size=xl]){margin-top:-1rem;margin-bottom:-1rem}:host(.cat-button-pull-t[size=xl]){margin-top:-1rem}:host(.cat-button-pull-l[size=xl]){margin-left:-1.25rem}:host(.cat-button-pull-b[size=xl]){margin-bottom:-1rem}:host(.cat-button-pull-r[size=xl]){margin-right:-1.25rem}:host(.cat-tab-active:not(:hover)){--cat-primary-text:transparent}:host(.cat-text-left) .cat-button{justify-content:left}:host(.cat-text-right) .cat-button{justify-content:right}:host(.cat-nav-item){width:100%}:host(.cat-nav-item) .cat-button{box-shadow:none;border-radius:0;justify-content:left;padding-left:1.25rem;padding-right:1.25rem;gap:0.5rem}:host(.cat-nav-item) .cat-button:focus-visible{outline-offset:-2px}";
263
+ const catButtonCss = ":host{display:inline-block;max-width:100%;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}.cat-button{position:relative;font:inherit;display:flex;align-items:center;justify-content:center;border:none;border-radius:var(--cat-border-radius-m, 0.25rem);text-decoration:none;width:100%;box-sizing:border-box;cursor:pointer;transition:color 0.13s linear, border-color 0.13s linear, background-color 0.13s linear, box-shadow 0.13s linear}.cat-button:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-button-content{word-wrap:break-word;word-break:break-word}.cat-button-ellipsed .cat-button-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.cat-button-disabled{cursor:not-allowed}.cat-button-round{border-radius:10rem}.cat-button-loading{cursor:default}.cat-button-loading cat-spinner{position:absolute}.cat-button-loading>*:not(cat-spinner){visibility:hidden}.cat-group-button-first{border-top-right-radius:0;border-bottom-right-radius:0}.cat-group-button-middle{border-radius:0}.cat-group-button-last{border-top-left-radius:0;border-bottom-left-radius:0}.cat-group-button:hover{z-index:1}.cat-group-button:focus-visible{z-index:2}.cat-button-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.cat-button-filled.cat-button-disabled{--bg:242, 244, 247;--fill:var(--cat-font-color-muted, 81, 92, 108)}.cat-button-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--base), 0.2);color:rgb(var(--text))}.cat-button-outlined.cat-button-disabled{--base:var(--cat-font-color-muted, 81, 92, 108);--text:var(--cat-font-color-muted, 81, 92, 108)}.cat-button-outlined:hover:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-outlined.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-outlined:active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-text{background-color:transparent;color:rgb(var(--text));text-decoration:var(--cat-link-button-decoration, none)}.cat-button-text.cat-button-disabled{--text:var(--cat-font-color-muted, 81, 92, 108)}.cat-button-text:hover:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:var(--cat-link-button-decoration-hover, none);background-color:rgba(var(--base), 0.1)}.cat-button-text.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:var(--cat-link-button-decoration-hover, none);background-color:rgba(var(--base), 0.1)}.cat-button-primary{--bg:var(--cat-primary-bg, 0, 129, 148);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 0, 129, 148);--base:var(--cat-primary-text, 0, 129, 148)}.cat-button-primary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-hover, 1, 115, 132);--fill:var(--cat-primary-fill-hover, 255, 255, 255);--text:var(--cat-primary-text-hover, 1, 115, 132)}.cat-button-primary.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-primary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-active, 2, 99, 113);--fill:var(--cat-primary-fill-active, 255, 255, 255);--text:var(--cat-primary-text-active, 2, 99, 113)}.cat-button-secondary{--bg:var(--cat-secondary-bg, 105, 118, 135);--fill:var(--cat-secondary-fill, 255, 255, 255);--text:var(--cat-secondary-text, 0, 0, 0);--base:var(--cat-secondary-bg, 105, 118, 135)}.cat-button-secondary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-secondary-bg-hover, 105, 118, 135);--fill:var(--cat-secondary-fill-hover, 255, 255, 255);--text:var(--cat-secondary-text-hover, 0, 0, 0)}.cat-button-secondary.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-secondary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-secondary-bg-active, 105, 118, 135);--fill:var(--cat-secondary-fill-active, 255, 255, 255);--text:var(--cat-secondary-text-active, 0, 0, 0)}.cat-button-success{--bg:var(--cat-success-bg-, 0, 132, 88);--fill:var(--cat-success-fill, 255, 255, 255);--text:var(--cat-success-text, 0, 132, 88);--base:var(--cat-success-text, 0, 132, 88)}.cat-button-success:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-success-bg-hover, 0, 117, 78);--fill:var(--cat-success-fill-hover, 255, 255, 255);--text:var(--cat-success-text-hover, 0, 117, 78)}.cat-button-success.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-success:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-success-bg-active, 0, 105, 70);--fill:var(--cat-success-fill-active, 255, 255, 255);--text:var(--cat-success-text-active, 0, 105, 70)}.cat-button-warning{--bg:var(--cat-warning-bg, 255, 206, 128);--fill:var(--cat-warning-fill, 0, 0, 0);--text:var(--cat-warning-text, 159, 97, 0);--base:var(--cat-warning-text, 159, 97, 0)}.cat-button-warning:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-warning-bg-hover, 255, 214, 148);--fill:var(--cat-warning-fill-hover, 0, 0, 0);--text:var(--cat-warning-text-hover, 159, 97, 0)}.cat-button-warning.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-warning:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-warning-bg-active, 255, 222, 168);--fill:var(--cat-warning-fill-active, 0, 0, 0);--text:var(--cat-warning-text-active, 159, 97, 0)}.cat-button-danger{--bg:var(--cat-danger-bg, 217, 52, 13);--fill:var(--cat-danger-fill, 255, 255, 255);--text:var(--cat-danger-text, 217, 52, 13);--base:var(--cat-danger-text, 217, 52, 13)}.cat-button-danger:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-danger-bg-hover, 194, 46, 11);--fill:var(--cat-danger-fill-hover, 255, 255, 255);--text:var(--cat-danger-text-hover, 194, 46, 11)}.cat-button-danger.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-danger:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-danger-bg-active, 174, 42, 10);--fill:var(--cat-danger-fill-active, 255, 255, 255);--text:var(--cat-danger-text-active, 174, 42, 10)}:host(.cat-button-pull:not([size])){margin:-0.625rem -0.75rem}:host(.cat-button-pull-h:not([size])){margin-left:-0.75rem;margin-right:-0.75rem}:host(.cat-button-pull-v:not([size])){margin-top:-0.625rem;margin-bottom:-0.625rem}:host(.cat-button-pull-t:not([size])){margin-top:-0.625rem}:host(.cat-button-pull-l:not([size])){margin-left:-0.75rem}:host(.cat-button-pull-b:not([size])){margin-bottom:-0.625rem}:host(.cat-button-pull-r:not([size])){margin-right:-0.75rem}.cat-button-xs{min-width:1.5rem;padding:0.1875rem 0.25rem;font-size:0.875rem;line-height:1.125rem;gap:0.25rem}.cat-button-xs.cat-button-icon{width:1.5rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=xs]){margin:-0.1875rem -0.25rem}:host(.cat-button-pull-h[size=xs]){margin-left:-0.25rem;margin-right:-0.25rem}:host(.cat-button-pull-v[size=xs]){margin-top:-0.1875rem;margin-bottom:-0.1875rem}:host(.cat-button-pull-t[size=xs]){margin-top:-0.1875rem}:host(.cat-button-pull-l[size=xs]){margin-left:-0.25rem}:host(.cat-button-pull-b[size=xs]){margin-bottom:-0.1875rem}:host(.cat-button-pull-r[size=xs]){margin-right:-0.25rem}.cat-button-s{min-width:2rem;padding:0.375rem 0.5rem;font-size:0.9375rem;line-height:1.25rem;gap:0.25rem}.cat-button-s cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-s.cat-button-icon{width:2rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=s]){margin:-0.375rem -0.5rem}:host(.cat-button-pull-h[size=s]){margin-left:-0.5rem;margin-right:-0.5rem}:host(.cat-button-pull-v[size=s]){margin-top:-0.375rem;margin-bottom:-0.375rem}:host(.cat-button-pull-t[size=s]){margin-top:-0.375rem}:host(.cat-button-pull-l[size=s]){margin-left:-0.5rem}:host(.cat-button-pull-b[size=s]){margin-bottom:-0.375rem}:host(.cat-button-pull-r[size=s]){margin-right:-0.5rem}.cat-button-m{min-width:2.5rem;padding:0.625rem 0.75rem;font-size:0.9375rem;line-height:1.25rem;gap:0.25rem}.cat-button-m cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-m.cat-button-icon{width:2.5rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=m]){margin:-0.625rem -0.75rem}:host(.cat-button-pull-h[size=m]){margin-left:-0.75rem;margin-right:-0.75rem}:host(.cat-button-pull-v[size=m]){margin-top:-0.625rem;margin-bottom:-0.625rem}:host(.cat-button-pull-t[size=m]){margin-top:-0.625rem}:host(.cat-button-pull-l[size=m]){margin-left:-0.75rem}:host(.cat-button-pull-b[size=m]){margin-bottom:-0.625rem}:host(.cat-button-pull-r[size=m]){margin-right:-0.75rem}.cat-button-l{min-width:3rem;padding:0.875rem 1rem;font-size:0.9375rem;line-height:1.25rem;gap:0.25rem}.cat-button-l cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-l.cat-button-icon{width:3rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=l]){margin:-0.875rem -1rem}:host(.cat-button-pull-h[size=l]){margin-left:-1rem;margin-right:-1rem}:host(.cat-button-pull-v[size=l]){margin-top:-0.875rem;margin-bottom:-0.875rem}:host(.cat-button-pull-t[size=l]){margin-top:-0.875rem}:host(.cat-button-pull-l[size=l]){margin-left:-1rem}:host(.cat-button-pull-b[size=l]){margin-bottom:-0.875rem}:host(.cat-button-pull-r[size=l]){margin-right:-1rem}.cat-button-xl{min-width:3.5rem;padding:1rem 1.25rem;font-size:1.125rem;line-height:1.5rem;gap:0.25rem}.cat-button-xl.cat-button-icon{width:3.5rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=xl]){margin:-1rem -1.25rem}:host(.cat-button-pull-h[size=xl]){margin-left:-1.25rem;margin-right:-1.25rem}:host(.cat-button-pull-v[size=xl]){margin-top:-1rem;margin-bottom:-1rem}:host(.cat-button-pull-t[size=xl]){margin-top:-1rem}:host(.cat-button-pull-l[size=xl]){margin-left:-1.25rem}:host(.cat-button-pull-b[size=xl]){margin-bottom:-1rem}:host(.cat-button-pull-r[size=xl]){margin-right:-1.25rem}:host(.cat-tab-active:not(:hover)){--cat-primary-text:transparent}:host(.cat-text-left) .cat-button{justify-content:left}:host(.cat-text-right) .cat-button{justify-content:right}:host(.cat-nav-item){width:100%}:host(.cat-nav-item) .cat-button{box-shadow:none;border-radius:0;justify-content:left;padding-left:1.25rem;padding-right:1.25rem;gap:0.5rem}:host(.cat-nav-item) .cat-button:focus-visible{outline-offset:-2px}";
264
264
 
265
265
  const CatButton = class {
266
266
  constructor(hostRef) {
@@ -283,7 +283,6 @@ const CatButton = class {
283
283
  this.url = undefined;
284
284
  this.urlTarget = undefined;
285
285
  this.icon = undefined;
286
- this.iconSrc = undefined;
287
286
  this.iconOnly = false;
288
287
  this.iconRight = false;
289
288
  this.buttonId = undefined;
@@ -398,19 +397,19 @@ const CatButton = class {
398
397
  }
399
398
  }
400
399
  get isIconButton() {
401
- return (Boolean(this.icon) || Boolean(this.iconSrc)) && this._iconOnly;
400
+ return Boolean(this.icon) && this._iconOnly;
402
401
  }
403
402
  get hasPrefixIcon() {
404
- return (Boolean(this.icon) || Boolean(this.iconSrc)) && !this._iconOnly && !this.iconRight;
403
+ return Boolean(this.icon) && !this._iconOnly && !this.iconRight;
405
404
  }
406
405
  get hasSuffixIcon() {
407
- return (Boolean(this.icon) || Boolean(this.iconSrc)) && !this._iconOnly && this.iconRight;
406
+ return Boolean(this.icon) && !this._iconOnly && this.iconRight;
408
407
  }
409
408
  get content() {
410
409
  return [
411
- this.hasPrefixIcon ? (index.h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize, part: "prefix" })) : null,
412
- this.isIconButton ? (index.h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize })) : (index.h("span", { class: "cat-button-content", part: "content" }, index.h("slot", null))),
413
- this.hasSuffixIcon ? (index.h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize, part: "suffix" })) : null,
410
+ this.hasPrefixIcon ? index.h("cat-icon", { icon: this.icon, size: this.iconSize, part: "prefix" }) : null,
411
+ this.isIconButton ? (index.h("cat-icon", { icon: this.icon, size: this.iconSize })) : (index.h("span", { class: "cat-button-content", part: "content" }, index.h("slot", null))),
412
+ this.hasSuffixIcon ? index.h("cat-icon", { icon: this.icon, size: this.iconSize, part: "suffix" }) : null,
414
413
  this.loading ? index.h("cat-spinner", { size: this.spinnerSize }) : null
415
414
  ];
416
415
  }
@@ -484,7 +483,7 @@ const CatFormHint = props => {
484
483
  ]));
485
484
  };
486
485
 
487
- const catCheckboxCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}:host{display:flex;flex-direction:column;gap:0.5rem;margin-bottom:1rem}:host([hidden]){display:none}label{flex:0 1 auto;display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;position:relative}.label-left{flex-direction:row-reverse}.label-left input{right:1px;left:unset}input{position:absolute;width:1.25rem;height:1.25rem;margin:0;opacity:0;cursor:inherit;left:1px;top:0.5px}.box{flex:0 0 auto;display:flex;position:relative;height:1.25rem;width:1.25rem;background-color:white;border:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));border-radius:var(--cat-border-radius-s, 0.125rem);transition:background-color 0.13s ease, border-color 0.13s ease;pointer-events:none}.box svg{fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:16px;stroke-dashoffset:16px;transition:all 0.13s ease;width:50%;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%) scale(0.99)}:checked+.box{background-color:rgb(var(--cat-primary-bg, 0, 129, 148));border-color:rgb(var(--cat-primary-bg, 0, 129, 148));stroke:rgb(var(--cat-primary-fill, 255, 255, 255))}:checked+.box .check{stroke-dashoffset:0}:indeterminate+.box{background-color:rgb(var(--cat-primary-bg, 0, 129, 148));border-color:rgb(var(--cat-primary-bg, 0, 129, 148));stroke:rgb(var(--cat-primary-fill, 255, 255, 255))}:indeterminate+.box .dash{stroke-dashoffset:0}:focus-visible+.box{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.is-disabled .box{background-color:#f2f4f7;border-color:rgb(var(--cat-border-color-dark, 215, 219, 224));stroke:rgb(var(--cat-font-color-muted, 81, 92, 108))}:host(.cat-error) .box{border:1px solid rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) :checked+.box,:host(.cat-error) :indeterminate+.box{background-color:rgb(var(--cat-danger-bg, 217, 52, 13));border-color:rgb(var(--cat-danger-bg, 217, 52, 13));stroke:rgb(var(--cat-danger-fill, 255, 255, 255))}.label{flex:1 1 auto;min-width:0}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}";
486
+ const catCheckboxCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1.125rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}.hint-wrapper{flex:0 1 auto;display:flex;gap:0.5rem}.hint-section{flex:1 1 auto;min-width:0}.input-hint,::slotted([slot=hint]){color:rgb(var(--cat-font-color-muted, 81, 92, 108));line-height:1.5;flex:1 1 auto;min-width:0}:host{display:flex;flex-direction:column;gap:0.5rem;margin-bottom:1rem}:host([hidden]){display:none}label{flex:0 1 auto;display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;position:relative}.label-left{flex-direction:row-reverse}.label-left input{right:1px;left:unset}input{position:absolute;width:1.25rem;height:1.25rem;margin:0;opacity:0;cursor:inherit;left:1px;top:0.5px}.box-placeholder{width:calc(1.25rem + 1px)}.box{flex:0 0 auto;display:flex;position:relative;height:1.25rem;width:1.25rem;background-color:white;border:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));border-radius:var(--cat-border-radius-s, 0.125rem);transition:background-color 0.13s ease, border-color 0.13s ease;pointer-events:none}.box svg{fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:16px;stroke-dashoffset:16px;transition:all 0.13s ease;width:50%;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%) scale(0.99)}:checked+.box{background-color:rgb(var(--cat-primary-bg, 0, 129, 148));border-color:rgb(var(--cat-primary-bg, 0, 129, 148));stroke:rgb(var(--cat-primary-fill, 255, 255, 255))}:checked+.box .check{stroke-dashoffset:0}:indeterminate+.box{background-color:rgb(var(--cat-primary-bg, 0, 129, 148));border-color:rgb(var(--cat-primary-bg, 0, 129, 148));stroke:rgb(var(--cat-primary-fill, 255, 255, 255))}:indeterminate+.box .dash{stroke-dashoffset:0}:focus-visible+.box{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.is-disabled .box{background-color:#f2f4f7;border-color:rgb(var(--cat-border-color-dark, 215, 219, 224));stroke:rgb(var(--cat-font-color-muted, 81, 92, 108))}:host(.cat-error) .box{border:1px solid rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) :checked+.box,:host(.cat-error) :indeterminate+.box{background-color:rgb(var(--cat-danger-bg, 217, 52, 13));border-color:rgb(var(--cat-danger-bg, 217, 52, 13));stroke:rgb(var(--cat-danger-fill, 255, 255, 255))}.label{flex:1 1 auto;min-width:0}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}";
488
487
 
489
488
  let nextUniqueId$8 = 0;
490
489
  const CatCheckbox = class {
@@ -525,7 +524,2995 @@ const CatCheckbox = class {
525
524
  }
526
525
  }
527
526
  /**
528
- * Programmatically move focus to the checkbox. Use this method instead of
527
+ * Programmatically move focus to the checkbox. Use this method instead of
528
+ * `input.focus()`.
529
+ *
530
+ * @param options An optional object providing options to control aspects of
531
+ * the focusing process.
532
+ */
533
+ async doFocus(options) {
534
+ this.input.focus(options);
535
+ }
536
+ /**
537
+ * Programmatically remove focus from the checkbox. Use this method instead of
538
+ * `input.blur()`.
539
+ */
540
+ async doBlur() {
541
+ this.input.blur();
542
+ }
543
+ /**
544
+ * Programmatically simulate a click on the checkbox.
545
+ */
546
+ async doClick() {
547
+ this.input.click();
548
+ }
549
+ render() {
550
+ return (index.h(index.Host, null, index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } }, index.h("input", Object.assign({}, this.nativeAttributes, { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value !== undefined ? String(this.value) : this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) })), index.h("span", { class: "box", "aria-hidden": "true", part: "checkbox" }, index.h("svg", { class: "check", viewBox: "0 0 12 10" }, index.h("polyline", { points: "1.5 6 4.5 9 10.5 1" })), index.h("svg", { class: "dash", viewBox: "0 0 12 10" }, index.h("polyline", { points: "1.5 5 10.5 5" }))), index.h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (index.h("div", { class: { 'hint-wrapper': true, 'label-left': this.labelLeft } }, index.h("div", { class: "box-placeholder" }), index.h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }) })))));
551
+ }
552
+ onInput(event) {
553
+ this.checked = this.input.checked;
554
+ if (!this.value || typeof this.value === 'boolean') {
555
+ this.value = this.checked;
556
+ }
557
+ this.catChange.emit(event);
558
+ }
559
+ onFocus(event) {
560
+ this.catFocus.emit(event);
561
+ }
562
+ onBlur(event) {
563
+ this.catBlur.emit(event);
564
+ }
565
+ get hostElement() { return index.getElement(this); }
566
+ };
567
+ CatCheckbox.style = catCheckboxCss;
568
+
569
+ var dayjs_min = catIconRegistry.createCommonjsModule(function (module, exports) {
570
+ !function(t,e){module.exports=e();}(catIconRegistry.commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case c:return r?l(1,0):l(31,11);case f:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),l=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,l=this;r=Number(r);var $=O.p(h),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===f)return this.set(f,this.$M+r);if($===c)return this.set(c,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},$={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||$[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,v=this-M,g=O.m(this,M);return g=($={},$[c]=g/12,$[f]=g,$[h]=g/3,$[o]=(v-m)/6048e5,$[a]=(v-m)/864e5,$[u]=v/n,$[s]=v/e,$[i]=v/t,$)[y]||v,l?g:O.a(g)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
571
+ });
572
+
573
+ var isoWeek = catIconRegistry.createCommonjsModule(function (module, exports) {
574
+ !function(e,t){module.exports=t();}(catIconRegistry.commonjsGlobal,(function(){var e="day";return function(t,i,s){var a=function(t){return t.add(4-t.isoWeekday(),e)},d=i.prototype;d.isoWeekYear=function(){return a(this).year()},d.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),e);var i,d,n,o,r=a(this),u=(i=this.isoWeekYear(),d=this.$u,n=(d?s.utc:s)().year(i).startOf("year"),o=4-n.isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,e));return r.diff(u,"week")+1},d.isoWeekday=function(e){return this.$utils().u(e)?this.day()||7:this.day(this.day()%7?e:e-7)};var n=d.startOf;d.startOf=function(e,t){var i=this.$utils(),s=!!i.u(t)||t;return "isoweek"===i.p(e)?s?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):n.bind(this)(e,t)};}}));
575
+ });
576
+
577
+ var utc = catIconRegistry.createCommonjsModule(function (module, exports) {
578
+ !function(t,i){module.exports=i();}(catIconRegistry.commonjsGlobal,(function(){var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var o=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),o.call(this,t);};var r=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds();}else r.call(this);};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s,o=this;if(f)return o.$offset=u,o.$u=0===s,o;if(0!==s){var r=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(o=this.local().add(u+r,t)).$offset=u,o.$x.$localOffset=r;}else o=this.utc();return o};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return !!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return "s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)};}}));
579
+ });
580
+
581
+ dayjs_min.extend(isoWeek);
582
+ dayjs_min.extend(utc);
583
+ const today$1 = () => dayjs_min().utc().startOf('day').toDate();
584
+
585
+ function lastItemOf(arr) {
586
+ return arr[arr.length - 1];
587
+ }
588
+
589
+ // push only the items not included in the array
590
+ function pushUnique(arr, ...items) {
591
+ items.forEach((item) => {
592
+ if (arr.includes(item)) {
593
+ return;
594
+ }
595
+ arr.push(item);
596
+ });
597
+ return arr;
598
+ }
599
+
600
+ function stringToArray(str, separator) {
601
+ // convert empty string to an empty array
602
+ return str ? str.split(separator) : [];
603
+ }
604
+
605
+ function isInRange(testVal, min, max) {
606
+ const minOK = min === undefined || testVal >= min;
607
+ const maxOK = max === undefined || testVal <= max;
608
+ return minOK && maxOK;
609
+ }
610
+
611
+ function limitToRange(val, min, max) {
612
+ if (val < min) {
613
+ return min;
614
+ }
615
+ if (val > max) {
616
+ return max;
617
+ }
618
+ return val;
619
+ }
620
+
621
+ function createTagRepeat(tagName, repeat, attributes = {}, index = 0, html = '') {
622
+ const openTagSrc = Object.keys(attributes).reduce((src, attr) => {
623
+ let val = attributes[attr];
624
+ if (typeof val === 'function') {
625
+ val = val(index);
626
+ }
627
+ return `${src} ${attr}="${val}"`;
628
+ }, tagName);
629
+ html += `<${openTagSrc}></${tagName}>`;
630
+
631
+ const next = index + 1;
632
+ return next < repeat
633
+ ? createTagRepeat(tagName, repeat, attributes, next, html)
634
+ : html;
635
+ }
636
+
637
+ // Remove the spacing surrounding tags for HTML parser not to create text nodes
638
+ // before/after elements
639
+ function optimizeTemplateHTML(html) {
640
+ return html.replace(/>\s+/g, '>').replace(/\s+</, '<');
641
+ }
642
+
643
+ function stripTime(timeValue) {
644
+ return new Date(timeValue).setHours(0, 0, 0, 0);
645
+ }
646
+
647
+ function today() {
648
+ return new Date().setHours(0, 0, 0, 0);
649
+ }
650
+
651
+ // Get the time value of the start of given date or year, month and day
652
+ function dateValue(...args) {
653
+ switch (args.length) {
654
+ case 0:
655
+ return today();
656
+ case 1:
657
+ return stripTime(args[0]);
658
+ }
659
+
660
+ // use setFullYear() to keep 2-digit year from being mapped to 1900-1999
661
+ const newDate = new Date(0);
662
+ newDate.setFullYear(...args);
663
+ return newDate.setHours(0, 0, 0, 0);
664
+ }
665
+
666
+ function addDays(date, amount) {
667
+ const newDate = new Date(date);
668
+ return newDate.setDate(newDate.getDate() + amount);
669
+ }
670
+
671
+ function addWeeks(date, amount) {
672
+ return addDays(date, amount * 7);
673
+ }
674
+
675
+ function addMonths(date, amount) {
676
+ // If the day of the date is not in the new month, the last day of the new
677
+ // month will be returned. e.g. Jan 31 + 1 month → Feb 28 (not Mar 03)
678
+ const newDate = new Date(date);
679
+ const monthsToSet = newDate.getMonth() + amount;
680
+ let expectedMonth = monthsToSet % 12;
681
+ if (expectedMonth < 0) {
682
+ expectedMonth += 12;
683
+ }
684
+
685
+ const time = newDate.setMonth(monthsToSet);
686
+ return newDate.getMonth() !== expectedMonth ? newDate.setDate(0) : time;
687
+ }
688
+
689
+ function addYears(date, amount) {
690
+ // If the date is Feb 29 and the new year is not a leap year, Feb 28 of the
691
+ // new year will be returned.
692
+ const newDate = new Date(date);
693
+ const expectedMonth = newDate.getMonth();
694
+ const time = newDate.setFullYear(newDate.getFullYear() + amount);
695
+ return expectedMonth === 1 && newDate.getMonth() === 2 ? newDate.setDate(0) : time;
696
+ }
697
+
698
+ // Calculate the distance bettwen 2 days of the week
699
+ function dayDiff(day, from) {
700
+ return (day - from + 7) % 7;
701
+ }
702
+
703
+ // Get the date of the specified day of the week of given base date
704
+ function dayOfTheWeekOf(baseDate, dayOfWeek, weekStart = 0) {
705
+ const baseDay = new Date(baseDate).getDay();
706
+ return addDays(baseDate, dayDiff(dayOfWeek, weekStart) - dayDiff(baseDay, weekStart));
707
+ }
708
+
709
+ function calcWeekNum(dayOfTheWeek, sameDayOfFirstWeek) {
710
+ return Math.round((dayOfTheWeek - sameDayOfFirstWeek) / 604800000) + 1;
711
+ }
712
+
713
+ // Get the ISO week number of a date
714
+ function getIsoWeek(date) {
715
+ // - Start of ISO week is Monday
716
+ // - Use Thursday for culculation because the first Thursday of ISO week is
717
+ // always in January
718
+ const thuOfTheWeek = dayOfTheWeekOf(date, 4, 1);
719
+ // - Week 1 in ISO week is the week including Jan 04
720
+ // - Use the Thu of given date's week (instead of given date itself) to
721
+ // calculate week 1 of the year so that Jan 01 - 03 won't be miscalculated
722
+ // as week 0 when Jan 04 is Mon - Wed
723
+ const firstThu = dayOfTheWeekOf(new Date(thuOfTheWeek).setMonth(0, 4), 4, 1);
724
+ // return Math.round((thuOfTheWeek - firstThu) / 604800000) + 1;
725
+ return calcWeekNum(thuOfTheWeek, firstThu);
726
+ }
727
+
728
+ // Calculate week number in traditional week number system
729
+ // @see https://en.wikipedia.org/wiki/Week#Other_week_numbering_systems
730
+ function calcTraditionalWeekNumber(date, weekStart) {
731
+ // - Week 1 of traditional week is the week including the Jan 01
732
+ // - Use Jan 01 of given date's year to calculate the start of week 1
733
+ const startOfFirstWeek = dayOfTheWeekOf(new Date(date).setMonth(0, 1), weekStart, weekStart);
734
+ const startOfTheWeek = dayOfTheWeekOf(date, weekStart, weekStart);
735
+ const weekNum = calcWeekNum(startOfTheWeek, startOfFirstWeek);
736
+ if (weekNum < 53) {
737
+ return weekNum;
738
+ }
739
+ // If the 53rd week includes Jan 01, it's actually next year's week 1
740
+ const weekOneOfNextYear = dayOfTheWeekOf(new Date(date).setDate(32), weekStart, weekStart);
741
+ return startOfTheWeek === weekOneOfNextYear ? 1 : weekNum;
742
+ }
743
+
744
+ // Get the Western traditional week number of a date
745
+ function getWesternTradWeek(date) {
746
+ // Start of Western traditionl week is Sunday
747
+ return calcTraditionalWeekNumber(date, 0);
748
+ }
749
+
750
+ // Get the Middle Eastern week number of a date
751
+ function getMidEasternWeek(date) {
752
+ // Start of Middle Eastern week is Saturday
753
+ return calcTraditionalWeekNumber(date, 6);
754
+ }
755
+
756
+ // Get the start year of the period of years that includes given date
757
+ // years: length of the year period
758
+ function startOfYearPeriod(date, years) {
759
+ /* @see https://en.wikipedia.org/wiki/Year_zero#ISO_8601 */
760
+ const year = new Date(date).getFullYear();
761
+ return Math.floor(year / years) * years;
762
+ }
763
+
764
+ // Convert date to the first/last date of the month/year of the date
765
+ function regularizeDate(date, timeSpan, useLastDate) {
766
+ if (timeSpan !== 1 && timeSpan !== 2) {
767
+ return date;
768
+ }
769
+ const newDate = new Date(date);
770
+ if (timeSpan === 1) {
771
+ useLastDate
772
+ ? newDate.setMonth(newDate.getMonth() + 1, 0)
773
+ : newDate.setDate(1);
774
+ } else {
775
+ useLastDate
776
+ ? newDate.setFullYear(newDate.getFullYear() + 1, 0, 0)
777
+ : newDate.setMonth(0, 1);
778
+ }
779
+ return newDate.setHours(0, 0, 0, 0);
780
+ }
781
+
782
+ // pattern for format parts
783
+ const reFormatTokens = /dd?|DD?|mm?|MM?|yy?(?:yy)?/;
784
+ // pattern for non date parts
785
+ const reNonDateParts = /[\s!-/:-@[-`{-~年月日]+/;
786
+ // cache for persed formats
787
+ let knownFormats = {};
788
+ // parse funtions for date parts
789
+ const parseFns = {
790
+ y(date, year) {
791
+ return new Date(date).setFullYear(parseInt(year, 10));
792
+ },
793
+ m(date, month, locale) {
794
+ const newDate = new Date(date);
795
+ let monthIndex = parseInt(month, 10) - 1;
796
+
797
+ if (isNaN(monthIndex)) {
798
+ if (!month) {
799
+ return NaN;
800
+ }
801
+
802
+ const monthName = month.toLowerCase();
803
+ const compareNames = name => name.toLowerCase().startsWith(monthName);
804
+ // compare with both short and full names because some locales have periods
805
+ // in the short names (not equal to the first X letters of the full names)
806
+ monthIndex = locale.monthsShort.findIndex(compareNames);
807
+ if (monthIndex < 0) {
808
+ monthIndex = locale.months.findIndex(compareNames);
809
+ }
810
+ if (monthIndex < 0) {
811
+ return NaN;
812
+ }
813
+ }
814
+
815
+ newDate.setMonth(monthIndex);
816
+ return newDate.getMonth() !== normalizeMonth(monthIndex)
817
+ ? newDate.setDate(0)
818
+ : newDate.getTime();
819
+ },
820
+ d(date, day) {
821
+ return new Date(date).setDate(parseInt(day, 10));
822
+ },
823
+ };
824
+ // format functions for date parts
825
+ const formatFns = {
826
+ d(date) {
827
+ return date.getDate();
828
+ },
829
+ dd(date) {
830
+ return padZero(date.getDate(), 2);
831
+ },
832
+ D(date, locale) {
833
+ return locale.daysShort[date.getDay()];
834
+ },
835
+ DD(date, locale) {
836
+ return locale.days[date.getDay()];
837
+ },
838
+ m(date) {
839
+ return date.getMonth() + 1;
840
+ },
841
+ mm(date) {
842
+ return padZero(date.getMonth() + 1, 2);
843
+ },
844
+ M(date, locale) {
845
+ return locale.monthsShort[date.getMonth()];
846
+ },
847
+ MM(date, locale) {
848
+ return locale.months[date.getMonth()];
849
+ },
850
+ y(date) {
851
+ return date.getFullYear();
852
+ },
853
+ yy(date) {
854
+ return padZero(date.getFullYear(), 2).slice(-2);
855
+ },
856
+ yyyy(date) {
857
+ return padZero(date.getFullYear(), 4);
858
+ },
859
+ };
860
+
861
+ // get month index in normal range (0 - 11) from any number
862
+ function normalizeMonth(monthIndex) {
863
+ return monthIndex > -1 ? monthIndex % 12 : normalizeMonth(monthIndex + 12);
864
+ }
865
+
866
+ function padZero(num, length) {
867
+ return num.toString().padStart(length, '0');
868
+ }
869
+
870
+ function parseFormatString(format) {
871
+ if (typeof format !== 'string') {
872
+ throw new Error("Invalid date format.");
873
+ }
874
+ if (format in knownFormats) {
875
+ return knownFormats[format];
876
+ }
877
+
878
+ // sprit the format string into parts and seprators
879
+ const separators = format.split(reFormatTokens);
880
+ const parts = format.match(new RegExp(reFormatTokens, 'g'));
881
+ if (separators.length === 0 || !parts) {
882
+ throw new Error("Invalid date format.");
883
+ }
884
+
885
+ // collect format functions used in the format
886
+ const partFormatters = parts.map(token => formatFns[token]);
887
+
888
+ // collect parse function keys used in the format
889
+ // iterate over parseFns' keys in order to keep the order of the keys.
890
+ const partParserKeys = Object.keys(parseFns).reduce((keys, key) => {
891
+ const token = parts.find(part => part[0] !== 'D' && part[0].toLowerCase() === key);
892
+ if (token) {
893
+ keys.push(key);
894
+ }
895
+ return keys;
896
+ }, []);
897
+
898
+ return knownFormats[format] = {
899
+ parser(dateStr, locale) {
900
+ const dateParts = dateStr.split(reNonDateParts).reduce((dtParts, part, index) => {
901
+ if (part.length > 0 && parts[index]) {
902
+ const token = parts[index][0];
903
+ if (token === 'M') {
904
+ dtParts.m = part;
905
+ } else if (token !== 'D') {
906
+ dtParts[token] = part;
907
+ }
908
+ }
909
+ return dtParts;
910
+ }, {});
911
+
912
+ // iterate over partParserkeys so that the parsing is made in the oder
913
+ // of year, month and day to prevent the day parser from correcting last
914
+ // day of month wrongly
915
+ return partParserKeys.reduce((origDate, key) => {
916
+ const newDate = parseFns[key](origDate, dateParts[key], locale);
917
+ // ingnore the part failed to parse
918
+ return isNaN(newDate) ? origDate : newDate;
919
+ }, today());
920
+ },
921
+ formatter(date, locale) {
922
+ let dateStr = partFormatters.reduce((str, fn, index) => {
923
+ return str += `${separators[index]}${fn(date, locale)}`;
924
+ }, '');
925
+ // separators' length is always parts' length + 1,
926
+ return dateStr += lastItemOf(separators);
927
+ },
928
+ };
929
+ }
930
+
931
+ function parseDate(dateStr, format, locale) {
932
+ if (dateStr instanceof Date || typeof dateStr === 'number') {
933
+ const date = stripTime(dateStr);
934
+ return isNaN(date) ? undefined : date;
935
+ }
936
+ if (!dateStr) {
937
+ return undefined;
938
+ }
939
+ if (dateStr === 'today') {
940
+ return today();
941
+ }
942
+
943
+ if (format && format.toValue) {
944
+ const date = format.toValue(dateStr, format, locale);
945
+ return isNaN(date) ? undefined : stripTime(date);
946
+ }
947
+
948
+ return parseFormatString(format).parser(dateStr, locale);
949
+ }
950
+
951
+ function formatDate(date, format, locale) {
952
+ if (isNaN(date) || (!date && date !== 0)) {
953
+ return '';
954
+ }
955
+
956
+ const dateObj = typeof date === 'number' ? new Date(date) : date;
957
+
958
+ if (format.toDisplay) {
959
+ return format.toDisplay(dateObj, format, locale);
960
+ }
961
+
962
+ return parseFormatString(format).formatter(dateObj, locale);
963
+ }
964
+
965
+ const range = document.createRange();
966
+
967
+ function parseHTML(html) {
968
+ return range.createContextualFragment(html);
969
+ }
970
+
971
+ function getParent(el) {
972
+ return el.parentElement
973
+ || (el.parentNode instanceof ShadowRoot ? el.parentNode.host : undefined);
974
+ }
975
+
976
+ function isActiveElement(el) {
977
+ return el.getRootNode().activeElement === el;
978
+ }
979
+
980
+ function hideElement(el) {
981
+ if (el.style.display === 'none') {
982
+ return;
983
+ }
984
+ // back up the existing display setting in data-style-display
985
+ if (el.style.display) {
986
+ el.dataset.styleDisplay = el.style.display;
987
+ }
988
+ el.style.display = 'none';
989
+ }
990
+
991
+ function showElement(el) {
992
+ if (el.style.display !== 'none') {
993
+ return;
994
+ }
995
+ if (el.dataset.styleDisplay) {
996
+ // restore backed-up dispay property
997
+ el.style.display = el.dataset.styleDisplay;
998
+ delete el.dataset.styleDisplay;
999
+ } else {
1000
+ el.style.display = '';
1001
+ }
1002
+ }
1003
+
1004
+ function emptyChildNodes(el) {
1005
+ if (el.firstChild) {
1006
+ el.removeChild(el.firstChild);
1007
+ emptyChildNodes(el);
1008
+ }
1009
+ }
1010
+
1011
+ function replaceChildNodes(el, newChildNodes) {
1012
+ emptyChildNodes(el);
1013
+ if (newChildNodes instanceof DocumentFragment) {
1014
+ el.appendChild(newChildNodes);
1015
+ } else if (typeof newChildNodes === 'string') {
1016
+ el.appendChild(parseHTML(newChildNodes));
1017
+ } else if (typeof newChildNodes.forEach === 'function') {
1018
+ newChildNodes.forEach((node) => {
1019
+ el.appendChild(node);
1020
+ });
1021
+ }
1022
+ }
1023
+
1024
+ const listenerRegistry = new WeakMap();
1025
+ const {addEventListener, removeEventListener} = EventTarget.prototype;
1026
+
1027
+ // Register event listeners to a key object
1028
+ // listeners: array of listener definitions;
1029
+ // - each definition must be a flat array of event target and the arguments
1030
+ // used to call addEventListener() on the target
1031
+ function registerListeners(keyObj, listeners) {
1032
+ let registered = listenerRegistry.get(keyObj);
1033
+ if (!registered) {
1034
+ registered = [];
1035
+ listenerRegistry.set(keyObj, registered);
1036
+ }
1037
+ listeners.forEach((listener) => {
1038
+ addEventListener.call(...listener);
1039
+ registered.push(listener);
1040
+ });
1041
+ }
1042
+
1043
+ function unregisterListeners(keyObj) {
1044
+ let listeners = listenerRegistry.get(keyObj);
1045
+ if (!listeners) {
1046
+ return;
1047
+ }
1048
+ listeners.forEach((listener) => {
1049
+ removeEventListener.call(...listener);
1050
+ });
1051
+ listenerRegistry.delete(keyObj);
1052
+ }
1053
+
1054
+ // Event.composedPath() polyfill for Edge
1055
+ // based on https://gist.github.com/kleinfreund/e9787d73776c0e3750dcfcdc89f100ec
1056
+ if (!Event.prototype.composedPath) {
1057
+ const getComposedPath = (node, path = []) => {
1058
+ path.push(node);
1059
+
1060
+ let parent;
1061
+ if (node.parentNode) {
1062
+ parent = node.parentNode;
1063
+ } else if (node.host) { // ShadowRoot
1064
+ parent = node.host;
1065
+ } else if (node.defaultView) { // Document
1066
+ parent = node.defaultView;
1067
+ }
1068
+ return parent ? getComposedPath(parent, path) : path;
1069
+ };
1070
+
1071
+ Event.prototype.composedPath = function () {
1072
+ return getComposedPath(this.target);
1073
+ };
1074
+ }
1075
+
1076
+ function findFromPath(path, criteria, currentTarget) {
1077
+ const [node, ...rest] = path;
1078
+ if (criteria(node)) {
1079
+ return node;
1080
+ }
1081
+ if (node === currentTarget || node.tagName === 'HTML' || rest.length === 0) {
1082
+ // stop when reaching currentTarget or <html>
1083
+ return;
1084
+ }
1085
+ return findFromPath(rest, criteria, currentTarget);
1086
+ }
1087
+
1088
+ // Search for the actual target of a delegated event
1089
+ function findElementInEventPath(ev, selector) {
1090
+ const criteria = typeof selector === 'function'
1091
+ ? selector
1092
+ : el => el instanceof Element && el.matches(selector);
1093
+ return findFromPath(ev.composedPath(), criteria, ev.currentTarget);
1094
+ }
1095
+
1096
+ // default locales
1097
+ const locales = {
1098
+ en: {
1099
+ days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
1100
+ daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
1101
+ daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
1102
+ months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
1103
+ monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
1104
+ today: "Today",
1105
+ clear: "Clear",
1106
+ titleFormat: "MM y"
1107
+ }
1108
+ };
1109
+
1110
+ // config options updatable by setOptions() and their default values
1111
+ const defaultOptions = {
1112
+ autohide: false,
1113
+ beforeShowDay: null,
1114
+ beforeShowDecade: null,
1115
+ beforeShowMonth: null,
1116
+ beforeShowYear: null,
1117
+ clearButton: false,
1118
+ dateDelimiter: ',',
1119
+ datesDisabled: [],
1120
+ daysOfWeekDisabled: [],
1121
+ daysOfWeekHighlighted: [],
1122
+ defaultViewDate: undefined, // placeholder, defaults to today() by the program
1123
+ disableTouchKeyboard: false,
1124
+ enableOnReadonly: true,
1125
+ format: 'mm/dd/yyyy',
1126
+ language: 'en',
1127
+ maxDate: null,
1128
+ maxNumberOfDates: 1,
1129
+ maxView: 3,
1130
+ minDate: null,
1131
+ nextArrow: '»',
1132
+ orientation: 'auto',
1133
+ pickLevel: 0,
1134
+ prevArrow: '«',
1135
+ showDaysOfWeek: true,
1136
+ showOnClick: true,
1137
+ showOnFocus: true,
1138
+ startView: 0,
1139
+ title: '',
1140
+ todayButton: false,
1141
+ todayButtonMode: 0,
1142
+ todayHighlight: false,
1143
+ updateOnBlur: true,
1144
+ weekNumbers: 0,
1145
+ weekStart: 0,
1146
+ };
1147
+
1148
+ const {
1149
+ language: defaultLang,
1150
+ format: defaultFormat,
1151
+ weekStart: defaultWeekStart,
1152
+ } = defaultOptions;
1153
+
1154
+ // Reducer function to filter out invalid day-of-week from the input
1155
+ function sanitizeDOW(dow, day) {
1156
+ return dow.length < 6 && day >= 0 && day < 7
1157
+ ? pushUnique(dow, day)
1158
+ : dow;
1159
+ }
1160
+
1161
+ function determineGetWeekMethod(numberingMode, weekStart) {
1162
+ const methodId = numberingMode === 4
1163
+ ? (weekStart === 6 ? 3 : !weekStart + 1)
1164
+ : numberingMode;
1165
+ switch (methodId) {
1166
+ case 1:
1167
+ return getIsoWeek;
1168
+ case 2:
1169
+ return getWesternTradWeek;
1170
+ case 3:
1171
+ return getMidEasternWeek;
1172
+ }
1173
+ }
1174
+
1175
+ function updateWeekStart(newValue, config, weekNumbers) {
1176
+ config.weekStart = newValue;
1177
+ config.weekEnd = (newValue + 6) % 7;
1178
+ if (weekNumbers === 4) {
1179
+ config.getWeekNumber = determineGetWeekMethod(4, newValue);
1180
+ }
1181
+ return newValue;
1182
+ }
1183
+
1184
+ // validate input date. if invalid, fallback to the original value
1185
+ function validateDate(value, format, locale, origValue) {
1186
+ const date = parseDate(value, format, locale);
1187
+ return date !== undefined ? date : origValue;
1188
+ }
1189
+
1190
+ // Validate viewId. if invalid, fallback to the original value
1191
+ function validateViewId(value, origValue, max = 3) {
1192
+ const viewId = parseInt(value, 10);
1193
+ return viewId >= 0 && viewId <= max ? viewId : origValue;
1194
+ }
1195
+
1196
+ function replaceOptions(options, from, to, convert = undefined) {
1197
+ if (from in options) {
1198
+ if (!(to in options)) {
1199
+ options[to] = convert ? convert(options[from]) : options[from];
1200
+ }
1201
+ delete options[from];
1202
+ }
1203
+ }
1204
+
1205
+ // Create Datepicker configuration to set
1206
+ function processOptions(options, datepicker) {
1207
+ const inOpts = Object.assign({}, options);
1208
+ const config = {};
1209
+ const locales = datepicker.constructor.locales;
1210
+ const rangeEnd = !!datepicker.rangeSideIndex;
1211
+ let {
1212
+ datesDisabled,
1213
+ format,
1214
+ language,
1215
+ locale,
1216
+ maxDate,
1217
+ maxView,
1218
+ minDate,
1219
+ pickLevel,
1220
+ startView,
1221
+ weekNumbers,
1222
+ weekStart,
1223
+ } = datepicker.config || {};
1224
+
1225
+ // for backword compatibility
1226
+ replaceOptions(inOpts, 'calendarWeeks', 'weekNumbers', val => val ? 1 : 0);
1227
+ replaceOptions(inOpts, 'clearBtn', 'clearButton');
1228
+ replaceOptions(inOpts, 'todayBtn', 'todayButton');
1229
+ replaceOptions(inOpts, 'todayBtnMode', 'todayButtonMode');
1230
+
1231
+ if (inOpts.language) {
1232
+ let lang;
1233
+ if (inOpts.language !== language) {
1234
+ if (locales[inOpts.language]) {
1235
+ lang = inOpts.language;
1236
+ } else {
1237
+ // Check if langauge + region tag can fallback to the one without
1238
+ // region (e.g. fr-CA → fr)
1239
+ lang = inOpts.language.split('-')[0];
1240
+ if (!locales[lang]) {
1241
+ lang = false;
1242
+ }
1243
+ }
1244
+ }
1245
+ delete inOpts.language;
1246
+ if (lang) {
1247
+ language = config.language = lang;
1248
+
1249
+ // update locale as well when updating language
1250
+ const origLocale = locale || locales[defaultLang];
1251
+ // use default language's properties for the fallback
1252
+ locale = Object.assign({
1253
+ format: defaultFormat,
1254
+ weekStart: defaultWeekStart
1255
+ }, locales[defaultLang]);
1256
+ if (language !== defaultLang) {
1257
+ Object.assign(locale, locales[language]);
1258
+ }
1259
+ config.locale = locale;
1260
+ // if format and/or weekStart are the same as old locale's defaults,
1261
+ // update them to new locale's defaults
1262
+ if (format === origLocale.format) {
1263
+ format = config.format = locale.format;
1264
+ }
1265
+ if (weekStart === origLocale.weekStart) {
1266
+ weekStart = updateWeekStart(locale.weekStart, config, weekNumbers);
1267
+ }
1268
+ }
1269
+ }
1270
+
1271
+ if (inOpts.format) {
1272
+ const hasToDisplay = typeof inOpts.format.toDisplay === 'function';
1273
+ const hasToValue = typeof inOpts.format.toValue === 'function';
1274
+ const validFormatString = reFormatTokens.test(inOpts.format);
1275
+ if ((hasToDisplay && hasToValue) || validFormatString) {
1276
+ format = config.format = inOpts.format;
1277
+ }
1278
+ delete inOpts.format;
1279
+ }
1280
+
1281
+ //*** pick level ***//
1282
+ let newPickLevel = pickLevel;
1283
+ if ('pickLevel' in inOpts) {
1284
+ newPickLevel = validateViewId(inOpts.pickLevel, pickLevel, 2);
1285
+ delete inOpts.pickLevel;
1286
+ }
1287
+ if (newPickLevel !== pickLevel) {
1288
+ if (newPickLevel > pickLevel) {
1289
+ // complement current minDate/madDate so that the existing range will be
1290
+ // expanded to fit the new level later
1291
+ if (!('minDate' in inOpts)) {
1292
+ inOpts.minDate = minDate;
1293
+ }
1294
+ if (!('maxDate' in inOpts)) {
1295
+ inOpts.maxDate = maxDate;
1296
+ }
1297
+ }
1298
+ // complement datesDisabled so that it will be reset later
1299
+ if (datesDisabled && !inOpts.datesDisabled) {
1300
+ inOpts.datesDisabled = [];
1301
+ }
1302
+ pickLevel = config.pickLevel = newPickLevel;
1303
+ }
1304
+
1305
+ //*** dates ***//
1306
+ // while min and maxDate for "no limit" in the options are better to be null
1307
+ // (especially when updating), the ones in the config have to be undefined
1308
+ // because null is treated as 0 (= unix epoch) when comparing with time value
1309
+ let minDt = minDate;
1310
+ let maxDt = maxDate;
1311
+ if ('minDate' in inOpts) {
1312
+ const defaultMinDt = dateValue(0, 0, 1);
1313
+ minDt = inOpts.minDate === null
1314
+ ? defaultMinDt // set 0000-01-01 to prevent negative values for year
1315
+ : validateDate(inOpts.minDate, format, locale, minDt);
1316
+ if (minDt !== defaultMinDt) {
1317
+ minDt = regularizeDate(minDt, pickLevel, false);
1318
+ }
1319
+ delete inOpts.minDate;
1320
+ }
1321
+ if ('maxDate' in inOpts) {
1322
+ maxDt = inOpts.maxDate === null
1323
+ ? undefined
1324
+ : validateDate(inOpts.maxDate, format, locale, maxDt);
1325
+ if (maxDt !== undefined) {
1326
+ maxDt = regularizeDate(maxDt, pickLevel, true);
1327
+ }
1328
+ delete inOpts.maxDate;
1329
+ }
1330
+ if (maxDt < minDt) {
1331
+ minDate = config.minDate = maxDt;
1332
+ maxDate = config.maxDate = minDt;
1333
+ } else {
1334
+ if (minDate !== minDt) {
1335
+ minDate = config.minDate = minDt;
1336
+ }
1337
+ if (maxDate !== maxDt) {
1338
+ maxDate = config.maxDate = maxDt;
1339
+ }
1340
+ }
1341
+
1342
+ if (inOpts.datesDisabled) {
1343
+ const dtsDisabled = inOpts.datesDisabled;
1344
+ if (typeof dtsDisabled === 'function') {
1345
+ config.datesDisabled = null;
1346
+ config.checkDisabled = (timeValue, viewId) => dtsDisabled(
1347
+ new Date(timeValue),
1348
+ viewId,
1349
+ rangeEnd
1350
+ );
1351
+ } else {
1352
+ const disabled = config.datesDisabled = dtsDisabled.reduce((dates, dt) => {
1353
+ const date = parseDate(dt, format, locale);
1354
+ return date !== undefined
1355
+ ? pushUnique(dates, regularizeDate(date, pickLevel, rangeEnd))
1356
+ : dates;
1357
+ }, []);
1358
+ config.checkDisabled = timeValue => disabled.includes(timeValue);
1359
+ }
1360
+ delete inOpts.datesDisabled;
1361
+ }
1362
+ if ('defaultViewDate' in inOpts) {
1363
+ const viewDate = parseDate(inOpts.defaultViewDate, format, locale);
1364
+ if (viewDate !== undefined) {
1365
+ config.defaultViewDate = viewDate;
1366
+ }
1367
+ delete inOpts.defaultViewDate;
1368
+ }
1369
+
1370
+ //*** days of week ***//
1371
+ if ('weekStart' in inOpts) {
1372
+ const wkStart = Number(inOpts.weekStart) % 7;
1373
+ if (!isNaN(wkStart)) {
1374
+ weekStart = updateWeekStart(wkStart, config, weekNumbers);
1375
+ }
1376
+ delete inOpts.weekStart;
1377
+ }
1378
+ if (inOpts.daysOfWeekDisabled) {
1379
+ config.daysOfWeekDisabled = inOpts.daysOfWeekDisabled.reduce(sanitizeDOW, []);
1380
+ delete inOpts.daysOfWeekDisabled;
1381
+ }
1382
+ if (inOpts.daysOfWeekHighlighted) {
1383
+ config.daysOfWeekHighlighted = inOpts.daysOfWeekHighlighted.reduce(sanitizeDOW, []);
1384
+ delete inOpts.daysOfWeekHighlighted;
1385
+ }
1386
+
1387
+ //*** week numbers ***//
1388
+ if ('weekNumbers' in inOpts) {
1389
+ let method = inOpts.weekNumbers;
1390
+ if (method) {
1391
+ const getWeekNumber = typeof method === 'function'
1392
+ ? (timeValue, startOfWeek) => method(new Date(timeValue), startOfWeek)
1393
+ : determineGetWeekMethod((method = parseInt(method, 10)), weekStart);
1394
+ if (getWeekNumber) {
1395
+ weekNumbers = config.weekNumbers = method;
1396
+ config.getWeekNumber = getWeekNumber;
1397
+ }
1398
+ } else {
1399
+ weekNumbers = config.weekNumbers = 0;
1400
+ config.getWeekNumber = null;
1401
+ }
1402
+ delete inOpts.weekNumbers;
1403
+ }
1404
+
1405
+ //*** multi date ***//
1406
+ if ('maxNumberOfDates' in inOpts) {
1407
+ const maxNumberOfDates = parseInt(inOpts.maxNumberOfDates, 10);
1408
+ if (maxNumberOfDates >= 0) {
1409
+ config.maxNumberOfDates = maxNumberOfDates;
1410
+ config.multidate = maxNumberOfDates !== 1;
1411
+ }
1412
+ delete inOpts.maxNumberOfDates;
1413
+ }
1414
+ if (inOpts.dateDelimiter) {
1415
+ config.dateDelimiter = String(inOpts.dateDelimiter);
1416
+ delete inOpts.dateDelimiter;
1417
+ }
1418
+
1419
+ //*** view ***//
1420
+ let newMaxView = maxView;
1421
+ if ('maxView' in inOpts) {
1422
+ newMaxView = validateViewId(inOpts.maxView, maxView);
1423
+ delete inOpts.maxView;
1424
+ }
1425
+ // ensure max view >= pick level
1426
+ newMaxView = pickLevel > newMaxView ? pickLevel : newMaxView;
1427
+ if (newMaxView !== maxView) {
1428
+ maxView = config.maxView = newMaxView;
1429
+ }
1430
+
1431
+ let newStartView = startView;
1432
+ if ('startView' in inOpts) {
1433
+ newStartView = validateViewId(inOpts.startView, newStartView);
1434
+ delete inOpts.startView;
1435
+ }
1436
+ // ensure pick level <= start view <= max view
1437
+ if (newStartView < pickLevel) {
1438
+ newStartView = pickLevel;
1439
+ } else if (newStartView > maxView) {
1440
+ newStartView = maxView;
1441
+ }
1442
+ if (newStartView !== startView) {
1443
+ config.startView = newStartView;
1444
+ }
1445
+
1446
+ //*** template ***//
1447
+ if (inOpts.prevArrow) {
1448
+ const prevArrow = parseHTML(inOpts.prevArrow);
1449
+ if (prevArrow.childNodes.length > 0) {
1450
+ config.prevArrow = prevArrow.childNodes;
1451
+ }
1452
+ delete inOpts.prevArrow;
1453
+ }
1454
+ if (inOpts.nextArrow) {
1455
+ const nextArrow = parseHTML(inOpts.nextArrow);
1456
+ if (nextArrow.childNodes.length > 0) {
1457
+ config.nextArrow = nextArrow.childNodes;
1458
+ }
1459
+ delete inOpts.nextArrow;
1460
+ }
1461
+
1462
+ //*** misc ***//
1463
+ if ('disableTouchKeyboard' in inOpts) {
1464
+ config.disableTouchKeyboard = 'ontouchstart' in document && !!inOpts.disableTouchKeyboard;
1465
+ delete inOpts.disableTouchKeyboard;
1466
+ }
1467
+ if (inOpts.orientation) {
1468
+ const orientation = inOpts.orientation.toLowerCase().split(/\s+/g);
1469
+ config.orientation = {
1470
+ x: orientation.find(x => (x === 'left' || x === 'right')) || 'auto',
1471
+ y: orientation.find(y => (y === 'top' || y === 'bottom')) || 'auto',
1472
+ };
1473
+ delete inOpts.orientation;
1474
+ }
1475
+ if ('todayButtonMode' in inOpts) {
1476
+ switch(inOpts.todayButtonMode) {
1477
+ case 0:
1478
+ case 1:
1479
+ config.todayButtonMode = inOpts.todayButtonMode;
1480
+ }
1481
+ delete inOpts.todayButtonMode;
1482
+ }
1483
+
1484
+ //*** copy the rest ***//
1485
+ Object.entries(inOpts).forEach(([key, value]) => {
1486
+ if (value !== undefined && key in defaultOptions) {
1487
+ config[key] = value;
1488
+ }
1489
+ });
1490
+
1491
+ return config;
1492
+ }
1493
+
1494
+ const defaultShortcutKeys = {
1495
+ show: {key: 'ArrowDown'},
1496
+ hide: null,
1497
+ toggle: {key: 'Escape'},
1498
+ prevButton: {key: 'ArrowLeft', ctrlOrMetaKey: true},
1499
+ nextButton: {key: 'ArrowRight', ctrlOrMetaKey: true},
1500
+ viewSwitch: {key: 'ArrowUp', ctrlOrMetaKey: true},
1501
+ clearButton: {key: 'Backspace', ctrlOrMetaKey: true},
1502
+ todayButton: {key: '.', ctrlOrMetaKey: true},
1503
+ exitEditMode: {key: 'ArrowDown', ctrlOrMetaKey: true},
1504
+ };
1505
+
1506
+ function createShortcutKeyConfig(options) {
1507
+ return Object.keys(defaultShortcutKeys).reduce((keyDefs, shortcut) => {
1508
+ const keyDef = options[shortcut] === undefined
1509
+ ? defaultShortcutKeys[shortcut]
1510
+ : options[shortcut];
1511
+ const key = keyDef && keyDef.key;
1512
+ if (!key || typeof key !== 'string') {
1513
+ return keyDefs;
1514
+ }
1515
+
1516
+ const normalizedDef = {
1517
+ key,
1518
+ ctrlOrMetaKey: !!(keyDef.ctrlOrMetaKey || keyDef.ctrlKey || keyDef.metaKey),
1519
+ };
1520
+ if (key.length > 1) {
1521
+ normalizedDef.altKey = !!keyDef.altKey;
1522
+ normalizedDef.shiftKey = !!keyDef.shiftKey;
1523
+ }
1524
+ keyDefs[shortcut] = normalizedDef;
1525
+ return keyDefs;
1526
+ }, {});
1527
+ }
1528
+
1529
+ const pickerTemplate = optimizeTemplateHTML(`<div class="datepicker">
1530
+ <div class="datepicker-picker">
1531
+ <div class="datepicker-header">
1532
+ <div class="datepicker-title"></div>
1533
+ <div class="datepicker-controls">
1534
+ <button type="button" class="%buttonClass% prev-button prev-btn"></button>
1535
+ <button type="button" class="%buttonClass% view-switch"></button>
1536
+ <button type="button" class="%buttonClass% next-button next-btn"></button>
1537
+ </div>
1538
+ </div>
1539
+ <div class="datepicker-main"></div>
1540
+ <div class="datepicker-footer">
1541
+ <div class="datepicker-controls">
1542
+ <button type="button" class="%buttonClass% today-button today-btn"></button>
1543
+ <button type="button" class="%buttonClass% clear-button clear-btn"></button>
1544
+ </div>
1545
+ </div>
1546
+ </div>
1547
+ </div>`);
1548
+
1549
+ const daysTemplate = optimizeTemplateHTML(`<div class="days">
1550
+ <div class="days-of-week">${createTagRepeat('span', 7, {class: 'dow'})}</div>
1551
+ <div class="datepicker-grid">${createTagRepeat('span', 42)}</div>
1552
+ </div>`);
1553
+
1554
+ const weekNumbersTemplate = optimizeTemplateHTML(`<div class="week-numbers calendar-weeks">
1555
+ <div class="days-of-week"><span class="dow"></span></div>
1556
+ <div class="weeks">${createTagRepeat('span', 6, {class: 'week'})}</div>
1557
+ </div>`);
1558
+
1559
+ // Base class of the view classes
1560
+ class View {
1561
+ constructor(picker, config) {
1562
+ Object.assign(this, config, {
1563
+ picker,
1564
+ element: parseHTML(`<div class="datepicker-view"></div>`).firstChild,
1565
+ selected: [],
1566
+ isRangeEnd: !!picker.datepicker.rangeSideIndex,
1567
+ });
1568
+ this.init(this.picker.datepicker.config);
1569
+ }
1570
+
1571
+ init(options) {
1572
+ if ('pickLevel' in options) {
1573
+ this.isMinView = this.id === options.pickLevel;
1574
+ }
1575
+ this.setOptions(options);
1576
+ this.updateFocus();
1577
+ this.updateSelection();
1578
+ }
1579
+
1580
+ prepareForRender(switchLabel, prevButtonDisabled, nextButtonDisabled) {
1581
+ // refresh disabled years on every render in order to clear the ones added
1582
+ // by beforeShow hook at previous render
1583
+ this.disabled = [];
1584
+
1585
+ const picker = this.picker;
1586
+ picker.setViewSwitchLabel(switchLabel);
1587
+ picker.setPrevButtonDisabled(prevButtonDisabled);
1588
+ picker.setNextButtonDisabled(nextButtonDisabled);
1589
+ }
1590
+
1591
+ setDisabled(date, classList) {
1592
+ classList.add('disabled');
1593
+ pushUnique(this.disabled, date);
1594
+ }
1595
+
1596
+ // Execute beforeShow() callback and apply the result to the element
1597
+ // args:
1598
+ performBeforeHook(el, timeValue) {
1599
+ let result = this.beforeShow(new Date(timeValue));
1600
+ switch (typeof result) {
1601
+ case 'boolean':
1602
+ result = {enabled: result};
1603
+ break;
1604
+ case 'string':
1605
+ result = {classes: result};
1606
+ }
1607
+
1608
+ if (result) {
1609
+ const classList = el.classList;
1610
+ if (result.enabled === false) {
1611
+ this.setDisabled(timeValue, classList);
1612
+ }
1613
+ if (result.classes) {
1614
+ const extraClasses = result.classes.split(/\s+/);
1615
+ classList.add(...extraClasses);
1616
+ if (extraClasses.includes('disabled')) {
1617
+ this.setDisabled(timeValue, classList);
1618
+ }
1619
+ }
1620
+ if (result.content) {
1621
+ replaceChildNodes(el, result.content);
1622
+ }
1623
+ }
1624
+ }
1625
+
1626
+ renderCell(el, content, cellVal, date, {selected, range}, outOfScope, extraClasses = []) {
1627
+ el.textContent = content;
1628
+ if (this.isMinView) {
1629
+ el.dataset.date = date;
1630
+ }
1631
+
1632
+ const classList = el.classList;
1633
+ el.className = `datepicker-cell ${this.cellClass}`;
1634
+ if (cellVal < this.first) {
1635
+ classList.add('prev');
1636
+ } else if (cellVal > this.last) {
1637
+ classList.add('next');
1638
+ }
1639
+ classList.add(...extraClasses);
1640
+ if (outOfScope || this.checkDisabled(date, this.id)) {
1641
+ this.setDisabled(date, classList);
1642
+ }
1643
+ if (range) {
1644
+ const [rangeStart, rangeEnd] = range;
1645
+ if (cellVal > rangeStart && cellVal < rangeEnd) {
1646
+ classList.add('range');
1647
+ }
1648
+ if (cellVal === rangeStart) {
1649
+ classList.add('range-start');
1650
+ }
1651
+ if (cellVal === rangeEnd) {
1652
+ classList.add('range-end');
1653
+ }
1654
+ }
1655
+ if (selected.includes(cellVal)) {
1656
+ classList.add('selected');
1657
+ }
1658
+ if (cellVal === this.focused) {
1659
+ classList.add('focused');
1660
+ }
1661
+
1662
+ if (this.beforeShow) {
1663
+ this.performBeforeHook(el, date);
1664
+ }
1665
+ }
1666
+
1667
+ refreshCell(el, cellVal, selected, [rangeStart, rangeEnd]) {
1668
+ const classList = el.classList;
1669
+ classList.remove('range', 'range-start', 'range-end', 'selected', 'focused');
1670
+ if (cellVal > rangeStart && cellVal < rangeEnd) {
1671
+ classList.add('range');
1672
+ }
1673
+ if (cellVal === rangeStart) {
1674
+ classList.add('range-start');
1675
+ }
1676
+ if (cellVal === rangeEnd) {
1677
+ classList.add('range-end');
1678
+ }
1679
+ if (selected.includes(cellVal)) {
1680
+ classList.add('selected');
1681
+ }
1682
+ if (cellVal === this.focused) {
1683
+ classList.add('focused');
1684
+ }
1685
+ }
1686
+
1687
+ changeFocusedCell(cellIndex) {
1688
+ this.grid.querySelectorAll('.focused').forEach((el) => {
1689
+ el.classList.remove('focused');
1690
+ });
1691
+ this.grid.children[cellIndex].classList.add('focused');
1692
+ }
1693
+ }
1694
+
1695
+ class DaysView extends View {
1696
+ constructor(picker) {
1697
+ super(picker, {
1698
+ id: 0,
1699
+ name: 'days',
1700
+ cellClass: 'day',
1701
+ });
1702
+ }
1703
+
1704
+ init(options, onConstruction = true) {
1705
+ if (onConstruction) {
1706
+ const inner = parseHTML(daysTemplate).firstChild;
1707
+ this.dow = inner.firstChild;
1708
+ this.grid = inner.lastChild;
1709
+ this.element.appendChild(inner);
1710
+ }
1711
+ super.init(options);
1712
+ }
1713
+
1714
+ setOptions(options) {
1715
+ let updateDOW;
1716
+
1717
+ if ('minDate' in options) {
1718
+ this.minDate = options.minDate;
1719
+ }
1720
+ if ('maxDate' in options) {
1721
+ this.maxDate = options.maxDate;
1722
+ }
1723
+ if (options.checkDisabled) {
1724
+ this.checkDisabled = options.checkDisabled;
1725
+ }
1726
+ if (options.daysOfWeekDisabled) {
1727
+ this.daysOfWeekDisabled = options.daysOfWeekDisabled;
1728
+ updateDOW = true;
1729
+ }
1730
+ if (options.daysOfWeekHighlighted) {
1731
+ this.daysOfWeekHighlighted = options.daysOfWeekHighlighted;
1732
+ }
1733
+ if ('todayHighlight' in options) {
1734
+ this.todayHighlight = options.todayHighlight;
1735
+ }
1736
+ if ('weekStart' in options) {
1737
+ this.weekStart = options.weekStart;
1738
+ this.weekEnd = options.weekEnd;
1739
+ updateDOW = true;
1740
+ }
1741
+ if (options.locale) {
1742
+ const locale = this.locale = options.locale;
1743
+ this.dayNames = locale.daysMin;
1744
+ this.switchLabelFormat = locale.titleFormat;
1745
+ updateDOW = true;
1746
+ }
1747
+ if ('beforeShowDay' in options) {
1748
+ this.beforeShow = typeof options.beforeShowDay === 'function'
1749
+ ? options.beforeShowDay
1750
+ : undefined;
1751
+ }
1752
+
1753
+ if ('weekNumbers' in options) {
1754
+ if (options.weekNumbers && !this.weekNumbers) {
1755
+ const weeksElem = parseHTML(weekNumbersTemplate).firstChild;
1756
+ this.weekNumbers = {
1757
+ element: weeksElem,
1758
+ dow: weeksElem.firstChild,
1759
+ weeks: weeksElem.lastChild,
1760
+ };
1761
+ this.element.insertBefore(weeksElem, this.element.firstChild);
1762
+ } else if (this.weekNumbers && !options.weekNumbers) {
1763
+ this.element.removeChild(this.weekNumbers.element);
1764
+ this.weekNumbers = null;
1765
+ }
1766
+ }
1767
+
1768
+ if ('getWeekNumber' in options) {
1769
+ this.getWeekNumber = options.getWeekNumber;
1770
+ }
1771
+
1772
+ if ('showDaysOfWeek' in options) {
1773
+ if (options.showDaysOfWeek) {
1774
+ showElement(this.dow);
1775
+ if (this.weekNumbers) {
1776
+ showElement(this.weekNumbers.dow);
1777
+ }
1778
+ } else {
1779
+ hideElement(this.dow);
1780
+ if (this.weekNumbers) {
1781
+ hideElement(this.weekNumbers.dow);
1782
+ }
1783
+ }
1784
+ }
1785
+
1786
+ // update days-of-week when locale, daysOfweekDisabled or weekStart is changed
1787
+ if (updateDOW) {
1788
+ Array.from(this.dow.children).forEach((el, index) => {
1789
+ const dow = (this.weekStart + index) % 7;
1790
+ el.textContent = this.dayNames[dow];
1791
+ el.className = this.daysOfWeekDisabled.includes(dow) ? 'dow disabled' : 'dow';
1792
+ });
1793
+ }
1794
+ }
1795
+
1796
+ // Apply update on the focused date to view's settings
1797
+ updateFocus() {
1798
+ const viewDate = new Date(this.picker.viewDate);
1799
+ const viewYear = viewDate.getFullYear();
1800
+ const viewMonth = viewDate.getMonth();
1801
+ const firstOfMonth = dateValue(viewYear, viewMonth, 1);
1802
+ const start = dayOfTheWeekOf(firstOfMonth, this.weekStart, this.weekStart);
1803
+
1804
+ this.first = firstOfMonth;
1805
+ this.last = dateValue(viewYear, viewMonth + 1, 0);
1806
+ this.start = start;
1807
+ this.focused = this.picker.viewDate;
1808
+ }
1809
+
1810
+ // Apply update on the selected dates to view's settings
1811
+ updateSelection() {
1812
+ const {dates, rangepicker} = this.picker.datepicker;
1813
+ this.selected = dates;
1814
+ if (rangepicker) {
1815
+ this.range = rangepicker.dates;
1816
+ }
1817
+ }
1818
+
1819
+ // Update the entire view UI
1820
+ render() {
1821
+ // update today marker on ever render
1822
+ this.today = this.todayHighlight ? today() : undefined;
1823
+
1824
+ this.prepareForRender(
1825
+ formatDate(this.focused, this.switchLabelFormat, this.locale),
1826
+ this.first <= this.minDate,
1827
+ this.last >= this.maxDate
1828
+ );
1829
+
1830
+ if (this.weekNumbers) {
1831
+ const weekStart = this.weekStart;
1832
+ const startOfWeek = dayOfTheWeekOf(this.first, weekStart, weekStart);
1833
+ Array.from(this.weekNumbers.weeks.children).forEach((el, index) => {
1834
+ const dateOfWeekStart = addWeeks(startOfWeek, index);
1835
+ el.textContent = this.getWeekNumber(dateOfWeekStart, weekStart);
1836
+ if (index > 3) {
1837
+ el.classList[dateOfWeekStart > this.last ? 'add' : 'remove']('next');
1838
+ }
1839
+ });
1840
+ }
1841
+ Array.from(this.grid.children).forEach((el, index) => {
1842
+ const current = addDays(this.start, index);
1843
+ const dateObj = new Date(current);
1844
+ const day = dateObj.getDay();
1845
+ const extraClasses = [];
1846
+
1847
+ if (this.today === current) {
1848
+ extraClasses.push('today');
1849
+ }
1850
+ if (this.daysOfWeekHighlighted.includes(day)) {
1851
+ extraClasses.push('highlighted');
1852
+ }
1853
+
1854
+ this.renderCell(
1855
+ el,
1856
+ dateObj.getDate(),
1857
+ current,
1858
+ current,
1859
+ this,
1860
+ current < this.minDate
1861
+ || current > this.maxDate
1862
+ || this.daysOfWeekDisabled.includes(day),
1863
+ extraClasses
1864
+ );
1865
+ });
1866
+ }
1867
+
1868
+ // Update the view UI by applying the changes of selected and focused items
1869
+ refresh() {
1870
+ const range = this.range || [];
1871
+ Array.from(this.grid.children).forEach((el) => {
1872
+ this.refreshCell(el, Number(el.dataset.date), this.selected, range);
1873
+ });
1874
+ }
1875
+
1876
+ // Update the view UI by applying the change of focused item
1877
+ refreshFocus() {
1878
+ this.changeFocusedCell(Math.round((this.focused - this.start) / 86400000));
1879
+ }
1880
+ }
1881
+
1882
+ function computeMonthRange(range, thisYear) {
1883
+ if (!range || !range[0] || !range[1]) {
1884
+ return;
1885
+ }
1886
+
1887
+ const [[startY, startM], [endY, endM]] = range;
1888
+ if (startY > thisYear || endY < thisYear) {
1889
+ return;
1890
+ }
1891
+ return [
1892
+ startY === thisYear ? startM : -1,
1893
+ endY === thisYear ? endM : 12,
1894
+ ];
1895
+ }
1896
+
1897
+ class MonthsView extends View {
1898
+ constructor(picker) {
1899
+ super(picker, {
1900
+ id: 1,
1901
+ name: 'months',
1902
+ cellClass: 'month',
1903
+ });
1904
+ }
1905
+
1906
+ init(options, onConstruction = true) {
1907
+ if (onConstruction) {
1908
+ this.grid = this.element;
1909
+ this.element.classList.add('months', 'datepicker-grid');
1910
+ this.grid.appendChild(parseHTML(createTagRepeat('span', 12, {'data-month': ix => ix})));
1911
+ this.first = 0;
1912
+ this.last = 11;
1913
+ }
1914
+ super.init(options);
1915
+ }
1916
+
1917
+ setOptions(options) {
1918
+ if (options.locale) {
1919
+ this.monthNames = options.locale.monthsShort;
1920
+ }
1921
+ if ('minDate' in options) {
1922
+ if (options.minDate === undefined) {
1923
+ this.minYear = this.minMonth = this.minDate = undefined;
1924
+ } else {
1925
+ const minDateObj = new Date(options.minDate);
1926
+ this.minYear = minDateObj.getFullYear();
1927
+ this.minMonth = minDateObj.getMonth();
1928
+ this.minDate = minDateObj.setDate(1);
1929
+ }
1930
+ }
1931
+ if ('maxDate' in options) {
1932
+ if (options.maxDate === undefined) {
1933
+ this.maxYear = this.maxMonth = this.maxDate = undefined;
1934
+ } else {
1935
+ const maxDateObj = new Date(options.maxDate);
1936
+ this.maxYear = maxDateObj.getFullYear();
1937
+ this.maxMonth = maxDateObj.getMonth();
1938
+ this.maxDate = dateValue(this.maxYear, this.maxMonth + 1, 0);
1939
+ }
1940
+ }
1941
+ if (options.checkDisabled) {
1942
+ this.checkDisabled = this.isMinView || options.datesDisabled === null
1943
+ ? options.checkDisabled
1944
+ : () => false;
1945
+ }
1946
+ if ('beforeShowMonth' in options) {
1947
+ this.beforeShow = typeof options.beforeShowMonth === 'function'
1948
+ ? options.beforeShowMonth
1949
+ : undefined;
1950
+ }
1951
+ }
1952
+
1953
+ // Update view's settings to reflect the viewDate set on the picker
1954
+ updateFocus() {
1955
+ const viewDate = new Date(this.picker.viewDate);
1956
+ this.year = viewDate.getFullYear();
1957
+ this.focused = viewDate.getMonth();
1958
+ }
1959
+
1960
+ // Update view's settings to reflect the selected dates
1961
+ updateSelection() {
1962
+ const {dates, rangepicker} = this.picker.datepicker;
1963
+ this.selected = dates.reduce((selected, timeValue) => {
1964
+ const date = new Date(timeValue);
1965
+ const year = date.getFullYear();
1966
+ const month = date.getMonth();
1967
+ if (selected[year] === undefined) {
1968
+ selected[year] = [month];
1969
+ } else {
1970
+ pushUnique(selected[year], month);
1971
+ }
1972
+ return selected;
1973
+ }, {});
1974
+ if (rangepicker && rangepicker.dates) {
1975
+ this.range = rangepicker.dates.map(timeValue => {
1976
+ const date = new Date(timeValue);
1977
+ return isNaN(date) ? undefined : [date.getFullYear(), date.getMonth()];
1978
+ });
1979
+ }
1980
+ }
1981
+
1982
+ // Update the entire view UI
1983
+ render() {
1984
+ this.prepareForRender(
1985
+ this.year,
1986
+ this.year <= this.minYear,
1987
+ this.year >= this.maxYear
1988
+ );
1989
+
1990
+ const selected = this.selected[this.year] || [];
1991
+ const yrOutOfRange = this.year < this.minYear || this.year > this.maxYear;
1992
+ const isMinYear = this.year === this.minYear;
1993
+ const isMaxYear = this.year === this.maxYear;
1994
+ const range = computeMonthRange(this.range, this.year);
1995
+
1996
+ Array.from(this.grid.children).forEach((el, index) => {
1997
+ const date = regularizeDate(new Date(this.year, index, 1), 1, this.isRangeEnd);
1998
+
1999
+ this.renderCell(
2000
+ el,
2001
+ this.monthNames[index],
2002
+ index,
2003
+ date,
2004
+ {selected, range},
2005
+ yrOutOfRange
2006
+ || isMinYear && index < this.minMonth
2007
+ || isMaxYear && index > this.maxMonth
2008
+ );
2009
+ });
2010
+ }
2011
+
2012
+ // Update the view UI by applying the changes of selected and focused items
2013
+ refresh() {
2014
+ const selected = this.selected[this.year] || [];
2015
+ const range = computeMonthRange(this.range, this.year) || [];
2016
+ Array.from(this.grid.children).forEach((el, index) => {
2017
+ this.refreshCell(el, index, selected, range);
2018
+ });
2019
+ }
2020
+
2021
+ // Update the view UI by applying the change of focused item
2022
+ refreshFocus() {
2023
+ this.changeFocusedCell(this.focused);
2024
+ }
2025
+ }
2026
+
2027
+ function toTitleCase(word) {
2028
+ return [...word].reduce((str, ch, ix) => str += ix ? ch : ch.toUpperCase(), '');
2029
+ }
2030
+
2031
+ // Class representing the years and decades view elements
2032
+ class YearsView extends View {
2033
+ constructor(picker, config) {
2034
+ super(picker, config);
2035
+ }
2036
+
2037
+ init(options, onConstruction = true) {
2038
+ if (onConstruction) {
2039
+ this.navStep = this.step * 10;
2040
+ this.beforeShowOption = `beforeShow${toTitleCase(this.cellClass)}`;
2041
+ this.grid = this.element;
2042
+ this.element.classList.add(this.name, 'datepicker-grid');
2043
+ this.grid.appendChild(parseHTML(createTagRepeat('span', 12)));
2044
+ }
2045
+ super.init(options);
2046
+ }
2047
+
2048
+ setOptions(options) {
2049
+ if ('minDate' in options) {
2050
+ if (options.minDate === undefined) {
2051
+ this.minYear = this.minDate = undefined;
2052
+ } else {
2053
+ this.minYear = startOfYearPeriod(options.minDate, this.step);
2054
+ this.minDate = dateValue(this.minYear, 0, 1);
2055
+ }
2056
+ }
2057
+ if ('maxDate' in options) {
2058
+ if (options.maxDate === undefined) {
2059
+ this.maxYear = this.maxDate = undefined;
2060
+ } else {
2061
+ this.maxYear = startOfYearPeriod(options.maxDate, this.step);
2062
+ this.maxDate = dateValue(this.maxYear, 11, 31);
2063
+ }
2064
+ }
2065
+ if (options.checkDisabled) {
2066
+ this.checkDisabled = this.isMinView || options.datesDisabled === null
2067
+ ? options.checkDisabled
2068
+ : () => false;
2069
+ }
2070
+ if (this.beforeShowOption in options) {
2071
+ const beforeShow = options[this.beforeShowOption];
2072
+ this.beforeShow = typeof beforeShow === 'function' ? beforeShow : undefined;
2073
+ }
2074
+ }
2075
+
2076
+ // Update view's settings to reflect the viewDate set on the picker
2077
+ updateFocus() {
2078
+ const viewDate = new Date(this.picker.viewDate);
2079
+ const first = startOfYearPeriod(viewDate, this.navStep);
2080
+ const last = first + 9 * this.step;
2081
+
2082
+ this.first = first;
2083
+ this.last = last;
2084
+ this.start = first - this.step;
2085
+ this.focused = startOfYearPeriod(viewDate, this.step);
2086
+ }
2087
+
2088
+ // Update view's settings to reflect the selected dates
2089
+ updateSelection() {
2090
+ const {dates, rangepicker} = this.picker.datepicker;
2091
+ this.selected = dates.reduce((years, timeValue) => {
2092
+ return pushUnique(years, startOfYearPeriod(timeValue, this.step));
2093
+ }, []);
2094
+ if (rangepicker && rangepicker.dates) {
2095
+ this.range = rangepicker.dates.map(timeValue => {
2096
+ if (timeValue !== undefined) {
2097
+ return startOfYearPeriod(timeValue, this.step);
2098
+ }
2099
+ });
2100
+ }
2101
+ }
2102
+
2103
+ // Update the entire view UI
2104
+ render() {
2105
+ this.prepareForRender(
2106
+ `${this.first}-${this.last}`,
2107
+ this.first <= this.minYear,
2108
+ this.last >= this.maxYear
2109
+ );
2110
+
2111
+ Array.from(this.grid.children).forEach((el, index) => {
2112
+ const current = this.start + (index * this.step);
2113
+ const date = regularizeDate(new Date(current, 0, 1), 2, this.isRangeEnd);
2114
+
2115
+ el.dataset.year = current;
2116
+ this.renderCell(
2117
+ el,
2118
+ current,
2119
+ current,
2120
+ date,
2121
+ this,
2122
+ current < this.minYear || current > this.maxYear
2123
+ );
2124
+ });
2125
+ }
2126
+
2127
+ // Update the view UI by applying the changes of selected and focused items
2128
+ refresh() {
2129
+ const range = this.range || [];
2130
+ Array.from(this.grid.children).forEach((el) => {
2131
+ this.refreshCell(el, Number(el.textContent), this.selected, range);
2132
+ });
2133
+ }
2134
+
2135
+ // Update the view UI by applying the change of focused item
2136
+ refreshFocus() {
2137
+ this.changeFocusedCell(Math.round((this.focused - this.start) / this.step));
2138
+ }
2139
+ }
2140
+
2141
+ function triggerDatepickerEvent(datepicker, type) {
2142
+ const detail = {
2143
+ date: datepicker.getDate(),
2144
+ viewDate: new Date(datepicker.picker.viewDate),
2145
+ viewId: datepicker.picker.currentView.id,
2146
+ datepicker,
2147
+ };
2148
+ datepicker.element.dispatchEvent(new CustomEvent(type, {detail}));
2149
+ }
2150
+
2151
+ // direction: -1 (to previous), 1 (to next)
2152
+ function goToPrevOrNext(datepicker, direction) {
2153
+ const {config, picker} = datepicker;
2154
+ const {currentView, viewDate} = picker;
2155
+ let newViewDate;
2156
+ switch (currentView.id) {
2157
+ case 0:
2158
+ newViewDate = addMonths(viewDate, direction);
2159
+ break;
2160
+ case 1:
2161
+ newViewDate = addYears(viewDate, direction);
2162
+ break;
2163
+ default:
2164
+ newViewDate = addYears(viewDate, direction * currentView.navStep);
2165
+ }
2166
+ newViewDate = limitToRange(newViewDate, config.minDate, config.maxDate);
2167
+ picker.changeFocus(newViewDate).render();
2168
+ }
2169
+
2170
+ function switchView(datepicker) {
2171
+ const viewId = datepicker.picker.currentView.id;
2172
+ if (viewId === datepicker.config.maxView) {
2173
+ return;
2174
+ }
2175
+ datepicker.picker.changeView(viewId + 1).render();
2176
+ }
2177
+
2178
+ function clearSelection(datepicker) {
2179
+ datepicker.setDate({clear: true});
2180
+ }
2181
+
2182
+ function goToOrSelectToday(datepicker) {
2183
+ const currentDate = today();
2184
+ if (datepicker.config.todayButtonMode === 1) {
2185
+ datepicker.setDate(currentDate, {forceRefresh: true, viewDate: currentDate});
2186
+ } else {
2187
+ datepicker.setFocusedDate(currentDate, true);
2188
+ }
2189
+ }
2190
+
2191
+ function unfocus(datepicker) {
2192
+ const onBlur = () => {
2193
+ if (datepicker.config.updateOnBlur) {
2194
+ datepicker.update({revert: true});
2195
+ } else {
2196
+ datepicker.refresh('input');
2197
+ }
2198
+ datepicker.hide();
2199
+ };
2200
+ const element = datepicker.element;
2201
+
2202
+ if (isActiveElement(element)) {
2203
+ element.addEventListener('blur', onBlur, {once: true});
2204
+ } else {
2205
+ onBlur();
2206
+ }
2207
+ }
2208
+
2209
+ function goToSelectedMonthOrYear(datepicker, selection) {
2210
+ const picker = datepicker.picker;
2211
+ const viewDate = new Date(picker.viewDate);
2212
+ const viewId = picker.currentView.id;
2213
+ const newDate = viewId === 1
2214
+ ? addMonths(viewDate, selection - viewDate.getMonth())
2215
+ : addYears(viewDate, selection - viewDate.getFullYear());
2216
+
2217
+ picker.changeFocus(newDate).changeView(viewId - 1).render();
2218
+ }
2219
+
2220
+ function onClickViewSwitch(datepicker) {
2221
+ switchView(datepicker);
2222
+ }
2223
+
2224
+ function onClickPrevButton(datepicker) {
2225
+ goToPrevOrNext(datepicker, -1);
2226
+ }
2227
+
2228
+ function onClickNextButton(datepicker) {
2229
+ goToPrevOrNext(datepicker, 1);
2230
+ }
2231
+
2232
+ // For the picker's main block to delegete the events from `datepicker-cell`s
2233
+ function onClickView(datepicker, ev) {
2234
+ const target = findElementInEventPath(ev, '.datepicker-cell');
2235
+ if (!target || target.classList.contains('disabled')) {
2236
+ return;
2237
+ }
2238
+
2239
+ const {id, isMinView} = datepicker.picker.currentView;
2240
+ const data = target.dataset;
2241
+ if (isMinView) {
2242
+ datepicker.setDate(Number(data.date));
2243
+ } else if (id === 1) {
2244
+ goToSelectedMonthOrYear(datepicker, Number(data.month));
2245
+ } else {
2246
+ goToSelectedMonthOrYear(datepicker, Number(data.year));
2247
+ }
2248
+ }
2249
+
2250
+ function onMousedownPicker(ev) {
2251
+ ev.preventDefault();
2252
+ }
2253
+
2254
+ const orientClasses = ['left', 'top', 'right', 'bottom'].reduce((obj, key) => {
2255
+ obj[key] = `datepicker-orient-${key}`;
2256
+ return obj;
2257
+ }, {});
2258
+ const toPx = num => num ? `${num}px` : num;
2259
+
2260
+ function processPickerOptions(picker, options) {
2261
+ if ('title' in options) {
2262
+ if (options.title) {
2263
+ picker.controls.title.textContent = options.title;
2264
+ showElement(picker.controls.title);
2265
+ } else {
2266
+ picker.controls.title.textContent = '';
2267
+ hideElement(picker.controls.title);
2268
+ }
2269
+ }
2270
+ if (options.prevArrow) {
2271
+ const prevButton = picker.controls.prevButton;
2272
+ emptyChildNodes(prevButton);
2273
+ options.prevArrow.forEach((node) => {
2274
+ prevButton.appendChild(node.cloneNode(true));
2275
+ });
2276
+ }
2277
+ if (options.nextArrow) {
2278
+ const nextButton = picker.controls.nextButton;
2279
+ emptyChildNodes(nextButton);
2280
+ options.nextArrow.forEach((node) => {
2281
+ nextButton.appendChild(node.cloneNode(true));
2282
+ });
2283
+ }
2284
+ if (options.locale) {
2285
+ picker.controls.todayButton.textContent = options.locale.today;
2286
+ picker.controls.clearButton.textContent = options.locale.clear;
2287
+ }
2288
+ if ('todayButton' in options) {
2289
+ if (options.todayButton) {
2290
+ showElement(picker.controls.todayButton);
2291
+ } else {
2292
+ hideElement(picker.controls.todayButton);
2293
+ }
2294
+ }
2295
+ if ('minDate' in options || 'maxDate' in options) {
2296
+ const {minDate, maxDate} = picker.datepicker.config;
2297
+ picker.controls.todayButton.disabled = !isInRange(today(), minDate, maxDate);
2298
+ }
2299
+ if ('clearButton' in options) {
2300
+ if (options.clearButton) {
2301
+ showElement(picker.controls.clearButton);
2302
+ } else {
2303
+ hideElement(picker.controls.clearButton);
2304
+ }
2305
+ }
2306
+ }
2307
+
2308
+ // Compute view date to reset, which will be...
2309
+ // - the last item of the selected dates or defaultViewDate if no selection
2310
+ // - limitted to minDate or maxDate if it exceeds the range
2311
+ function computeResetViewDate(datepicker) {
2312
+ const {dates, config, rangeSideIndex} = datepicker;
2313
+ const viewDate = dates.length > 0
2314
+ ? lastItemOf(dates)
2315
+ : regularizeDate(config.defaultViewDate, config.pickLevel, rangeSideIndex);
2316
+ return limitToRange(viewDate, config.minDate, config.maxDate);
2317
+ }
2318
+
2319
+ // Change current view's view date
2320
+ function setViewDate(picker, newDate) {
2321
+ if (!('_oldViewDate' in picker) && newDate !== picker.viewDate) {
2322
+ picker._oldViewDate = picker.viewDate;
2323
+ }
2324
+ picker.viewDate = newDate;
2325
+
2326
+ // return whether the new date is in different period on time from the one
2327
+ // displayed in the current view
2328
+ // when true, the view needs to be re-rendered on the next UI refresh.
2329
+ const {id, year, first, last} = picker.currentView;
2330
+ const viewYear = new Date(newDate).getFullYear();
2331
+ switch (id) {
2332
+ case 0:
2333
+ return newDate < first || newDate > last;
2334
+ case 1:
2335
+ return viewYear !== year;
2336
+ default:
2337
+ return viewYear < first || viewYear > last;
2338
+ }
2339
+ }
2340
+
2341
+ function getTextDirection(el) {
2342
+ return window.getComputedStyle(el).direction;
2343
+ }
2344
+
2345
+ // find the closet scrollable ancestor elemnt under the body
2346
+ function findScrollParents(el) {
2347
+ const parent = getParent(el);
2348
+ if (parent === document.body || !parent) {
2349
+ return;
2350
+ }
2351
+
2352
+ // checking overflow only is enough because computed overflow cannot be
2353
+ // visible or a combination of visible and other when either axis is set
2354
+ // to other than visible.
2355
+ // (Setting one axis to other than 'visible' while the other is 'visible'
2356
+ // results in the other axis turning to 'auto')
2357
+ return window.getComputedStyle(parent).overflow !== 'visible'
2358
+ ? parent
2359
+ : findScrollParents(parent);
2360
+ }
2361
+
2362
+ // Class representing the picker UI
2363
+ class Picker {
2364
+ constructor(datepicker) {
2365
+ const {config, inputField} = this.datepicker = datepicker;
2366
+
2367
+ const template = pickerTemplate.replace(/%buttonClass%/g, config.buttonClass);
2368
+ const element = this.element = parseHTML(template).firstChild;
2369
+ const [header, main, footer] = element.firstChild.children;
2370
+ const title = header.firstElementChild;
2371
+ const [prevButton, viewSwitch, nextButton] = header.lastElementChild.children;
2372
+ const [todayButton, clearButton] = footer.firstChild.children;
2373
+ const controls = {
2374
+ title,
2375
+ prevButton,
2376
+ viewSwitch,
2377
+ nextButton,
2378
+ todayButton,
2379
+ clearButton,
2380
+ };
2381
+ this.main = main;
2382
+ this.controls = controls;
2383
+
2384
+ const elementClass = inputField ? 'dropdown' : 'inline';
2385
+ element.classList.add(`datepicker-${elementClass}`);
2386
+
2387
+ processPickerOptions(this, config);
2388
+ this.viewDate = computeResetViewDate(datepicker);
2389
+
2390
+ // set up event listeners
2391
+ registerListeners(datepicker, [
2392
+ [element, 'mousedown', onMousedownPicker],
2393
+ [main, 'click', onClickView.bind(null, datepicker)],
2394
+ [controls.viewSwitch, 'click', onClickViewSwitch.bind(null, datepicker)],
2395
+ [controls.prevButton, 'click', onClickPrevButton.bind(null, datepicker)],
2396
+ [controls.nextButton, 'click', onClickNextButton.bind(null, datepicker)],
2397
+ [controls.todayButton, 'click', goToOrSelectToday.bind(null, datepicker)],
2398
+ [controls.clearButton, 'click', clearSelection.bind(null, datepicker)],
2399
+ ]);
2400
+
2401
+ // set up views
2402
+ this.views = [
2403
+ new DaysView(this),
2404
+ new MonthsView(this),
2405
+ new YearsView(this, {id: 2, name: 'years', cellClass: 'year', step: 1}),
2406
+ new YearsView(this, {id: 3, name: 'decades', cellClass: 'decade', step: 10}),
2407
+ ];
2408
+ this.currentView = this.views[config.startView];
2409
+
2410
+ this.currentView.render();
2411
+ this.main.appendChild(this.currentView.element);
2412
+ if (config.container) {
2413
+ config.container.appendChild(this.element);
2414
+ } else {
2415
+ inputField.after(this.element);
2416
+ }
2417
+ }
2418
+
2419
+ setOptions(options) {
2420
+ processPickerOptions(this, options);
2421
+ this.views.forEach((view) => {
2422
+ view.init(options, false);
2423
+ });
2424
+ this.currentView.render();
2425
+ }
2426
+
2427
+ detach() {
2428
+ this.element.remove();
2429
+ }
2430
+
2431
+ show() {
2432
+ if (this.active) {
2433
+ return;
2434
+ }
2435
+
2436
+ const {datepicker, element} = this;
2437
+ const inputField = datepicker.inputField;
2438
+ if (inputField) {
2439
+ // ensure picker's direction matches input's
2440
+ const inputDirection = getTextDirection(inputField);
2441
+ if (inputDirection !== getTextDirection(getParent(element))) {
2442
+ element.dir = inputDirection;
2443
+ } else if (element.dir) {
2444
+ element.removeAttribute('dir');
2445
+ }
2446
+
2447
+ element.style.visibility = 'hidden';
2448
+ element.classList.add('active');
2449
+ this.place();
2450
+ element.style.visibility = '';
2451
+
2452
+ if (datepicker.config.disableTouchKeyboard) {
2453
+ inputField.blur();
2454
+ }
2455
+ } else {
2456
+ element.classList.add('active');
2457
+ }
2458
+ this.active = true;
2459
+ triggerDatepickerEvent(datepicker, 'show');
2460
+ }
2461
+
2462
+ hide() {
2463
+ if (!this.active) {
2464
+ return;
2465
+ }
2466
+ this.datepicker.exitEditMode();
2467
+ this.element.classList.remove('active');
2468
+ this.active = false;
2469
+ triggerDatepickerEvent(this.datepicker, 'hide');
2470
+ }
2471
+
2472
+ place() {
2473
+ const {classList, offsetParent, style} = this.element;
2474
+ const {config, inputField} = this.datepicker;
2475
+ const {
2476
+ width: calendarWidth,
2477
+ height: calendarHeight,
2478
+ } = this.element.getBoundingClientRect();
2479
+ const {
2480
+ left: inputLeft,
2481
+ top: inputTop,
2482
+ right: inputRight,
2483
+ bottom: inputBottom,
2484
+ width: inputWidth,
2485
+ height: inputHeight
2486
+ } = inputField.getBoundingClientRect();
2487
+ let {x: orientX, y: orientY} = config.orientation;
2488
+ let left = inputLeft;
2489
+ let top = inputTop;
2490
+
2491
+ // caliculate offsetLeft/Top of inputField
2492
+ if (offsetParent === document.body || !offsetParent) {
2493
+ left += window.scrollX;
2494
+ top += window.scrollY;
2495
+ } else {
2496
+ const offsetParentRect = offsetParent.getBoundingClientRect();
2497
+ left -= offsetParentRect.left - offsetParent.scrollLeft;
2498
+ top -= offsetParentRect.top - offsetParent.scrollTop;
2499
+ }
2500
+
2501
+ // caliculate the boundaries of the visible area that contains inputField
2502
+ const scrollParent = findScrollParents(inputField);
2503
+ let scrollAreaLeft = 0;
2504
+ let scrollAreaTop = 0;
2505
+ let {
2506
+ clientWidth: scrollAreaRight,
2507
+ clientHeight: scrollAreaBottom,
2508
+ } = document.documentElement;
2509
+
2510
+ if (scrollParent) {
2511
+ const scrollParentRect = scrollParent.getBoundingClientRect();
2512
+ if (scrollParentRect.top > 0) {
2513
+ scrollAreaTop = scrollParentRect.top;
2514
+ }
2515
+ if (scrollParentRect.left > 0) {
2516
+ scrollAreaLeft = scrollParentRect.left;
2517
+ }
2518
+ if (scrollParentRect.right < scrollAreaRight) {
2519
+ scrollAreaRight = scrollParentRect.right;
2520
+ }
2521
+ if (scrollParentRect.bottom < scrollAreaBottom) {
2522
+ scrollAreaBottom = scrollParentRect.bottom;
2523
+ }
2524
+ }
2525
+
2526
+ // determine the horizontal orientation and left position
2527
+ let adjustment = 0;
2528
+ if (orientX === 'auto') {
2529
+ if (inputLeft < scrollAreaLeft) {
2530
+ orientX = 'left';
2531
+ adjustment = scrollAreaLeft - inputLeft;
2532
+ } else if (inputLeft + calendarWidth > scrollAreaRight) {
2533
+ orientX = 'right';
2534
+ if (scrollAreaRight < inputRight) {
2535
+ adjustment = scrollAreaRight - inputRight;
2536
+ }
2537
+ } else if (getTextDirection(inputField) === 'rtl') {
2538
+ orientX = inputRight - calendarWidth < scrollAreaLeft ? 'left' : 'right';
2539
+ } else {
2540
+ orientX = 'left';
2541
+ }
2542
+ }
2543
+ if (orientX === 'right') {
2544
+ left += inputWidth - calendarWidth;
2545
+ }
2546
+ left += adjustment;
2547
+
2548
+ // determine the vertical orientation and top position
2549
+ if (orientY === 'auto') {
2550
+ if (inputTop - calendarHeight > scrollAreaTop) {
2551
+ orientY = inputBottom + calendarHeight > scrollAreaBottom ? 'top' : 'bottom';
2552
+ } else {
2553
+ orientY = 'bottom';
2554
+ }
2555
+ }
2556
+ if (orientY === 'top') {
2557
+ top -= calendarHeight;
2558
+ } else {
2559
+ top += inputHeight;
2560
+ }
2561
+
2562
+ classList.remove(...Object.values(orientClasses));
2563
+ classList.add(orientClasses[orientX], orientClasses[orientY]);
2564
+
2565
+ style.left = toPx(left);
2566
+ style.top = toPx(top);
2567
+ }
2568
+
2569
+ setViewSwitchLabel(labelText) {
2570
+ this.controls.viewSwitch.textContent = labelText;
2571
+ }
2572
+
2573
+ setPrevButtonDisabled(disabled) {
2574
+ this.controls.prevButton.disabled = disabled;
2575
+ }
2576
+
2577
+ setNextButtonDisabled(disabled) {
2578
+ this.controls.nextButton.disabled = disabled;
2579
+ }
2580
+
2581
+ changeView(viewId) {
2582
+ const currentView = this.currentView;
2583
+ if (viewId !== currentView.id) {
2584
+ if (!this._oldView) {
2585
+ this._oldView = currentView;
2586
+ }
2587
+ this.currentView = this.views[viewId];
2588
+ this._renderMethod = 'render';
2589
+ }
2590
+ return this;
2591
+ }
2592
+
2593
+ // Change the focused date (view date)
2594
+ changeFocus(newViewDate) {
2595
+ this._renderMethod = setViewDate(this, newViewDate) ? 'render' : 'refreshFocus';
2596
+ this.views.forEach((view) => {
2597
+ view.updateFocus();
2598
+ });
2599
+ return this;
2600
+ }
2601
+
2602
+ // Apply the change of the selected dates
2603
+ update(viewDate = undefined) {
2604
+ const newViewDate = viewDate === undefined
2605
+ ? computeResetViewDate(this.datepicker)
2606
+ : viewDate;
2607
+ this._renderMethod = setViewDate(this, newViewDate) ? 'render' : 'refresh';
2608
+ this.views.forEach((view) => {
2609
+ view.updateFocus();
2610
+ view.updateSelection();
2611
+ });
2612
+ return this;
2613
+ }
2614
+
2615
+ // Refresh the picker UI
2616
+ render(quickRender = true) {
2617
+ const {currentView, datepicker, _oldView: oldView} = this;
2618
+ const oldViewDate = new Date(this._oldViewDate);
2619
+ const renderMethod = (quickRender && this._renderMethod) || 'render';
2620
+ delete this._oldView;
2621
+ delete this._oldViewDate;
2622
+ delete this._renderMethod;
2623
+
2624
+ currentView[renderMethod]();
2625
+ if (oldView) {
2626
+ this.main.replaceChild(currentView.element, oldView.element);
2627
+ triggerDatepickerEvent(datepicker, 'changeView');
2628
+ }
2629
+ if (!isNaN(oldViewDate)) {
2630
+ const newViewDate = new Date(this.viewDate);
2631
+ if (newViewDate.getFullYear() !== oldViewDate.getFullYear()) {
2632
+ triggerDatepickerEvent(datepicker, 'changeYear');
2633
+ }
2634
+ if (newViewDate.getMonth() !== oldViewDate.getMonth()) {
2635
+ triggerDatepickerEvent(datepicker, 'changeMonth');
2636
+ }
2637
+ }
2638
+ }
2639
+ }
2640
+
2641
+ // Find the closest date that doesn't meet the condition for unavailable date
2642
+ // Returns undefined if no available date is found
2643
+ // addFn: function to calculate the next date
2644
+ // - args: time value, amount
2645
+ // increase: amount to pass to addFn
2646
+ // testFn: function to test the unavailability of the date
2647
+ // - args: time value; return: true if unavailable
2648
+ function findNextAvailableOne(date, addFn, increase, testFn, min, max) {
2649
+ if (!isInRange(date, min, max)) {
2650
+ return;
2651
+ }
2652
+ if (testFn(date)) {
2653
+ const newDate = addFn(date, increase);
2654
+ return findNextAvailableOne(newDate, addFn, increase, testFn, min, max);
2655
+ }
2656
+ return date;
2657
+ }
2658
+
2659
+ // direction: -1 (left/up), 1 (right/down)
2660
+ // vertical: true for up/down, false for left/right
2661
+ function moveByArrowKey(datepicker, direction, vertical) {
2662
+ const picker = datepicker.picker;
2663
+ const currentView = picker.currentView;
2664
+ const step = currentView.step || 1;
2665
+ let viewDate = picker.viewDate;
2666
+ let addFn;
2667
+ switch (currentView.id) {
2668
+ case 0:
2669
+ viewDate = addDays(viewDate, vertical ? direction * 7 : direction);
2670
+ addFn = addDays;
2671
+ break;
2672
+ case 1:
2673
+ viewDate = addMonths(viewDate, vertical ? direction * 4 : direction);
2674
+ addFn = addMonths;
2675
+ break;
2676
+ default:
2677
+ viewDate = addYears(viewDate, direction * (vertical ? 4 : 1) * step);
2678
+ addFn = addYears;
2679
+ }
2680
+ viewDate = findNextAvailableOne(
2681
+ viewDate,
2682
+ addFn,
2683
+ direction < 0 ? -step : step,
2684
+ (date) => currentView.disabled.includes(date),
2685
+ currentView.minDate,
2686
+ currentView.maxDate
2687
+ );
2688
+ if (viewDate !== undefined) {
2689
+ picker.changeFocus(viewDate).render();
2690
+ }
2691
+ }
2692
+
2693
+ function onKeydown(datepicker, ev) {
2694
+ const {config, picker, editMode} = datepicker;
2695
+ const active = picker.active;
2696
+ const {key, altKey, shiftKey} = ev;
2697
+ const ctrlOrMetaKey = ev.ctrlKey || ev.metaKey;
2698
+ const cancelEvent = () => {
2699
+ ev.preventDefault();
2700
+ ev.stopPropagation();
2701
+ };
2702
+
2703
+ // tab/enter keys should not be taken by shortcut keys
2704
+ if (key === 'Tab') {
2705
+ unfocus(datepicker);
2706
+ return;
2707
+ }
2708
+ if (key === 'Enter') {
2709
+ if (!active) {
2710
+ datepicker.update();
2711
+ } else if (editMode) {
2712
+ datepicker.exitEditMode({update: true, autohide: config.autohide});
2713
+ } else {
2714
+ const currentView = picker.currentView;
2715
+ if (currentView.isMinView) {
2716
+ datepicker.setDate(picker.viewDate);
2717
+ } else {
2718
+ picker.changeView(currentView.id - 1).render();
2719
+ cancelEvent();
2720
+ }
2721
+ }
2722
+ return;
2723
+ }
2724
+
2725
+ const shortcutKeys = config.shortcutKeys;
2726
+ const keyInfo = {key, ctrlOrMetaKey, altKey, shiftKey};
2727
+ const shortcut = Object.keys(shortcutKeys).find((item) => {
2728
+ const keyDef = shortcutKeys[item];
2729
+ return !Object.keys(keyDef).find(prop => keyDef[prop] !== keyInfo[prop]);
2730
+ });
2731
+ if (shortcut) {
2732
+ let action;
2733
+ if (shortcut === 'toggle') {
2734
+ action = shortcut;
2735
+ } else if (editMode) {
2736
+ if (shortcut === 'exitEditMode') {
2737
+ action = shortcut;
2738
+ }
2739
+ } else if (active) {
2740
+ if (shortcut === 'hide') {
2741
+ action = shortcut;
2742
+ } else if (shortcut === 'prevButton') {
2743
+ action = [goToPrevOrNext, [datepicker, -1]];
2744
+ } else if (shortcut === 'nextButton') {
2745
+ action = [goToPrevOrNext, [datepicker, 1]];
2746
+ } else if (shortcut === 'viewSwitch') {
2747
+ action = [switchView, [datepicker]];
2748
+ } else if (config.clearButton && shortcut === 'clearButton') {
2749
+ action = [clearSelection, [datepicker]];
2750
+ } else if (config.todayButton && shortcut === 'todayButton') {
2751
+ action = [goToOrSelectToday, [datepicker]];
2752
+ }
2753
+ } else if (shortcut === 'show') {
2754
+ action = shortcut;
2755
+ }
2756
+ if (action) {
2757
+ if (Array.isArray(action)) {
2758
+ action[0].apply(null, action[1]);
2759
+ } else {
2760
+ datepicker[action]();
2761
+ }
2762
+ cancelEvent();
2763
+ return;
2764
+ }
2765
+ }
2766
+
2767
+ // perform as a regular <input> when picker in hidden or in edit mode
2768
+ if (!active || editMode) {
2769
+ return;
2770
+ }
2771
+
2772
+ const handleArrowKeyPress = (direction, vertical) => {
2773
+ if (shiftKey || ctrlOrMetaKey || altKey) {
2774
+ datepicker.enterEditMode();
2775
+ } else {
2776
+ moveByArrowKey(datepicker, direction, vertical);
2777
+ ev.preventDefault();
2778
+ }
2779
+ };
2780
+
2781
+ if (key === 'ArrowLeft') {
2782
+ handleArrowKeyPress(-1, false);
2783
+ } else if (key === 'ArrowRight') {
2784
+ handleArrowKeyPress(1, false);
2785
+ } else if (key === 'ArrowUp') {
2786
+ handleArrowKeyPress(-1, true);
2787
+ } else if (key === 'ArrowDown') {
2788
+ handleArrowKeyPress(1, true);
2789
+ } else if (
2790
+ key === 'Backspace'
2791
+ || key === 'Delete'
2792
+ // When autofill is performed, Chromium-based browsers trigger fake
2793
+ // keydown/keyup events that don't have the `key` property (on Edge,
2794
+ // keyup only) in addition to the input event. Therefore, we need to
2795
+ // check the existence of `key`'s value before checking the length.
2796
+ // (issue #144)
2797
+ || (key && key.length === 1 && !ctrlOrMetaKey)
2798
+ ) {
2799
+ datepicker.enterEditMode();
2800
+ }
2801
+ }
2802
+
2803
+ function onFocus(datepicker) {
2804
+ if (datepicker.config.showOnFocus && !datepicker._showing) {
2805
+ datepicker.show();
2806
+ }
2807
+ }
2808
+
2809
+ // for the prevention for entering edit mode while getting focus on click
2810
+ function onMousedown(datepicker, ev) {
2811
+ const el = ev.target;
2812
+ if (datepicker.picker.active || datepicker.config.showOnClick) {
2813
+ el._active = isActiveElement(el);
2814
+ el._clicking = setTimeout(() => {
2815
+ delete el._active;
2816
+ delete el._clicking;
2817
+ }, 2000);
2818
+ }
2819
+ }
2820
+
2821
+ function onClickInput(datepicker, ev) {
2822
+ const el = ev.target;
2823
+ if (!el._clicking) {
2824
+ return;
2825
+ }
2826
+ clearTimeout(el._clicking);
2827
+ delete el._clicking;
2828
+
2829
+ if (el._active) {
2830
+ datepicker.enterEditMode();
2831
+ }
2832
+ delete el._active;
2833
+
2834
+ if (datepicker.config.showOnClick) {
2835
+ datepicker.show();
2836
+ }
2837
+ }
2838
+
2839
+ function onPaste(datepicker, ev) {
2840
+ if (ev.clipboardData.types.includes('text/plain')) {
2841
+ datepicker.enterEditMode();
2842
+ }
2843
+ }
2844
+
2845
+ // for the `document` to delegate the events from outside the picker/input field
2846
+ function onClickOutside(datepicker, ev) {
2847
+ const {element, picker} = datepicker;
2848
+ // check both picker's and input's activeness to make updateOnBlur work in
2849
+ // the cases where...
2850
+ // - picker is hidden by ESC key press → input stays focused
2851
+ // - input is unfocused by closing mobile keyboard → piker is kept shown
2852
+ if (!picker.active && !isActiveElement(element)) {
2853
+ return;
2854
+ }
2855
+ const pickerElem = picker.element;
2856
+ if (findElementInEventPath(ev, el => el === element || el === pickerElem)) {
2857
+ return;
2858
+ }
2859
+ unfocus(datepicker);
2860
+ }
2861
+
2862
+ function stringifyDates(dates, config) {
2863
+ return dates
2864
+ .map(dt => formatDate(dt, config.format, config.locale))
2865
+ .join(config.dateDelimiter);
2866
+ }
2867
+
2868
+ // parse input dates and create an array of time values for selection
2869
+ // returns undefined if there are no valid dates in inputDates
2870
+ // when origDates (current selection) is passed, the function works to mix
2871
+ // the input dates into the current selection
2872
+ function processInputDates(datepicker, inputDates, clear = false) {
2873
+ if (inputDates.length === 0) {
2874
+ // empty input is considered valid unless origiDates is passed
2875
+ return clear ? [] : undefined;
2876
+ }
2877
+
2878
+ const {config, dates: origDates, rangeSideIndex} = datepicker;
2879
+ const {pickLevel, maxNumberOfDates} = config;
2880
+ let newDates = inputDates.reduce((dates, dt) => {
2881
+ let date = parseDate(dt, config.format, config.locale);
2882
+ if (date === undefined) {
2883
+ return dates;
2884
+ }
2885
+ // adjust to 1st of the month/Jan 1st of the year
2886
+ // or to the last day of the monh/Dec 31st of the year if the datepicker
2887
+ // is the range-end picker of a rangepicker
2888
+ date = regularizeDate(date, pickLevel, rangeSideIndex);
2889
+ if (
2890
+ isInRange(date, config.minDate, config.maxDate)
2891
+ && !dates.includes(date)
2892
+ && !config.checkDisabled(date, pickLevel)
2893
+ && (pickLevel > 0 || !config.daysOfWeekDisabled.includes(new Date(date).getDay()))
2894
+ ) {
2895
+ dates.push(date);
2896
+ }
2897
+ return dates;
2898
+ }, []);
2899
+ if (newDates.length === 0) {
2900
+ return;
2901
+ }
2902
+ if (config.multidate && !clear) {
2903
+ // get the synmetric difference between origDates and newDates
2904
+ newDates = newDates.reduce((dates, date) => {
2905
+ if (!origDates.includes(date)) {
2906
+ dates.push(date);
2907
+ }
2908
+ return dates;
2909
+ }, origDates.filter(date => !newDates.includes(date)));
2910
+ }
2911
+ // do length check always because user can input multiple dates regardless of the mode
2912
+ return maxNumberOfDates && newDates.length > maxNumberOfDates
2913
+ ? newDates.slice(maxNumberOfDates * -1)
2914
+ : newDates;
2915
+ }
2916
+
2917
+ // refresh the UI elements
2918
+ // modes: 1: input only, 2, picker only, 3 both
2919
+ function refreshUI(datepicker, mode = 3, quickRender = true, viewDate = undefined) {
2920
+ const {config, picker, inputField} = datepicker;
2921
+ if (mode & 2) {
2922
+ const newView = picker.active ? config.pickLevel : config.startView;
2923
+ picker.update(viewDate).changeView(newView).render(quickRender);
2924
+ }
2925
+ if (mode & 1 && inputField) {
2926
+ inputField.value = stringifyDates(datepicker.dates, config);
2927
+ }
2928
+ }
2929
+
2930
+ function setDate(datepicker, inputDates, options) {
2931
+ const config = datepicker.config;
2932
+ let {clear, render, autohide, revert, forceRefresh, viewDate} = options;
2933
+ if (render === undefined) {
2934
+ render = true;
2935
+ }
2936
+ if (!render) {
2937
+ autohide = forceRefresh = false;
2938
+ } else if (autohide === undefined) {
2939
+ autohide = config.autohide;
2940
+ }
2941
+ viewDate = parseDate(viewDate, config.format, config.locale);
2942
+
2943
+ const newDates = processInputDates(datepicker, inputDates, clear);
2944
+ if (!newDates && !revert) {
2945
+ return;
2946
+ }
2947
+ if (newDates && newDates.toString() !== datepicker.dates.toString()) {
2948
+ datepicker.dates = newDates;
2949
+ refreshUI(datepicker, render ? 3 : 1, true, viewDate);
2950
+ triggerDatepickerEvent(datepicker, 'changeDate');
2951
+ } else {
2952
+ refreshUI(datepicker, forceRefresh ? 3 : 1, true, viewDate);
2953
+ }
2954
+
2955
+ if (autohide) {
2956
+ datepicker.hide();
2957
+ }
2958
+ }
2959
+
2960
+ function getOutputConverter(datepicker, format) {
2961
+ return format
2962
+ ? date => formatDate(date, format, datepicker.config.locale)
2963
+ : date => new Date(date);
2964
+ }
2965
+
2966
+ /**
2967
+ * Class representing a date picker
2968
+ */
2969
+ class Datepicker {
2970
+ /**
2971
+ * Create a date picker
2972
+ * @param {Element} element - element to bind a date picker
2973
+ * @param {Object} [options] - config options
2974
+ * @param {DateRangePicker} [rangepicker] - DateRangePicker instance the
2975
+ * date picker belongs to. Use this only when creating date picker as a part
2976
+ * of date range picker
2977
+ */
2978
+ constructor(element, options = {}, rangepicker = undefined) {
2979
+ element.datepicker = this;
2980
+ this.element = element;
2981
+ this.dates = [];
2982
+
2983
+ // initialize config
2984
+ const config = this.config = Object.assign({
2985
+ buttonClass: (options.buttonClass && String(options.buttonClass)) || 'button',
2986
+ container: null,
2987
+ defaultViewDate: today(),
2988
+ maxDate: undefined,
2989
+ minDate: undefined,
2990
+ }, processOptions(defaultOptions, this));
2991
+
2992
+ // configure by type
2993
+ let inputField;
2994
+ if (element.tagName === 'INPUT') {
2995
+ inputField = this.inputField = element;
2996
+ inputField.classList.add('datepicker-input');
2997
+ if (options.container) {
2998
+ // omit string type check because it doesn't guarantee to avoid errors
2999
+ // (invalid selector string causes abend with sytax error)
3000
+ config.container = options.container instanceof HTMLElement
3001
+ ? options.container
3002
+ : document.querySelector(options.container);
3003
+ }
3004
+ } else {
3005
+ config.container = element;
3006
+ }
3007
+ if (rangepicker) {
3008
+ // check validiry
3009
+ const index = rangepicker.inputs.indexOf(inputField);
3010
+ const datepickers = rangepicker.datepickers;
3011
+ if (index < 0 || index > 1 || !Array.isArray(datepickers)) {
3012
+ throw Error('Invalid rangepicker object.');
3013
+ }
3014
+ // attach itaelf to the rangepicker here so that processInputDates() can
3015
+ // determine if this is the range-end picker of the rangepicker while
3016
+ // setting inital values when pickLevel > 0
3017
+ datepickers[index] = this;
3018
+ this.rangepicker = rangepicker;
3019
+ this.rangeSideIndex = index;
3020
+ }
3021
+
3022
+ // set up config
3023
+ this._options = options;
3024
+ Object.assign(config, processOptions(options, this));
3025
+ config.shortcutKeys = createShortcutKeyConfig(options.shortcutKeys || {});
3026
+
3027
+ // process initial value
3028
+ const initialDates = stringToArray(
3029
+ element.value || element.dataset.date,
3030
+ config.dateDelimiter
3031
+ );
3032
+ delete element.dataset.date;
3033
+ const inputDateValues = processInputDates(this, initialDates);
3034
+ if (inputDateValues && inputDateValues.length > 0) {
3035
+ this.dates = inputDateValues;
3036
+ }
3037
+ if (inputField) {
3038
+ inputField.value = stringifyDates(this.dates, config);
3039
+ }
3040
+
3041
+ // set up picekr element
3042
+ const picker = this.picker = new Picker(this);
3043
+
3044
+ const keydownListener = [element, 'keydown', onKeydown.bind(null, this)];
3045
+ if (inputField) {
3046
+ registerListeners(this, [
3047
+ keydownListener,
3048
+ [inputField, 'focus', onFocus.bind(null, this)],
3049
+ [inputField, 'mousedown', onMousedown.bind(null, this)],
3050
+ [inputField, 'click', onClickInput.bind(null, this)],
3051
+ [inputField, 'paste', onPaste.bind(null, this)],
3052
+ // To detect a click on outside, just listening to mousedown is enough,
3053
+ // no need to listen to touchstart.
3054
+ // Actually, listening to touchstart can be a problem because, while
3055
+ // mousedown is fired only on tapping but not on swiping/pinching,
3056
+ // touchstart is fired on swiping/pinching as well.
3057
+ // (issue #95)
3058
+ [document, 'mousedown', onClickOutside.bind(null, this)],
3059
+ [window, 'resize', picker.place.bind(picker)]
3060
+ ]);
3061
+ } else {
3062
+ registerListeners(this, [keydownListener]);
3063
+ this.show();
3064
+ }
3065
+ }
3066
+
3067
+ /**
3068
+ * Format Date object or time value in given format and language
3069
+ * @param {Date|Number} date - date or time value to format
3070
+ * @param {String|Object} format - format string or object that contains
3071
+ * toDisplay() custom formatter, whose signature is
3072
+ * - args:
3073
+ * - date: {Date} - Date instance of the date passed to the method
3074
+ * - format: {Object} - the format object passed to the method
3075
+ * - locale: {Object} - locale for the language specified by `lang`
3076
+ * - return:
3077
+ * {String} formatted date
3078
+ * @param {String} [lang=en] - language code for the locale to use
3079
+ * @return {String} formatted date
3080
+ */
3081
+ static formatDate(date, format, lang) {
3082
+ return formatDate(date, format, lang && locales[lang] || locales.en);
3083
+ }
3084
+
3085
+ /**
3086
+ * Parse date string
3087
+ * @param {String|Date|Number} dateStr - date string, Date object or time
3088
+ * value to parse
3089
+ * @param {String|Object} format - format string or object that contains
3090
+ * toValue() custom parser, whose signature is
3091
+ * - args:
3092
+ * - dateStr: {String|Date|Number} - the dateStr passed to the method
3093
+ * - format: {Object} - the format object passed to the method
3094
+ * - locale: {Object} - locale for the language specified by `lang`
3095
+ * - return:
3096
+ * {Date|Number} parsed date or its time value
3097
+ * @param {String} [lang=en] - language code for the locale to use
3098
+ * @return {Number} time value of parsed date
3099
+ */
3100
+ static parseDate(dateStr, format, lang) {
3101
+ return parseDate(dateStr, format, lang && locales[lang] || locales.en);
3102
+ }
3103
+
3104
+ /**
3105
+ * @type {Object} - Installed locales in `[languageCode]: localeObject` format
3106
+ * en`:_English (US)_ is pre-installed.
3107
+ */
3108
+ static get locales() {
3109
+ return locales;
3110
+ }
3111
+
3112
+ /**
3113
+ * @type {Boolean} - Whether the picker element is shown. `true` whne shown
3114
+ */
3115
+ get active() {
3116
+ return !!(this.picker && this.picker.active);
3117
+ }
3118
+
3119
+ /**
3120
+ * @type {HTMLDivElement} - DOM object of picker element
3121
+ */
3122
+ get pickerElement() {
3123
+ return this.picker ? this.picker.element : undefined;
3124
+ }
3125
+
3126
+ /**
3127
+ * Set new values to the config options
3128
+ * @param {Object} options - config options to update
3129
+ */
3130
+ setOptions(options) {
3131
+ const newOptions = processOptions(options, this);
3132
+ Object.assign(this._options, options);
3133
+ Object.assign(this.config, newOptions);
3134
+ this.picker.setOptions(newOptions);
3135
+
3136
+ refreshUI(this, 3);
3137
+ }
3138
+
3139
+ /**
3140
+ * Show the picker element
3141
+ */
3142
+ show() {
3143
+ if (this.inputField) {
3144
+ const {config, inputField} = this;
3145
+ if (inputField.disabled || (inputField.readOnly && !config.enableOnReadonly)) {
3146
+ return;
3147
+ }
3148
+ if (!isActiveElement(inputField) && !config.disableTouchKeyboard) {
3149
+ this._showing = true;
3150
+ inputField.focus();
3151
+ delete this._showing;
3152
+ }
3153
+ }
3154
+ this.picker.show();
3155
+ }
3156
+
3157
+ /**
3158
+ * Hide the picker element
3159
+ * Not available on inline picker
3160
+ */
3161
+ hide() {
3162
+ if (!this.inputField) {
3163
+ return;
3164
+ }
3165
+ this.picker.hide();
3166
+ this.picker.update().changeView(this.config.startView).render();
3167
+ }
3168
+
3169
+ /**
3170
+ * Toggle the display of the picker element
3171
+ * Not available on inline picker
3172
+ *
3173
+ * Unlike hide(), the picker does not return to the start view when hiding.
3174
+ */
3175
+ toggle() {
3176
+ if (!this.picker.active) {
3177
+ this.show();
3178
+ } else if (this.inputField) {
3179
+ this.picker.hide();
3180
+ }
3181
+ }
3182
+
3183
+ /**
3184
+ * Destroy the Datepicker instance
3185
+ * @return {Detepicker} - the instance destroyed
3186
+ */
3187
+ destroy() {
3188
+ this.hide();
3189
+ unregisterListeners(this);
3190
+ this.picker.detach();
3191
+ const element = this.element;
3192
+ element.classList.remove('datepicker-input');
3193
+ delete element.datepicker;
3194
+ return this;
3195
+ }
3196
+
3197
+ /**
3198
+ * Get the selected date(s)
3199
+ *
3200
+ * The method returns a Date object of selected date by default, and returns
3201
+ * an array of selected dates in multidate mode. If format string is passed,
3202
+ * it returns date string(s) formatted in given format.
3203
+ *
3204
+ * @param {String} [format] - format string to stringify the date(s)
3205
+ * @return {Date|String|Date[]|String[]} - selected date(s), or if none is
3206
+ * selected, empty array in multidate mode and undefined in sigledate mode
3207
+ */
3208
+ getDate(format = undefined) {
3209
+ const callback = getOutputConverter(this, format);
3210
+
3211
+ if (this.config.multidate) {
3212
+ return this.dates.map(callback);
3213
+ }
3214
+ if (this.dates.length > 0) {
3215
+ return callback(this.dates[0]);
3216
+ }
3217
+ }
3218
+
3219
+ /**
3220
+ * Set selected date(s)
3221
+ *
3222
+ * In multidate mode, you can pass multiple dates as a series of arguments
3223
+ * or an array. (Since each date is parsed individually, the type of the
3224
+ * dates doesn't have to be the same.)
3225
+ * The given dates are used to toggle the select status of each date. The
3226
+ * number of selected dates is kept from exceeding the length set to
3227
+ * maxNumberOfDates.
3228
+ *
3229
+ * With clear: true option, the method can be used to clear the selection
3230
+ * and to replace the selection instead of toggling in multidate mode.
3231
+ * If the option is passed with no date arguments or an empty dates array,
3232
+ * it works as "clear" (clear the selection then set nothing), and if the
3233
+ * option is passed with new dates to select, it works as "replace" (clear
3234
+ * the selection then set the given dates)
3235
+ *
3236
+ * When render: false option is used, the method omits re-rendering the
3237
+ * picker element. In this case, you need to call refresh() method later in
3238
+ * order for the picker element to reflect the changes. The input field is
3239
+ * refreshed always regardless of this option.
3240
+ *
3241
+ * When invalid (unparsable, repeated, disabled or out-of-range) dates are
3242
+ * passed, the method ignores them and applies only valid ones. In the case
3243
+ * that all the given dates are invalid, which is distinguished from passing
3244
+ * no dates, the method considers it as an error and leaves the selection
3245
+ * untouched. (The input field also remains untouched unless revert: true
3246
+ * option is used.)
3247
+ * Replacing the selection with the same date(s) also causes a similar
3248
+ * situation. In both cases, the method does not refresh the picker element
3249
+ * unless forceRefresh: true option is used.
3250
+ *
3251
+ * If viewDate option is used, the method changes the focused date to the
3252
+ * specified date instead of the last item of the selection.
3253
+ *
3254
+ * @param {...(Date|Number|String)|Array} [dates] - Date strings, Date
3255
+ * objects, time values or mix of those for new selection
3256
+ * @param {Object} [options] - function options
3257
+ * - clear: {boolean} - Whether to clear the existing selection
3258
+ * defualt: false
3259
+ * - render: {boolean} - Whether to re-render the picker element
3260
+ * default: true
3261
+ * - autohide: {boolean} - Whether to hide the picker element after re-render
3262
+ * Ignored when used with render: false
3263
+ * default: config.autohide
3264
+ * - revert: {boolean} - Whether to refresh the input field when all the
3265
+ * passed dates are invalid
3266
+ * default: false
3267
+ * - forceRefresh: {boolean} - Whether to refresh the picker element when
3268
+ * passed dates don't change the existing selection
3269
+ * default: false
3270
+ * - viewDate: {Date|Number|String} - Date to be focused after setiing date(s)
3271
+ * default: The last item of the resulting selection, or defaultViewDate
3272
+ * config option if none is selected
3273
+ */
3274
+ setDate(...args) {
3275
+ const dates = [...args];
3276
+ const opts = {};
3277
+ const lastArg = lastItemOf(args);
3278
+ if (
3279
+ lastArg
3280
+ && typeof lastArg === 'object'
3281
+ && !Array.isArray(lastArg)
3282
+ && !(lastArg instanceof Date)
3283
+ ) {
3284
+ Object.assign(opts, dates.pop());
3285
+ }
3286
+
3287
+ const inputDates = Array.isArray(dates[0]) ? dates[0] : dates;
3288
+ setDate(this, inputDates, opts);
3289
+ }
3290
+
3291
+ /**
3292
+ * Update the selected date(s) with input field's value
3293
+ * Not available on inline picker
3294
+ *
3295
+ * The input field will be refreshed with properly formatted date string.
3296
+ *
3297
+ * In the case that all the entered dates are invalid (unparsable, repeated,
3298
+ * disabled or out-of-range), which is distinguished from empty input field,
3299
+ * the method leaves the input field untouched as well as the selection by
3300
+ * default. If revert: true option is used in this case, the input field is
3301
+ * refreshed with the existing selection.
3302
+ * The method also doesn't refresh the picker element in this case and when
3303
+ * the entered dates are the same as the existing selection. If
3304
+ * forceRefresh: true option is used, the picker element is refreshed in
3305
+ * these cases too.
3306
+ *
3307
+ * @param {Object} [options] - function options
3308
+ * - autohide: {boolean} - whether to hide the picker element after refresh
3309
+ * default: false
3310
+ * - revert: {boolean} - Whether to refresh the input field when all the
3311
+ * passed dates are invalid
3312
+ * default: false
3313
+ * - forceRefresh: {boolean} - Whether to refresh the picer element when
3314
+ * input field's value doesn't change the existing selection
3315
+ * default: false
3316
+ */
3317
+ update(options = undefined) {
3318
+ if (!this.inputField) {
3319
+ return;
3320
+ }
3321
+
3322
+ const opts = Object.assign(options || {}, {clear: true, render: true, viewDate: undefined});
3323
+ const inputDates = stringToArray(this.inputField.value, this.config.dateDelimiter);
3324
+ setDate(this, inputDates, opts);
3325
+ }
3326
+
3327
+ /**
3328
+ * Get the focused date
3329
+ *
3330
+ * The method returns a Date object of focused date by default. If format
3331
+ * string is passed, it returns date string formatted in given format.
3332
+ *
3333
+ * @param {String} [format] - format string to stringify the date
3334
+ * @return {Date|String} - focused date (viewDate)
3335
+ */
3336
+ getFocusedDate(format = undefined) {
3337
+ return getOutputConverter(this, format)(this.picker.viewDate);
3338
+ }
3339
+
3340
+ /**
3341
+ * Set focused date
3342
+ *
3343
+ * By default, the method updates the focus on the view shown at the time,
3344
+ * or the one set to the startView config option if the picker is hidden.
3345
+ * When resetView: true is passed, the view displayed is changed to the
3346
+ * pickLevel config option's if the picker is shown.
3347
+ *
3348
+ * @param {Date|Number|String} viewDate - date string, Date object, time
3349
+ * values of the date to focus
3350
+ * @param {Boolean} [resetView] - whether to change the view to pickLevel
3351
+ * config option's when the picker is shown. Ignored when the picker is
3352
+ * hidden
3353
+ */
3354
+ setFocusedDate(viewDate, resetView = false) {
3355
+ const {config, picker, active, rangeSideIndex} = this;
3356
+ const pickLevel = config.pickLevel;
3357
+ const newViewDate = parseDate(viewDate, config.format, config.locale);
3358
+ if (newViewDate === undefined) {
3359
+ return;
3360
+ }
3361
+
3362
+ picker.changeFocus(regularizeDate(newViewDate, pickLevel, rangeSideIndex));
3363
+ if (active && resetView) {
3364
+ picker.changeView(pickLevel);
3365
+ }
3366
+ picker.render();
3367
+ }
3368
+
3369
+ /**
3370
+ * Refresh the picker element and the associated input field
3371
+ * @param {String} [target] - target item when refreshing one item only
3372
+ * 'picker' or 'input'
3373
+ * @param {Boolean} [forceRender] - whether to re-render the picker element
3374
+ * regardless of its state instead of optimized refresh
3375
+ */
3376
+ refresh(target = undefined, forceRender = false) {
3377
+ if (target && typeof target !== 'string') {
3378
+ forceRender = target;
3379
+ target = undefined;
3380
+ }
3381
+
3382
+ let mode;
3383
+ if (target === 'picker') {
3384
+ mode = 2;
3385
+ } else if (target === 'input') {
3386
+ mode = 1;
3387
+ } else {
3388
+ mode = 3;
3389
+ }
3390
+ refreshUI(this, mode, !forceRender);
3391
+ }
3392
+
3393
+ /**
3394
+ * Enter edit mode
3395
+ * Not available on inline picker or when the picker element is hidden
3396
+ */
3397
+ enterEditMode() {
3398
+ const inputField = this.inputField;
3399
+ if (!inputField || inputField.readOnly || !this.picker.active || this.editMode) {
3400
+ return;
3401
+ }
3402
+ this.editMode = true;
3403
+ inputField.classList.add('in-edit');
3404
+ }
3405
+
3406
+ /**
3407
+ * Exit from edit mode
3408
+ * Not available on inline picker
3409
+ * @param {Object} [options] - function options
3410
+ * - update: {boolean} - whether to call update() after exiting
3411
+ * If false, input field is revert to the existing selection
3412
+ * default: false
3413
+ */
3414
+ exitEditMode(options = undefined) {
3415
+ if (!this.inputField || !this.editMode) {
3416
+ return;
3417
+ }
3418
+ const opts = Object.assign({update: false}, options);
3419
+ delete this.editMode;
3420
+ this.inputField.classList.remove('in-edit');
3421
+ if (opts.update) {
3422
+ this.update(opts);
3423
+ }
3424
+ }
3425
+ }
3426
+
3427
+ var DatepickerTypeEnum;
3428
+ (function (DatepickerTypeEnum) {
3429
+ DatepickerTypeEnum[DatepickerTypeEnum["date"] = 0] = "date";
3430
+ DatepickerTypeEnum[DatepickerTypeEnum["month"] = 1] = "month";
3431
+ DatepickerTypeEnum[DatepickerTypeEnum["year"] = 2] = "year";
3432
+ DatepickerTypeEnum[DatepickerTypeEnum["week"] = 3] = "week";
3433
+ })(DatepickerTypeEnum || (DatepickerTypeEnum = {}));
3434
+
3435
+ var _a, _b, _c;
3436
+ const browserLanguage = (_b = (_a = window === null || window === void 0 ? void 0 : window.navigator) === null || _a === void 0 ? void 0 : _a.language) !== null && _b !== void 0 ? _b : 'en';
3437
+ const getDefaultDate = (type, selectedDate) => {
3438
+ const date = selectedDate ? dayjs_min(selectedDate).toDate() : today$1();
3439
+ return type === 'week' ? dayjs_min(date).startOf('isoWeek').toDate() : date;
3440
+ };
3441
+ function getDatepickerOptions(type, selectedDate) {
3442
+ const config = {
3443
+ enableOnReadonly: false,
3444
+ pickLevel: DatepickerTypeEnum[type],
3445
+ todayButton: true,
3446
+ todayButtonMode: 1,
3447
+ todayHighlight: true,
3448
+ weekStart: 1,
3449
+ language: 'browser',
3450
+ defaultViewDate: getDefaultDate(type, selectedDate)
3451
+ };
3452
+ return config;
3453
+ }
3454
+ function daysForLocale(weekday = 'long') {
3455
+ const date = new Date();
3456
+ const firstDayOfWeek = new Date(date.setUTCDate(date.getUTCDate() - date.getUTCDay()));
3457
+ const format = new Intl.DateTimeFormat(browserLanguage, { weekday }).format;
3458
+ return [...Array(7).keys()].map(day => format(firstDayOfWeek.setUTCDate(firstDayOfWeek.getUTCDate() + day)));
3459
+ }
3460
+ function monthsForLocale(month = 'long') {
3461
+ const date = new Date();
3462
+ const format = new Intl.DateTimeFormat(browserLanguage, { month }).format;
3463
+ return [...Array(12).keys()].map(month => format(date.setUTCMonth(month)));
3464
+ }
3465
+ if ((_c = Datepicker === null || Datepicker === void 0 ? void 0 : Datepicker.locales) === null || _c === void 0 ? void 0 : _c.browser) {
3466
+ Datepicker.locales.browser = {
3467
+ days: daysForLocale('long'),
3468
+ daysShort: daysForLocale('short'),
3469
+ daysMin: daysForLocale('narrow'),
3470
+ months: monthsForLocale('long'),
3471
+ monthsShort: monthsForLocale('short'),
3472
+ today: catIconRegistry.catI18nRegistry.t('input.today')
3473
+ };
3474
+ }
3475
+
3476
+ const catDatepickerCss = ".datepicker{width:min-content}.datepicker:not(.active){display:none}.datepicker-dropdown{position:absolute;z-index:20;padding-top:4px}.datepicker-dropdown.datepicker-orient-top{padding-top:0;padding-bottom:4px}.datepicker-picker{display:flex;flex-direction:column;border-radius:var(--cat-border-radius-m, 0.25rem);background-color:white}.datepicker-dropdown .datepicker-picker{box-shadow:0 4px 6px -2px rgba(27, 31, 38, 0.03), 0 12px 16px -4px rgba(27, 31, 38, 0.08)}.datepicker-main{flex:auto;padding:2px}.datepicker-footer{box-shadow:none;background-color:transparent}.datepicker-title{box-shadow:none;background-color:hsl(0, 0%, 96%);padding:0.375rem 0.75rem;text-align:center;font-weight:700}.datepicker-controls{display:flex}.datepicker-header .datepicker-controls{padding:2px 2px 0}.datepicker-controls .button{display:inline-flex;position:relative;align-items:center;justify-content:center;margin:0;border:1px solid rgb(var(--cat-border-color, 235, 236, 240));border-radius:var(--cat-border-radius-m, 0.25rem);box-shadow:none;background-color:hsl(0, 0%, 100%);cursor:pointer;padding:calc(0.375em - 1px) 0.75em;height:2.25em;vertical-align:top;text-align:center;line-height:1.5;white-space:nowrap;color:hsl(0, 0%, 21%);font-size:0.9375rem}.datepicker-controls .button:focus,.datepicker-controls .button:active{outline:none}.datepicker-controls .button:hover{border-color:#b8b8b8;color:hsl(0, 0%, 21%)}.datepicker-controls .button:focus{border-color:hsl(217, 71%, 53%);color:hsl(0, 0%, 21%)}.datepicker-controls .button:focus:not(:active){box-shadow:0 0 0 0.125em rgba(50, 115, 220, 0.25)}.datepicker-controls .button:active{border-color:#474747;color:hsl(0, 0%, 21%)}.datepicker-controls .button[disabled]{cursor:not-allowed}.datepicker-header .datepicker-controls .button{border-color:transparent;font-weight:bold}.datepicker-header .datepicker-controls .button:hover{background-color:#f2f4f7}.datepicker-header .datepicker-controls .button:active{background-color:#f2f4f7}.datepicker-footer .datepicker-controls .button{flex:auto;margin:calc(0.375rem - 1px) 0.375rem;border-radius:var(--cat-border-radius-s, 0.125rem);font-size:0.875rem}.datepicker-controls .view-switch{flex:auto}.datepicker-controls .prev-button,.datepicker-controls .next-button{padding-right:0.375rem;padding-left:0.375rem;flex:0 0 14.2857142857%}.datepicker-controls .prev-button.disabled,.datepicker-controls .next-button.disabled{visibility:hidden}.datepicker-view,.datepicker-grid{display:flex}.datepicker-view{align-items:stretch;width:17.5rem}.datepicker-grid{flex-wrap:wrap;flex:auto}.datepicker .days{display:flex;flex-direction:column;flex:auto}.datepicker .days-of-week{display:flex}.datepicker .week-numbers{display:flex;flex-direction:column;flex:0 0 9.6774193548%}.datepicker .weeks{display:flex;flex-direction:column;align-items:stretch;flex:auto}.datepicker span{display:flex;align-items:center;justify-content:center;border-radius:var(--cat-border-radius-m, 0.25rem);cursor:default;-webkit-touch-callout:none;user-select:none}.datepicker .dow{height:2rem;font-size:0.875rem0.9375rem/2;font-weight:700}.datepicker .week{flex:auto;color:rgb(var(--cat-font-color-muted, 81, 92, 108));font-size:0.875rem}.datepicker-cell,.datepicker .days .dow{flex-basis:14.2857142857%}.datepicker-cell{height:2.5rem}.datepicker-cell:not(.day){flex-basis:25%;height:5rem}.datepicker-cell:not(.disabled):hover{background-color:transparent;cursor:pointer}.datepicker-cell.focused:not(.selected){background-color:#f2f4f7}.datepicker-cell.selected,.datepicker-cell.selected:hover{background-color:rgb(var(--cat-primary-bg, 0, 129, 148));color:rgb(var(--cat-primary-fill, 255, 255, 255));font-weight:700}.datepicker-cell.disabled{color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.datepicker-cell.prev:not(.disabled),.datepicker-cell.next:not(.disabled){color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.datepicker-cell.prev.selected,.datepicker-cell.next.selected{color:rgb(var(--cat-primary-fill, 255, 255, 255))}.datepicker-cell.highlighted:not(.selected):not(.range):not(.today){border-radius:0;background-color:#f2f4f7}.datepicker-cell.highlighted:not(.selected):not(.range):not(.today):not(.disabled):hover{background-color:#f2f4f7}.datepicker-cell.highlighted:not(.selected):not(.range):not(.today).focused{background-color:#f2f4f7}.datepicker-cell.today:not(.selected){background-color:transparent}.datepicker-cell.today:not(.selected):not(.disabled){color:rgb(var(--cat-primary-text, 0, 129, 148))}.datepicker-cell.today.focused:not(.selected){background-color:#f2f4f7}.datepicker-cell.range-end:not(.selected),.datepicker-cell.range-start:not(.selected){background-color:#b8b8b8;color:rgb(var(--cat-primary-fill, 255, 255, 255))}.datepicker-cell.range-end.focused:not(.selected),.datepicker-cell.range-start.focused:not(.selected){background-color:#b3b3b3}.datepicker-cell.range-start:not(.range-end){border-radius:var(--cat-border-radius-m, 0.25rem) 0 0 var(--cat-border-radius-m, 0.25rem)}.datepicker-cell.range-end:not(.range-start){border-radius:0 var(--cat-border-radius-m, 0.25rem) var(--cat-border-radius-m, 0.25rem) 0}.datepicker-cell.range{border-radius:0;background-color:gainsboro}.datepicker-cell.range:not(.disabled):not(.focused):not(.today):hover{background-color:#d7d7d7}.datepicker-cell.range.disabled{color:#c6c6c6}.datepicker-cell.range.focused{background-color:#d1d1d1}.datepicker-input.in-edit{border-color:#276bda}.datepicker-input.in-edit:focus,.datepicker-input.in-edit:active{box-shadow:none}.datepicker-picker{border:1px solid rgb(var(--cat-border-color, 235, 236, 240))}.datepicker-main{padding:0.5rem 1rem}.datepicker-view:has(.week-numbers){width:19.375rem}.datepicker-view.months,.datepicker-view.years{width:20rem}.datepicker .dow,.datepicker .week{font-size:0.75rem;line-height:1rem;font-weight:700;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.datepicker-cell.today:not(.selected){box-shadow:inset 0 0 0 2px rgb(var(--cat-primary-bg, 0, 129, 148))}.datepicker-cell.focused:not(.selected),.datepicker-cell:not(.selected):not(.disabled):hover{background-color:#f2f4f7}.datepicker-controls{gap:0.5rem}.datepicker-header .datepicker-controls{padding:1rem 1rem 0}.datepicker-header .datepicker-controls .button{height:2.5rem}.datepicker-header .datepicker-controls .prev-button,.datepicker-header .datepicker-controls .next-button{flex-basis:2.5rem;font-size:1.25rem}.datepicker-footer .datepicker-controls{padding:0 1rem 1rem}.datepicker-footer .datepicker-controls .button{margin:0;height:2.5rem;font-size:0.9375rem}.datepicker-footer .datepicker-controls .button:hover,.datepicker-footer .datepicker-controls .button:active{border-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1)::before{content:\"\";width:700%;height:100%;border-radius:var(--cat-border-radius-m, 0.25rem);position:absolute;top:0;left:0;opacity:0;z-index:1}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).today:not(.selected)::before{box-shadow:inset 0 0 0 1.5px #008194;border-radius:var(--cat-border-radius-m, 0.25rem);opacity:1}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1):not(:hover)::before{background:none}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1):hover::before{opacity:1;background-color:transparent}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).selected,.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).selected.focused{color:white}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).selected::before,.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).selected.focused::before{opacity:1;background-color:rgb(var(--cat-primary-bg, 0, 129, 148));z-index:-1}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).focused{background:none}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).focused::before{opacity:1;background-color:#f2f4f7;z-index:-1}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell{position:relative}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.selected,.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.focused{z-index:2}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.today:not(.selected){box-shadow:none}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell:not(.disabled):hover{background-color:inherit}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.focused{background:none}";
3477
+
3478
+ const CatDatepicker = class {
3479
+ constructor(hostRef) {
3480
+ index.registerInstance(this, hostRef);
3481
+ this.catChange = index.createEvent(this, "catChange", 7);
3482
+ this.catFocus = index.createEvent(this, "catFocus", 7);
3483
+ this.catBlur = index.createEvent(this, "catBlur", 7);
3484
+ this.hasSlottedLabel = false;
3485
+ this.hasSlottedHint = false;
3486
+ this.requiredMarker = 'optional';
3487
+ this.horizontal = false;
3488
+ this.autoComplete = undefined;
3489
+ this.clearable = false;
3490
+ this.disabled = false;
3491
+ this.hint = undefined;
3492
+ this.icon = undefined;
3493
+ this.iconLeft = false;
3494
+ this.identifier = undefined;
3495
+ this.label = '';
3496
+ this.labelHidden = false;
3497
+ this.max = undefined;
3498
+ this.min = undefined;
3499
+ this.name = undefined;
3500
+ this.placeholder = undefined;
3501
+ this.textPrefix = undefined;
3502
+ this.textSuffix = undefined;
3503
+ this.readonly = false;
3504
+ this.required = false;
3505
+ this.format = 'mm/dd/yyyy';
3506
+ this.weekNumbers = true;
3507
+ this.type = 'date';
3508
+ this.datesDisabled = undefined;
3509
+ this.value = undefined;
3510
+ this.errors = undefined;
3511
+ this.errorUpdate = 0;
3512
+ this.nativeAttributes = undefined;
3513
+ }
3514
+ /**
3515
+ * Programmatically move focus to the input. Use this method instead of
529
3516
  * `input.focus()`.
530
3517
  *
531
3518
  * @param options An optional object providing options to control aspects of
@@ -535,37 +3522,176 @@ const CatCheckbox = class {
535
3522
  this.input.focus(options);
536
3523
  }
537
3524
  /**
538
- * Programmatically remove focus from the checkbox. Use this method instead of
3525
+ * Programmatically remove focus from the input. Use this method instead of
539
3526
  * `input.blur()`.
540
3527
  */
541
3528
  async doBlur() {
542
3529
  this.input.blur();
543
3530
  }
544
3531
  /**
545
- * Programmatically simulate a click on the checkbox.
3532
+ * Programmatically simulate a click on the input.
546
3533
  */
547
3534
  async doClick() {
548
3535
  this.input.click();
549
3536
  }
3537
+ /**
3538
+ * Clear the input.
3539
+ */
3540
+ async clear() {
3541
+ this.value = '';
3542
+ }
3543
+ componentWillRender() {
3544
+ this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
3545
+ this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
3546
+ }
550
3547
  render() {
551
- return (index.h(index.Host, null, index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } }, index.h("input", Object.assign({}, this.nativeAttributes, { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value !== undefined ? String(this.value) : this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) })), index.h("span", { class: "box", "aria-hidden": "true", part: "checkbox" }, index.h("svg", { class: "check", viewBox: "0 0 12 10" }, index.h("polyline", { points: "1.5 6 4.5 9 10.5 1" })), index.h("svg", { class: "dash", viewBox: "0 0 12 10" }, index.h("polyline", { points: "1.5 5 10.5 5" }))), index.h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (index.h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }) }))));
3548
+ return (index.h(index.Host, null, index.h("cat-input", { ref: el => (this.catInput = el), requiredMarker: this.requiredMarker, horizontal: this.horizontal, autoComplete: this.autoComplete, clearable: this.clearable, disabled: this.disabled, hint: this.hint, icon: this.icon, iconRight: !this.iconLeft, identifier: this.identifier, label: this.label, labelHidden: this.labelHidden, name: this.name, placeholder: this.placeholder, textPrefix: this.textPrefix, textSuffix: this.textSuffix, readonly: this.readonly, required: this.required, value: this.value, errors: this.errors, errorUpdate: this.errorUpdate, nativeAttributes: this.nativeAttributes, onCatChange: event => this.onCatChange(event), onCatFocus: event => this.onCatFocus(event.detail), onCatBlur: event => this.onCatBlur(event.detail) }, this.hasSlottedLabel && (index.h("span", { slot: "label" }, index.h("slot", { name: "label" }))), this.hasSlottedHint && (index.h("span", { slot: "hint" }, index.h("slot", { name: "hint" }))))));
552
3549
  }
553
- onInput(event) {
554
- this.checked = this.input.checked;
555
- if (!this.value || typeof this.value === 'boolean') {
556
- this.value = this.checked;
3550
+ componentDidLoad() {
3551
+ var _a;
3552
+ if (this.hostElement) {
3553
+ const inputWrapper = (_a = this.catInput.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.input-wrapper');
3554
+ const inputElement = inputWrapper === null || inputWrapper === void 0 ? void 0 : inputWrapper.querySelector('input');
3555
+ if (inputElement) {
3556
+ this.input = inputElement;
3557
+ }
3558
+ else {
3559
+ catIconRegistry.loglevel.error('[CatInput] Missing input element', this);
3560
+ return;
3561
+ }
3562
+ this.datepicker = new Datepicker(inputElement, Object.assign(Object.assign({}, getDatepickerOptions(this.type, this.value)), { container: inputWrapper, maxDate: this.max, minDate: this.min, datesDisabled: this.datesDisabled, prevArrow: '←', nextArrow: '→', weekNumbers: this.weekNumbers ? 1 : 0, format: {
3563
+ toValue: (dateStr) => this.type === 'week' ? this.fromISOWeek(dateStr) : Datepicker.parseDate(dateStr, this.dateFormat),
3564
+ toDisplay: (date) => this.type === 'week' ? this.toISOWeek(date).toString() : Datepicker.formatDate(date, this.dateFormat)
3565
+ }, beforeShowDay: (date) => (this.shouldHighlightAsToday(date) ? 'today' : null), beforeShowMonth: (date) => (this.shouldHighlightAsToday(date) ? 'today' : null), beforeShowYear: (date) => (this.shouldHighlightAsToday(date) ? 'today' : null) }));
3566
+ if (this.type === 'week') {
3567
+ this.datepicker.pickerElement.classList.add('weekly');
3568
+ }
3569
+ this.input.addEventListener('show', this.handleWeekDays.bind(this));
3570
+ this.input.addEventListener('changeDate', this.handleDateChange.bind(this));
3571
+ this.input.addEventListener('changeMonth', this.handleWeekDays.bind(this));
3572
+ this.input.addEventListener('changeView', this.handleWeekDays.bind(this));
3573
+ this.input.addEventListener('keydown', this.focusAllWeekDays.bind(this));
3574
+ }
3575
+ }
3576
+ disconnectedCallback() {
3577
+ this.input.removeEventListener('show', this.handleWeekDays.bind(this));
3578
+ this.input.removeEventListener('changeDate', this.handleDateChange.bind(this));
3579
+ this.input.removeEventListener('changeMonth', this.handleWeekDays.bind(this));
3580
+ this.input.removeEventListener('changeView', this.handleWeekDays.bind(this));
3581
+ this.input.removeEventListener('keydown', this.focusAllWeekDays.bind(this));
3582
+ }
3583
+ handleDateChange(event) {
3584
+ this.selectAllWeekDays(event.detail.date);
3585
+ this.value = this.input.value;
3586
+ this.catChange.emit();
3587
+ }
3588
+ handleWeekDays(event) {
3589
+ this.selectAllWeekDays(event);
3590
+ this.focusAllWeekDays();
3591
+ }
3592
+ selectAllWeekDays(event) {
3593
+ var _a, _b;
3594
+ const date = event instanceof Date ? event : (_a = event.detail) === null || _a === void 0 ? void 0 : _a.date;
3595
+ if (this.type !== 'week') {
3596
+ return;
3597
+ }
3598
+ if ((_b = this.input) === null || _b === void 0 ? void 0 : _b.value) {
3599
+ const firstDayOfWeek = dayjs_min(date).startOf('isoWeek');
3600
+ if (!firstDayOfWeek.isSame(dayjs_min(date).startOf('day'))) {
3601
+ this.datepicker.setDate(firstDayOfWeek.toDate());
3602
+ }
3603
+ else {
3604
+ this.addClassToAllWeekDays('selected');
3605
+ }
3606
+ }
3607
+ }
3608
+ focusAllWeekDays() {
3609
+ const date = dayjs_min(this.datepicker.picker.viewDate);
3610
+ if (this.type !== 'week' || !date) {
3611
+ return;
3612
+ }
3613
+ const firstDayOfWeek = dayjs_min(date).startOf('isoWeek');
3614
+ if (!firstDayOfWeek.isSame(dayjs_min(date).startOf('day'))) {
3615
+ this.datepicker.setFocusedDate(firstDayOfWeek.toDate());
3616
+ }
3617
+ this.addClassToAllWeekDays('focused');
3618
+ }
3619
+ addClassToAllWeekDays(className) {
3620
+ let weekdaysCount = 7;
3621
+ const pickerElement = this.datepicker.pickerElement;
3622
+ let selected = pickerElement.querySelector(`.datepicker-cell:not(.month):not(.year).${className}`);
3623
+ while (weekdaysCount > 1) {
3624
+ if (selected) {
3625
+ selected = selected.nextElementSibling;
3626
+ selected === null || selected === void 0 ? void 0 : selected.classList.add(className);
3627
+ weekdaysCount--;
3628
+ }
3629
+ else {
3630
+ break;
3631
+ }
557
3632
  }
3633
+ }
3634
+ onCatChange(event) {
3635
+ this.value = this.input.value;
558
3636
  this.catChange.emit(event);
559
3637
  }
560
- onFocus(event) {
3638
+ onCatFocus(event) {
561
3639
  this.catFocus.emit(event);
562
3640
  }
563
- onBlur(event) {
3641
+ onCatBlur(event) {
564
3642
  this.catBlur.emit(event);
565
3643
  }
3644
+ shouldHighlightAsToday(date) {
3645
+ const now = new Date();
3646
+ const isSameYear = now.getFullYear() === date.getFullYear();
3647
+ const isSameMonth = now.getMonth() === date.getMonth();
3648
+ const isSameDay = now.getDate() === date.getDate();
3649
+ switch (this.type) {
3650
+ case 'date':
3651
+ return isSameYear && isSameMonth && isSameDay;
3652
+ case 'week':
3653
+ return isSameYear && this.toISOWeek(now) === this.toISOWeek(date);
3654
+ case 'month':
3655
+ return isSameYear && isSameMonth;
3656
+ case 'year':
3657
+ return isSameYear;
3658
+ default:
3659
+ return false;
3660
+ }
3661
+ }
3662
+ // ----- Date handling
3663
+ get dateFormat() {
3664
+ const date = new Date(Date.UTC(3333, 10, 22));
3665
+ const dateStr = new Intl.DateTimeFormat('en-US', {
3666
+ year: 'numeric',
3667
+ month: this.type !== 'year' ? 'numeric' : undefined,
3668
+ day: this.type === 'date' || this.type === 'week' ? 'numeric' : undefined
3669
+ }).format(date);
3670
+ return dateStr.replace('22', 'dd').replace('11', 'mm').replace('3333', 'yyyy');
3671
+ }
3672
+ fromISOWeek(week) {
3673
+ if (typeof week === 'string' || typeof week === 'number') {
3674
+ const weekNumber = parseInt(week.toString(), 10);
3675
+ return isNaN(weekNumber) ? new Date() : this.fromISOWeekNumber(weekNumber);
3676
+ }
3677
+ return week;
3678
+ }
3679
+ fromISOWeekNumber(weekNumber, year = new Date().getFullYear()) {
3680
+ const refDate = new Date(Date.UTC(year, 0, 4)); // January 4th
3681
+ const diffDays = (weekNumber - 1) * 7 - (refDate.getUTCDay() || 7) + 1;
3682
+ const date = new Date(refDate);
3683
+ date.setUTCDate(date.getUTCDate() + diffDays);
3684
+ return date;
3685
+ }
3686
+ toISOWeek(date) {
3687
+ const currentDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
3688
+ currentDate.setUTCDate(currentDate.getUTCDate() + 4 - (currentDate.getUTCDay() || 7));
3689
+ const firstDayOfYear = new Date(Date.UTC(currentDate.getUTCFullYear(), 0, 1));
3690
+ return Math.ceil(((currentDate.getTime() - firstDayOfYear.getTime()) / 86400000 + 1) / 7);
3691
+ }
566
3692
  get hostElement() { return index.getElement(this); }
567
3693
  };
568
- CatCheckbox.style = catCheckboxCss;
3694
+ CatDatepicker.style = catDatepickerCss;
569
3695
 
570
3696
  function getAlignment(placement) {
571
3697
  return placement.split('-')[1];
@@ -1200,18 +4326,17 @@ const size = function (options) {
1200
4326
  }
1201
4327
  const overflowAvailableHeight = height - overflow[heightSide];
1202
4328
  const overflowAvailableWidth = width - overflow[widthSide];
4329
+ const noShift = !state.middlewareData.shift;
1203
4330
  let availableHeight = overflowAvailableHeight;
1204
4331
  let availableWidth = overflowAvailableWidth;
1205
4332
  if (isXAxis) {
1206
- availableWidth = min$1(
1207
- // Maximum clipping viewport width
1208
- width - overflow.right - overflow.left, overflowAvailableWidth);
4333
+ const maximumClippingWidth = width - overflow.left - overflow.right;
4334
+ availableWidth = alignment || noShift ? min$1(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
1209
4335
  } else {
1210
- availableHeight = min$1(
1211
- // Maximum clipping viewport height
1212
- height - overflow.bottom - overflow.top, overflowAvailableHeight);
4336
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
4337
+ availableHeight = alignment || noShift ? min$1(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
1213
4338
  }
1214
- if (!state.middlewareData.shift && !alignment) {
4339
+ if (noShift && !alignment) {
1215
4340
  const xMin = max$1(overflow.left, 0);
1216
4341
  const xMax = max$1(overflow.right, 0);
1217
4342
  const yMin = max$1(overflow.top, 0);
@@ -1249,28 +4374,9 @@ function getComputedStyle$1(element) {
1249
4374
  return getWindow(element).getComputedStyle(element);
1250
4375
  }
1251
4376
 
1252
- const min = Math.min;
1253
- const max = Math.max;
1254
- const round = Math.round;
1255
-
1256
- function getCssDimensions(element) {
1257
- const css = getComputedStyle$1(element);
1258
- let width = parseFloat(css.width);
1259
- let height = parseFloat(css.height);
1260
- const offsetWidth = element.offsetWidth;
1261
- const offsetHeight = element.offsetHeight;
1262
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1263
- if (shouldFallback) {
1264
- width = offsetWidth;
1265
- height = offsetHeight;
1266
- }
1267
- return {
1268
- width,
1269
- height,
1270
- fallback: shouldFallback
1271
- };
4377
+ function isNode(value) {
4378
+ return value instanceof getWindow(value).Node;
1272
4379
  }
1273
-
1274
4380
  function getNodeName(node) {
1275
4381
  return isNode(node) ? (node.nodeName || '').toLowerCase() : '';
1276
4382
  }
@@ -1294,9 +4400,6 @@ function isHTMLElement(value) {
1294
4400
  function isElement(value) {
1295
4401
  return value instanceof getWindow(value).Element;
1296
4402
  }
1297
- function isNode(value) {
1298
- return value instanceof getWindow(value).Node;
1299
- }
1300
4403
  function isShadowRoot(node) {
1301
4404
  // Browsers without `ShadowRoot` support.
1302
4405
  if (typeof ShadowRoot === 'undefined') {
@@ -1353,6 +4456,31 @@ function isLastTraversableNode(node) {
1353
4456
  return ['html', 'body', '#document'].includes(getNodeName(node));
1354
4457
  }
1355
4458
 
4459
+ const min = Math.min;
4460
+ const max = Math.max;
4461
+ const round = Math.round;
4462
+
4463
+ function getCssDimensions(element) {
4464
+ const css = getComputedStyle$1(element);
4465
+ // In testing environments, the `width` and `height` properties are empty
4466
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
4467
+ let width = parseFloat(css.width) || 0;
4468
+ let height = parseFloat(css.height) || 0;
4469
+ const hasOffset = isHTMLElement(element);
4470
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
4471
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
4472
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
4473
+ if (shouldFallback) {
4474
+ width = offsetWidth;
4475
+ height = offsetHeight;
4476
+ }
4477
+ return {
4478
+ width,
4479
+ height,
4480
+ fallback: shouldFallback
4481
+ };
4482
+ }
4483
+
1356
4484
  function unwrapElement(element) {
1357
4485
  return !isElement(element) ? element.contextElement : element;
1358
4486
  }
@@ -1434,16 +4562,12 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
1434
4562
  currentIFrame = getWindow(currentIFrame).frameElement;
1435
4563
  }
1436
4564
  }
1437
- return {
4565
+ return rectToClientRect({
1438
4566
  width,
1439
4567
  height,
1440
- top: y,
1441
- right: x + width,
1442
- bottom: y + height,
1443
- left: x,
1444
4568
  x,
1445
4569
  y
1446
- };
4570
+ });
1447
4571
  }
1448
4572
 
1449
4573
  function getDocumentElement(node) {
@@ -1642,6 +4766,13 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
1642
4766
  }
1643
4767
  return rectToClientRect(rect);
1644
4768
  }
4769
+ function hasFixedPositionAncestor(element, stopNode) {
4770
+ const parentNode = getParentNode(element);
4771
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
4772
+ return false;
4773
+ }
4774
+ return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
4775
+ }
1645
4776
 
1646
4777
  // A "clipping ancestor" is an `overflow` element with the characteristic of
1647
4778
  // clipping (or hiding) child elements. This returns all clipping ancestors
@@ -1659,19 +4790,17 @@ function getClippingElementAncestors(element, cache) {
1659
4790
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1660
4791
  while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1661
4792
  const computedStyle = getComputedStyle$1(currentNode);
1662
- const containingBlock = isContainingBlock(currentNode);
1663
- const shouldIgnoreCurrentNode = computedStyle.position === 'fixed';
1664
- if (shouldIgnoreCurrentNode) {
4793
+ const currentNodeIsContaining = isContainingBlock(currentNode);
4794
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1665
4795
  currentContainingBlockComputedStyle = null;
4796
+ }
4797
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
4798
+ if (shouldDropCurrentNode) {
4799
+ // Drop non-containing blocks.
4800
+ result = result.filter(ancestor => ancestor !== currentNode);
1666
4801
  } else {
1667
- const shouldDropCurrentNode = elementIsFixed ? !containingBlock && !currentContainingBlockComputedStyle : !containingBlock && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position);
1668
- if (shouldDropCurrentNode) {
1669
- // Drop non-containing blocks.
1670
- result = result.filter(ancestor => ancestor !== currentNode);
1671
- } else {
1672
- // Record last containing block for next iteration.
1673
- currentContainingBlockComputedStyle = computedStyle;
1674
- }
4802
+ // Record last containing block for next iteration.
4803
+ currentContainingBlockComputedStyle = computedStyle;
1675
4804
  }
1676
4805
  currentNode = getParentNode(currentNode);
1677
4806
  }
@@ -1708,10 +4837,7 @@ function getClippingRect(_ref) {
1708
4837
  }
1709
4838
 
1710
4839
  function getDimensions(element) {
1711
- if (isHTMLElement(element)) {
1712
- return getCssDimensions(element);
1713
- }
1714
- return element.getBoundingClientRect();
4840
+ return getCssDimensions(element);
1715
4841
  }
1716
4842
 
1717
4843
  function getTrueOffsetParent(element, polyfill) {
@@ -1739,6 +4865,9 @@ function getContainingBlock(element) {
1739
4865
  // such as table ancestors and cross browser bugs.
1740
4866
  function getOffsetParent(element, polyfill) {
1741
4867
  const window = getWindow(element);
4868
+ if (!isHTMLElement(element)) {
4869
+ return window;
4870
+ }
1742
4871
  let offsetParent = getTrueOffsetParent(element, polyfill);
1743
4872
  while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
1744
4873
  offsetParent = getTrueOffsetParent(offsetParent, polyfill);
@@ -1823,27 +4952,26 @@ function autoUpdate(reference, floating, update, options) {
1823
4952
  options = {};
1824
4953
  }
1825
4954
  const {
1826
- ancestorScroll: _ancestorScroll = true,
4955
+ ancestorScroll = true,
1827
4956
  ancestorResize = true,
1828
4957
  elementResize = true,
1829
4958
  animationFrame = false
1830
4959
  } = options;
1831
- const ancestorScroll = _ancestorScroll && !animationFrame;
1832
4960
  const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : reference.contextElement ? getOverflowAncestors(reference.contextElement) : []), ...getOverflowAncestors(floating)] : [];
1833
4961
  ancestors.forEach(ancestor => {
1834
- ancestorScroll && ancestor.addEventListener('scroll', update, {
1835
- passive: true
1836
- });
4962
+ // ignores Window, checks for [object VisualViewport]
4963
+ const isVisualViewport = !isElement(ancestor) && ancestor.toString().includes('V');
4964
+ if (ancestorScroll && (animationFrame ? isVisualViewport : true)) {
4965
+ ancestor.addEventListener('scroll', update, {
4966
+ passive: true
4967
+ });
4968
+ }
1837
4969
  ancestorResize && ancestor.addEventListener('resize', update);
1838
4970
  });
1839
4971
  let observer = null;
1840
4972
  if (elementResize) {
1841
- let initialUpdate = true;
1842
4973
  observer = new ResizeObserver(() => {
1843
- if (!initialUpdate) {
1844
- update();
1845
- }
1846
- initialUpdate = false;
4974
+ update();
1847
4975
  });
1848
4976
  isElement(reference) && !animationFrame && observer.observe(reference);
1849
4977
  if (!isElement(reference) && reference.contextElement && !animationFrame) {
@@ -1909,17 +5037,66 @@ const computePosition = (reference, floating, options) => {
1909
5037
  const timeTransitionS = 125;
1910
5038
 
1911
5039
  /*!
1912
- * tabbable 6.0.1
5040
+ * tabbable 6.1.2
1913
5041
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
1914
5042
  */
1915
- var candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]:not(slot)', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])', 'details>summary:first-of-type', 'details'];
5043
+ // NOTE: separate `:not()` selectors has broader browser support than the newer
5044
+ // `:not([inert], [inert] *)` (Feb 2023)
5045
+ // CAREFUL: JSDom does not support `:not([inert] *)` as a selector; using it causes
5046
+ // the entire query to fail, resulting in no nodes found, which will break a lot
5047
+ // of things... so we have to rely on JS to identify nodes inside an inert container
5048
+ var candidateSelectors = ['input:not([inert])', 'select:not([inert])', 'textarea:not([inert])', 'a[href]:not([inert])', 'button:not([inert])', '[tabindex]:not(slot):not([inert])', 'audio[controls]:not([inert])', 'video[controls]:not([inert])', '[contenteditable]:not([contenteditable="false"]):not([inert])', 'details>summary:first-of-type:not([inert])', 'details:not([inert])'];
1916
5049
  var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
1917
5050
  var NoElement = typeof Element === 'undefined';
1918
5051
  var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1919
5052
  var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
1920
- return element.getRootNode();
5053
+ var _element$getRootNode;
5054
+ return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
1921
5055
  } : function (element) {
1922
- return element.ownerDocument;
5056
+ return element === null || element === void 0 ? void 0 : element.ownerDocument;
5057
+ };
5058
+
5059
+ /**
5060
+ * Determines if a node is inert or in an inert ancestor.
5061
+ * @param {Element} [node]
5062
+ * @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to
5063
+ * see if any of them are inert. If false, only `node` itself is considered.
5064
+ * @returns {boolean} True if inert itself or by way of being in an inert ancestor.
5065
+ * False if `node` is falsy.
5066
+ */
5067
+ var isInert = function isInert(node, lookUp) {
5068
+ var _node$getAttribute;
5069
+ if (lookUp === void 0) {
5070
+ lookUp = true;
5071
+ }
5072
+ // CAREFUL: JSDom does not support inert at all, so we can't use the `HTMLElement.inert`
5073
+ // JS API property; we have to check the attribute, which can either be empty or 'true';
5074
+ // if it's `null` (not specified) or 'false', it's an active element
5075
+ var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, 'inert');
5076
+ var inert = inertAtt === '' || inertAtt === 'true';
5077
+
5078
+ // NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
5079
+ // if it weren't for `matches()` not being a function on shadow roots; the following
5080
+ // code works for any kind of node
5081
+ // CAREFUL: JSDom does not appear to support certain selectors like `:not([inert] *)`
5082
+ // so it likely would not support `:is([inert] *)` either...
5083
+ var result = inert || lookUp && node && isInert(node.parentNode); // recursive
5084
+
5085
+ return result;
5086
+ };
5087
+
5088
+ /**
5089
+ * Determines if a node's content is editable.
5090
+ * @param {Element} [node]
5091
+ * @returns True if it's content-editable; false if it's not or `node` is falsy.
5092
+ */
5093
+ var isContentEditable = function isContentEditable(node) {
5094
+ var _node$getAttribute2;
5095
+ // CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have
5096
+ // to use the attribute directly to check for this, which can either be empty or 'true';
5097
+ // if it's `null` (not specified) or 'false', it's a non-editable element
5098
+ var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, 'contenteditable');
5099
+ return attValue === '' || attValue === 'true';
1923
5100
  };
1924
5101
 
1925
5102
  /**
@@ -1929,6 +5106,11 @@ var getRootNode = !NoElement && Element.prototype.getRootNode ? function (elemen
1929
5106
  * @returns {Element[]}
1930
5107
  */
1931
5108
  var getCandidates = function getCandidates(el, includeContainer, filter) {
5109
+ // even if `includeContainer=false`, we still have to check it for inertness because
5110
+ // if it's inert, all its children are inert
5111
+ if (isInert(el)) {
5112
+ return [];
5113
+ }
1932
5114
  var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
1933
5115
  if (includeContainer && matches.call(el, candidateSelector)) {
1934
5116
  candidates.unshift(el);
@@ -1976,6 +5158,11 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
1976
5158
  var elementsToCheck = Array.from(elements);
1977
5159
  while (elementsToCheck.length) {
1978
5160
  var element = elementsToCheck.shift();
5161
+ if (isInert(element, false)) {
5162
+ // no need to look up since we're drilling down
5163
+ // anything inside this container will also be inert
5164
+ continue;
5165
+ }
1979
5166
  if (element.tagName === 'SLOT') {
1980
5167
  // add shadow dom slot scope (slot itself cannot be focusable)
1981
5168
  var assigned = element.assignedElements();
@@ -2000,7 +5187,11 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
2000
5187
  var shadowRoot = element.shadowRoot ||
2001
5188
  // check for an undisclosed shadow
2002
5189
  typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);
2003
- var validShadowRoot = !options.shadowRootFilter || options.shadowRootFilter(element);
5190
+
5191
+ // no inert look up because we're already drilling down and checking for inertness
5192
+ // on the way down, so all containers to this root node should have already been
5193
+ // vetted as non-inert
5194
+ var validShadowRoot = !isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
2004
5195
  if (shadowRoot && validShadowRoot) {
2005
5196
  // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
2006
5197
  // shadow exists, so look at light dom children as fallback BUT create a scope for any
@@ -2039,7 +5230,7 @@ var getTabindex = function getTabindex(node, isScope) {
2039
5230
  // isScope is positive for custom element with shadow root or slot that by default
2040
5231
  // have tabIndex -1, but need to be sorted by document order in order for their
2041
5232
  // content to be inserted in the correct position
2042
- if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node.isContentEditable) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
5233
+ if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
2043
5234
  return 0;
2044
5235
  }
2045
5236
  }
@@ -2099,7 +5290,7 @@ var isNonTabbableRadio = function isNonTabbableRadio(node) {
2099
5290
 
2100
5291
  // determines if a node is ultimately attached to the window's document
2101
5292
  var isNodeAttached = function isNodeAttached(node) {
2102
- var _nodeRootHost;
5293
+ var _nodeRoot;
2103
5294
  // The root node is the shadow root if the node is in a shadow DOM; some document otherwise
2104
5295
  // (but NOT _the_ document; see second 'If' comment below for more).
2105
5296
  // If rootNode is shadow root, it'll have a host, which is the element to which the shadow
@@ -2119,15 +5310,28 @@ var isNodeAttached = function isNodeAttached(node) {
2119
5310
  // to ignore the rootNode at this point, and use `node.ownerDocument`. Otherwise,
2120
5311
  // using `rootNode.contains(node)` will _always_ be true we'll get false-positives when
2121
5312
  // node is actually detached.
2122
- var nodeRootHost = getRootNode(node).host;
2123
- var attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && _nodeRootHost.ownerDocument.contains(nodeRootHost) || node.ownerDocument.contains(node));
2124
- while (!attached && nodeRootHost) {
2125
- var _nodeRootHost2;
2126
- // since it's not attached and we have a root host, the node MUST be in a nested shadow DOM,
2127
- // which means we need to get the host's host and check if that parent host is contained
2128
- // in (i.e. attached to) the document
2129
- nodeRootHost = getRootNode(nodeRootHost).host;
2130
- attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && _nodeRootHost2.ownerDocument.contains(nodeRootHost));
5313
+ // NOTE: If `nodeRootHost` or `node` happens to be the `document` itself (which is possible
5314
+ // if a tabbable/focusable node was quickly added to the DOM, focused, and then removed
5315
+ // from the DOM as in https://github.com/focus-trap/focus-trap-react/issues/905), then
5316
+ // `ownerDocument` will be `null`, hence the optional chaining on it.
5317
+ var nodeRoot = node && getRootNode(node);
5318
+ var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
5319
+
5320
+ // in some cases, a detached node will return itself as the root instead of a document or
5321
+ // shadow root object, in which case, we shouldn't try to look further up the host chain
5322
+ var attached = false;
5323
+ if (nodeRoot && nodeRoot !== node) {
5324
+ var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
5325
+ attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node));
5326
+ while (!attached && nodeRootHost) {
5327
+ var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
5328
+ // since it's not attached and we have a root host, the node MUST be in a nested shadow DOM,
5329
+ // which means we need to get the host's host and check if that parent host is contained
5330
+ // in (i.e. attached to) the document
5331
+ nodeRoot = getRootNode(nodeRootHost);
5332
+ nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
5333
+ attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
5334
+ }
2131
5335
  }
2132
5336
  return attached;
2133
5337
  };
@@ -2262,7 +5466,11 @@ var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
2262
5466
  return false;
2263
5467
  };
2264
5468
  var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
2265
- if (node.disabled || isHiddenInput(node) || isHidden(node, options) ||
5469
+ if (node.disabled ||
5470
+ // we must do an inert look up to filter out any elements inside an inert ancestor
5471
+ // because we're limited in the type of selectors we can use in JSDom (see related
5472
+ // note related to `candidateSelectors`)
5473
+ isInert(node) || isHiddenInput(node) || isHidden(node, options) ||
2266
5474
  // For a details element with a summary, the summary element gets the focus
2267
5475
  isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
2268
5476
  return false;
@@ -2366,7 +5574,7 @@ var isFocusable = function isFocusable(node, options) {
2366
5574
  };
2367
5575
 
2368
5576
  /*!
2369
- * focus-trap 7.2.0
5577
+ * focus-trap 7.4.3
2370
5578
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
2371
5579
  */
2372
5580
 
@@ -2575,23 +5783,24 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2575
5783
  /**
2576
5784
  * Finds the index of the container that contains the element.
2577
5785
  * @param {HTMLElement} element
5786
+ * @param {Event} [event]
2578
5787
  * @returns {number} Index of the container in either `state.containers` or
2579
5788
  * `state.containerGroups` (the order/length of these lists are the same); -1
2580
5789
  * if the element isn't found.
2581
5790
  */
2582
- var findContainerIndex = function findContainerIndex(element) {
5791
+ var findContainerIndex = function findContainerIndex(element, event) {
5792
+ var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === 'function' ? event.composedPath() : undefined;
2583
5793
  // NOTE: search `containerGroups` because it's possible a group contains no tabbable
2584
5794
  // nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
2585
5795
  // and we still need to find the element in there
2586
5796
  return state.containerGroups.findIndex(function (_ref) {
2587
5797
  var container = _ref.container,
2588
5798
  tabbableNodes = _ref.tabbableNodes;
2589
- return container.contains(element) ||
2590
- // fall back to explicit tabbable search which will take into consideration any
5799
+ return container.contains(element) || ( // fall back to explicit tabbable search which will take into consideration any
2591
5800
  // web components if the `tabbableOptions.getShadowRoot` option was used for
2592
5801
  // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
2593
5802
  // look inside web components even if open)
2594
- tabbableNodes.find(function (node) {
5803
+ composedPath === null || composedPath === void 0 ? void 0 : composedPath.includes(container)) || tabbableNodes.find(function (node) {
2595
5804
  return node === element;
2596
5805
  });
2597
5806
  });
@@ -2647,8 +5856,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2647
5856
  if (node === false) {
2648
5857
  return false;
2649
5858
  }
2650
- if (node === undefined) {
2651
- // option not specified: use fallback options
5859
+ if (node === undefined || !isFocusable(node, config.tabbableOptions)) {
5860
+ // option not specified nor focusable: use fallback options
2652
5861
  if (findContainerIndex(doc.activeElement) >= 0) {
2653
5862
  node = doc.activeElement;
2654
5863
  } else {
@@ -2752,25 +5961,20 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2752
5961
  // so that it precedes the focus event.
2753
5962
  var checkPointerDown = function checkPointerDown(e) {
2754
5963
  var target = getActualTarget(e);
2755
- if (findContainerIndex(target) >= 0) {
5964
+ if (findContainerIndex(target, e) >= 0) {
2756
5965
  // allow the click since it ocurred inside the trap
2757
5966
  return;
2758
5967
  }
2759
5968
  if (valueOrHandler(config.clickOutsideDeactivates, e)) {
2760
5969
  // immediately deactivate the trap
2761
5970
  trap.deactivate({
2762
- // if, on deactivation, we should return focus to the node originally-focused
2763
- // when the trap was activated (or the configured `setReturnFocus` node),
2764
- // then assume it's also OK to return focus to the outside node that was
2765
- // just clicked, causing deactivation, as long as that node is focusable;
2766
- // if it isn't focusable, then return focus to the original node focused
2767
- // on activation (or the configured `setReturnFocus` node)
2768
5971
  // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
2769
5972
  // which will result in the outside click setting focus to the node
2770
- // that was clicked, whether it's focusable or not; by setting
5973
+ // that was clicked (and if not focusable, to "nothing"); by setting
2771
5974
  // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
2772
- // on activation (or the configured `setReturnFocus` node)
2773
- returnFocus: config.returnFocusOnDeactivate && !isFocusable(target, config.tabbableOptions)
5975
+ // on activation (or the configured `setReturnFocus` node), whether the
5976
+ // outside click was on a focusable node or not
5977
+ returnFocus: config.returnFocusOnDeactivate
2774
5978
  });
2775
5979
  return;
2776
5980
  }
@@ -2790,7 +5994,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2790
5994
  // In case focus escapes the trap for some strange reason, pull it back in.
2791
5995
  var checkFocusIn = function checkFocusIn(e) {
2792
5996
  var target = getActualTarget(e);
2793
- var targetContained = findContainerIndex(target) >= 0;
5997
+ var targetContained = findContainerIndex(target, e) >= 0;
2794
5998
 
2795
5999
  // In Firefox when you Tab out of an iframe the Document is briefly focused.
2796
6000
  if (targetContained || target instanceof Document) {
@@ -2817,7 +6021,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2817
6021
  // make sure the target is actually contained in a group
2818
6022
  // NOTE: the target may also be the container itself if it's focusable
2819
6023
  // with tabIndex='-1' and was given initial focus
2820
- var containerIndex = findContainerIndex(target);
6024
+ var containerIndex = findContainerIndex(target, event);
2821
6025
  var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;
2822
6026
  if (containerIndex < 0) {
2823
6027
  // target not found in any group: quite possible focus has escaped the trap,
@@ -2918,7 +6122,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2918
6122
  };
2919
6123
  var checkClick = function checkClick(e) {
2920
6124
  var target = getActualTarget(e);
2921
- if (findContainerIndex(target) >= 0) {
6125
+ if (findContainerIndex(target, e) >= 0) {
2922
6126
  return;
2923
6127
  }
2924
6128
  if (valueOrHandler(config.clickOutsideDeactivates, e)) {
@@ -2979,6 +6183,43 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2979
6183
  return trap;
2980
6184
  };
2981
6185
 
6186
+ //
6187
+ // MUTATION OBSERVER
6188
+ //
6189
+
6190
+ var checkDomRemoval = function checkDomRemoval(mutations) {
6191
+ var isFocusedNodeRemoved = mutations.some(function (mutation) {
6192
+ var removedNodes = Array.from(mutation.removedNodes);
6193
+ return removedNodes.some(function (node) {
6194
+ return node === state.mostRecentlyFocusedNode;
6195
+ });
6196
+ });
6197
+
6198
+ // If the currently focused is removed then browsers will move focus to the
6199
+ // <body> element. If this happens, try to move focus back into the trap.
6200
+ if (isFocusedNodeRemoved) {
6201
+ tryFocus(getInitialFocusNode());
6202
+ }
6203
+ };
6204
+
6205
+ // Use MutationObserver - if supported - to detect if focused node is removed
6206
+ // from the DOM.
6207
+ var mutationObserver = typeof window !== 'undefined' && 'MutationObserver' in window ? new MutationObserver(checkDomRemoval) : undefined;
6208
+ var updateObservedNodes = function updateObservedNodes() {
6209
+ if (!mutationObserver) {
6210
+ return;
6211
+ }
6212
+ mutationObserver.disconnect();
6213
+ if (state.active && !state.paused) {
6214
+ state.containers.map(function (container) {
6215
+ mutationObserver.observe(container, {
6216
+ subtree: true,
6217
+ childList: true
6218
+ });
6219
+ });
6220
+ }
6221
+ };
6222
+
2982
6223
  //
2983
6224
  // TRAP DEFINITION
2984
6225
  //
@@ -3003,17 +6244,14 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
3003
6244
  state.active = true;
3004
6245
  state.paused = false;
3005
6246
  state.nodeFocusedBeforeActivation = doc.activeElement;
3006
- if (onActivate) {
3007
- onActivate();
3008
- }
6247
+ onActivate === null || onActivate === void 0 ? void 0 : onActivate();
3009
6248
  var finishActivation = function finishActivation() {
3010
6249
  if (checkCanFocusTrap) {
3011
6250
  updateTabbableNodes();
3012
6251
  }
3013
6252
  addListeners();
3014
- if (onPostActivate) {
3015
- onPostActivate();
3016
- }
6253
+ updateObservedNodes();
6254
+ onPostActivate === null || onPostActivate === void 0 ? void 0 : onPostActivate();
3017
6255
  };
3018
6256
  if (checkCanFocusTrap) {
3019
6257
  checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
@@ -3036,22 +6274,19 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
3036
6274
  removeListeners();
3037
6275
  state.active = false;
3038
6276
  state.paused = false;
6277
+ updateObservedNodes();
3039
6278
  activeFocusTraps.deactivateTrap(trapStack, trap);
3040
6279
  var onDeactivate = getOption(options, 'onDeactivate');
3041
6280
  var onPostDeactivate = getOption(options, 'onPostDeactivate');
3042
6281
  var checkCanReturnFocus = getOption(options, 'checkCanReturnFocus');
3043
6282
  var returnFocus = getOption(options, 'returnFocus', 'returnFocusOnDeactivate');
3044
- if (onDeactivate) {
3045
- onDeactivate();
3046
- }
6283
+ onDeactivate === null || onDeactivate === void 0 ? void 0 : onDeactivate();
3047
6284
  var finishDeactivation = function finishDeactivation() {
3048
6285
  delay$1(function () {
3049
6286
  if (returnFocus) {
3050
6287
  tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
3051
6288
  }
3052
- if (onPostDeactivate) {
3053
- onPostDeactivate();
3054
- }
6289
+ onPostDeactivate === null || onPostDeactivate === void 0 ? void 0 : onPostDeactivate();
3055
6290
  });
3056
6291
  };
3057
6292
  if (returnFocus && checkCanReturnFocus) {
@@ -3061,21 +6296,31 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
3061
6296
  finishDeactivation();
3062
6297
  return this;
3063
6298
  },
3064
- pause: function pause() {
6299
+ pause: function pause(pauseOptions) {
3065
6300
  if (state.paused || !state.active) {
3066
6301
  return this;
3067
6302
  }
6303
+ var onPause = getOption(pauseOptions, 'onPause');
6304
+ var onPostPause = getOption(pauseOptions, 'onPostPause');
3068
6305
  state.paused = true;
6306
+ onPause === null || onPause === void 0 ? void 0 : onPause();
3069
6307
  removeListeners();
6308
+ updateObservedNodes();
6309
+ onPostPause === null || onPostPause === void 0 ? void 0 : onPostPause();
3070
6310
  return this;
3071
6311
  },
3072
- unpause: function unpause() {
6312
+ unpause: function unpause(unpauseOptions) {
3073
6313
  if (!state.paused || !state.active) {
3074
6314
  return this;
3075
6315
  }
6316
+ var onUnpause = getOption(unpauseOptions, 'onUnpause');
6317
+ var onPostUnpause = getOption(unpauseOptions, 'onPostUnpause');
3076
6318
  state.paused = false;
6319
+ onUnpause === null || onUnpause === void 0 ? void 0 : onUnpause();
3077
6320
  updateTabbableNodes();
3078
6321
  addListeners();
6322
+ updateObservedNodes();
6323
+ onPostUnpause === null || onPostUnpause === void 0 ? void 0 : onPostUnpause();
3079
6324
  return this;
3080
6325
  },
3081
6326
  updateContainerElements: function updateContainerElements(containerElements) {
@@ -3086,6 +6331,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
3086
6331
  if (state.active) {
3087
6332
  updateTabbableNodes();
3088
6333
  }
6334
+ updateObservedNodes();
3089
6335
  return this;
3090
6336
  }
3091
6337
  };
@@ -3099,7 +6345,7 @@ const firstTabbable = (container) => {
3099
6345
  return (container ? tabbable(container, { includeContainer: true, getShadowRoot: true }) : []).shift();
3100
6346
  };
3101
6347
 
3102
- const catDropdownCss = ":host{display:contents}:host([hidden]){display:none}::slotted(nav){padding-top:0.5rem;padding-bottom:0.5rem;min-width:8rem;max-width:16rem}.content{position:fixed;background:white;display:none;-webkit-overflow-scrolling:touch;min-height:2rem;max-height:calc(100vh - 48px);box-shadow:0 4px 6px -2px rgba(27, 31, 38, 0.03), 0 12px 16px -4px rgba(27, 31, 38, 0.08);border-radius:var(--cat-border-radius-m, 0.25rem);z-index:100;opacity:0;transition:transform 0.13s cubic-bezier(0.3, 0, 0.8, 0.15), opacity 0.13s cubic-bezier(0.3, 0, 0.8, 0.15)}.content[data-placement^=top]{transform:translateY(1rem)}.content[data-placement^=left]{transform:translateX(1rem)}.content[data-placement^=right]{transform:translateX(-1rem)}.content[data-placement^=bottom]{transform:translateY(-1rem)}.content.show{opacity:1;transform:translateX(0);transform:translateY(0);transition:transform 0.5s cubic-bezier(0.05, 0.7, 0.1, 1), opacity 0.5s cubic-bezier(0.05, 0.7, 0.1, 1)}.content.overflow-auto{overflow:auto}";
6348
+ const catDropdownCss = ":host{display:contents}:host([hidden]){display:none}::slotted(nav){padding-top:0.5rem;padding-bottom:0.5rem;min-width:8rem;max-width:16rem}.content{position:fixed;background:white;display:none;-webkit-overflow-scrolling:touch;min-height:2rem;max-height:calc(100vh - 48px);box-shadow:0 4px 6px -2px rgba(27, 31, 38, 0.03), 0 12px 16px -4px rgba(27, 31, 38, 0.08);border-radius:var(--cat-border-radius-m, 0.25rem);border:1px solid rgb(var(--cat-border-color, 235, 236, 240));z-index:100;opacity:0;transition:transform 0.13s cubic-bezier(0.3, 0, 0.8, 0.15), opacity 0.13s cubic-bezier(0.3, 0, 0.8, 0.15)}.content[data-placement^=top]{transform:translateY(1rem)}.content[data-placement^=left]{transform:translateX(1rem)}.content[data-placement^=right]{transform:translateX(-1rem)}.content[data-placement^=bottom]{transform:translateY(-1rem)}.content.show{opacity:1;transform:translateX(0);transform:translateY(0);transition:transform 0.5s cubic-bezier(0.05, 0.7, 0.1, 1), opacity 0.5s cubic-bezier(0.05, 0.7, 0.1, 1)}.content.overflow-auto{overflow:auto}";
3103
6349
 
3104
6350
  let nextUniqueId$7 = 0;
3105
6351
  const CatDropdown = class {
@@ -3121,8 +6367,9 @@ const CatDropdown = class {
3121
6367
  this.initTrigger();
3122
6368
  this.toggle();
3123
6369
  }
6370
+ const button = event.target;
3124
6371
  // hide dropdown on button click
3125
- if (!this.noAutoClose && event.composedPath().includes(this.content)) {
6372
+ if (!this.noAutoClose && event.composedPath().includes(this.content) && button.slot !== 'trigger') {
3126
6373
  this.close();
3127
6374
  }
3128
6375
  }
@@ -3155,9 +6402,15 @@ const CatDropdown = class {
3155
6402
  getShadowRoot: true
3156
6403
  },
3157
6404
  allowOutsideClick: true,
3158
- clickOutsideDeactivates: event => !this.noAutoClose &&
3159
- !event.composedPath().includes(this.content) &&
3160
- (!this.trigger || !event.composedPath().includes(this.trigger)),
6405
+ clickOutsideDeactivates: event => {
6406
+ const shouldClose = !this.noAutoClose &&
6407
+ !event.composedPath().includes(this.content) &&
6408
+ (!this.trigger || !event.composedPath().includes(this.trigger));
6409
+ if (shouldClose) {
6410
+ this.close();
6411
+ }
6412
+ return shouldClose;
6413
+ },
3161
6414
  onPostDeactivate: () => this.close()
3162
6415
  });
3163
6416
  this.trap.activate();
@@ -3167,7 +6420,7 @@ const CatDropdown = class {
3167
6420
  * Closes the dropdown.
3168
6421
  */
3169
6422
  async close() {
3170
- if (this.isOpen === null) {
6423
+ if (this.isOpen === null || !this.isOpen) {
3171
6424
  return; // busy
3172
6425
  }
3173
6426
  this.isOpen = null;
@@ -3288,7 +6541,7 @@ const CatFormGroup = class {
3288
6541
  return (index.h(index.Host, { style: { '--label-size': this.labelSize } }, index.h("slot", { onSlotchange: this.onSlotChange.bind(this) })));
3289
6542
  }
3290
6543
  onSlotChange() {
3291
- this.formElements = Array.from(this.hostElement.querySelectorAll('cat-textarea, cat-input, cat-select, cat-label'));
6544
+ this.formElements = Array.from(this.hostElement.querySelectorAll('cat-textarea, cat-input, cat-select, cat-label, cat-datepicker'));
3292
6545
  this.onRequiredMarker(this.requiredMarker);
3293
6546
  this.onHorizontal(this.horizontal);
3294
6547
  }
@@ -3336,7 +6589,7 @@ function isNumberValue(value) {
3336
6589
  return !isNaN(parseFloat(value)) && !isNaN(Number(value));
3337
6590
  }
3338
6591
 
3339
- const catInputCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}.cat-bg-primary{background-color:rgb(var(--cat-primary-bg, 0, 129, 148)) !important;color:rgb(var(--cat-primary-fill, 255, 255, 255)) !important}.cat-bg-primary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primary-hover:hover{background-color:rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;color:rgb(var(--cat-primary-fill-hover, 255, 255, 255)) !important}.cat-text-primary,.cat-link-primary{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-link-primary,.cat-text-primary-hover{transition:color 0.13s}.cat-link-primary:hover,.cat-text-primary-hover:hover{color:rgb(var(--cat-primary-text-hover, 1, 115, 132)) !important}.cat-link-primary:active,.cat-text-primary-hover:active{color:rgb(var(--cat-primary-text-active, 2, 99, 113)) !important}.cat-bg-primaryInverted{background-color:#93b4f2 !important;color:black !important}.cat-bg-primaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primaryInverted-hover:hover{background-color:#93b4f2 !important;color:black !important}.cat-text-primaryInverted,.cat-link-primaryInverted{color:#93b4f2 !important}.cat-link-primaryInverted,.cat-text-primaryInverted-hover{transition:color 0.13s}.cat-link-primaryInverted:hover,.cat-text-primaryInverted-hover:hover{color:#93b4f2 !important}.cat-link-primaryInverted:active,.cat-text-primaryInverted-hover:active{color:#93b4f2 !important}.cat-bg-secondary{background-color:rgb(var(--cat-secondary-bg, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill, 255, 255, 255)) !important}.cat-bg-secondary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondary-hover:hover{background-color:rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill-hover, 255, 255, 255)) !important}.cat-text-secondary,.cat-link-secondary{color:rgb(var(--cat-secondary-text, 0, 0, 0)) !important}.cat-link-secondary,.cat-text-secondary-hover{transition:color 0.13s}.cat-link-secondary:hover,.cat-text-secondary-hover:hover{color:rgb(var(--cat-secondary-text-hover, 0, 0, 0)) !important}.cat-link-secondary:active,.cat-text-secondary-hover:active{color:rgb(var(--cat-secondary-text-active, 0, 0, 0)) !important}.cat-bg-secondaryInverted{background-color:#697687 !important;color:black !important}.cat-bg-secondaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondaryInverted-hover:hover{background-color:#697687 !important;color:black !important}.cat-text-secondaryInverted,.cat-link-secondaryInverted{color:white !important}.cat-link-secondaryInverted,.cat-text-secondaryInverted-hover{transition:color 0.13s}.cat-link-secondaryInverted:hover,.cat-text-secondaryInverted-hover:hover{color:white !important}.cat-link-secondaryInverted:active,.cat-text-secondaryInverted-hover:active{color:white !important}.cat-bg-success{background-color:rgb(var(--cat-success-bg-, 0, 132, 88)) !important;color:rgb(var(--cat-success-fill, 255, 255, 255)) !important}.cat-bg-success-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-success-hover:hover{background-color:rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;color:rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important}.cat-text-success,.cat-link-success{color:rgb(var(--cat-success-text, 0, 132, 88)) !important}.cat-link-success,.cat-text-success-hover{transition:color 0.13s}.cat-link-success:hover,.cat-text-success-hover:hover{color:rgb(var(--cat-success-text-hover, 0, 117, 78)) !important}.cat-link-success:active,.cat-text-success-hover:active{color:rgb(var(--cat-success-text-active, 0, 105, 70)) !important}.cat-bg-warning{background-color:rgb(var(--cat-warning-bg, 255, 206, 128)) !important;color:rgb(var(--cat-warning-fill, 0, 0, 0)) !important}.cat-bg-warning-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-warning-hover:hover{background-color:rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;color:rgb(var(--cat-warning-fill-hover, 0, 0, 0)) !important}.cat-text-warning,.cat-link-warning{color:rgb(var(--cat-warning-text, 159, 97, 0)) !important}.cat-link-warning,.cat-text-warning-hover{transition:color 0.13s}.cat-link-warning:hover,.cat-text-warning-hover:hover{color:rgb(var(--cat-warning-text-hover, 159, 97, 0)) !important}.cat-link-warning:active,.cat-text-warning-hover:active{color:rgb(var(--cat-warning-text-active, 159, 97, 0)) !important}.cat-bg-danger{background-color:rgb(var(--cat-danger-bg, 217, 52, 13)) !important;color:rgb(var(--cat-danger-fill, 255, 255, 255)) !important}.cat-bg-danger-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-danger-hover:hover{background-color:rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;color:rgb(var(--cat-danger-fill-hover, 255, 255, 255)) !important}.cat-text-danger,.cat-link-danger{color:rgb(var(--cat-danger-text, 217, 52, 13)) !important}.cat-link-danger,.cat-text-danger-hover{transition:color 0.13s}.cat-link-danger:hover,.cat-text-danger-hover:hover{color:rgb(var(--cat-danger-text-hover, 194, 46, 11)) !important}.cat-link-danger:active,.cat-text-danger-hover:active{color:rgb(var(--cat-danger-text-active, 174, 42, 10)) !important}.cat-active{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-muted{color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}.label{overflow:hidden;word-wrap:break-word;word-break:break-word}.label-container{flex-basis:var(--label-size, 33.33%)}.label-container.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.label-container .label-wrapper{display:flex;gap:0.25rem}.label-metadata{display:flex;flex-shrink:0;flex-grow:1;justify-content:space-between;gap:0.25rem}.label-optional{display:flex;align-items:center;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.label-character-count{display:flex;align-items:center;margin-left:auto;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.input-horizontal .label-wrapper,.textarea-horizontal .label-wrapper,.select-horizontal .label-wrapper{flex-direction:column}.input-horizontal label,.textarea-horizontal label,.select-horizontal label{min-height:2.5rem;display:inline-flex;align-items:center}.input-horizontal .label-metadata,.textarea-horizontal .label-metadata,.select-horizontal .label-metadata{justify-content:flex-start}.input-horizontal .label-metadata .label-character-count,.textarea-horizontal .label-metadata .label-character-count,.select-horizontal .label-metadata .label-character-count{margin-left:0}:host{display:flex;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);margin-bottom:1rem}:host([hidden]){display:none}.input-field,.input-container{display:flex;flex-direction:column;gap:0.5rem;flex:1 1 auto}.input-field.input-horizontal{flex-direction:row;gap:1rem}.input-wrapper{display:flex;align-items:stretch;gap:0.75rem;padding:0 0.75rem;height:2.5rem;overflow:hidden;background:white;border-radius:var(--cat-border-radius-m, 0.25rem);box-shadow:0 0 0 1px rgb(var(--cat-border-color-dark, 215, 219, 224));transition:box-shadow 0.13s linear;}.input-wrapper.input-round{border-radius:10rem}.input-wrapper.input-disabled{background:#f2f4f7;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.input-wrapper:not(.input-disabled):hover{box-shadow:0 0 0 2px rgb(var(--cat-border-color-dark, 215, 219, 224))}.input-wrapper:not(.input-disabled):hover.input-invalid{box-shadow:0 0 0 2px rgba(var(--cat-danger-bg, 217, 52, 13), 0.2)}.input-wrapper:not(.input-disabled):focus-within{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255))}.input-wrapper:not(.input-disabled):focus-within.input-invalid{outline:2px solid rgba(var(--cat-danger-bg, 217, 52, 13), 0.2)}.input-wrapper.input-invalid{box-shadow:0 0 0 1px rgba(var(--cat-danger-bg, 217, 52, 13), 0.2)}.input-wrapper:has(input:-webkit-autofill),.input-wrapper:has(input:-webkit-autofill):hover,.input-wrapper:has(input:-webkit-autofill):focus{background-color:#e8f0fe}.text-prefix,.text-suffix{display:inline-flex;align-items:center;-webkit-user-select:none;-ms-user-select:none;user-select:none;}.text-prefix{border-right:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));padding-right:0.75rem}.text-suffix{border-left:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));padding-left:0.75rem}.icon-prefix,.icon-suffix{align-self:center}.input-inner-wrapper{display:flex;align-items:center;position:relative;flex:1 1 auto}input{font:inherit;margin:0;padding:0;width:100%;min-width:0;border:none;outline:none;background:none;}.input-disabled input{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}input.has-clearable{padding-right:1.5rem}input::placeholder{color:rgb(var(--cat-font-color-muted, 81, 92, 108))}input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus{-webkit-box-shadow:0 0 0 9999px #e8f0fe inset}.clearable{position:absolute;top:calc(50% - 1rem);right:-0.5rem}";
6592
+ const catInputCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1.125rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}.cat-bg-primary{background-color:rgb(var(--cat-primary-bg, 0, 129, 148)) !important;color:rgb(var(--cat-primary-fill, 255, 255, 255)) !important}.cat-bg-primary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primary-hover:hover{background-color:rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;color:rgb(var(--cat-primary-fill-hover, 255, 255, 255)) !important}.cat-text-primary,.cat-link-primary{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-link-primary,.cat-text-primary-hover{transition:color 0.13s}.cat-link-primary:hover,.cat-text-primary-hover:hover{color:rgb(var(--cat-primary-text-hover, 1, 115, 132)) !important}.cat-link-primary:active,.cat-text-primary-hover:active{color:rgb(var(--cat-primary-text-active, 2, 99, 113)) !important}.cat-bg-primaryInverted{background-color:#93b4f2 !important;color:black !important}.cat-bg-primaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primaryInverted-hover:hover{background-color:#93b4f2 !important;color:black !important}.cat-text-primaryInverted,.cat-link-primaryInverted{color:#93b4f2 !important}.cat-link-primaryInverted,.cat-text-primaryInverted-hover{transition:color 0.13s}.cat-link-primaryInverted:hover,.cat-text-primaryInverted-hover:hover{color:#93b4f2 !important}.cat-link-primaryInverted:active,.cat-text-primaryInverted-hover:active{color:#93b4f2 !important}.cat-bg-secondary{background-color:rgb(var(--cat-secondary-bg, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill, 255, 255, 255)) !important}.cat-bg-secondary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondary-hover:hover{background-color:rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill-hover, 255, 255, 255)) !important}.cat-text-secondary,.cat-link-secondary{color:rgb(var(--cat-secondary-text, 0, 0, 0)) !important}.cat-link-secondary,.cat-text-secondary-hover{transition:color 0.13s}.cat-link-secondary:hover,.cat-text-secondary-hover:hover{color:rgb(var(--cat-secondary-text-hover, 0, 0, 0)) !important}.cat-link-secondary:active,.cat-text-secondary-hover:active{color:rgb(var(--cat-secondary-text-active, 0, 0, 0)) !important}.cat-bg-secondaryInverted{background-color:#697687 !important;color:black !important}.cat-bg-secondaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondaryInverted-hover:hover{background-color:#697687 !important;color:black !important}.cat-text-secondaryInverted,.cat-link-secondaryInverted{color:white !important}.cat-link-secondaryInverted,.cat-text-secondaryInverted-hover{transition:color 0.13s}.cat-link-secondaryInverted:hover,.cat-text-secondaryInverted-hover:hover{color:white !important}.cat-link-secondaryInverted:active,.cat-text-secondaryInverted-hover:active{color:white !important}.cat-bg-success{background-color:rgb(var(--cat-success-bg-, 0, 132, 88)) !important;color:rgb(var(--cat-success-fill, 255, 255, 255)) !important}.cat-bg-success-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-success-hover:hover{background-color:rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;color:rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important}.cat-text-success,.cat-link-success{color:rgb(var(--cat-success-text, 0, 132, 88)) !important}.cat-link-success,.cat-text-success-hover{transition:color 0.13s}.cat-link-success:hover,.cat-text-success-hover:hover{color:rgb(var(--cat-success-text-hover, 0, 117, 78)) !important}.cat-link-success:active,.cat-text-success-hover:active{color:rgb(var(--cat-success-text-active, 0, 105, 70)) !important}.cat-bg-warning{background-color:rgb(var(--cat-warning-bg, 255, 206, 128)) !important;color:rgb(var(--cat-warning-fill, 0, 0, 0)) !important}.cat-bg-warning-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-warning-hover:hover{background-color:rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;color:rgb(var(--cat-warning-fill-hover, 0, 0, 0)) !important}.cat-text-warning,.cat-link-warning{color:rgb(var(--cat-warning-text, 159, 97, 0)) !important}.cat-link-warning,.cat-text-warning-hover{transition:color 0.13s}.cat-link-warning:hover,.cat-text-warning-hover:hover{color:rgb(var(--cat-warning-text-hover, 159, 97, 0)) !important}.cat-link-warning:active,.cat-text-warning-hover:active{color:rgb(var(--cat-warning-text-active, 159, 97, 0)) !important}.cat-bg-danger{background-color:rgb(var(--cat-danger-bg, 217, 52, 13)) !important;color:rgb(var(--cat-danger-fill, 255, 255, 255)) !important}.cat-bg-danger-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-danger-hover:hover{background-color:rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;color:rgb(var(--cat-danger-fill-hover, 255, 255, 255)) !important}.cat-text-danger,.cat-link-danger{color:rgb(var(--cat-danger-text, 217, 52, 13)) !important}.cat-link-danger,.cat-text-danger-hover{transition:color 0.13s}.cat-link-danger:hover,.cat-text-danger-hover:hover{color:rgb(var(--cat-danger-text-hover, 194, 46, 11)) !important}.cat-link-danger:active,.cat-text-danger-hover:active{color:rgb(var(--cat-danger-text-active, 174, 42, 10)) !important}.cat-active{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-muted{color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}.label{overflow:hidden;word-wrap:break-word;word-break:break-word}.label-container{flex-basis:var(--label-size, 33.33%)}.label-container.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.label-container .label-wrapper{display:flex;gap:0.25rem}.label-metadata{display:flex;flex-shrink:0;flex-grow:1;justify-content:space-between;gap:0.25rem}.label-optional{display:flex;align-items:center;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.label-character-count{display:flex;align-items:center;margin-left:auto;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.input-horizontal .label-wrapper,.textarea-horizontal .label-wrapper,.select-horizontal .label-wrapper{flex-direction:column}.input-horizontal label,.textarea-horizontal label,.select-horizontal label{min-height:2.5rem;display:inline-flex;align-items:center}.input-horizontal .label-metadata,.textarea-horizontal .label-metadata,.select-horizontal .label-metadata{justify-content:flex-start}.input-horizontal .label-metadata .label-character-count,.textarea-horizontal .label-metadata .label-character-count,.select-horizontal .label-metadata .label-character-count{margin-left:0}.datepicker{width:min-content}.datepicker:not(.active){display:none}.datepicker-dropdown{position:absolute;z-index:20;padding-top:4px}.datepicker-dropdown.datepicker-orient-top{padding-top:0;padding-bottom:4px}.datepicker-picker{display:flex;flex-direction:column;border-radius:var(--cat-border-radius-m, 0.25rem);background-color:white}.datepicker-dropdown .datepicker-picker{box-shadow:0 4px 6px -2px rgba(27, 31, 38, 0.03), 0 12px 16px -4px rgba(27, 31, 38, 0.08)}.datepicker-main{flex:auto;padding:2px}.datepicker-footer{box-shadow:none;background-color:transparent}.datepicker-title{box-shadow:none;background-color:hsl(0, 0%, 96%);padding:0.375rem 0.75rem;text-align:center;font-weight:700}.datepicker-controls{display:flex}.datepicker-header .datepicker-controls{padding:2px 2px 0}.datepicker-controls .button{display:inline-flex;position:relative;align-items:center;justify-content:center;margin:0;border:1px solid rgb(var(--cat-border-color, 235, 236, 240));border-radius:var(--cat-border-radius-m, 0.25rem);box-shadow:none;background-color:hsl(0, 0%, 100%);cursor:pointer;padding:calc(0.375em - 1px) 0.75em;height:2.25em;vertical-align:top;text-align:center;line-height:1.5;white-space:nowrap;color:hsl(0, 0%, 21%);font-size:0.9375rem}.datepicker-controls .button:focus,.datepicker-controls .button:active{outline:none}.datepicker-controls .button:hover{border-color:#b8b8b8;color:hsl(0, 0%, 21%)}.datepicker-controls .button:focus{border-color:hsl(217, 71%, 53%);color:hsl(0, 0%, 21%)}.datepicker-controls .button:focus:not(:active){box-shadow:0 0 0 0.125em rgba(50, 115, 220, 0.25)}.datepicker-controls .button:active{border-color:#474747;color:hsl(0, 0%, 21%)}.datepicker-controls .button[disabled]{cursor:not-allowed}.datepicker-header .datepicker-controls .button{border-color:transparent;font-weight:bold}.datepicker-header .datepicker-controls .button:hover{background-color:#f2f4f7}.datepicker-header .datepicker-controls .button:active{background-color:#f2f4f7}.datepicker-footer .datepicker-controls .button{flex:auto;margin:calc(0.375rem - 1px) 0.375rem;border-radius:var(--cat-border-radius-s, 0.125rem);font-size:0.875rem}.datepicker-controls .view-switch{flex:auto}.datepicker-controls .prev-button,.datepicker-controls .next-button{padding-right:0.375rem;padding-left:0.375rem;flex:0 0 14.2857142857%}.datepicker-controls .prev-button.disabled,.datepicker-controls .next-button.disabled{visibility:hidden}.datepicker-view,.datepicker-grid{display:flex}.datepicker-view{align-items:stretch;width:17.5rem}.datepicker-grid{flex-wrap:wrap;flex:auto}.datepicker .days{display:flex;flex-direction:column;flex:auto}.datepicker .days-of-week{display:flex}.datepicker .week-numbers{display:flex;flex-direction:column;flex:0 0 9.6774193548%}.datepicker .weeks{display:flex;flex-direction:column;align-items:stretch;flex:auto}.datepicker span{display:flex;align-items:center;justify-content:center;border-radius:var(--cat-border-radius-m, 0.25rem);cursor:default;-webkit-touch-callout:none;user-select:none}.datepicker .dow{height:2rem;font-size:0.875rem0.9375rem/2;font-weight:700}.datepicker .week{flex:auto;color:rgb(var(--cat-font-color-muted, 81, 92, 108));font-size:0.875rem}.datepicker-cell,.datepicker .days .dow{flex-basis:14.2857142857%}.datepicker-cell{height:2.5rem}.datepicker-cell:not(.day){flex-basis:25%;height:5rem}.datepicker-cell:not(.disabled):hover{background-color:transparent;cursor:pointer}.datepicker-cell.focused:not(.selected){background-color:#f2f4f7}.datepicker-cell.selected,.datepicker-cell.selected:hover{background-color:rgb(var(--cat-primary-bg, 0, 129, 148));color:rgb(var(--cat-primary-fill, 255, 255, 255));font-weight:700}.datepicker-cell.disabled{color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.datepicker-cell.prev:not(.disabled),.datepicker-cell.next:not(.disabled){color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.datepicker-cell.prev.selected,.datepicker-cell.next.selected{color:rgb(var(--cat-primary-fill, 255, 255, 255))}.datepicker-cell.highlighted:not(.selected):not(.range):not(.today){border-radius:0;background-color:#f2f4f7}.datepicker-cell.highlighted:not(.selected):not(.range):not(.today):not(.disabled):hover{background-color:#f2f4f7}.datepicker-cell.highlighted:not(.selected):not(.range):not(.today).focused{background-color:#f2f4f7}.datepicker-cell.today:not(.selected){background-color:transparent}.datepicker-cell.today:not(.selected):not(.disabled){color:rgb(var(--cat-primary-text, 0, 129, 148))}.datepicker-cell.today.focused:not(.selected){background-color:#f2f4f7}.datepicker-cell.range-end:not(.selected),.datepicker-cell.range-start:not(.selected){background-color:#b8b8b8;color:rgb(var(--cat-primary-fill, 255, 255, 255))}.datepicker-cell.range-end.focused:not(.selected),.datepicker-cell.range-start.focused:not(.selected){background-color:#b3b3b3}.datepicker-cell.range-start:not(.range-end){border-radius:var(--cat-border-radius-m, 0.25rem) 0 0 var(--cat-border-radius-m, 0.25rem)}.datepicker-cell.range-end:not(.range-start){border-radius:0 var(--cat-border-radius-m, 0.25rem) var(--cat-border-radius-m, 0.25rem) 0}.datepicker-cell.range{border-radius:0;background-color:gainsboro}.datepicker-cell.range:not(.disabled):not(.focused):not(.today):hover{background-color:#d7d7d7}.datepicker-cell.range.disabled{color:#c6c6c6}.datepicker-cell.range.focused{background-color:#d1d1d1}.datepicker-input.in-edit{border-color:#276bda}.datepicker-input.in-edit:focus,.datepicker-input.in-edit:active{box-shadow:none}.datepicker-picker{border:1px solid rgb(var(--cat-border-color, 235, 236, 240))}.datepicker-main{padding:0.5rem 1rem}.datepicker-view:has(.week-numbers){width:19.375rem}.datepicker-view.months,.datepicker-view.years{width:20rem}.datepicker .dow,.datepicker .week{font-size:0.75rem;line-height:1rem;font-weight:700;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.datepicker-cell.today:not(.selected){box-shadow:inset 0 0 0 2px rgb(var(--cat-primary-bg, 0, 129, 148))}.datepicker-cell.focused:not(.selected),.datepicker-cell:not(.selected):not(.disabled):hover{background-color:#f2f4f7}.datepicker-controls{gap:0.5rem}.datepicker-header .datepicker-controls{padding:1rem 1rem 0}.datepicker-header .datepicker-controls .button{height:2.5rem}.datepicker-header .datepicker-controls .prev-button,.datepicker-header .datepicker-controls .next-button{flex-basis:2.5rem;font-size:1.25rem}.datepicker-footer .datepicker-controls{padding:0 1rem 1rem}.datepicker-footer .datepicker-controls .button{margin:0;height:2.5rem;font-size:0.9375rem}.datepicker-footer .datepicker-controls .button:hover,.datepicker-footer .datepicker-controls .button:active{border-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1)::before{content:\"\";width:700%;height:100%;border-radius:var(--cat-border-radius-m, 0.25rem);position:absolute;top:0;left:0;opacity:0;z-index:1}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).today:not(.selected)::before{box-shadow:inset 0 0 0 1.5px #008194;border-radius:var(--cat-border-radius-m, 0.25rem);opacity:1}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1):not(:hover)::before{background:none}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1):hover::before{opacity:1;background-color:transparent}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).selected,.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).selected.focused{color:white}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).selected::before,.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).selected.focused::before{opacity:1;background-color:rgb(var(--cat-primary-bg, 0, 129, 148));z-index:-1}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).focused{background:none}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid :nth-child(7n+1).focused::before{opacity:1;background-color:#f2f4f7;z-index:-1}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell{position:relative}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.selected,.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.focused{z-index:2}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.today:not(.selected){box-shadow:none}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell:not(.disabled):hover{background-color:inherit}.datepicker.weekly .datepicker-view:not(.months):not(.years) .datepicker-grid .datepicker-cell.focused{background:none}:host{display:flex;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);margin-bottom:1rem}:host([hidden]){display:none}.input-field,.input-container{display:flex;flex-direction:column;gap:0.5rem;flex:1 1 auto}.input-field.input-horizontal{flex-direction:row;gap:1rem}.input-wrapper{display:flex;align-items:stretch;gap:0.75rem;padding:0 0.75rem;height:2.5rem;overflow:hidden;background:white;border-radius:var(--cat-border-radius-m, 0.25rem);box-shadow:inset 0 0 0 1px rgb(var(--border-color));transition:box-shadow 0.13s linear;--border-color:var(--cat-border-color-dark, 215, 219, 224);}.input-wrapper.input-round{border-radius:10rem}.input-wrapper.input-disabled{background:#f2f4f7;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.input-wrapper:not(.input-disabled):hover{box-shadow:inset 0 0 0 1px rgb(var(--border-color)), 0 0 0 1px rgb(var(--border-color))}.input-wrapper:focus-within{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:-1px}.input-wrapper.input-invalid{--border-color:var(--cat-danger-bg, 217, 52, 13), 0.2}.input-wrapper:has(input:-webkit-autofill),.input-wrapper:has(input:-webkit-autofill):hover,.input-wrapper:has(input:-webkit-autofill):focus{background-color:#e8f0fe}.text-prefix,.text-suffix{display:inline-flex;align-items:center;-webkit-user-select:none;-ms-user-select:none;user-select:none;}.text-prefix{border-right:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));padding-right:0.75rem}.text-suffix{border-left:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));padding-left:0.75rem}.icon-prefix,.icon-suffix{align-self:center}.input-inner-wrapper{display:flex;align-items:center;position:relative;flex:1 1 auto}input{font:inherit;margin:0;padding:0;width:100%;min-width:0;border:none;outline:none;background:none;}.input-disabled input{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}input.has-clearable{padding-right:1.5rem}input::placeholder{color:rgb(var(--cat-font-color-muted, 81, 92, 108))}input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus{-webkit-box-shadow:0 0 0 9999px #e8f0fe inset}.clearable{position:absolute;top:calc(50% - 1rem);right:-0.5rem}";
3340
6593
 
3341
6594
  let nextUniqueId$6 = 0;
3342
6595
  const CatInput = class {
@@ -3445,7 +6698,7 @@ const CatInput = class {
3445
6698
  'input-invalid': this.invalid
3446
6699
  }, onClick: () => this.input.focus() }, this.textPrefix && (index.h("span", { class: "text-prefix", part: "prefix" }, this.textPrefix)), this.icon && !this.iconRight && index.h("cat-icon", { icon: this.icon, class: "icon-prefix", size: "l" }), index.h("div", { class: "input-inner-wrapper" }, index.h("input", Object.assign({}, this.nativeAttributes, { ref: el => (this.input = el), id: this.id, class: {
3447
6700
  'has-clearable': this.clearable && !this.disabled
3448
- }, autocomplete: this.autoComplete, disabled: this.disabled, max: this.max, maxlength: this.maxLength, min: this.min, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.type, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this), "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": ((_c = this.hint) === null || _c === void 0 ? void 0 : _c.length) ? this.id + '-hint' : undefined })), this.clearable && !this.disabled && this.value && (index.h("cat-button", { class: "clearable", icon: "cross-circle-outlined", "icon-only": "true", size: "s", variant: "text", "a11y-label": catIconRegistry.catI18nRegistry.t('input.clear'), onClick: this.clear.bind(this) }))), !this.invalid && this.icon && this.iconRight && (index.h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" })), this.invalid && (index.h("cat-icon", { icon: "alert-circle-outlined", class: "icon-suffix cat-text-danger", size: "l" })), this.textSuffix && (index.h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))), (this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (index.h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }), errorMap: this.errorMap })))));
6701
+ }, autocomplete: this.autoComplete, disabled: this.disabled, max: this.max, maxlength: this.maxLength, min: this.min, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.type, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this), "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": ((_c = this.hint) === null || _c === void 0 ? void 0 : _c.length) ? this.id + '-hint' : undefined })), this.clearable && !this.disabled && this.value && (index.h("cat-button", { class: "clearable", icon: "$cat:input-close", "icon-only": "true", size: "s", variant: "text", "a11y-label": catIconRegistry.catI18nRegistry.t('input.clear'), onClick: this.clear.bind(this) }))), !this.invalid && this.icon && this.iconRight && (index.h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" })), this.invalid && index.h("cat-icon", { icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" }), this.textSuffix && (index.h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))), (this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (index.h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }), errorMap: this.errorMap })))));
3449
6702
  }
3450
6703
  get invalid() {
3451
6704
  return !!this.errorMap;
@@ -3538,6 +6791,7 @@ const catPaginationCss = ":host{display:inline-block}:host([hidden]){display:non
3538
6791
  const CatPagination = class {
3539
6792
  constructor(hostRef) {
3540
6793
  index.registerInstance(this, hostRef);
6794
+ this.catChange = index.createEvent(this, "catChange", 7);
3541
6795
  this.page = 0;
3542
6796
  this.pageCount = 1;
3543
6797
  this.activePadding = 1;
@@ -3546,13 +6800,13 @@ const CatPagination = class {
3546
6800
  this.variant = 'text';
3547
6801
  this.round = false;
3548
6802
  this.compact = false;
3549
- this.iconPrev = 'chevron-left-outlined';
3550
- this.iconNext = 'chevron-right-outlined';
6803
+ this.iconPrev = '$cat:pagination-left';
6804
+ this.iconNext = '$cat:pagination-right';
3551
6805
  }
3552
6806
  render() {
3553
6807
  return (index.h("nav", { role: "navigation" }, index.h("ol", { class: {
3554
6808
  [`cat-pagination-${this.size}`]: Boolean(this.size)
3555
- } }, index.h("li", null, index.h("cat-button", { variant: this.variant, size: this.size, round: this.round, disabled: this.isFirst, a11yLabel: catIconRegistry.catI18nRegistry.t('pagination.prev'), icon: this.iconPrev, iconOnly: true, onClick: () => (this.page = this.page - 1) })), this.content, index.h("li", null, index.h("cat-button", { variant: this.variant, size: this.size, round: this.round, disabled: this.isLast, a11yLabel: catIconRegistry.catI18nRegistry.t('pagination.next'), icon: this.iconNext, iconOnly: true, onClick: () => (this.page = this.page + 1) })))));
6809
+ } }, index.h("li", null, index.h("cat-button", { variant: this.variant, size: this.size, round: this.round, disabled: this.isFirst, a11yLabel: catIconRegistry.catI18nRegistry.t('pagination.prev'), icon: this.iconPrev, iconOnly: true, onClick: () => this.setPage(this.page - 1) })), this.content, index.h("li", null, index.h("cat-button", { variant: this.variant, size: this.size, round: this.round, disabled: this.isLast, a11yLabel: catIconRegistry.catI18nRegistry.t('pagination.next'), icon: this.iconNext, iconOnly: true, onClick: () => this.setPage(this.page + 1) })))));
3556
6810
  }
3557
6811
  get isFirst() {
3558
6812
  return this.page === 0;
@@ -3560,6 +6814,10 @@ const CatPagination = class {
3560
6814
  get isLast() {
3561
6815
  return this.page === this.pageCount - 1;
3562
6816
  }
6817
+ setPage(value) {
6818
+ this.page = value;
6819
+ this.catChange.emit(this.page);
6820
+ }
3563
6821
  get pages() {
3564
6822
  if (!this.sidePadding && !this.activePadding) {
3565
6823
  return [this.page];
@@ -3594,13 +6852,13 @@ const CatPagination = class {
3594
6852
  }
3595
6853
  return this.pages.map((page, i) => [
3596
6854
  i > 0 && this.pages[i - 1] !== page - 1 ? index.h("li", { class: "dots" }, "\u2026") : null,
3597
- index.h("li", null, index.h("cat-button", { variant: this.variant, size: this.size, round: this.round, color: this.page === page ? 'primary' : undefined, active: this.page === page, a11yLabel: catIconRegistry.catI18nRegistry.t('pagination.page', { page: page + 1 }), a11yCurrent: this.page === page ? 'step' : undefined, onClick: () => (this.page = page) }, page + 1))
6855
+ index.h("li", null, index.h("cat-button", { variant: this.variant, size: this.size, round: this.round, color: this.page === page ? 'primary' : undefined, active: this.page === page, a11yLabel: catIconRegistry.catI18nRegistry.t('pagination.page', { page: page + 1 }), a11yCurrent: this.page === page ? 'step' : undefined, onClick: () => this.setPage(page) }, page + 1))
3598
6856
  ]);
3599
6857
  }
3600
6858
  };
3601
6859
  CatPagination.style = catPaginationCss;
3602
6860
 
3603
- const catRadioCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}:host{display:flex;flex-direction:column;gap:0.5rem;margin-bottom:1rem}:host([hidden]){display:none}label{display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);cursor:pointer}.label-left{flex-direction:row-reverse}.radio{display:flex;position:relative;align-self:flex-start}.circle{position:absolute;width:0.75rem;height:0.75rem;background-color:rgb(var(--cat-primary-bg, 0, 129, 148));border-radius:10rem;top:calc(50% - 0.375rem);left:calc(50% - 0.375rem);visibility:hidden;pointer-events:none}input{margin:0;width:1.25rem;height:1.25rem;appearance:none;background-color:white;border:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));border-radius:10rem;cursor:inherit}input:checked{border-color:rgb(var(--cat-primary-bg, 0, 129, 148))}input:checked+.circle{visibility:visible}input:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}:host(.cat-error) input{border-color:rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) .circle{background-color:rgb(var(--cat-danger-bg, 217, 52, 13))}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.is-disabled input{background-color:#f2f4f7}.is-disabled input:checked{border-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}.is-disabled .circle{background-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}";
6861
+ const catRadioCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1.125rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}.hint-wrapper{flex:0 1 auto;display:flex;gap:0.5rem}.hint-section{flex:1 1 auto;min-width:0}.input-hint,::slotted([slot=hint]){color:rgb(var(--cat-font-color-muted, 81, 92, 108));line-height:1.5;flex:1 1 auto;min-width:0}:host{display:flex;flex-direction:column;gap:0.5rem;margin-bottom:1rem}:host([hidden]){display:none}label{display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);cursor:pointer}.label-left{flex-direction:row-reverse}.radio{display:flex;position:relative;align-self:flex-start}.circle-placeholder{width:calc(1.25rem + 1px)}.circle{position:absolute;width:0.75rem;height:0.75rem;background-color:rgb(var(--cat-primary-bg, 0, 129, 148));border-radius:10rem;top:calc(50% - 0.375rem);left:calc(50% - 0.375rem);visibility:hidden;pointer-events:none}input{margin:0;width:1.25rem;height:1.25rem;appearance:none;background-color:white;border:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));border-radius:10rem;cursor:inherit}input:checked{border-color:rgb(var(--cat-primary-bg, 0, 129, 148))}input:checked+.circle{visibility:visible}input:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}:host(.cat-error) input{border-color:rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) .circle{background-color:rgb(var(--cat-danger-bg, 217, 52, 13))}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.is-disabled input{background-color:#f2f4f7}.is-disabled input:checked{border-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}.is-disabled .circle{background-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}";
3604
6862
 
3605
6863
  let nextUniqueId$5 = 0;
3606
6864
  const CatRadio = class {
@@ -3658,7 +6916,7 @@ const CatRadio = class {
3658
6916
  this.input.click();
3659
6917
  }
3660
6918
  render() {
3661
- return (index.h(index.Host, null, index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }, role: "radio", "aria-checked": this.checked ? 'true' : 'false' }, index.h("span", { class: "radio" }, index.h("input", Object.assign({}, this.nativeAttributes, { ref: el => (this.input = el), id: this.identifier || this.id, type: "radio", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onChange.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) })), index.h("span", { class: "circle" })), index.h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (index.h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }) }))));
6919
+ return (index.h(index.Host, null, index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }, role: "radio", "aria-checked": this.checked ? 'true' : 'false' }, index.h("span", { class: "radio" }, index.h("input", Object.assign({}, this.nativeAttributes, { ref: el => (this.input = el), id: this.identifier || this.id, type: "radio", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onChange.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) })), index.h("span", { class: "circle" })), index.h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (index.h("div", { class: { 'hint-wrapper': true, 'label-left': this.labelLeft } }, index.h("div", { class: "circle-placeholder" }), index.h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }) })))));
3662
6920
  }
3663
6921
  onChange(event) {
3664
6922
  this.checked = true;
@@ -4084,7 +7342,7 @@ class SafeSubscriber extends Subscriber {
4084
7342
  let partialObserver;
4085
7343
  if (isFunction(observerOrNext) || !observerOrNext) {
4086
7344
  partialObserver = {
4087
- next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined,
7345
+ next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
4088
7346
  error: error !== null && error !== void 0 ? error : undefined,
4089
7347
  complete: complete !== null && complete !== void 0 ? complete : undefined,
4090
7348
  };
@@ -4478,6 +7736,7 @@ class AsyncAction extends Action {
4478
7736
  this.pending = false;
4479
7737
  }
4480
7738
  schedule(state, delay = 0) {
7739
+ var _a;
4481
7740
  if (this.closed) {
4482
7741
  return this;
4483
7742
  }
@@ -4489,7 +7748,7 @@ class AsyncAction extends Action {
4489
7748
  }
4490
7749
  this.pending = true;
4491
7750
  this.delay = delay;
4492
- this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
7751
+ this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
4493
7752
  return this;
4494
7753
  }
4495
7754
  requestAsyncId(scheduler, _id, delay = 0) {
@@ -4499,7 +7758,9 @@ class AsyncAction extends Action {
4499
7758
  if (delay != null && this.delay === delay && this.pending === false) {
4500
7759
  return id;
4501
7760
  }
4502
- intervalProvider.clearInterval(id);
7761
+ if (id != null) {
7762
+ intervalProvider.clearInterval(id);
7763
+ }
4503
7764
  return undefined;
4504
7765
  }
4505
7766
  execute(state, delay) {
@@ -4562,7 +7823,6 @@ class AsyncScheduler extends Scheduler {
4562
7823
  super(SchedulerAction, now);
4563
7824
  this.actions = [];
4564
7825
  this._active = false;
4565
- this._scheduled = undefined;
4566
7826
  }
4567
7827
  flush(action) {
4568
7828
  const { actions } = this;
@@ -5314,7 +8574,7 @@ function delayWhen(delayDurationSelector, subscriptionDelay) {
5314
8574
  if (subscriptionDelay) {
5315
8575
  return (source) => concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
5316
8576
  }
5317
- return mergeMap((value, index) => delayDurationSelector(value, index).pipe(take(1), mapTo(value)));
8577
+ return mergeMap((value, index) => innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)));
5318
8578
  }
5319
8579
 
5320
8580
  function delay(due, scheduler = asyncScheduler) {
@@ -5445,7 +8705,7 @@ function tap(observerOrNext, error, complete) {
5445
8705
  identity;
5446
8706
  }
5447
8707
 
5448
- const catScrollableCss = ":host{overflow:hidden;position:relative;display:flex}:host([hidden]){display:none}.shadow-bottom,.shadow-right,.shadow-left,.shadow-top{position:absolute;transition:box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1)}.shadow-top{z-index:2;width:100%;top:0}.shadow-left{z-index:4;height:100%;left:0}.shadow-right{z-index:4;height:100%;right:0}.shadow-bottom{z-index:2;width:100%;bottom:0}.scrollable-wrapper{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none}.scrollable-wrapper.cat-scrollable-top .shadow-top,.scrollable-wrapper.cat-scrollable-bottom .shadow-bottom,.scrollable-wrapper.cat-scrollable-left .shadow-left,.scrollable-wrapper.cat-scrollable-right .shadow-right{box-shadow:0 0 4px 1px rgba(16, 29, 48, 0.2)}.scrollable-content{width:100%;overflow:hidden}.scrollable-content.scroll-x{overflow-x:auto}.scrollable-content.scroll-y{overflow-y:auto}.scrollable-content.no-overscroll{overscroll-behavior:contain}";
8708
+ const catScrollableCss = ":host{overflow:hidden;position:relative;display:flex}:host([hidden]){display:none}.shadow-bottom,.shadow-right,.shadow-left,.shadow-top{position:absolute;transition:box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1)}.shadow-top{z-index:2;width:100%;top:0}.shadow-left{z-index:4;height:100%;left:0}.shadow-right{z-index:4;height:100%;right:0}.shadow-bottom{z-index:2;width:100%;bottom:0}.scrollable-wrapper{position:absolute;inset:0;pointer-events:none}.scrollable-wrapper.cat-scrollable-top .shadow-top,.scrollable-wrapper.cat-scrollable-bottom .shadow-bottom,.scrollable-wrapper.cat-scrollable-left .shadow-left,.scrollable-wrapper.cat-scrollable-right .shadow-right{box-shadow:0 0 4px 1px rgba(16, 29, 48, 0.2)}.scrollable-content{width:100%;overflow:hidden}.scrollable-content.scroll-x{overflow-x:auto}.scrollable-content.scroll-y{overflow-y:auto}.scrollable-content.no-overscroll{overscroll-behavior:contain}";
5449
8709
 
5450
8710
  const CatScrollable = class {
5451
8711
  constructor(hostRef) {
@@ -5634,7 +8894,7 @@ var autosizeInput = function (element, options) {
5634
8894
  }
5635
8895
  };
5636
8896
 
5637
- const catSelectCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}.cat-bg-primary{background-color:rgb(var(--cat-primary-bg, 0, 129, 148)) !important;color:rgb(var(--cat-primary-fill, 255, 255, 255)) !important}.cat-bg-primary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primary-hover:hover{background-color:rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;color:rgb(var(--cat-primary-fill-hover, 255, 255, 255)) !important}.cat-text-primary,.cat-link-primary{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-link-primary,.cat-text-primary-hover{transition:color 0.13s}.cat-link-primary:hover,.cat-text-primary-hover:hover{color:rgb(var(--cat-primary-text-hover, 1, 115, 132)) !important}.cat-link-primary:active,.cat-text-primary-hover:active{color:rgb(var(--cat-primary-text-active, 2, 99, 113)) !important}.cat-bg-primaryInverted{background-color:#93b4f2 !important;color:black !important}.cat-bg-primaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primaryInverted-hover:hover{background-color:#93b4f2 !important;color:black !important}.cat-text-primaryInverted,.cat-link-primaryInverted{color:#93b4f2 !important}.cat-link-primaryInverted,.cat-text-primaryInverted-hover{transition:color 0.13s}.cat-link-primaryInverted:hover,.cat-text-primaryInverted-hover:hover{color:#93b4f2 !important}.cat-link-primaryInverted:active,.cat-text-primaryInverted-hover:active{color:#93b4f2 !important}.cat-bg-secondary{background-color:rgb(var(--cat-secondary-bg, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill, 255, 255, 255)) !important}.cat-bg-secondary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondary-hover:hover{background-color:rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill-hover, 255, 255, 255)) !important}.cat-text-secondary,.cat-link-secondary{color:rgb(var(--cat-secondary-text, 0, 0, 0)) !important}.cat-link-secondary,.cat-text-secondary-hover{transition:color 0.13s}.cat-link-secondary:hover,.cat-text-secondary-hover:hover{color:rgb(var(--cat-secondary-text-hover, 0, 0, 0)) !important}.cat-link-secondary:active,.cat-text-secondary-hover:active{color:rgb(var(--cat-secondary-text-active, 0, 0, 0)) !important}.cat-bg-secondaryInverted{background-color:#697687 !important;color:black !important}.cat-bg-secondaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondaryInverted-hover:hover{background-color:#697687 !important;color:black !important}.cat-text-secondaryInverted,.cat-link-secondaryInverted{color:white !important}.cat-link-secondaryInverted,.cat-text-secondaryInverted-hover{transition:color 0.13s}.cat-link-secondaryInverted:hover,.cat-text-secondaryInverted-hover:hover{color:white !important}.cat-link-secondaryInverted:active,.cat-text-secondaryInverted-hover:active{color:white !important}.cat-bg-success{background-color:rgb(var(--cat-success-bg-, 0, 132, 88)) !important;color:rgb(var(--cat-success-fill, 255, 255, 255)) !important}.cat-bg-success-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-success-hover:hover{background-color:rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;color:rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important}.cat-text-success,.cat-link-success{color:rgb(var(--cat-success-text, 0, 132, 88)) !important}.cat-link-success,.cat-text-success-hover{transition:color 0.13s}.cat-link-success:hover,.cat-text-success-hover:hover{color:rgb(var(--cat-success-text-hover, 0, 117, 78)) !important}.cat-link-success:active,.cat-text-success-hover:active{color:rgb(var(--cat-success-text-active, 0, 105, 70)) !important}.cat-bg-warning{background-color:rgb(var(--cat-warning-bg, 255, 206, 128)) !important;color:rgb(var(--cat-warning-fill, 0, 0, 0)) !important}.cat-bg-warning-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-warning-hover:hover{background-color:rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;color:rgb(var(--cat-warning-fill-hover, 0, 0, 0)) !important}.cat-text-warning,.cat-link-warning{color:rgb(var(--cat-warning-text, 159, 97, 0)) !important}.cat-link-warning,.cat-text-warning-hover{transition:color 0.13s}.cat-link-warning:hover,.cat-text-warning-hover:hover{color:rgb(var(--cat-warning-text-hover, 159, 97, 0)) !important}.cat-link-warning:active,.cat-text-warning-hover:active{color:rgb(var(--cat-warning-text-active, 159, 97, 0)) !important}.cat-bg-danger{background-color:rgb(var(--cat-danger-bg, 217, 52, 13)) !important;color:rgb(var(--cat-danger-fill, 255, 255, 255)) !important}.cat-bg-danger-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-danger-hover:hover{background-color:rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;color:rgb(var(--cat-danger-fill-hover, 255, 255, 255)) !important}.cat-text-danger,.cat-link-danger{color:rgb(var(--cat-danger-text, 217, 52, 13)) !important}.cat-link-danger,.cat-text-danger-hover{transition:color 0.13s}.cat-link-danger:hover,.cat-text-danger-hover:hover{color:rgb(var(--cat-danger-text-hover, 194, 46, 11)) !important}.cat-link-danger:active,.cat-text-danger-hover:active{color:rgb(var(--cat-danger-text-active, 174, 42, 10)) !important}.cat-active{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-muted{color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}.label{overflow:hidden;word-wrap:break-word;word-break:break-word}.label-container{flex-basis:var(--label-size, 33.33%)}.label-container.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.label-container .label-wrapper{display:flex;gap:0.25rem}.label-metadata{display:flex;flex-shrink:0;flex-grow:1;justify-content:space-between;gap:0.25rem}.label-optional{display:flex;align-items:center;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.label-character-count{display:flex;align-items:center;margin-left:auto;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.input-horizontal .label-wrapper,.textarea-horizontal .label-wrapper,.select-horizontal .label-wrapper{flex-direction:column}.input-horizontal label,.textarea-horizontal label,.select-horizontal label{min-height:2.5rem;display:inline-flex;align-items:center}.input-horizontal .label-metadata,.textarea-horizontal .label-metadata,.select-horizontal .label-metadata{justify-content:flex-start}.input-horizontal .label-metadata .label-character-count,.textarea-horizontal .label-metadata .label-character-count,.select-horizontal .label-metadata .label-character-count{margin-left:0}:host{display:flex;flex-direction:column;gap:0.5rem;line-height:1.25rem;position:relative;margin-bottom:1rem}:host([hidden]){display:none}label{align-self:flex-start}label.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.select-field,.select-container{display:flex;flex-direction:column;gap:0.5rem;flex:1 1 auto}.select-field.select-horizontal{flex-direction:row;gap:1rem}.input-optional{margin-left:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.select-wrapper{display:flex;align-items:flex-start;background:white;border-radius:var(--cat-border-radius-m, 0.25rem);box-shadow:0 0 0 1px rgb(var(--cat-border-color-dark, 215, 219, 224));transition:box-shadow 0.13s linear;padding:0.25rem;}.select-wrapper:not(.select-disabled):hover{box-shadow:0 0 0 2px rgb(var(--cat-border-color-dark, 215, 219, 224))}.select-wrapper:not(.select-disabled):hover.select-invalid{box-shadow:0 0 0 2px rgba(var(--cat-danger-bg, 217, 52, 13), 0.2)}.select-wrapper:not(.select-disabled):focus-within{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255))}.select-wrapper:not(.select-disabled):focus-within.select-invalid{outline:2px solid rgba(var(--cat-danger-bg, 217, 52, 13), 0.2)}.select-wrapper.select-invalid{box-shadow:0 0 0 1px rgba(var(--cat-danger-bg, 217, 52, 13), 0.2)}.select-wrapper:has(input:-webkit-autofill),.select-wrapper:has(input:-webkit-autofill):hover,.select-wrapper:has(input:-webkit-autofill):focus{background-color:#e8f0fe}:host(.cat-error) .select-wrapper{box-shadow:0 0 0 1px rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) .select-wrapper:not(.input-disabled):hover{box-shadow:0 0 0 2px rgb(var(--cat-danger-bg, 217, 52, 13))}.select-disabled{background:#f2f4f7;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108));pointer-events:none}.select-wrapper-inner{display:flex;flex:1 1 auto;flex-wrap:wrap;align-items:center;gap:0.25rem;min-width:0}.select-wrapper-inner>cat-avatar{display:inline-block;padding-left:0.5rem}.select-wrapper-inner>cat-avatar+.select-input{padding-left:0.25rem}.select-wrapper-inner cat-avatar{--cat-avatar-size:1.25rem;--cat-avatar-font-size:0.5rem}.select-input{font:inherit;background:none;border:none;outline:none;padding:0.375rem 0.5rem;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.select-disabled .select-input{cursor:inherit}.select-pills{display:contents}.pill{display:inline-flex;align-items:center;gap:0.5rem;padding:0.25rem 0.5rem;background:#f2f4f7;border-radius:var(--cat-border-radius-s, 0.125rem);white-space:nowrap;min-width:0}.pill>span{overflow:hidden;text-overflow:ellipsis;flex:1 1 0%}.pill>cat-button{margin-right:-0.25rem;margin-left:-0.25rem}.select-btn{transition:transform 0.13s linear}.select-btn::part(button){outline:none}cat-spinner{padding:0.375rem}.icon-suffix{padding:0.25rem}.select-btn-open{transform:rotate(180deg)}.select-dropdown{position:absolute;right:0;background:white;display:none;overflow:auto;box-shadow:0 4px 6px -2px rgba(27, 31, 38, 0.03), 0 12px 16px -4px rgba(27, 31, 38, 0.08);border-radius:var(--cat-border-radius-m, 0.25rem);z-index:100}.select-options-wrapper{max-height:16rem;width:100%}.select-empty{margin:1rem 0;padding:0 1.25rem}.select-options{list-style-type:none;margin:0;padding:0.5rem 0}.select-options cat-checkbox,.select-options .select-option-single{margin:0;padding:0.5rem 1rem}.select-option-inner{display:flex;gap:0.5rem}.select-option-inner cat-avatar{--cat-avatar-size:1.25rem;--cat-avatar-font-size:0.5rem}.select-option-text{flex:1 1 0%;min-width:0}.select-option-single{cursor:pointer}.select-input-transparent-caret{caret-color:transparent}.select-option-empty,.select-option-loading{padding:0.5rem 1rem}.select-option:hover{background-color:rgba(var(--cat-secondary-bg, 105, 118, 135), 0.05)}.select-option-active{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:-2px}.select-option-label{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-wrap:break-word;word-break:break-word}.select-option-description{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}";
8897
+ const catSelectCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1.125rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}.cat-bg-primary{background-color:rgb(var(--cat-primary-bg, 0, 129, 148)) !important;color:rgb(var(--cat-primary-fill, 255, 255, 255)) !important}.cat-bg-primary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primary-hover:hover{background-color:rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;color:rgb(var(--cat-primary-fill-hover, 255, 255, 255)) !important}.cat-text-primary,.cat-link-primary{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-link-primary,.cat-text-primary-hover{transition:color 0.13s}.cat-link-primary:hover,.cat-text-primary-hover:hover{color:rgb(var(--cat-primary-text-hover, 1, 115, 132)) !important}.cat-link-primary:active,.cat-text-primary-hover:active{color:rgb(var(--cat-primary-text-active, 2, 99, 113)) !important}.cat-bg-primaryInverted{background-color:#93b4f2 !important;color:black !important}.cat-bg-primaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primaryInverted-hover:hover{background-color:#93b4f2 !important;color:black !important}.cat-text-primaryInverted,.cat-link-primaryInverted{color:#93b4f2 !important}.cat-link-primaryInverted,.cat-text-primaryInverted-hover{transition:color 0.13s}.cat-link-primaryInverted:hover,.cat-text-primaryInverted-hover:hover{color:#93b4f2 !important}.cat-link-primaryInverted:active,.cat-text-primaryInverted-hover:active{color:#93b4f2 !important}.cat-bg-secondary{background-color:rgb(var(--cat-secondary-bg, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill, 255, 255, 255)) !important}.cat-bg-secondary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondary-hover:hover{background-color:rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill-hover, 255, 255, 255)) !important}.cat-text-secondary,.cat-link-secondary{color:rgb(var(--cat-secondary-text, 0, 0, 0)) !important}.cat-link-secondary,.cat-text-secondary-hover{transition:color 0.13s}.cat-link-secondary:hover,.cat-text-secondary-hover:hover{color:rgb(var(--cat-secondary-text-hover, 0, 0, 0)) !important}.cat-link-secondary:active,.cat-text-secondary-hover:active{color:rgb(var(--cat-secondary-text-active, 0, 0, 0)) !important}.cat-bg-secondaryInverted{background-color:#697687 !important;color:black !important}.cat-bg-secondaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondaryInverted-hover:hover{background-color:#697687 !important;color:black !important}.cat-text-secondaryInverted,.cat-link-secondaryInverted{color:white !important}.cat-link-secondaryInverted,.cat-text-secondaryInverted-hover{transition:color 0.13s}.cat-link-secondaryInverted:hover,.cat-text-secondaryInverted-hover:hover{color:white !important}.cat-link-secondaryInverted:active,.cat-text-secondaryInverted-hover:active{color:white !important}.cat-bg-success{background-color:rgb(var(--cat-success-bg-, 0, 132, 88)) !important;color:rgb(var(--cat-success-fill, 255, 255, 255)) !important}.cat-bg-success-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-success-hover:hover{background-color:rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;color:rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important}.cat-text-success,.cat-link-success{color:rgb(var(--cat-success-text, 0, 132, 88)) !important}.cat-link-success,.cat-text-success-hover{transition:color 0.13s}.cat-link-success:hover,.cat-text-success-hover:hover{color:rgb(var(--cat-success-text-hover, 0, 117, 78)) !important}.cat-link-success:active,.cat-text-success-hover:active{color:rgb(var(--cat-success-text-active, 0, 105, 70)) !important}.cat-bg-warning{background-color:rgb(var(--cat-warning-bg, 255, 206, 128)) !important;color:rgb(var(--cat-warning-fill, 0, 0, 0)) !important}.cat-bg-warning-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-warning-hover:hover{background-color:rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;color:rgb(var(--cat-warning-fill-hover, 0, 0, 0)) !important}.cat-text-warning,.cat-link-warning{color:rgb(var(--cat-warning-text, 159, 97, 0)) !important}.cat-link-warning,.cat-text-warning-hover{transition:color 0.13s}.cat-link-warning:hover,.cat-text-warning-hover:hover{color:rgb(var(--cat-warning-text-hover, 159, 97, 0)) !important}.cat-link-warning:active,.cat-text-warning-hover:active{color:rgb(var(--cat-warning-text-active, 159, 97, 0)) !important}.cat-bg-danger{background-color:rgb(var(--cat-danger-bg, 217, 52, 13)) !important;color:rgb(var(--cat-danger-fill, 255, 255, 255)) !important}.cat-bg-danger-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-danger-hover:hover{background-color:rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;color:rgb(var(--cat-danger-fill-hover, 255, 255, 255)) !important}.cat-text-danger,.cat-link-danger{color:rgb(var(--cat-danger-text, 217, 52, 13)) !important}.cat-link-danger,.cat-text-danger-hover{transition:color 0.13s}.cat-link-danger:hover,.cat-text-danger-hover:hover{color:rgb(var(--cat-danger-text-hover, 194, 46, 11)) !important}.cat-link-danger:active,.cat-text-danger-hover:active{color:rgb(var(--cat-danger-text-active, 174, 42, 10)) !important}.cat-active{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-muted{color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}.label{overflow:hidden;word-wrap:break-word;word-break:break-word}.label-container{flex-basis:var(--label-size, 33.33%)}.label-container.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.label-container .label-wrapper{display:flex;gap:0.25rem}.label-metadata{display:flex;flex-shrink:0;flex-grow:1;justify-content:space-between;gap:0.25rem}.label-optional{display:flex;align-items:center;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.label-character-count{display:flex;align-items:center;margin-left:auto;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.input-horizontal .label-wrapper,.textarea-horizontal .label-wrapper,.select-horizontal .label-wrapper{flex-direction:column}.input-horizontal label,.textarea-horizontal label,.select-horizontal label{min-height:2.5rem;display:inline-flex;align-items:center}.input-horizontal .label-metadata,.textarea-horizontal .label-metadata,.select-horizontal .label-metadata{justify-content:flex-start}.input-horizontal .label-metadata .label-character-count,.textarea-horizontal .label-metadata .label-character-count,.select-horizontal .label-metadata .label-character-count{margin-left:0}:host{display:flex;flex-direction:column;gap:0.5rem;line-height:1.25rem;position:relative;margin-bottom:1rem}:host([hidden]){display:none}label{align-self:flex-start}label.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.select-field,.select-container{display:flex;flex-direction:column;gap:0.5rem;flex:1 1 auto}.select-field.select-horizontal{flex-direction:row;gap:1rem}.input-optional{margin-left:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.select-wrapper{display:flex;align-items:flex-start;background:white;border-radius:var(--cat-border-radius-m, 0.25rem);box-shadow:inset 0 0 0 1px rgb(var(--border-color));transition:box-shadow 0.13s linear;padding:0.25rem;--border-color:var(--cat-border-color-dark, 215, 219, 224);}.select-wrapper:not(.select-disabled):hover{box-shadow:inset 0 0 0 1px rgb(var(--border-color)), 0 0 0 1px rgb(var(--border-color))}.select-wrapper:focus-within{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:-1px}.select-wrapper.select-invalid{--border-color:var(--cat-danger-bg, 217, 52, 13), 0.2}.select-wrapper:has(input:-webkit-autofill),.select-wrapper:has(input:-webkit-autofill):hover,.select-wrapper:has(input:-webkit-autofill):focus{background-color:#e8f0fe}:host(.cat-error) .select-wrapper{box-shadow:0 0 0 1px rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) .select-wrapper:not(.input-disabled):hover{box-shadow:0 0 0 2px rgb(var(--cat-danger-bg, 217, 52, 13))}.select-disabled{background:#f2f4f7;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108));pointer-events:none}.select-wrapper-inner{display:flex;flex:1 1 auto;flex-wrap:wrap;align-items:center;gap:0.25rem;min-width:0}.select-wrapper-inner>cat-avatar{display:inline-block;padding-left:0.5rem}.select-wrapper-inner>cat-avatar+.select-input{padding-left:0.25rem}.select-wrapper-inner cat-avatar{--cat-avatar-size:1.25rem;--cat-avatar-font-size:0.5rem}.select-input{font:inherit;background:none;border:none;outline:none;padding:0.375rem 0.5rem;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.select-disabled .select-input{cursor:inherit}.select-pills{display:contents}.pill{display:inline-flex;align-items:center;gap:0.5rem;padding:0.25rem 0.5rem;background:#f2f4f7;border-radius:var(--cat-border-radius-s, 0.125rem);white-space:nowrap;min-width:0}.pill>span{overflow:hidden;text-overflow:ellipsis;flex:1 1 0%}.pill>cat-button{margin-right:-0.25rem;margin-left:-0.25rem}.select-btn{transition:transform 0.13s linear}.select-btn::part(button){outline:none}cat-spinner{padding:0.375rem}.icon-suffix{padding:0.25rem}.select-btn-open{transform:rotate(180deg)}.select-dropdown{position:absolute;right:0;background:white;display:none;overflow:auto;box-shadow:0 4px 6px -2px rgba(27, 31, 38, 0.03), 0 12px 16px -4px rgba(27, 31, 38, 0.08);border-radius:var(--cat-border-radius-m, 0.25rem);border:1px solid rgb(var(--cat-border-color, 235, 236, 240));z-index:100}.select-options-wrapper{max-height:16rem;width:100%}.select-empty{margin:1rem 0;padding:0 1.25rem}.select-options{list-style-type:none;margin:0;padding:0.5rem 0}.select-options cat-checkbox,.select-options .select-option-single{margin:0;padding:0.5rem 1rem}.select-option-inner{display:flex;gap:0.5rem}.select-option-inner cat-avatar{--cat-avatar-size:1.25rem;--cat-avatar-font-size:0.5rem}.select-option-text{flex:1 1 0%;min-width:0}.select-option-single{cursor:pointer}.select-input-transparent-caret{caret-color:transparent}.select-option-empty,.select-option-loading{padding:0.5rem 1rem}.select-option:hover{background-color:rgba(var(--cat-secondary-bg, 105, 118, 135), 0.05)}.select-option-active{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:-2px}.select-option-label{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-wrap:break-word;word-break:break-word}.select-option-description{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}";
5638
8898
 
5639
8899
  const INIT_STATE = {
5640
8900
  term: '',
@@ -5643,6 +8903,7 @@ const INIT_STATE = {
5643
8903
  isResolving: false,
5644
8904
  options: [],
5645
8905
  selection: [],
8906
+ tempSelection: [],
5646
8907
  activeOptionIndex: -1,
5647
8908
  activeSelectionIndex: -1
5648
8909
  };
@@ -5768,6 +9029,7 @@ const CatSelect = class {
5768
9029
  }
5769
9030
  }
5770
9031
  onBlur(event) {
9032
+ var _a;
5771
9033
  if (!this.multiple && this.state.activeOptionIndex >= 0) {
5772
9034
  if (this.tags && this.state.options[this.state.activeOptionIndex].item.id === `select-${this.id}-option-tag`) {
5773
9035
  this.createTag(this.state.term);
@@ -5777,7 +9039,18 @@ const CatSelect = class {
5777
9039
  }
5778
9040
  }
5779
9041
  this.hide();
5780
- this.patchState({ activeSelectionIndex: -1 });
9042
+ if (!this.multiple && ((_a = this.state.tempSelection) === null || _a === void 0 ? void 0 : _a.length)) {
9043
+ this.patchState({
9044
+ activeSelectionIndex: -1,
9045
+ selection: this.state.tempSelection,
9046
+ tempSelection: [],
9047
+ options: [],
9048
+ term: this.state.tempSelection[0].render.label
9049
+ });
9050
+ }
9051
+ else {
9052
+ this.patchState({ activeSelectionIndex: -1 });
9053
+ }
5781
9054
  this.catBlur.emit(event);
5782
9055
  if (coerceBoolean(this.errorUpdate)) {
5783
9056
  this.showErrors();
@@ -5826,7 +9099,10 @@ const CatSelect = class {
5826
9099
  else if (this.state.selection.length) {
5827
9100
  const selectionClone = [...this.state.selection];
5828
9101
  selectionClone.pop();
5829
- this.patchState({ selection: selectionClone });
9102
+ this.patchState({
9103
+ selection: selectionClone,
9104
+ tempSelection: this.state.term ? [...this.state.selection] : []
9105
+ });
5830
9106
  }
5831
9107
  }
5832
9108
  }
@@ -5913,11 +9189,11 @@ const CatSelect = class {
5913
9189
  pill: true,
5914
9190
  'select-no-open': true,
5915
9191
  'select-option-active': this.state.activeSelectionIndex === i
5916
- }, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (index.h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, initials: (_a = item.render.avatar.initials) !== null && _a !== void 0 ? _a : '' })) : null, index.h("span", null, item.render.label), !this.disabled && (index.h("cat-button", { size: "xs", variant: "text", icon: "16-cross", iconOnly: true, a11yLabel: catIconRegistry.catI18nRegistry.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1 }))));
5917
- }))) : this.state.selection.length && this.state.selection[0].render.avatar ? (index.h("cat-avatar", { label: this.state.selection[0].render.label, round: this.state.selection[0].render.avatar.round, src: this.state.selection[0].render.avatar.src, initials: (_a = this.state.selection[0].render.avatar.initials) !== null && _a !== void 0 ? _a : '' })) : null, index.h("input", Object.assign({}, this.nativeAttributes, { class: "select-input", ref: el => (this.input = el), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-activedescendant": this.activeDescendant, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": ((_b = this.hint) === null || _b === void 0 ? void 0 : _b.length) ? this.id + '-hint' : undefined, onInput: this.onInput.bind(this), value: !this.multiple ? this.state.term : undefined, placeholder: this.placeholder, disabled: this.disabled || this.state.isResolving }))), this.state.isResolving && index.h("cat-spinner", null), this.invalid && (index.h("cat-icon", { icon: "alert-circle-outlined", class: "icon-suffix cat-text-danger", size: "l" })), (this.state.selection.length || this.state.term.length) &&
9192
+ }, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (index.h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: (_a = item.render.avatar.initials) !== null && _a !== void 0 ? _a : '' })) : null, index.h("span", null, item.render.label), !this.disabled && (index.h("cat-button", { size: "xs", variant: "text", icon: "$cat:select-clear", iconOnly: true, a11yLabel: catIconRegistry.catI18nRegistry.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1 }))));
9193
+ }))) : this.state.selection.length && this.state.selection[0].render.avatar ? (index.h("cat-avatar", { label: this.state.selection[0].render.label, round: this.state.selection[0].render.avatar.round, src: this.state.selection[0].render.avatar.src, icon: this.state.selection[0].render.avatar.icon, initials: (_a = this.state.selection[0].render.avatar.initials) !== null && _a !== void 0 ? _a : '' })) : null, index.h("input", Object.assign({}, this.nativeAttributes, { class: "select-input", ref: el => (this.input = el), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-activedescendant": this.activeDescendant, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": ((_b = this.hint) === null || _b === void 0 ? void 0 : _b.length) ? this.id + '-hint' : undefined, onInput: this.onInput.bind(this), value: !this.multiple ? this.state.term : undefined, placeholder: this.placeholder, disabled: this.disabled || this.state.isResolving }))), this.state.isResolving && index.h("cat-spinner", null), this.invalid && (index.h("cat-icon", { icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), (this.state.selection.length || this.state.term.length) &&
5918
9194
  !this.disabled &&
5919
9195
  !this.state.isResolving &&
5920
- this.clearable ? (index.h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "cross-circle-outlined", variant: "text", size: "s", a11yLabel: catIconRegistry.catI18nRegistry.t('input.clear'), onClick: () => this.clear() })) : null, !this.state.isResolving && (index.h("cat-button", { iconOnly: true, icon: "chevron-down-outlined", class: { 'select-btn': true, 'select-btn-open': this.state.isOpen }, variant: "text", size: "s", a11yLabel: this.state.isOpen ? catIconRegistry.catI18nRegistry.t('select.close') : catIconRegistry.catI18nRegistry.t('select.open'), "aria-controls": `select-listbox-${this.id}`, "aria-expanded": this.state.isOpen, tabIndex: -1, disabled: this.disabled || this.state.isResolving }))), (this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (index.h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }), errorMap: this.errorMap })))), index.h("div", { class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (index.h("cat-scrollable", { class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, index.h("ul", { class: "select-options", role: "listbox", "aria-multiselectable": this.multiple, "aria-setsize": this.state.totalElements, id: `select-listbox-${this.id}` }, this.optionsList, this.state.isLoading
9196
+ this.clearable ? (index.h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "$cat:input-close", variant: "text", size: "s", a11yLabel: catIconRegistry.catI18nRegistry.t('input.clear'), onClick: () => this.clear() })) : null, !this.state.isResolving && (index.h("cat-button", { iconOnly: true, icon: "$cat:select-open", class: { 'select-btn': true, 'select-btn-open': this.state.isOpen }, variant: "text", size: "s", a11yLabel: this.state.isOpen ? catIconRegistry.catI18nRegistry.t('select.close') : catIconRegistry.catI18nRegistry.t('select.open'), "aria-controls": `select-listbox-${this.id}`, "aria-expanded": this.state.isOpen, tabIndex: -1, disabled: this.disabled || this.state.isResolving }))), (this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (index.h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }), errorMap: this.errorMap })))), index.h("div", { class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (index.h("cat-scrollable", { class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, index.h("ul", { class: "select-options", role: "listbox", "aria-multiselectable": this.multiple, "aria-setsize": this.state.totalElements, id: `select-listbox-${this.id}` }, this.optionsList, this.state.isLoading
5921
9197
  ? Array.from(Array(CatSelect.SKELETON_COUNT)).map(() => (index.h("li", { class: "select-option-loading" }, index.h("cat-skeleton", { variant: "body", lines: 1 }), index.h("cat-skeleton", { variant: "body", lines: 1 }))))
5922
9198
  : !this.state.options.length &&
5923
9199
  !this.tags && (index.h("li", { class: "select-option-empty" }, this.noItems ? this.noItems : catIconRegistry.catI18nRegistry.t('select.empty')))))))));
@@ -5939,11 +9215,11 @@ const CatSelect = class {
5939
9215
  return (index.h("li", { role: "option", class: "select-option", id: `select-${this.id}-option-${i}`, "aria-selected": isOptionSelected ? 'true' : 'false' }, this.multiple ? (index.h("cat-checkbox", { class: { 'select-option-active': this.state.activeOptionIndex === i }, checked: isOptionSelected, tabIndex: -1, labelLeft: true, onFocus: () => { var _a; return (_a = this.input) === null || _a === void 0 ? void 0 : _a.focus(); }, onCatChange: e => {
5940
9216
  !isTagOption ? this.toggle(item) : this.toggleTag(item);
5941
9217
  e.stopPropagation();
5942
- } }, index.h("span", { slot: "label", class: "select-option-inner" }, item.render.avatar ? (index.h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, initials: (_a = item.render.avatar.initials) !== null && _a !== void 0 ? _a : '' })) : null, index.h("span", { class: "select-option-text" }, index.h("span", { class: "select-option-label" }, getLabel()), index.h("span", { class: "select-option-description" }, item.render.description))))) : (index.h("div", { class: {
9218
+ } }, index.h("span", { slot: "label", class: "select-option-inner" }, item.render.avatar ? (index.h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: (_a = item.render.avatar.initials) !== null && _a !== void 0 ? _a : '' })) : null, index.h("span", { class: "select-option-text" }, index.h("span", { class: "select-option-label" }, getLabel()), index.h("span", { class: "select-option-description" }, item.render.description))))) : (index.h("div", { class: {
5943
9219
  'select-option-inner': true,
5944
9220
  'select-option-single': true,
5945
9221
  'select-option-active': this.state.activeOptionIndex === i
5946
- }, onFocus: () => { var _a; return (_a = this.input) === null || _a === void 0 ? void 0 : _a.focus(); }, onClick: () => (isTagOption ? this.createTag(item.render.label) : this.select(item)), tabIndex: -1 }, item.render.avatar ? (index.h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, initials: (_b = item.render.avatar.initials) !== null && _b !== void 0 ? _b : '' })) : null, index.h("span", { class: "select-option-text" }, index.h("span", { class: "select-option-label" }, getLabel()), index.h("span", { class: "select-option-description" }, item.render.description))))));
9222
+ }, onFocus: () => { var _a; return (_a = this.input) === null || _a === void 0 ? void 0 : _a.focus(); }, onClick: () => (isTagOption ? this.createTag(item.render.label) : this.select(item)), tabIndex: -1 }, item.render.avatar ? (index.h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: (_b = item.render.avatar.initials) !== null && _b !== void 0 ? _b : '' })) : null, index.h("span", { class: "select-option-text" }, index.h("span", { class: "select-option-label" }, getLabel()), index.h("span", { class: "select-option-description" }, item.render.description))))));
5947
9223
  });
5948
9224
  }
5949
9225
  resolve() {
@@ -5986,7 +9262,7 @@ const CatSelect = class {
5986
9262
  if (!this.state.isOpen) {
5987
9263
  this.patchState({ isOpen: true });
5988
9264
  this.catOpen.emit();
5989
- this.term$.next(this.state.term);
9265
+ this.term$.next('');
5990
9266
  (_a = this.input) === null || _a === void 0 ? void 0 : _a.classList.remove('select-input-transparent-caret');
5991
9267
  }
5992
9268
  }
@@ -6039,12 +9315,12 @@ const CatSelect = class {
6039
9315
  }
6040
9316
  clear() {
6041
9317
  if (this.input && this.state.term) {
6042
- this.patchState({ selection: [], options: [], term: '', activeOptionIndex: -1 });
9318
+ this.patchState({ selection: [], options: [], term: '', activeOptionIndex: -1, tempSelection: [] });
6043
9319
  this.term$.next('');
6044
9320
  this.input.value = '';
6045
9321
  }
6046
9322
  else {
6047
- this.patchState({ selection: [] });
9323
+ this.patchState({ selection: [], tempSelection: [] });
6048
9324
  }
6049
9325
  }
6050
9326
  reset(connector) {
@@ -6070,12 +9346,17 @@ const CatSelect = class {
6070
9346
  }
6071
9347
  }
6072
9348
  onInput() {
6073
- var _a;
9349
+ var _a, _b;
6074
9350
  this.search(((_a = this.input) === null || _a === void 0 ? void 0 : _a.value.trim()) || '');
6075
- if (!this.multiple && this.state.selection.length) {
6076
- const selectionClone = [...this.state.selection];
6077
- selectionClone.pop();
6078
- this.patchState({ selection: selectionClone });
9351
+ if (!this.multiple) {
9352
+ if (this.state.selection.length) {
9353
+ const selectionClone = [...this.state.selection];
9354
+ selectionClone.pop();
9355
+ this.patchState({ selection: selectionClone, tempSelection: [...this.state.selection] });
9356
+ }
9357
+ if (!((_b = this.input) === null || _b === void 0 ? void 0 : _b.value.trim())) {
9358
+ this.patchState({ tempSelection: [] });
9359
+ }
6079
9360
  }
6080
9361
  this.show();
6081
9362
  }
@@ -7650,7 +10931,7 @@ const countries = [
7650
10931
  }
7651
10932
  ];
7652
10933
 
7653
- const catSkeletonCss = ":host{display:flex;flex-direction:column;position:relative;--background:#ebecf0;--highlight:#d7dbe0;--speed:2s}:host([variant=square]),:host([variant=circle]){display:inline-flex}:host([hidden]){display:none}:host([variant=head]){margin-bottom:0.5rem}:host([variant=body]){margin-bottom:1rem}.skeleton{display:block;border-radius:var(--cat-border-radius-m, 0.25rem);background:var(--background)}.skeleton-circle{border-radius:10rem}.skeleton-xs.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 1.5rem)}.skeleton-xs.skeleton-square,.skeleton-xs.skeleton-circle{width:var(--width, 1.5rem);height:var(--height, 1.5rem)}.skeleton-xs.skeleton-head,.skeleton-xs.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-xs.skeleton-head{height:calc(0.9375rem - 4px);margin:calc((1.25rem - 0.9375rem + 4px) * 0.5) 0}.skeleton-xs.skeleton-body{height:calc(0.75rem - 4px);margin:calc((1rem - 0.75rem + 4px) * 0.5) 0}.skeleton-s.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 2rem)}.skeleton-s.skeleton-square,.skeleton-s.skeleton-circle{width:var(--width, 2rem);height:var(--height, 2rem)}.skeleton-s.skeleton-head,.skeleton-s.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-s.skeleton-head{height:calc(1.125rem - 4px);margin:calc((1.5rem - 1.125rem + 4px) * 0.5) 0}.skeleton-s.skeleton-body{height:calc(0.875rem - 4px);margin:calc((1rem - 0.875rem + 4px) * 0.5) 0}.skeleton-m.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 2.5rem)}.skeleton-m.skeleton-square,.skeleton-m.skeleton-circle{width:var(--width, 2.5rem);height:var(--height, 2.5rem)}.skeleton-m.skeleton-head,.skeleton-m.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-m.skeleton-head{height:calc(1.25rem - 4px);margin:calc((1.5rem - 1.25rem + 4px) * 0.5) 0}.skeleton-m.skeleton-body{height:calc(0.9375rem - 4px);margin:calc((1.25rem - 0.9375rem + 4px) * 0.5) 0}.skeleton-l.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 3rem)}.skeleton-l.skeleton-square,.skeleton-l.skeleton-circle{width:var(--width, 3rem);height:var(--height, 3rem)}.skeleton-l.skeleton-head,.skeleton-l.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-l.skeleton-head{height:calc(1.5rem - 4px);margin:calc((1.75rem - 1.5rem + 4px) * 0.5) 0}.skeleton-l.skeleton-body{height:calc(1.125rem - 4px);margin:calc((1.5rem - 1.125rem + 4px) * 0.5) 0}.skeleton-xl.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 3.5rem)}.skeleton-xl.skeleton-square,.skeleton-xl.skeleton-circle{width:var(--width, 3.5rem);height:var(--height, 3.5rem)}.skeleton-xl.skeleton-head,.skeleton-xl.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-xl.skeleton-head{height:calc(1.75rem - 4px);margin:calc((2rem - 1.75rem + 4px) * 0.5) 0}.skeleton-xl.skeleton-body{height:calc(1.25rem - 4px);margin:calc((1.5rem - 1.25rem + 4px) * 0.5) 0}.skeleton-sheen{background:linear-gradient(90deg, var(--background) 33%, var(--highlight) 50%, var(--background) 66%) var(--background);background-size:300% 100%;animation:sheen var(--speed) ease-in-out infinite}.skeleton-pulse{position:relative;overflow:hidden}.skeleton-pulse::before{content:\"\";display:block;position:absolute;width:100%;height:100%;background-color:var(--highlight);animation:var(--speed) ease-in-out 0.5s infinite normal none running pulse;opacity:0}@keyframes sheen{0%{background-position:right}}@keyframes pulse{50%{opacity:1}}";
10934
+ const catSkeletonCss = ":host{display:flex;flex-direction:column;position:relative;--background:#ebecf0;--highlight:#d7dbe0;--speed:2s}:host([variant=square]),:host([variant=circle]){display:inline-flex}:host([hidden]){display:none}:host([variant=head]){margin-bottom:0.5rem}:host([variant=body]){margin-bottom:1rem}.skeleton{display:block;border-radius:var(--cat-border-radius-m, 0.25rem);background:var(--background)}.skeleton-circle{border-radius:10rem}.skeleton-xs.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 1.5rem)}.skeleton-xs.skeleton-square,.skeleton-xs.skeleton-circle{width:var(--width, 1.5rem);height:var(--height, 1.5rem)}.skeleton-xs.skeleton-head,.skeleton-xs.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-xs.skeleton-head{height:calc(0.9375rem - 4px);margin:calc((1.25rem - 0.9375rem + 4px) * 0.5) 0}.skeleton-xs.skeleton-body{height:calc(0.75rem - 4px);margin:calc((1rem - 0.75rem + 4px) * 0.5) 0}.skeleton-s.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 2rem)}.skeleton-s.skeleton-square,.skeleton-s.skeleton-circle{width:var(--width, 2rem);height:var(--height, 2rem)}.skeleton-s.skeleton-head,.skeleton-s.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-s.skeleton-head{height:calc(1.125rem - 4px);margin:calc((1.5rem - 1.125rem + 4px) * 0.5) 0}.skeleton-s.skeleton-body{height:calc(0.875rem - 4px);margin:calc((1.125rem - 0.875rem + 4px) * 0.5) 0}.skeleton-m.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 2.5rem)}.skeleton-m.skeleton-square,.skeleton-m.skeleton-circle{width:var(--width, 2.5rem);height:var(--height, 2.5rem)}.skeleton-m.skeleton-head,.skeleton-m.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-m.skeleton-head{height:calc(1.25rem - 4px);margin:calc((1.5rem - 1.25rem + 4px) * 0.5) 0}.skeleton-m.skeleton-body{height:calc(0.9375rem - 4px);margin:calc((1.25rem - 0.9375rem + 4px) * 0.5) 0}.skeleton-l.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 3rem)}.skeleton-l.skeleton-square,.skeleton-l.skeleton-circle{width:var(--width, 3rem);height:var(--height, 3rem)}.skeleton-l.skeleton-head,.skeleton-l.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-l.skeleton-head{height:calc(1.5rem - 4px);margin:calc((1.75rem - 1.5rem + 4px) * 0.5) 0}.skeleton-l.skeleton-body{height:calc(1.125rem - 4px);margin:calc((1.5rem - 1.125rem + 4px) * 0.5) 0}.skeleton-xl.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 3.5rem)}.skeleton-xl.skeleton-square,.skeleton-xl.skeleton-circle{width:var(--width, 3.5rem);height:var(--height, 3.5rem)}.skeleton-xl.skeleton-head,.skeleton-xl.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-xl.skeleton-head{height:calc(1.75rem - 4px);margin:calc((2rem - 1.75rem + 4px) * 0.5) 0}.skeleton-xl.skeleton-body{height:calc(1.25rem - 4px);margin:calc((1.5rem - 1.25rem + 4px) * 0.5) 0}.skeleton-sheen{background:linear-gradient(90deg, var(--background) 33%, var(--highlight) 50%, var(--background) 66%) var(--background);background-size:300% 100%;animation:sheen var(--speed) ease-in-out infinite}.skeleton-pulse{position:relative;overflow:hidden}.skeleton-pulse::before{content:\"\";display:block;position:absolute;width:100%;height:100%;background-color:var(--highlight);animation:var(--speed) ease-in-out 0.5s infinite normal none running pulse;opacity:0}@keyframes sheen{0%{background-position:right}}@keyframes pulse{50%{opacity:1}}";
7654
10935
 
7655
10936
  const CatSkeleton = class {
7656
10937
  constructor(hostRef) {
@@ -7810,9 +11091,9 @@ const CatTabs = class {
7810
11091
  };
7811
11092
  CatTabs.style = catTabsCss;
7812
11093
 
7813
- var e=new Map;function t(t){var r=e.get(t);r&&r.destroy();}function r(t){var r=e.get(t);r&&r.update();}var o=null;"undefined"==typeof window?((o=function(e){return e}).destroy=function(e){return e},o.update=function(e){return e}):((o=function(t,r){return t&&Array.prototype.forEach.call(t.length?t:[t],function(t){return function(t){if(t&&t.nodeName&&"TEXTAREA"===t.nodeName&&!e.has(t)){var r=null,o=window.getComputedStyle(t),n=function(r){window.removeEventListener("resize",l,!1),t.removeEventListener("input",l,!1),t.removeEventListener("keyup",l,!1),t.removeEventListener("autosize:destroy",n,!1),t.removeEventListener("autosize:update",l,!1),Object.keys(r).forEach(function(e){return t.style[e]=r[e]}),e.delete(t);}.bind(t,{height:t.style.height,resize:t.style.resize,textAlign:t.style.textAlign,overflowY:t.style.overflowY,overflowX:t.style.overflowX,wordWrap:t.style.wordWrap});t.addEventListener("autosize:destroy",n,!1),window.addEventListener("resize",l,!1),t.addEventListener("input",l,!1),t.addEventListener("autosize:update",l,!1),t.style.overflowX="hidden",t.style.wordWrap="break-word",e.set(t,{destroy:n,update:l}),l();}function l(e){void 0===e&&(e=null);var n=o.overflowY;if(0!==t.scrollHeight){var i,a=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push([e.parentNode,e.parentNode.scrollTop]),e=e.parentNode;return function(){return t.forEach(function(e){var t=e[0],r=e[1];t.style.scrollBehavior="auto",t.scrollTop=r,t.style.scrollBehavior=null;})}}(t);if(t.style.height="","vertical"===o.resize?t.style.resize="none":"both"===o.resize&&(t.style.resize="horizontal"),i="content-box"===o.boxSizing?t.scrollHeight-(parseFloat(o.paddingTop)+parseFloat(o.paddingBottom)):t.scrollHeight+parseFloat(o.borderTopWidth)+parseFloat(o.borderBottomWidth),"none"!==o.maxHeight&&i>parseFloat(o.maxHeight)?("hidden"===o.overflowY&&(t.style.overflow="scroll"),i=parseFloat(o.maxHeight)):"hidden"!==o.overflowY&&(t.style.overflow="hidden"),t.style.height=i+"px",e&&(t.style.textAlign=e),a(),r!==i&&(t.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),r=i),n!==o.overflow&&!e){var s=o.textAlign;"hidden"===o.overflow&&(t.style.textAlign="start"===s?"end":"start"),l(s);}}}}(t)}),t}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],t),e},o.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e});var n=o;
11094
+ var e=new Map;function t(t){var o=e.get(t);o&&o.destroy();}function o(t){var o=e.get(t);o&&o.update();}var r=null;"undefined"==typeof window?((r=function(e){return e}).destroy=function(e){return e},r.update=function(e){return e}):((r=function(t,o){return t&&Array.prototype.forEach.call(t.length?t:[t],function(t){return function(t){if(t&&t.nodeName&&"TEXTAREA"===t.nodeName&&!e.has(t)){var o,r=null,n=window.getComputedStyle(t),i=(o=t.value,function(){a({testForHeightReduction:""===o||!t.value.startsWith(o),restoreTextAlign:null}),o=t.value;}),l=function(o){t.removeEventListener("autosize:destroy",l),t.removeEventListener("autosize:update",s),t.removeEventListener("input",i),window.removeEventListener("resize",s),Object.keys(o).forEach(function(e){return t.style[e]=o[e]}),e.delete(t);}.bind(t,{height:t.style.height,resize:t.style.resize,textAlign:t.style.textAlign,overflowY:t.style.overflowY,overflowX:t.style.overflowX,wordWrap:t.style.wordWrap});t.addEventListener("autosize:destroy",l),t.addEventListener("autosize:update",s),t.addEventListener("input",i),window.addEventListener("resize",s),t.style.overflowX="hidden",t.style.wordWrap="break-word",e.set(t,{destroy:l,update:s}),s();}function a(e){var o,i,l=e.restoreTextAlign,s=void 0===l?null:l,d=e.testForHeightReduction,u=void 0===d||d,c=n.overflowY;if(0!==t.scrollHeight&&("vertical"===n.resize?t.style.resize="none":"both"===n.resize&&(t.style.resize="horizontal"),u&&(o=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push([e.parentNode,e.parentNode.scrollTop]),e=e.parentNode;return function(){return t.forEach(function(e){var t=e[0],o=e[1];t.style.scrollBehavior="auto",t.scrollTop=o,t.style.scrollBehavior=null;})}}(t),t.style.height=""),i="content-box"===n.boxSizing?t.scrollHeight-(parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)):t.scrollHeight+parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),"none"!==n.maxHeight&&i>parseFloat(n.maxHeight)?("hidden"===n.overflowY&&(t.style.overflow="scroll"),i=parseFloat(n.maxHeight)):"hidden"!==n.overflowY&&(t.style.overflow="hidden"),t.style.height=i+"px",s&&(t.style.textAlign=s),o&&o(),r!==i&&(t.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),r=i),c!==n.overflow&&!s)){var v=n.textAlign;"hidden"===n.overflow&&(t.style.textAlign="start"===v?"end":"start"),a({restoreTextAlign:v,testForHeightReduction:!0});}}function s(){a({testForHeightReduction:!0,restoreTextAlign:null});}}(t)}),t}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],t),e},r.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e});var n=r;
7814
11095
 
7815
- const catTextareaCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}.cat-bg-primary{background-color:rgb(var(--cat-primary-bg, 0, 129, 148)) !important;color:rgb(var(--cat-primary-fill, 255, 255, 255)) !important}.cat-bg-primary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primary-hover:hover{background-color:rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;color:rgb(var(--cat-primary-fill-hover, 255, 255, 255)) !important}.cat-text-primary,.cat-link-primary{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-link-primary,.cat-text-primary-hover{transition:color 0.13s}.cat-link-primary:hover,.cat-text-primary-hover:hover{color:rgb(var(--cat-primary-text-hover, 1, 115, 132)) !important}.cat-link-primary:active,.cat-text-primary-hover:active{color:rgb(var(--cat-primary-text-active, 2, 99, 113)) !important}.cat-bg-primaryInverted{background-color:#93b4f2 !important;color:black !important}.cat-bg-primaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primaryInverted-hover:hover{background-color:#93b4f2 !important;color:black !important}.cat-text-primaryInverted,.cat-link-primaryInverted{color:#93b4f2 !important}.cat-link-primaryInverted,.cat-text-primaryInverted-hover{transition:color 0.13s}.cat-link-primaryInverted:hover,.cat-text-primaryInverted-hover:hover{color:#93b4f2 !important}.cat-link-primaryInverted:active,.cat-text-primaryInverted-hover:active{color:#93b4f2 !important}.cat-bg-secondary{background-color:rgb(var(--cat-secondary-bg, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill, 255, 255, 255)) !important}.cat-bg-secondary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondary-hover:hover{background-color:rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill-hover, 255, 255, 255)) !important}.cat-text-secondary,.cat-link-secondary{color:rgb(var(--cat-secondary-text, 0, 0, 0)) !important}.cat-link-secondary,.cat-text-secondary-hover{transition:color 0.13s}.cat-link-secondary:hover,.cat-text-secondary-hover:hover{color:rgb(var(--cat-secondary-text-hover, 0, 0, 0)) !important}.cat-link-secondary:active,.cat-text-secondary-hover:active{color:rgb(var(--cat-secondary-text-active, 0, 0, 0)) !important}.cat-bg-secondaryInverted{background-color:#697687 !important;color:black !important}.cat-bg-secondaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondaryInverted-hover:hover{background-color:#697687 !important;color:black !important}.cat-text-secondaryInverted,.cat-link-secondaryInverted{color:white !important}.cat-link-secondaryInverted,.cat-text-secondaryInverted-hover{transition:color 0.13s}.cat-link-secondaryInverted:hover,.cat-text-secondaryInverted-hover:hover{color:white !important}.cat-link-secondaryInverted:active,.cat-text-secondaryInverted-hover:active{color:white !important}.cat-bg-success{background-color:rgb(var(--cat-success-bg-, 0, 132, 88)) !important;color:rgb(var(--cat-success-fill, 255, 255, 255)) !important}.cat-bg-success-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-success-hover:hover{background-color:rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;color:rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important}.cat-text-success,.cat-link-success{color:rgb(var(--cat-success-text, 0, 132, 88)) !important}.cat-link-success,.cat-text-success-hover{transition:color 0.13s}.cat-link-success:hover,.cat-text-success-hover:hover{color:rgb(var(--cat-success-text-hover, 0, 117, 78)) !important}.cat-link-success:active,.cat-text-success-hover:active{color:rgb(var(--cat-success-text-active, 0, 105, 70)) !important}.cat-bg-warning{background-color:rgb(var(--cat-warning-bg, 255, 206, 128)) !important;color:rgb(var(--cat-warning-fill, 0, 0, 0)) !important}.cat-bg-warning-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-warning-hover:hover{background-color:rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;color:rgb(var(--cat-warning-fill-hover, 0, 0, 0)) !important}.cat-text-warning,.cat-link-warning{color:rgb(var(--cat-warning-text, 159, 97, 0)) !important}.cat-link-warning,.cat-text-warning-hover{transition:color 0.13s}.cat-link-warning:hover,.cat-text-warning-hover:hover{color:rgb(var(--cat-warning-text-hover, 159, 97, 0)) !important}.cat-link-warning:active,.cat-text-warning-hover:active{color:rgb(var(--cat-warning-text-active, 159, 97, 0)) !important}.cat-bg-danger{background-color:rgb(var(--cat-danger-bg, 217, 52, 13)) !important;color:rgb(var(--cat-danger-fill, 255, 255, 255)) !important}.cat-bg-danger-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-danger-hover:hover{background-color:rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;color:rgb(var(--cat-danger-fill-hover, 255, 255, 255)) !important}.cat-text-danger,.cat-link-danger{color:rgb(var(--cat-danger-text, 217, 52, 13)) !important}.cat-link-danger,.cat-text-danger-hover{transition:color 0.13s}.cat-link-danger:hover,.cat-text-danger-hover:hover{color:rgb(var(--cat-danger-text-hover, 194, 46, 11)) !important}.cat-link-danger:active,.cat-text-danger-hover:active{color:rgb(var(--cat-danger-text-active, 174, 42, 10)) !important}.cat-active{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-muted{color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}.label{overflow:hidden;word-wrap:break-word;word-break:break-word}.label-container{flex-basis:var(--label-size, 33.33%)}.label-container.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.label-container .label-wrapper{display:flex;gap:0.25rem}.label-metadata{display:flex;flex-shrink:0;flex-grow:1;justify-content:space-between;gap:0.25rem}.label-optional{display:flex;align-items:center;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.label-character-count{display:flex;align-items:center;margin-left:auto;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.input-horizontal .label-wrapper,.textarea-horizontal .label-wrapper,.select-horizontal .label-wrapper{flex-direction:column}.input-horizontal label,.textarea-horizontal label,.select-horizontal label{min-height:2.5rem;display:inline-flex;align-items:center}.input-horizontal .label-metadata,.textarea-horizontal .label-metadata,.select-horizontal .label-metadata{justify-content:flex-start}.input-horizontal .label-metadata .label-character-count,.textarea-horizontal .label-metadata .label-character-count,.select-horizontal .label-metadata .label-character-count{margin-left:0}:host{display:flex;flex-direction:column;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);margin-bottom:1rem}:host([hidden]){display:none}.textarea-field,.textarea-container{display:flex;flex-direction:column;gap:0.5rem;flex:1 1 auto}.textarea-field.textarea-horizontal{flex-direction:row;gap:1rem}.textarea-wrapper{position:relative;display:flex;flex-direction:column}.icon-suffix{position:absolute;top:calc(0.625rem - 2px);right:0.75rem;background:rgba(255, 255, 255, 0.75);border-radius:100rem}.textarea-disabled .icon-suffix{background:rgba(242, 244, 247, 0.75)}textarea{margin:0;padding:0.625rem 0.75rem;min-height:2.5rem;font:inherit;background:white;border-radius:var(--cat-border-radius-m, 0.25rem);border:none;box-shadow:0 0 0 1px rgb(var(--cat-border-color-dark, 215, 219, 224));transition:box-shadow 0.13s linear;resize:vertical;}textarea:disabled{background:#f2f4f7;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108));resize:none}.textarea-invalid textarea{box-shadow:0 0 0 1px rgba(var(--cat-danger-bg, 217, 52, 13), 0.2)}textarea:hover:not(:disabled){box-shadow:0 0 0 2px rgb(var(--cat-border-color-dark, 215, 219, 224))}.textarea-invalid textarea:hover:not(:disabled){box-shadow:0 0 0 2px rgba(var(--cat-danger-bg, 217, 52, 13), 0.2)}textarea:focus{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255))}.textarea-invalid textarea:focus{outline:2px solid rgba(var(--cat-danger-bg, 217, 52, 13), 0.2)}textarea::placeholder{color:rgb(var(--cat-font-color-muted, 81, 92, 108))}textarea:-webkit-autofill,textarea:-webkit-autofill:hover,textarea:-webkit-autofill:focus{-webkit-box-shadow:0 0 0 9999px #e8f0fe inset}";
11096
+ const catTextareaCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1.125rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}.cat-bg-primary{background-color:rgb(var(--cat-primary-bg, 0, 129, 148)) !important;color:rgb(var(--cat-primary-fill, 255, 255, 255)) !important}.cat-bg-primary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primary-hover:hover{background-color:rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;color:rgb(var(--cat-primary-fill-hover, 255, 255, 255)) !important}.cat-text-primary,.cat-link-primary{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-link-primary,.cat-text-primary-hover{transition:color 0.13s}.cat-link-primary:hover,.cat-text-primary-hover:hover{color:rgb(var(--cat-primary-text-hover, 1, 115, 132)) !important}.cat-link-primary:active,.cat-text-primary-hover:active{color:rgb(var(--cat-primary-text-active, 2, 99, 113)) !important}.cat-bg-primaryInverted{background-color:#93b4f2 !important;color:black !important}.cat-bg-primaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-primaryInverted-hover:hover{background-color:#93b4f2 !important;color:black !important}.cat-text-primaryInverted,.cat-link-primaryInverted{color:#93b4f2 !important}.cat-link-primaryInverted,.cat-text-primaryInverted-hover{transition:color 0.13s}.cat-link-primaryInverted:hover,.cat-text-primaryInverted-hover:hover{color:#93b4f2 !important}.cat-link-primaryInverted:active,.cat-text-primaryInverted-hover:active{color:#93b4f2 !important}.cat-bg-secondary{background-color:rgb(var(--cat-secondary-bg, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill, 255, 255, 255)) !important}.cat-bg-secondary-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondary-hover:hover{background-color:rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;color:rgb(var(--cat-secondary-fill-hover, 255, 255, 255)) !important}.cat-text-secondary,.cat-link-secondary{color:rgb(var(--cat-secondary-text, 0, 0, 0)) !important}.cat-link-secondary,.cat-text-secondary-hover{transition:color 0.13s}.cat-link-secondary:hover,.cat-text-secondary-hover:hover{color:rgb(var(--cat-secondary-text-hover, 0, 0, 0)) !important}.cat-link-secondary:active,.cat-text-secondary-hover:active{color:rgb(var(--cat-secondary-text-active, 0, 0, 0)) !important}.cat-bg-secondaryInverted{background-color:#697687 !important;color:black !important}.cat-bg-secondaryInverted-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-secondaryInverted-hover:hover{background-color:#697687 !important;color:black !important}.cat-text-secondaryInverted,.cat-link-secondaryInverted{color:white !important}.cat-link-secondaryInverted,.cat-text-secondaryInverted-hover{transition:color 0.13s}.cat-link-secondaryInverted:hover,.cat-text-secondaryInverted-hover:hover{color:white !important}.cat-link-secondaryInverted:active,.cat-text-secondaryInverted-hover:active{color:white !important}.cat-bg-success{background-color:rgb(var(--cat-success-bg-, 0, 132, 88)) !important;color:rgb(var(--cat-success-fill, 255, 255, 255)) !important}.cat-bg-success-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-success-hover:hover{background-color:rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;color:rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important}.cat-text-success,.cat-link-success{color:rgb(var(--cat-success-text, 0, 132, 88)) !important}.cat-link-success,.cat-text-success-hover{transition:color 0.13s}.cat-link-success:hover,.cat-text-success-hover:hover{color:rgb(var(--cat-success-text-hover, 0, 117, 78)) !important}.cat-link-success:active,.cat-text-success-hover:active{color:rgb(var(--cat-success-text-active, 0, 105, 70)) !important}.cat-bg-warning{background-color:rgb(var(--cat-warning-bg, 255, 206, 128)) !important;color:rgb(var(--cat-warning-fill, 0, 0, 0)) !important}.cat-bg-warning-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-warning-hover:hover{background-color:rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;color:rgb(var(--cat-warning-fill-hover, 0, 0, 0)) !important}.cat-text-warning,.cat-link-warning{color:rgb(var(--cat-warning-text, 159, 97, 0)) !important}.cat-link-warning,.cat-text-warning-hover{transition:color 0.13s}.cat-link-warning:hover,.cat-text-warning-hover:hover{color:rgb(var(--cat-warning-text-hover, 159, 97, 0)) !important}.cat-link-warning:active,.cat-text-warning-hover:active{color:rgb(var(--cat-warning-text-active, 159, 97, 0)) !important}.cat-bg-danger{background-color:rgb(var(--cat-danger-bg, 217, 52, 13)) !important;color:rgb(var(--cat-danger-fill, 255, 255, 255)) !important}.cat-bg-danger-hover{transition:background-color 0.13s, color 0.13s}.cat-bg-danger-hover:hover{background-color:rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;color:rgb(var(--cat-danger-fill-hover, 255, 255, 255)) !important}.cat-text-danger,.cat-link-danger{color:rgb(var(--cat-danger-text, 217, 52, 13)) !important}.cat-link-danger,.cat-text-danger-hover{transition:color 0.13s}.cat-link-danger:hover,.cat-text-danger-hover:hover{color:rgb(var(--cat-danger-text-hover, 194, 46, 11)) !important}.cat-link-danger:active,.cat-text-danger-hover:active{color:rgb(var(--cat-danger-text-active, 174, 42, 10)) !important}.cat-active{color:rgb(var(--cat-primary-text, 0, 129, 148)) !important}.cat-muted{color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}.label{overflow:hidden;word-wrap:break-word;word-break:break-word}.label-container{flex-basis:var(--label-size, 33.33%)}.label-container.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.label-container .label-wrapper{display:flex;gap:0.25rem}.label-metadata{display:flex;flex-shrink:0;flex-grow:1;justify-content:space-between;gap:0.25rem}.label-optional{display:flex;align-items:center;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.label-character-count{display:flex;align-items:center;margin-left:auto;max-height:1.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.input-horizontal .label-wrapper,.textarea-horizontal .label-wrapper,.select-horizontal .label-wrapper{flex-direction:column}.input-horizontal label,.textarea-horizontal label,.select-horizontal label{min-height:2.5rem;display:inline-flex;align-items:center}.input-horizontal .label-metadata,.textarea-horizontal .label-metadata,.select-horizontal .label-metadata{justify-content:flex-start}.input-horizontal .label-metadata .label-character-count,.textarea-horizontal .label-metadata .label-character-count,.select-horizontal .label-metadata .label-character-count{margin-left:0}:host{display:flex;flex-direction:column;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);margin-bottom:1rem}:host([hidden]){display:none}.textarea-field,.textarea-container{display:flex;flex-direction:column;gap:0.5rem;flex:1 1 auto}.textarea-field.textarea-horizontal{flex-direction:row;gap:1rem}.textarea-wrapper{position:relative;display:flex;flex-direction:column}.icon-suffix{position:absolute;top:calc(0.625rem - 2px);right:0.75rem;background:rgba(255, 255, 255, 0.75);border-radius:100rem}.textarea-disabled .icon-suffix{background:rgba(242, 244, 247, 0.75)}textarea{margin:0;padding:0.625rem 0.75rem;box-sizing:border-box;min-height:2.5rem;font:inherit;background:white;border-radius:var(--cat-border-radius-m, 0.25rem);border:none;box-shadow:inset 0 0 0 1px rgb(var(--border-color));transition:box-shadow 0.13s linear;resize:vertical;--border-color:var(--cat-border-color-dark, 215, 219, 224);}textarea:disabled{background:#f2f4f7;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108));resize:none}textarea:not(:disabled):hover{box-shadow:inset 0 0 0 1px rgb(var(--border-color)), 0 0 0 1px rgb(var(--border-color))}textarea:focus{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:-1px}.textarea-invalid textarea{--border-color:var(--cat-danger-bg, 217, 52, 13), 0.2}textarea::placeholder{color:rgb(var(--cat-font-color-muted, 81, 92, 108))}textarea:-webkit-autofill,textarea:-webkit-autofill:hover,textarea:-webkit-autofill:focus{-webkit-box-shadow:0 0 0 9999px #e8f0fe inset}";
7816
11097
 
7817
11098
  let nextUniqueId$2 = 0;
7818
11099
  const CatTextarea = class {
@@ -7906,7 +11187,7 @@ const CatTextarea = class {
7906
11187
  'textarea-wrapper': true,
7907
11188
  'textarea-disabled': this.disabled,
7908
11189
  'textarea-invalid': this.invalid
7909
- } }, index.h("textarea", Object.assign({}, this.nativeAttributes, { ref: el => (this.textarea = el), id: this.id, disabled: this.disabled, maxlength: this.maxLength, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, rows: this.rows, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this), "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": ((_c = this.hint) === null || _c === void 0 ? void 0 : _c.length) ? this.id + '-hint' : undefined })), this.invalid && (index.h("cat-icon", { icon: "alert-circle-outlined", class: "icon-suffix cat-text-danger", size: "l", onClick: () => this.textarea.focus() }))), (this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (index.h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }), errorMap: this.errorMap }))))));
11190
+ } }, index.h("textarea", Object.assign({}, this.nativeAttributes, { ref: el => (this.textarea = el), id: this.id, disabled: this.disabled, maxlength: this.maxLength, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, rows: this.rows, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this), "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": ((_c = this.hint) === null || _c === void 0 ? void 0 : _c.length) ? this.id + '-hint' : undefined })), this.invalid && (index.h("cat-icon", { icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l", onClick: () => this.textarea.focus() }))), (this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (index.h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }), errorMap: this.errorMap }))))));
7910
11191
  }
7911
11192
  get invalid() {
7912
11193
  return !!this.errorMap;
@@ -7950,7 +11231,167 @@ const CatTextarea = class {
7950
11231
  };
7951
11232
  CatTextarea.style = catTextareaCss;
7952
11233
 
7953
- const catToggleCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}:host{display:flex;flex-direction:column;gap:0.5rem;margin-bottom:1rem}:host([hidden]){display:none}label{flex:0 1 auto;display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}.label-left{flex-direction:row-reverse}input{position:absolute;margin:0;width:2rem;height:1.25rem;opacity:0;cursor:inherit}.toggle{flex:0 0 auto;display:flex;align-items:center;justify-content:center;position:relative;width:2rem;height:1.25rem;border-radius:10rem;background-color:rgb(var(--cat-border-color-dark, 215, 219, 224));transition:background-color 0.13s ease;pointer-events:none}:checked+.toggle{background-color:rgb(var(--cat-primary-bg, 0, 129, 148))}:focus-visible+.toggle{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.toggle::after{content:\"\";position:absolute;width:1rem;height:1rem;background:#fff;border-radius:10rem;transform:translateX(calc(2px - 0.5rem));transition:transform 0.13s linear;box-shadow:0 1px 2px rgba(27, 31, 38, 0.06), 0 1px 3px rgba(27, 31, 38, 0.1)}:checked+.toggle::after{transform:translateX(calc(-2px + 0.5rem));background:rgb(var(--cat-primary-fill, 255, 255, 255))}.is-disabled .toggle{background-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}:host(.cat-error) .toggle{background-color:rgba(var(--cat-danger-bg, 217, 52, 13), 0.2)}:host(.cat-error) :checked+.toggle{background-color:rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) :checked+.toggle::after{background:rgb(var(--cat-danger-fill, 255, 255, 255))}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}";
11234
+ const catTimepickerCss = "";
11235
+
11236
+ const CatTimepicker = class {
11237
+ constructor(hostRef) {
11238
+ index.registerInstance(this, hostRef);
11239
+ this.catOpen = index.createEvent(this, "catOpen", 7);
11240
+ this.catClose = index.createEvent(this, "catClose", 7);
11241
+ this.catChange = index.createEvent(this, "catChange", 7);
11242
+ this.catBlur = index.createEvent(this, "catBlur", 7);
11243
+ this.state = undefined;
11244
+ this.hasSlottedLabel = false;
11245
+ this.hasSlottedHint = false;
11246
+ this.errorMap = undefined;
11247
+ this.requiredMarker = 'optional';
11248
+ this.horizontal = false;
11249
+ this.multiple = false;
11250
+ this.placement = 'bottom-start';
11251
+ this.value = undefined;
11252
+ this.disabled = false;
11253
+ this.placeholder = undefined;
11254
+ this.hint = undefined;
11255
+ this.identifier = undefined;
11256
+ this.label = '';
11257
+ this.name = undefined;
11258
+ this.labelHidden = false;
11259
+ this.required = false;
11260
+ this.clearable = false;
11261
+ this.max = undefined;
11262
+ this.min = undefined;
11263
+ this.noItems = undefined;
11264
+ this.errors = undefined;
11265
+ this.errorUpdate = 0;
11266
+ this.nativeAttributes = undefined;
11267
+ this.minutesStep = 30;
11268
+ this.hourShort = this.isBrowserHour12();
11269
+ }
11270
+ componentWillRender() {
11271
+ this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
11272
+ this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
11273
+ }
11274
+ componentDidLoad() {
11275
+ var _a;
11276
+ (_a = this.timeSelect) === null || _a === void 0 ? void 0 : _a.connect(this.timeConnector);
11277
+ // IMask spike
11278
+ // const input = this.hostElement.shadowRoot?.querySelector('cat-select')?.shadowRoot?.querySelector('input');
11279
+ // if (input) {
11280
+ // this.timeMask = this.getTimeMask(input);
11281
+ // }
11282
+ }
11283
+ render() {
11284
+ return (index.h(index.Host, null, index.h("cat-select", { requiredMarker: this.requiredMarker, horizontal: this.horizontal, clearable: this.clearable, disabled: this.disabled, hint: this.hint, identifier: this.identifier, label: this.label, labelHidden: this.labelHidden, name: this.name, multiple: this.multiple, placeholder: this.placeholder, placement: this.placement, required: this.required, noItems: this.noItems, ref: el => (this.timeSelect = el), value: this.value, errors: this.errors, errorUpdate: this.errorUpdate, nativeAttributes: this.nativeAttributes, onCatChange: event => this.onCatChange(event), onCatOpen: this.onCatOpen.bind(this), onCatClose: this.onCatClose.bind(this), onCatBlur: this.onCatBlur.bind(this) }, this.hasSlottedLabel && (index.h("span", { slot: "label" }, index.h("slot", { name: "label" }))), this.hasSlottedHint && (index.h("span", { slot: "hint" }, index.h("slot", { name: "hint" }))))));
11285
+ }
11286
+ get timeConnector() {
11287
+ return {
11288
+ resolve: (times) => {
11289
+ return of(times.map(t => this.timeArray.find(time => time.hour === this.getHour(t) && time.minutes === this.getMinutes(t))));
11290
+ },
11291
+ retrieve: (term) => {
11292
+ const filteredTimeArray = this.timeArray.filter(t => {
11293
+ if (!term)
11294
+ return true;
11295
+ const formatedTime = this.hourShort ? this.formatAMPM(t.hour, t.minutes) : this.formatTime(t.hour, t.minutes);
11296
+ return formatedTime.toUpperCase().includes(term.toUpperCase());
11297
+ });
11298
+ return of({
11299
+ last: true,
11300
+ totalElements: filteredTimeArray.length,
11301
+ content: filteredTimeArray
11302
+ });
11303
+ },
11304
+ render: ({ hour, minutes }) => ({
11305
+ label: this.hourShort ? this.formatAMPM(hour, minutes) : this.formatTime(hour, minutes)
11306
+ })
11307
+ };
11308
+ }
11309
+ get timeArray() {
11310
+ const times = [];
11311
+ for (let hour = 0; hour < 24; hour++) {
11312
+ for (let minutes = 0; minutes < 60; minutes += this.minutesStep) {
11313
+ if (this.isHigherThanMinValue(hour, minutes) && this.isLowerThanMaxValue(hour, minutes)) {
11314
+ times.push({
11315
+ id: this.hourShort ? this.formatAMPM(hour, minutes) : this.formatTime(hour, minutes),
11316
+ hour,
11317
+ minutes
11318
+ });
11319
+ }
11320
+ }
11321
+ }
11322
+ return times;
11323
+ }
11324
+ isBrowserHour12() {
11325
+ var _a, _b;
11326
+ const browserLanguage = (_b = (_a = window === null || window === void 0 ? void 0 : window.navigator) === null || _a === void 0 ? void 0 : _a.language) !== null && _b !== void 0 ? _b : 'en';
11327
+ const hour = new Intl.DateTimeFormat(browserLanguage, { hour: 'numeric' }).format(new Date().setHours(16));
11328
+ return hour.toLowerCase().includes('pm' );
11329
+ }
11330
+ getHour(time) {
11331
+ let hour = Number(time.split(':')[0]);
11332
+ if (time.toLowerCase().includes('pm') && hour < 12)
11333
+ hour = hour + 12;
11334
+ if (time.toLowerCase().includes('am') && hour == 12)
11335
+ hour = hour - 12;
11336
+ return hour;
11337
+ }
11338
+ getMinutes(time) {
11339
+ const minutes = time.match(/:(\d+)/);
11340
+ return Number(minutes ? minutes[1] : 0);
11341
+ }
11342
+ isHigherThanMinValue(hour, minutes) {
11343
+ if (this.min) {
11344
+ const minHour = this.getHour(this.min);
11345
+ const minMinutes = this.getMinutes(this.min);
11346
+ return hour > minHour || (hour === minHour && minutes >= minMinutes);
11347
+ }
11348
+ return true;
11349
+ }
11350
+ isLowerThanMaxValue(hour, minutes) {
11351
+ if (this.max) {
11352
+ const maxHour = this.getHour(this.max);
11353
+ const maxMinutes = this.getMinutes(this.max);
11354
+ return hour < maxHour || (hour === maxHour && minutes <= maxMinutes);
11355
+ }
11356
+ return true;
11357
+ }
11358
+ formatAMPM(hour, minutes) {
11359
+ if (hour === 0) {
11360
+ return `12:${minutes < 10 ? `0${minutes}` : minutes} AM`;
11361
+ }
11362
+ else if (hour < 12) {
11363
+ return `${hour < 10 ? `0${hour}` : hour}:${minutes < 10 ? `0${minutes}` : minutes} AM`;
11364
+ }
11365
+ else {
11366
+ return `${hour % 12 < 10 ? `0${hour % 12}` : hour % 12}:${minutes < 10 ? `0${minutes}` : minutes} PM`;
11367
+ }
11368
+ }
11369
+ formatTime(hour, minutes) {
11370
+ return `${hour < 10 ? `0${hour}` : hour}:${minutes < 10 ? `0${minutes}` : minutes}`;
11371
+ }
11372
+ onCatChange(event) {
11373
+ var _a;
11374
+ event.stopPropagation();
11375
+ this.value = (_a = this.timeSelect) === null || _a === void 0 ? void 0 : _a.value;
11376
+ this.catChange.emit(event);
11377
+ }
11378
+ onCatOpen(event) {
11379
+ event.stopPropagation();
11380
+ this.catOpen.emit(event);
11381
+ }
11382
+ onCatClose(event) {
11383
+ event.stopPropagation();
11384
+ this.catClose.emit(event);
11385
+ }
11386
+ onCatBlur(event) {
11387
+ event.stopPropagation();
11388
+ this.catBlur.emit(event);
11389
+ }
11390
+ get hostElement() { return index.getElement(this); }
11391
+ };
11392
+ CatTimepicker.style = catTimepickerCss;
11393
+
11394
+ const catToggleCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column;color:rgb(var(--cat-hint-color, inherit))}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1.125rem;font-weight:var(--cat-font-weight-body, 400);margin:0 !important}.hint-wrapper{flex:0 1 auto;display:flex;gap:0.5rem}.hint-section{flex:1 1 auto;min-width:0}.input-hint,::slotted([slot=hint]){color:rgb(var(--cat-font-color-muted, 81, 92, 108));line-height:1.5;flex:1 1 auto;min-width:0}:host{display:flex;flex-direction:column;gap:0.5rem;margin-bottom:1rem}:host([hidden]){display:none}label{flex:0 1 auto;display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}.label-left{flex-direction:row-reverse}input{position:absolute;margin:0;width:2rem;height:1.25rem;opacity:0;cursor:inherit}.toggle-placeholder{width:calc(2rem + 1px)}.toggle{flex:0 0 auto;display:flex;align-items:center;justify-content:center;position:relative;width:2rem;height:1.25rem;border-radius:10rem;background-color:rgb(var(--cat-border-color-dark, 215, 219, 224));transition:background-color 0.13s ease;pointer-events:none}:checked+.toggle{background-color:rgb(var(--cat-primary-bg, 0, 129, 148))}:focus-visible+.toggle{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.toggle::after{content:\"\";position:absolute;width:1rem;height:1rem;background:#fff;border-radius:10rem;transform:translateX(calc(2px - 0.5rem));transition:transform 0.13s linear;box-shadow:0 1px 2px rgba(27, 31, 38, 0.06), 0 1px 3px rgba(27, 31, 38, 0.1)}:checked+.toggle::after{transform:translateX(calc(-2px + 0.5rem));background:rgb(var(--cat-primary-fill, 255, 255, 255))}.is-disabled .toggle{background-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}:host(.cat-error) .toggle{background-color:rgba(var(--cat-danger-bg, 217, 52, 13), 0.2)}:host(.cat-error) :checked+.toggle{background-color:rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) :checked+.toggle::after{background:rgb(var(--cat-danger-fill, 255, 255, 255))}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}";
7954
11395
 
7955
11396
  let nextUniqueId$1 = 0;
7956
11397
  const CatToggle = class {
@@ -8008,7 +11449,7 @@ const CatToggle = class {
8008
11449
  this.input.click();
8009
11450
  }
8010
11451
  render() {
8011
- return (index.h(index.Host, null, index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } }, index.h("input", Object.assign({}, this.nativeAttributes, { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value !== undefined ? String(this.value) : this.value, checked: this.checked, required: this.required, disabled: this.disabled, class: "form-check-input", role: "switch", onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) })), index.h("span", { class: "toggle", part: "toggle" }), index.h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (index.h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }) }))));
11452
+ return (index.h(index.Host, null, index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } }, index.h("input", Object.assign({}, this.nativeAttributes, { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value !== undefined ? String(this.value) : this.value, checked: this.checked, required: this.required, disabled: this.disabled, class: "form-check-input", role: "switch", onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) })), index.h("span", { class: "toggle", part: "toggle" }), index.h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (index.h("div", { class: { 'hint-wrapper': true, 'label-left': this.labelLeft } }, index.h("div", { class: "toggle-placeholder" }), index.h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }) })))));
8012
11453
  }
8013
11454
  onInput(event) {
8014
11455
  this.checked = this.input.checked;
@@ -8029,7 +11470,7 @@ CatToggle.style = catToggleCss;
8029
11470
 
8030
11471
  const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
8031
11472
 
8032
- const catTooltipCss = ":host{display:contents}:host([hidden]){display:none}.tooltip{--cat-font-color-head:cat-token(\"color.ui.font.tooltip\", $wrap: false);--cat-font-color-body:cat-token(\"color.ui.font.tooltip\", $wrap: false);position:fixed;width:max-content;top:0;left:0;box-sizing:border-box;font-size:0.875rem;line-height:1rem;font-weight:500;background-color:rgb(var(--cat-bg-tooltip, 0, 0, 0));border-radius:var(--cat-border-radius-m, 0.25rem);color:rgb(var(--cat-font-color-tooltip, 255, 255, 255));transition:opacity 0.25s linear, visibility 0.25s linear;visibility:hidden;opacity:0;box-shadow:rgba(0, 0, 0, 0.08) 0 1px 8px 0;z-index:200;max-width:min(100vw - 0.5rem, 20rem)}.tooltip-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.tooltip-show{opacity:1;visibility:visible}.tooltip-round{border-radius:10rem}.tooltip-s{padding:0.375rem 0.5rem}.tooltip-s.tooltip-round{padding:0.375rem 0.75rem}.tooltip-m{padding:0.75rem}.tooltip-m.tooltip-round{padding:0.75rem 1rem}.tooltip-l{padding:1rem}.tooltip-l.tooltip-round{padding:1rem 1.5rem}";
11473
+ const catTooltipCss = ":host{display:contents}:host([hidden]){display:none}.tooltip{--cat-font-color-head:cat-token(\"color.ui.font.tooltip\", $wrap: false);--cat-font-color-body:cat-token(\"color.ui.font.tooltip\", $wrap: false);position:fixed;width:max-content;top:0;left:0;box-sizing:border-box;font-size:0.875rem;line-height:1.125rem;font-weight:500;background-color:rgb(var(--cat-bg-tooltip, 0, 0, 0));border-radius:var(--cat-border-radius-m, 0.25rem);color:rgb(var(--cat-font-color-tooltip, 255, 255, 255));transition:opacity 0.25s linear, visibility 0.25s linear;visibility:hidden;opacity:0;box-shadow:rgba(0, 0, 0, 0.08) 0 1px 8px 0;z-index:200;max-width:min(100vw - 0.5rem, 20rem)}.tooltip-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.tooltip-show{opacity:1;visibility:visible}.tooltip-round{border-radius:10rem}.tooltip-s{padding:0.375rem 0.5rem}.tooltip-s.tooltip-round{padding:0.375rem 0.75rem}.tooltip-m{padding:0.75rem}.tooltip-m.tooltip-round{padding:0.75rem 1rem}.tooltip-l{padding:1rem}.tooltip-l.tooltip-round{padding:1rem 1.5rem}";
8033
11474
 
8034
11475
  let nextUniqueId = 0;
8035
11476
  const CatTooltip = class {
@@ -8166,6 +11607,7 @@ exports.cat_button = CatButton;
8166
11607
  exports.cat_button_group = CatButtonGroup;
8167
11608
  exports.cat_card = CatCard;
8168
11609
  exports.cat_checkbox = CatCheckbox;
11610
+ exports.cat_datepicker = CatDatepicker;
8169
11611
  exports.cat_dropdown = CatDropdown;
8170
11612
  exports.cat_form_group = CatFormGroup;
8171
11613
  exports.cat_icon = CatIcon;
@@ -8182,7 +11624,8 @@ exports.cat_spinner = CatSpinner;
8182
11624
  exports.cat_tab = CatTab;
8183
11625
  exports.cat_tabs = CatTabs;
8184
11626
  exports.cat_textarea = CatTextarea;
11627
+ exports.cat_timepicker = CatTimepicker;
8185
11628
  exports.cat_toggle = CatToggle;
8186
11629
  exports.cat_tooltip = CatTooltip;
8187
11630
 
8188
- //# sourceMappingURL=cat-alert_25.cjs.entry.js.map
11631
+ //# sourceMappingURL=cat-alert_27.cjs.entry.js.map