@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
@@ -1,5 +1,5 @@
1
- import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-fc2f91a4.js';
2
- import { l as loglevel, b as catI18nRegistry, d as catIconRegistry } from './cat-icon-registry-d6b80490.js';
1
+ import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-636ce8d6.js';
2
+ import { l as loglevel, b as catI18nRegistry, c as createCommonjsModule, a as commonjsGlobal, d as catIconRegistry } from './cat-icon-registry-4bd597f4.js';
3
3
 
4
4
  function setAttributeDefault(host, attr, value) {
5
5
  if (!host.hostElement.hasAttribute(attr) && value != null) {
@@ -13,11 +13,11 @@ const CatAlert = class {
13
13
  constructor(hostRef) {
14
14
  registerInstance(this, hostRef);
15
15
  this.mapIcon = new Map([
16
- ['primary', 'star-circle-filled'],
17
- ['secondary', 'clock-filled'],
18
- ['success', 'check-circle-filled'],
19
- ['warning', 'danger-filled'],
20
- ['danger', 'cross-circle-filled']
16
+ ['primary', '$cat:alert-primary'],
17
+ ['secondary', '$cat:alert-secondary'],
18
+ ['success', '$cat:alert-success'],
19
+ ['warning', '$cat:alert-warning'],
20
+ ['danger', '$cat:alert-danger']
21
21
  ]);
22
22
  this.mapRole = new Map([
23
23
  ['primary', 'status'],
@@ -256,7 +256,7 @@ function createEmptyStyleRule(query) {
256
256
  }
257
257
  }
258
258
 
259
- 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}";
259
+ 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}";
260
260
 
261
261
  const CatButton = class {
262
262
  constructor(hostRef) {
@@ -279,7 +279,6 @@ const CatButton = class {
279
279
  this.url = undefined;
280
280
  this.urlTarget = undefined;
281
281
  this.icon = undefined;
282
- this.iconSrc = undefined;
283
282
  this.iconOnly = false;
284
283
  this.iconRight = false;
285
284
  this.buttonId = undefined;
@@ -394,19 +393,19 @@ const CatButton = class {
394
393
  }
395
394
  }
396
395
  get isIconButton() {
397
- return (Boolean(this.icon) || Boolean(this.iconSrc)) && this._iconOnly;
396
+ return Boolean(this.icon) && this._iconOnly;
398
397
  }
399
398
  get hasPrefixIcon() {
400
- return (Boolean(this.icon) || Boolean(this.iconSrc)) && !this._iconOnly && !this.iconRight;
399
+ return Boolean(this.icon) && !this._iconOnly && !this.iconRight;
401
400
  }
402
401
  get hasSuffixIcon() {
403
- return (Boolean(this.icon) || Boolean(this.iconSrc)) && !this._iconOnly && this.iconRight;
402
+ return Boolean(this.icon) && !this._iconOnly && this.iconRight;
404
403
  }
405
404
  get content() {
406
405
  return [
407
- this.hasPrefixIcon ? (h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize, part: "prefix" })) : null,
408
- this.isIconButton ? (h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize })) : (h("span", { class: "cat-button-content", part: "content" }, h("slot", null))),
409
- this.hasSuffixIcon ? (h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize, part: "suffix" })) : null,
406
+ this.hasPrefixIcon ? h("cat-icon", { icon: this.icon, size: this.iconSize, part: "prefix" }) : null,
407
+ this.isIconButton ? (h("cat-icon", { icon: this.icon, size: this.iconSize })) : (h("span", { class: "cat-button-content", part: "content" }, h("slot", null))),
408
+ this.hasSuffixIcon ? h("cat-icon", { icon: this.icon, size: this.iconSize, part: "suffix" }) : null,
410
409
  this.loading ? h("cat-spinner", { size: this.spinnerSize }) : null
411
410
  ];
412
411
  }
@@ -480,7 +479,7 @@ const CatFormHint = props => {
480
479
  ]));
481
480
  };
482
481
 
483
- 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))}";
482
+ 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))}";
484
483
 
485
484
  let nextUniqueId$8 = 0;
486
485
  const CatCheckbox = class {
@@ -521,7 +520,2995 @@ const CatCheckbox = class {
521
520
  }
522
521
  }
523
522
  /**
524
- * Programmatically move focus to the checkbox. Use this method instead of
523
+ * Programmatically move focus to the checkbox. Use this method instead of
524
+ * `input.focus()`.
525
+ *
526
+ * @param options An optional object providing options to control aspects of
527
+ * the focusing process.
528
+ */
529
+ async doFocus(options) {
530
+ this.input.focus(options);
531
+ }
532
+ /**
533
+ * Programmatically remove focus from the checkbox. Use this method instead of
534
+ * `input.blur()`.
535
+ */
536
+ async doBlur() {
537
+ this.input.blur();
538
+ }
539
+ /**
540
+ * Programmatically simulate a click on the checkbox.
541
+ */
542
+ async doClick() {
543
+ this.input.click();
544
+ }
545
+ render() {
546
+ return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } }, 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) })), h("span", { class: "box", "aria-hidden": "true", part: "checkbox" }, h("svg", { class: "check", viewBox: "0 0 12 10" }, h("polyline", { points: "1.5 6 4.5 9 10.5 1" })), h("svg", { class: "dash", viewBox: "0 0 12 10" }, h("polyline", { points: "1.5 5 10.5 5" }))), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (h("div", { class: { 'hint-wrapper': true, 'label-left': this.labelLeft } }, h("div", { class: "box-placeholder" }), h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }) })))));
547
+ }
548
+ onInput(event) {
549
+ this.checked = this.input.checked;
550
+ if (!this.value || typeof this.value === 'boolean') {
551
+ this.value = this.checked;
552
+ }
553
+ this.catChange.emit(event);
554
+ }
555
+ onFocus(event) {
556
+ this.catFocus.emit(event);
557
+ }
558
+ onBlur(event) {
559
+ this.catBlur.emit(event);
560
+ }
561
+ get hostElement() { return getElement(this); }
562
+ };
563
+ CatCheckbox.style = catCheckboxCss;
564
+
565
+ var dayjs_min = createCommonjsModule(function (module, exports) {
566
+ !function(t,e){module.exports=e();}(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}));
567
+ });
568
+
569
+ var isoWeek = createCommonjsModule(function (module, exports) {
570
+ !function(e,t){module.exports=t();}(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)};}}));
571
+ });
572
+
573
+ var utc = createCommonjsModule(function (module, exports) {
574
+ !function(t,i){module.exports=i();}(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)};}}));
575
+ });
576
+
577
+ dayjs_min.extend(isoWeek);
578
+ dayjs_min.extend(utc);
579
+ const today$1 = () => dayjs_min().utc().startOf('day').toDate();
580
+
581
+ function lastItemOf(arr) {
582
+ return arr[arr.length - 1];
583
+ }
584
+
585
+ // push only the items not included in the array
586
+ function pushUnique(arr, ...items) {
587
+ items.forEach((item) => {
588
+ if (arr.includes(item)) {
589
+ return;
590
+ }
591
+ arr.push(item);
592
+ });
593
+ return arr;
594
+ }
595
+
596
+ function stringToArray(str, separator) {
597
+ // convert empty string to an empty array
598
+ return str ? str.split(separator) : [];
599
+ }
600
+
601
+ function isInRange(testVal, min, max) {
602
+ const minOK = min === undefined || testVal >= min;
603
+ const maxOK = max === undefined || testVal <= max;
604
+ return minOK && maxOK;
605
+ }
606
+
607
+ function limitToRange(val, min, max) {
608
+ if (val < min) {
609
+ return min;
610
+ }
611
+ if (val > max) {
612
+ return max;
613
+ }
614
+ return val;
615
+ }
616
+
617
+ function createTagRepeat(tagName, repeat, attributes = {}, index = 0, html = '') {
618
+ const openTagSrc = Object.keys(attributes).reduce((src, attr) => {
619
+ let val = attributes[attr];
620
+ if (typeof val === 'function') {
621
+ val = val(index);
622
+ }
623
+ return `${src} ${attr}="${val}"`;
624
+ }, tagName);
625
+ html += `<${openTagSrc}></${tagName}>`;
626
+
627
+ const next = index + 1;
628
+ return next < repeat
629
+ ? createTagRepeat(tagName, repeat, attributes, next, html)
630
+ : html;
631
+ }
632
+
633
+ // Remove the spacing surrounding tags for HTML parser not to create text nodes
634
+ // before/after elements
635
+ function optimizeTemplateHTML(html) {
636
+ return html.replace(/>\s+/g, '>').replace(/\s+</, '<');
637
+ }
638
+
639
+ function stripTime(timeValue) {
640
+ return new Date(timeValue).setHours(0, 0, 0, 0);
641
+ }
642
+
643
+ function today() {
644
+ return new Date().setHours(0, 0, 0, 0);
645
+ }
646
+
647
+ // Get the time value of the start of given date or year, month and day
648
+ function dateValue(...args) {
649
+ switch (args.length) {
650
+ case 0:
651
+ return today();
652
+ case 1:
653
+ return stripTime(args[0]);
654
+ }
655
+
656
+ // use setFullYear() to keep 2-digit year from being mapped to 1900-1999
657
+ const newDate = new Date(0);
658
+ newDate.setFullYear(...args);
659
+ return newDate.setHours(0, 0, 0, 0);
660
+ }
661
+
662
+ function addDays(date, amount) {
663
+ const newDate = new Date(date);
664
+ return newDate.setDate(newDate.getDate() + amount);
665
+ }
666
+
667
+ function addWeeks(date, amount) {
668
+ return addDays(date, amount * 7);
669
+ }
670
+
671
+ function addMonths(date, amount) {
672
+ // If the day of the date is not in the new month, the last day of the new
673
+ // month will be returned. e.g. Jan 31 + 1 month → Feb 28 (not Mar 03)
674
+ const newDate = new Date(date);
675
+ const monthsToSet = newDate.getMonth() + amount;
676
+ let expectedMonth = monthsToSet % 12;
677
+ if (expectedMonth < 0) {
678
+ expectedMonth += 12;
679
+ }
680
+
681
+ const time = newDate.setMonth(monthsToSet);
682
+ return newDate.getMonth() !== expectedMonth ? newDate.setDate(0) : time;
683
+ }
684
+
685
+ function addYears(date, amount) {
686
+ // If the date is Feb 29 and the new year is not a leap year, Feb 28 of the
687
+ // new year will be returned.
688
+ const newDate = new Date(date);
689
+ const expectedMonth = newDate.getMonth();
690
+ const time = newDate.setFullYear(newDate.getFullYear() + amount);
691
+ return expectedMonth === 1 && newDate.getMonth() === 2 ? newDate.setDate(0) : time;
692
+ }
693
+
694
+ // Calculate the distance bettwen 2 days of the week
695
+ function dayDiff(day, from) {
696
+ return (day - from + 7) % 7;
697
+ }
698
+
699
+ // Get the date of the specified day of the week of given base date
700
+ function dayOfTheWeekOf(baseDate, dayOfWeek, weekStart = 0) {
701
+ const baseDay = new Date(baseDate).getDay();
702
+ return addDays(baseDate, dayDiff(dayOfWeek, weekStart) - dayDiff(baseDay, weekStart));
703
+ }
704
+
705
+ function calcWeekNum(dayOfTheWeek, sameDayOfFirstWeek) {
706
+ return Math.round((dayOfTheWeek - sameDayOfFirstWeek) / 604800000) + 1;
707
+ }
708
+
709
+ // Get the ISO week number of a date
710
+ function getIsoWeek(date) {
711
+ // - Start of ISO week is Monday
712
+ // - Use Thursday for culculation because the first Thursday of ISO week is
713
+ // always in January
714
+ const thuOfTheWeek = dayOfTheWeekOf(date, 4, 1);
715
+ // - Week 1 in ISO week is the week including Jan 04
716
+ // - Use the Thu of given date's week (instead of given date itself) to
717
+ // calculate week 1 of the year so that Jan 01 - 03 won't be miscalculated
718
+ // as week 0 when Jan 04 is Mon - Wed
719
+ const firstThu = dayOfTheWeekOf(new Date(thuOfTheWeek).setMonth(0, 4), 4, 1);
720
+ // return Math.round((thuOfTheWeek - firstThu) / 604800000) + 1;
721
+ return calcWeekNum(thuOfTheWeek, firstThu);
722
+ }
723
+
724
+ // Calculate week number in traditional week number system
725
+ // @see https://en.wikipedia.org/wiki/Week#Other_week_numbering_systems
726
+ function calcTraditionalWeekNumber(date, weekStart) {
727
+ // - Week 1 of traditional week is the week including the Jan 01
728
+ // - Use Jan 01 of given date's year to calculate the start of week 1
729
+ const startOfFirstWeek = dayOfTheWeekOf(new Date(date).setMonth(0, 1), weekStart, weekStart);
730
+ const startOfTheWeek = dayOfTheWeekOf(date, weekStart, weekStart);
731
+ const weekNum = calcWeekNum(startOfTheWeek, startOfFirstWeek);
732
+ if (weekNum < 53) {
733
+ return weekNum;
734
+ }
735
+ // If the 53rd week includes Jan 01, it's actually next year's week 1
736
+ const weekOneOfNextYear = dayOfTheWeekOf(new Date(date).setDate(32), weekStart, weekStart);
737
+ return startOfTheWeek === weekOneOfNextYear ? 1 : weekNum;
738
+ }
739
+
740
+ // Get the Western traditional week number of a date
741
+ function getWesternTradWeek(date) {
742
+ // Start of Western traditionl week is Sunday
743
+ return calcTraditionalWeekNumber(date, 0);
744
+ }
745
+
746
+ // Get the Middle Eastern week number of a date
747
+ function getMidEasternWeek(date) {
748
+ // Start of Middle Eastern week is Saturday
749
+ return calcTraditionalWeekNumber(date, 6);
750
+ }
751
+
752
+ // Get the start year of the period of years that includes given date
753
+ // years: length of the year period
754
+ function startOfYearPeriod(date, years) {
755
+ /* @see https://en.wikipedia.org/wiki/Year_zero#ISO_8601 */
756
+ const year = new Date(date).getFullYear();
757
+ return Math.floor(year / years) * years;
758
+ }
759
+
760
+ // Convert date to the first/last date of the month/year of the date
761
+ function regularizeDate(date, timeSpan, useLastDate) {
762
+ if (timeSpan !== 1 && timeSpan !== 2) {
763
+ return date;
764
+ }
765
+ const newDate = new Date(date);
766
+ if (timeSpan === 1) {
767
+ useLastDate
768
+ ? newDate.setMonth(newDate.getMonth() + 1, 0)
769
+ : newDate.setDate(1);
770
+ } else {
771
+ useLastDate
772
+ ? newDate.setFullYear(newDate.getFullYear() + 1, 0, 0)
773
+ : newDate.setMonth(0, 1);
774
+ }
775
+ return newDate.setHours(0, 0, 0, 0);
776
+ }
777
+
778
+ // pattern for format parts
779
+ const reFormatTokens = /dd?|DD?|mm?|MM?|yy?(?:yy)?/;
780
+ // pattern for non date parts
781
+ const reNonDateParts = /[\s!-/:-@[-`{-~年月日]+/;
782
+ // cache for persed formats
783
+ let knownFormats = {};
784
+ // parse funtions for date parts
785
+ const parseFns = {
786
+ y(date, year) {
787
+ return new Date(date).setFullYear(parseInt(year, 10));
788
+ },
789
+ m(date, month, locale) {
790
+ const newDate = new Date(date);
791
+ let monthIndex = parseInt(month, 10) - 1;
792
+
793
+ if (isNaN(monthIndex)) {
794
+ if (!month) {
795
+ return NaN;
796
+ }
797
+
798
+ const monthName = month.toLowerCase();
799
+ const compareNames = name => name.toLowerCase().startsWith(monthName);
800
+ // compare with both short and full names because some locales have periods
801
+ // in the short names (not equal to the first X letters of the full names)
802
+ monthIndex = locale.monthsShort.findIndex(compareNames);
803
+ if (monthIndex < 0) {
804
+ monthIndex = locale.months.findIndex(compareNames);
805
+ }
806
+ if (monthIndex < 0) {
807
+ return NaN;
808
+ }
809
+ }
810
+
811
+ newDate.setMonth(monthIndex);
812
+ return newDate.getMonth() !== normalizeMonth(monthIndex)
813
+ ? newDate.setDate(0)
814
+ : newDate.getTime();
815
+ },
816
+ d(date, day) {
817
+ return new Date(date).setDate(parseInt(day, 10));
818
+ },
819
+ };
820
+ // format functions for date parts
821
+ const formatFns = {
822
+ d(date) {
823
+ return date.getDate();
824
+ },
825
+ dd(date) {
826
+ return padZero(date.getDate(), 2);
827
+ },
828
+ D(date, locale) {
829
+ return locale.daysShort[date.getDay()];
830
+ },
831
+ DD(date, locale) {
832
+ return locale.days[date.getDay()];
833
+ },
834
+ m(date) {
835
+ return date.getMonth() + 1;
836
+ },
837
+ mm(date) {
838
+ return padZero(date.getMonth() + 1, 2);
839
+ },
840
+ M(date, locale) {
841
+ return locale.monthsShort[date.getMonth()];
842
+ },
843
+ MM(date, locale) {
844
+ return locale.months[date.getMonth()];
845
+ },
846
+ y(date) {
847
+ return date.getFullYear();
848
+ },
849
+ yy(date) {
850
+ return padZero(date.getFullYear(), 2).slice(-2);
851
+ },
852
+ yyyy(date) {
853
+ return padZero(date.getFullYear(), 4);
854
+ },
855
+ };
856
+
857
+ // get month index in normal range (0 - 11) from any number
858
+ function normalizeMonth(monthIndex) {
859
+ return monthIndex > -1 ? monthIndex % 12 : normalizeMonth(monthIndex + 12);
860
+ }
861
+
862
+ function padZero(num, length) {
863
+ return num.toString().padStart(length, '0');
864
+ }
865
+
866
+ function parseFormatString(format) {
867
+ if (typeof format !== 'string') {
868
+ throw new Error("Invalid date format.");
869
+ }
870
+ if (format in knownFormats) {
871
+ return knownFormats[format];
872
+ }
873
+
874
+ // sprit the format string into parts and seprators
875
+ const separators = format.split(reFormatTokens);
876
+ const parts = format.match(new RegExp(reFormatTokens, 'g'));
877
+ if (separators.length === 0 || !parts) {
878
+ throw new Error("Invalid date format.");
879
+ }
880
+
881
+ // collect format functions used in the format
882
+ const partFormatters = parts.map(token => formatFns[token]);
883
+
884
+ // collect parse function keys used in the format
885
+ // iterate over parseFns' keys in order to keep the order of the keys.
886
+ const partParserKeys = Object.keys(parseFns).reduce((keys, key) => {
887
+ const token = parts.find(part => part[0] !== 'D' && part[0].toLowerCase() === key);
888
+ if (token) {
889
+ keys.push(key);
890
+ }
891
+ return keys;
892
+ }, []);
893
+
894
+ return knownFormats[format] = {
895
+ parser(dateStr, locale) {
896
+ const dateParts = dateStr.split(reNonDateParts).reduce((dtParts, part, index) => {
897
+ if (part.length > 0 && parts[index]) {
898
+ const token = parts[index][0];
899
+ if (token === 'M') {
900
+ dtParts.m = part;
901
+ } else if (token !== 'D') {
902
+ dtParts[token] = part;
903
+ }
904
+ }
905
+ return dtParts;
906
+ }, {});
907
+
908
+ // iterate over partParserkeys so that the parsing is made in the oder
909
+ // of year, month and day to prevent the day parser from correcting last
910
+ // day of month wrongly
911
+ return partParserKeys.reduce((origDate, key) => {
912
+ const newDate = parseFns[key](origDate, dateParts[key], locale);
913
+ // ingnore the part failed to parse
914
+ return isNaN(newDate) ? origDate : newDate;
915
+ }, today());
916
+ },
917
+ formatter(date, locale) {
918
+ let dateStr = partFormatters.reduce((str, fn, index) => {
919
+ return str += `${separators[index]}${fn(date, locale)}`;
920
+ }, '');
921
+ // separators' length is always parts' length + 1,
922
+ return dateStr += lastItemOf(separators);
923
+ },
924
+ };
925
+ }
926
+
927
+ function parseDate(dateStr, format, locale) {
928
+ if (dateStr instanceof Date || typeof dateStr === 'number') {
929
+ const date = stripTime(dateStr);
930
+ return isNaN(date) ? undefined : date;
931
+ }
932
+ if (!dateStr) {
933
+ return undefined;
934
+ }
935
+ if (dateStr === 'today') {
936
+ return today();
937
+ }
938
+
939
+ if (format && format.toValue) {
940
+ const date = format.toValue(dateStr, format, locale);
941
+ return isNaN(date) ? undefined : stripTime(date);
942
+ }
943
+
944
+ return parseFormatString(format).parser(dateStr, locale);
945
+ }
946
+
947
+ function formatDate(date, format, locale) {
948
+ if (isNaN(date) || (!date && date !== 0)) {
949
+ return '';
950
+ }
951
+
952
+ const dateObj = typeof date === 'number' ? new Date(date) : date;
953
+
954
+ if (format.toDisplay) {
955
+ return format.toDisplay(dateObj, format, locale);
956
+ }
957
+
958
+ return parseFormatString(format).formatter(dateObj, locale);
959
+ }
960
+
961
+ const range = document.createRange();
962
+
963
+ function parseHTML(html) {
964
+ return range.createContextualFragment(html);
965
+ }
966
+
967
+ function getParent(el) {
968
+ return el.parentElement
969
+ || (el.parentNode instanceof ShadowRoot ? el.parentNode.host : undefined);
970
+ }
971
+
972
+ function isActiveElement(el) {
973
+ return el.getRootNode().activeElement === el;
974
+ }
975
+
976
+ function hideElement(el) {
977
+ if (el.style.display === 'none') {
978
+ return;
979
+ }
980
+ // back up the existing display setting in data-style-display
981
+ if (el.style.display) {
982
+ el.dataset.styleDisplay = el.style.display;
983
+ }
984
+ el.style.display = 'none';
985
+ }
986
+
987
+ function showElement(el) {
988
+ if (el.style.display !== 'none') {
989
+ return;
990
+ }
991
+ if (el.dataset.styleDisplay) {
992
+ // restore backed-up dispay property
993
+ el.style.display = el.dataset.styleDisplay;
994
+ delete el.dataset.styleDisplay;
995
+ } else {
996
+ el.style.display = '';
997
+ }
998
+ }
999
+
1000
+ function emptyChildNodes(el) {
1001
+ if (el.firstChild) {
1002
+ el.removeChild(el.firstChild);
1003
+ emptyChildNodes(el);
1004
+ }
1005
+ }
1006
+
1007
+ function replaceChildNodes(el, newChildNodes) {
1008
+ emptyChildNodes(el);
1009
+ if (newChildNodes instanceof DocumentFragment) {
1010
+ el.appendChild(newChildNodes);
1011
+ } else if (typeof newChildNodes === 'string') {
1012
+ el.appendChild(parseHTML(newChildNodes));
1013
+ } else if (typeof newChildNodes.forEach === 'function') {
1014
+ newChildNodes.forEach((node) => {
1015
+ el.appendChild(node);
1016
+ });
1017
+ }
1018
+ }
1019
+
1020
+ const listenerRegistry = new WeakMap();
1021
+ const {addEventListener, removeEventListener} = EventTarget.prototype;
1022
+
1023
+ // Register event listeners to a key object
1024
+ // listeners: array of listener definitions;
1025
+ // - each definition must be a flat array of event target and the arguments
1026
+ // used to call addEventListener() on the target
1027
+ function registerListeners(keyObj, listeners) {
1028
+ let registered = listenerRegistry.get(keyObj);
1029
+ if (!registered) {
1030
+ registered = [];
1031
+ listenerRegistry.set(keyObj, registered);
1032
+ }
1033
+ listeners.forEach((listener) => {
1034
+ addEventListener.call(...listener);
1035
+ registered.push(listener);
1036
+ });
1037
+ }
1038
+
1039
+ function unregisterListeners(keyObj) {
1040
+ let listeners = listenerRegistry.get(keyObj);
1041
+ if (!listeners) {
1042
+ return;
1043
+ }
1044
+ listeners.forEach((listener) => {
1045
+ removeEventListener.call(...listener);
1046
+ });
1047
+ listenerRegistry.delete(keyObj);
1048
+ }
1049
+
1050
+ // Event.composedPath() polyfill for Edge
1051
+ // based on https://gist.github.com/kleinfreund/e9787d73776c0e3750dcfcdc89f100ec
1052
+ if (!Event.prototype.composedPath) {
1053
+ const getComposedPath = (node, path = []) => {
1054
+ path.push(node);
1055
+
1056
+ let parent;
1057
+ if (node.parentNode) {
1058
+ parent = node.parentNode;
1059
+ } else if (node.host) { // ShadowRoot
1060
+ parent = node.host;
1061
+ } else if (node.defaultView) { // Document
1062
+ parent = node.defaultView;
1063
+ }
1064
+ return parent ? getComposedPath(parent, path) : path;
1065
+ };
1066
+
1067
+ Event.prototype.composedPath = function () {
1068
+ return getComposedPath(this.target);
1069
+ };
1070
+ }
1071
+
1072
+ function findFromPath(path, criteria, currentTarget) {
1073
+ const [node, ...rest] = path;
1074
+ if (criteria(node)) {
1075
+ return node;
1076
+ }
1077
+ if (node === currentTarget || node.tagName === 'HTML' || rest.length === 0) {
1078
+ // stop when reaching currentTarget or <html>
1079
+ return;
1080
+ }
1081
+ return findFromPath(rest, criteria, currentTarget);
1082
+ }
1083
+
1084
+ // Search for the actual target of a delegated event
1085
+ function findElementInEventPath(ev, selector) {
1086
+ const criteria = typeof selector === 'function'
1087
+ ? selector
1088
+ : el => el instanceof Element && el.matches(selector);
1089
+ return findFromPath(ev.composedPath(), criteria, ev.currentTarget);
1090
+ }
1091
+
1092
+ // default locales
1093
+ const locales = {
1094
+ en: {
1095
+ days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
1096
+ daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
1097
+ daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
1098
+ months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
1099
+ monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
1100
+ today: "Today",
1101
+ clear: "Clear",
1102
+ titleFormat: "MM y"
1103
+ }
1104
+ };
1105
+
1106
+ // config options updatable by setOptions() and their default values
1107
+ const defaultOptions = {
1108
+ autohide: false,
1109
+ beforeShowDay: null,
1110
+ beforeShowDecade: null,
1111
+ beforeShowMonth: null,
1112
+ beforeShowYear: null,
1113
+ clearButton: false,
1114
+ dateDelimiter: ',',
1115
+ datesDisabled: [],
1116
+ daysOfWeekDisabled: [],
1117
+ daysOfWeekHighlighted: [],
1118
+ defaultViewDate: undefined, // placeholder, defaults to today() by the program
1119
+ disableTouchKeyboard: false,
1120
+ enableOnReadonly: true,
1121
+ format: 'mm/dd/yyyy',
1122
+ language: 'en',
1123
+ maxDate: null,
1124
+ maxNumberOfDates: 1,
1125
+ maxView: 3,
1126
+ minDate: null,
1127
+ nextArrow: '»',
1128
+ orientation: 'auto',
1129
+ pickLevel: 0,
1130
+ prevArrow: '«',
1131
+ showDaysOfWeek: true,
1132
+ showOnClick: true,
1133
+ showOnFocus: true,
1134
+ startView: 0,
1135
+ title: '',
1136
+ todayButton: false,
1137
+ todayButtonMode: 0,
1138
+ todayHighlight: false,
1139
+ updateOnBlur: true,
1140
+ weekNumbers: 0,
1141
+ weekStart: 0,
1142
+ };
1143
+
1144
+ const {
1145
+ language: defaultLang,
1146
+ format: defaultFormat,
1147
+ weekStart: defaultWeekStart,
1148
+ } = defaultOptions;
1149
+
1150
+ // Reducer function to filter out invalid day-of-week from the input
1151
+ function sanitizeDOW(dow, day) {
1152
+ return dow.length < 6 && day >= 0 && day < 7
1153
+ ? pushUnique(dow, day)
1154
+ : dow;
1155
+ }
1156
+
1157
+ function determineGetWeekMethod(numberingMode, weekStart) {
1158
+ const methodId = numberingMode === 4
1159
+ ? (weekStart === 6 ? 3 : !weekStart + 1)
1160
+ : numberingMode;
1161
+ switch (methodId) {
1162
+ case 1:
1163
+ return getIsoWeek;
1164
+ case 2:
1165
+ return getWesternTradWeek;
1166
+ case 3:
1167
+ return getMidEasternWeek;
1168
+ }
1169
+ }
1170
+
1171
+ function updateWeekStart(newValue, config, weekNumbers) {
1172
+ config.weekStart = newValue;
1173
+ config.weekEnd = (newValue + 6) % 7;
1174
+ if (weekNumbers === 4) {
1175
+ config.getWeekNumber = determineGetWeekMethod(4, newValue);
1176
+ }
1177
+ return newValue;
1178
+ }
1179
+
1180
+ // validate input date. if invalid, fallback to the original value
1181
+ function validateDate(value, format, locale, origValue) {
1182
+ const date = parseDate(value, format, locale);
1183
+ return date !== undefined ? date : origValue;
1184
+ }
1185
+
1186
+ // Validate viewId. if invalid, fallback to the original value
1187
+ function validateViewId(value, origValue, max = 3) {
1188
+ const viewId = parseInt(value, 10);
1189
+ return viewId >= 0 && viewId <= max ? viewId : origValue;
1190
+ }
1191
+
1192
+ function replaceOptions(options, from, to, convert = undefined) {
1193
+ if (from in options) {
1194
+ if (!(to in options)) {
1195
+ options[to] = convert ? convert(options[from]) : options[from];
1196
+ }
1197
+ delete options[from];
1198
+ }
1199
+ }
1200
+
1201
+ // Create Datepicker configuration to set
1202
+ function processOptions(options, datepicker) {
1203
+ const inOpts = Object.assign({}, options);
1204
+ const config = {};
1205
+ const locales = datepicker.constructor.locales;
1206
+ const rangeEnd = !!datepicker.rangeSideIndex;
1207
+ let {
1208
+ datesDisabled,
1209
+ format,
1210
+ language,
1211
+ locale,
1212
+ maxDate,
1213
+ maxView,
1214
+ minDate,
1215
+ pickLevel,
1216
+ startView,
1217
+ weekNumbers,
1218
+ weekStart,
1219
+ } = datepicker.config || {};
1220
+
1221
+ // for backword compatibility
1222
+ replaceOptions(inOpts, 'calendarWeeks', 'weekNumbers', val => val ? 1 : 0);
1223
+ replaceOptions(inOpts, 'clearBtn', 'clearButton');
1224
+ replaceOptions(inOpts, 'todayBtn', 'todayButton');
1225
+ replaceOptions(inOpts, 'todayBtnMode', 'todayButtonMode');
1226
+
1227
+ if (inOpts.language) {
1228
+ let lang;
1229
+ if (inOpts.language !== language) {
1230
+ if (locales[inOpts.language]) {
1231
+ lang = inOpts.language;
1232
+ } else {
1233
+ // Check if langauge + region tag can fallback to the one without
1234
+ // region (e.g. fr-CA → fr)
1235
+ lang = inOpts.language.split('-')[0];
1236
+ if (!locales[lang]) {
1237
+ lang = false;
1238
+ }
1239
+ }
1240
+ }
1241
+ delete inOpts.language;
1242
+ if (lang) {
1243
+ language = config.language = lang;
1244
+
1245
+ // update locale as well when updating language
1246
+ const origLocale = locale || locales[defaultLang];
1247
+ // use default language's properties for the fallback
1248
+ locale = Object.assign({
1249
+ format: defaultFormat,
1250
+ weekStart: defaultWeekStart
1251
+ }, locales[defaultLang]);
1252
+ if (language !== defaultLang) {
1253
+ Object.assign(locale, locales[language]);
1254
+ }
1255
+ config.locale = locale;
1256
+ // if format and/or weekStart are the same as old locale's defaults,
1257
+ // update them to new locale's defaults
1258
+ if (format === origLocale.format) {
1259
+ format = config.format = locale.format;
1260
+ }
1261
+ if (weekStart === origLocale.weekStart) {
1262
+ weekStart = updateWeekStart(locale.weekStart, config, weekNumbers);
1263
+ }
1264
+ }
1265
+ }
1266
+
1267
+ if (inOpts.format) {
1268
+ const hasToDisplay = typeof inOpts.format.toDisplay === 'function';
1269
+ const hasToValue = typeof inOpts.format.toValue === 'function';
1270
+ const validFormatString = reFormatTokens.test(inOpts.format);
1271
+ if ((hasToDisplay && hasToValue) || validFormatString) {
1272
+ format = config.format = inOpts.format;
1273
+ }
1274
+ delete inOpts.format;
1275
+ }
1276
+
1277
+ //*** pick level ***//
1278
+ let newPickLevel = pickLevel;
1279
+ if ('pickLevel' in inOpts) {
1280
+ newPickLevel = validateViewId(inOpts.pickLevel, pickLevel, 2);
1281
+ delete inOpts.pickLevel;
1282
+ }
1283
+ if (newPickLevel !== pickLevel) {
1284
+ if (newPickLevel > pickLevel) {
1285
+ // complement current minDate/madDate so that the existing range will be
1286
+ // expanded to fit the new level later
1287
+ if (!('minDate' in inOpts)) {
1288
+ inOpts.minDate = minDate;
1289
+ }
1290
+ if (!('maxDate' in inOpts)) {
1291
+ inOpts.maxDate = maxDate;
1292
+ }
1293
+ }
1294
+ // complement datesDisabled so that it will be reset later
1295
+ if (datesDisabled && !inOpts.datesDisabled) {
1296
+ inOpts.datesDisabled = [];
1297
+ }
1298
+ pickLevel = config.pickLevel = newPickLevel;
1299
+ }
1300
+
1301
+ //*** dates ***//
1302
+ // while min and maxDate for "no limit" in the options are better to be null
1303
+ // (especially when updating), the ones in the config have to be undefined
1304
+ // because null is treated as 0 (= unix epoch) when comparing with time value
1305
+ let minDt = minDate;
1306
+ let maxDt = maxDate;
1307
+ if ('minDate' in inOpts) {
1308
+ const defaultMinDt = dateValue(0, 0, 1);
1309
+ minDt = inOpts.minDate === null
1310
+ ? defaultMinDt // set 0000-01-01 to prevent negative values for year
1311
+ : validateDate(inOpts.minDate, format, locale, minDt);
1312
+ if (minDt !== defaultMinDt) {
1313
+ minDt = regularizeDate(minDt, pickLevel, false);
1314
+ }
1315
+ delete inOpts.minDate;
1316
+ }
1317
+ if ('maxDate' in inOpts) {
1318
+ maxDt = inOpts.maxDate === null
1319
+ ? undefined
1320
+ : validateDate(inOpts.maxDate, format, locale, maxDt);
1321
+ if (maxDt !== undefined) {
1322
+ maxDt = regularizeDate(maxDt, pickLevel, true);
1323
+ }
1324
+ delete inOpts.maxDate;
1325
+ }
1326
+ if (maxDt < minDt) {
1327
+ minDate = config.minDate = maxDt;
1328
+ maxDate = config.maxDate = minDt;
1329
+ } else {
1330
+ if (minDate !== minDt) {
1331
+ minDate = config.minDate = minDt;
1332
+ }
1333
+ if (maxDate !== maxDt) {
1334
+ maxDate = config.maxDate = maxDt;
1335
+ }
1336
+ }
1337
+
1338
+ if (inOpts.datesDisabled) {
1339
+ const dtsDisabled = inOpts.datesDisabled;
1340
+ if (typeof dtsDisabled === 'function') {
1341
+ config.datesDisabled = null;
1342
+ config.checkDisabled = (timeValue, viewId) => dtsDisabled(
1343
+ new Date(timeValue),
1344
+ viewId,
1345
+ rangeEnd
1346
+ );
1347
+ } else {
1348
+ const disabled = config.datesDisabled = dtsDisabled.reduce((dates, dt) => {
1349
+ const date = parseDate(dt, format, locale);
1350
+ return date !== undefined
1351
+ ? pushUnique(dates, regularizeDate(date, pickLevel, rangeEnd))
1352
+ : dates;
1353
+ }, []);
1354
+ config.checkDisabled = timeValue => disabled.includes(timeValue);
1355
+ }
1356
+ delete inOpts.datesDisabled;
1357
+ }
1358
+ if ('defaultViewDate' in inOpts) {
1359
+ const viewDate = parseDate(inOpts.defaultViewDate, format, locale);
1360
+ if (viewDate !== undefined) {
1361
+ config.defaultViewDate = viewDate;
1362
+ }
1363
+ delete inOpts.defaultViewDate;
1364
+ }
1365
+
1366
+ //*** days of week ***//
1367
+ if ('weekStart' in inOpts) {
1368
+ const wkStart = Number(inOpts.weekStart) % 7;
1369
+ if (!isNaN(wkStart)) {
1370
+ weekStart = updateWeekStart(wkStart, config, weekNumbers);
1371
+ }
1372
+ delete inOpts.weekStart;
1373
+ }
1374
+ if (inOpts.daysOfWeekDisabled) {
1375
+ config.daysOfWeekDisabled = inOpts.daysOfWeekDisabled.reduce(sanitizeDOW, []);
1376
+ delete inOpts.daysOfWeekDisabled;
1377
+ }
1378
+ if (inOpts.daysOfWeekHighlighted) {
1379
+ config.daysOfWeekHighlighted = inOpts.daysOfWeekHighlighted.reduce(sanitizeDOW, []);
1380
+ delete inOpts.daysOfWeekHighlighted;
1381
+ }
1382
+
1383
+ //*** week numbers ***//
1384
+ if ('weekNumbers' in inOpts) {
1385
+ let method = inOpts.weekNumbers;
1386
+ if (method) {
1387
+ const getWeekNumber = typeof method === 'function'
1388
+ ? (timeValue, startOfWeek) => method(new Date(timeValue), startOfWeek)
1389
+ : determineGetWeekMethod((method = parseInt(method, 10)), weekStart);
1390
+ if (getWeekNumber) {
1391
+ weekNumbers = config.weekNumbers = method;
1392
+ config.getWeekNumber = getWeekNumber;
1393
+ }
1394
+ } else {
1395
+ weekNumbers = config.weekNumbers = 0;
1396
+ config.getWeekNumber = null;
1397
+ }
1398
+ delete inOpts.weekNumbers;
1399
+ }
1400
+
1401
+ //*** multi date ***//
1402
+ if ('maxNumberOfDates' in inOpts) {
1403
+ const maxNumberOfDates = parseInt(inOpts.maxNumberOfDates, 10);
1404
+ if (maxNumberOfDates >= 0) {
1405
+ config.maxNumberOfDates = maxNumberOfDates;
1406
+ config.multidate = maxNumberOfDates !== 1;
1407
+ }
1408
+ delete inOpts.maxNumberOfDates;
1409
+ }
1410
+ if (inOpts.dateDelimiter) {
1411
+ config.dateDelimiter = String(inOpts.dateDelimiter);
1412
+ delete inOpts.dateDelimiter;
1413
+ }
1414
+
1415
+ //*** view ***//
1416
+ let newMaxView = maxView;
1417
+ if ('maxView' in inOpts) {
1418
+ newMaxView = validateViewId(inOpts.maxView, maxView);
1419
+ delete inOpts.maxView;
1420
+ }
1421
+ // ensure max view >= pick level
1422
+ newMaxView = pickLevel > newMaxView ? pickLevel : newMaxView;
1423
+ if (newMaxView !== maxView) {
1424
+ maxView = config.maxView = newMaxView;
1425
+ }
1426
+
1427
+ let newStartView = startView;
1428
+ if ('startView' in inOpts) {
1429
+ newStartView = validateViewId(inOpts.startView, newStartView);
1430
+ delete inOpts.startView;
1431
+ }
1432
+ // ensure pick level <= start view <= max view
1433
+ if (newStartView < pickLevel) {
1434
+ newStartView = pickLevel;
1435
+ } else if (newStartView > maxView) {
1436
+ newStartView = maxView;
1437
+ }
1438
+ if (newStartView !== startView) {
1439
+ config.startView = newStartView;
1440
+ }
1441
+
1442
+ //*** template ***//
1443
+ if (inOpts.prevArrow) {
1444
+ const prevArrow = parseHTML(inOpts.prevArrow);
1445
+ if (prevArrow.childNodes.length > 0) {
1446
+ config.prevArrow = prevArrow.childNodes;
1447
+ }
1448
+ delete inOpts.prevArrow;
1449
+ }
1450
+ if (inOpts.nextArrow) {
1451
+ const nextArrow = parseHTML(inOpts.nextArrow);
1452
+ if (nextArrow.childNodes.length > 0) {
1453
+ config.nextArrow = nextArrow.childNodes;
1454
+ }
1455
+ delete inOpts.nextArrow;
1456
+ }
1457
+
1458
+ //*** misc ***//
1459
+ if ('disableTouchKeyboard' in inOpts) {
1460
+ config.disableTouchKeyboard = 'ontouchstart' in document && !!inOpts.disableTouchKeyboard;
1461
+ delete inOpts.disableTouchKeyboard;
1462
+ }
1463
+ if (inOpts.orientation) {
1464
+ const orientation = inOpts.orientation.toLowerCase().split(/\s+/g);
1465
+ config.orientation = {
1466
+ x: orientation.find(x => (x === 'left' || x === 'right')) || 'auto',
1467
+ y: orientation.find(y => (y === 'top' || y === 'bottom')) || 'auto',
1468
+ };
1469
+ delete inOpts.orientation;
1470
+ }
1471
+ if ('todayButtonMode' in inOpts) {
1472
+ switch(inOpts.todayButtonMode) {
1473
+ case 0:
1474
+ case 1:
1475
+ config.todayButtonMode = inOpts.todayButtonMode;
1476
+ }
1477
+ delete inOpts.todayButtonMode;
1478
+ }
1479
+
1480
+ //*** copy the rest ***//
1481
+ Object.entries(inOpts).forEach(([key, value]) => {
1482
+ if (value !== undefined && key in defaultOptions) {
1483
+ config[key] = value;
1484
+ }
1485
+ });
1486
+
1487
+ return config;
1488
+ }
1489
+
1490
+ const defaultShortcutKeys = {
1491
+ show: {key: 'ArrowDown'},
1492
+ hide: null,
1493
+ toggle: {key: 'Escape'},
1494
+ prevButton: {key: 'ArrowLeft', ctrlOrMetaKey: true},
1495
+ nextButton: {key: 'ArrowRight', ctrlOrMetaKey: true},
1496
+ viewSwitch: {key: 'ArrowUp', ctrlOrMetaKey: true},
1497
+ clearButton: {key: 'Backspace', ctrlOrMetaKey: true},
1498
+ todayButton: {key: '.', ctrlOrMetaKey: true},
1499
+ exitEditMode: {key: 'ArrowDown', ctrlOrMetaKey: true},
1500
+ };
1501
+
1502
+ function createShortcutKeyConfig(options) {
1503
+ return Object.keys(defaultShortcutKeys).reduce((keyDefs, shortcut) => {
1504
+ const keyDef = options[shortcut] === undefined
1505
+ ? defaultShortcutKeys[shortcut]
1506
+ : options[shortcut];
1507
+ const key = keyDef && keyDef.key;
1508
+ if (!key || typeof key !== 'string') {
1509
+ return keyDefs;
1510
+ }
1511
+
1512
+ const normalizedDef = {
1513
+ key,
1514
+ ctrlOrMetaKey: !!(keyDef.ctrlOrMetaKey || keyDef.ctrlKey || keyDef.metaKey),
1515
+ };
1516
+ if (key.length > 1) {
1517
+ normalizedDef.altKey = !!keyDef.altKey;
1518
+ normalizedDef.shiftKey = !!keyDef.shiftKey;
1519
+ }
1520
+ keyDefs[shortcut] = normalizedDef;
1521
+ return keyDefs;
1522
+ }, {});
1523
+ }
1524
+
1525
+ const pickerTemplate = optimizeTemplateHTML(`<div class="datepicker">
1526
+ <div class="datepicker-picker">
1527
+ <div class="datepicker-header">
1528
+ <div class="datepicker-title"></div>
1529
+ <div class="datepicker-controls">
1530
+ <button type="button" class="%buttonClass% prev-button prev-btn"></button>
1531
+ <button type="button" class="%buttonClass% view-switch"></button>
1532
+ <button type="button" class="%buttonClass% next-button next-btn"></button>
1533
+ </div>
1534
+ </div>
1535
+ <div class="datepicker-main"></div>
1536
+ <div class="datepicker-footer">
1537
+ <div class="datepicker-controls">
1538
+ <button type="button" class="%buttonClass% today-button today-btn"></button>
1539
+ <button type="button" class="%buttonClass% clear-button clear-btn"></button>
1540
+ </div>
1541
+ </div>
1542
+ </div>
1543
+ </div>`);
1544
+
1545
+ const daysTemplate = optimizeTemplateHTML(`<div class="days">
1546
+ <div class="days-of-week">${createTagRepeat('span', 7, {class: 'dow'})}</div>
1547
+ <div class="datepicker-grid">${createTagRepeat('span', 42)}</div>
1548
+ </div>`);
1549
+
1550
+ const weekNumbersTemplate = optimizeTemplateHTML(`<div class="week-numbers calendar-weeks">
1551
+ <div class="days-of-week"><span class="dow"></span></div>
1552
+ <div class="weeks">${createTagRepeat('span', 6, {class: 'week'})}</div>
1553
+ </div>`);
1554
+
1555
+ // Base class of the view classes
1556
+ class View {
1557
+ constructor(picker, config) {
1558
+ Object.assign(this, config, {
1559
+ picker,
1560
+ element: parseHTML(`<div class="datepicker-view"></div>`).firstChild,
1561
+ selected: [],
1562
+ isRangeEnd: !!picker.datepicker.rangeSideIndex,
1563
+ });
1564
+ this.init(this.picker.datepicker.config);
1565
+ }
1566
+
1567
+ init(options) {
1568
+ if ('pickLevel' in options) {
1569
+ this.isMinView = this.id === options.pickLevel;
1570
+ }
1571
+ this.setOptions(options);
1572
+ this.updateFocus();
1573
+ this.updateSelection();
1574
+ }
1575
+
1576
+ prepareForRender(switchLabel, prevButtonDisabled, nextButtonDisabled) {
1577
+ // refresh disabled years on every render in order to clear the ones added
1578
+ // by beforeShow hook at previous render
1579
+ this.disabled = [];
1580
+
1581
+ const picker = this.picker;
1582
+ picker.setViewSwitchLabel(switchLabel);
1583
+ picker.setPrevButtonDisabled(prevButtonDisabled);
1584
+ picker.setNextButtonDisabled(nextButtonDisabled);
1585
+ }
1586
+
1587
+ setDisabled(date, classList) {
1588
+ classList.add('disabled');
1589
+ pushUnique(this.disabled, date);
1590
+ }
1591
+
1592
+ // Execute beforeShow() callback and apply the result to the element
1593
+ // args:
1594
+ performBeforeHook(el, timeValue) {
1595
+ let result = this.beforeShow(new Date(timeValue));
1596
+ switch (typeof result) {
1597
+ case 'boolean':
1598
+ result = {enabled: result};
1599
+ break;
1600
+ case 'string':
1601
+ result = {classes: result};
1602
+ }
1603
+
1604
+ if (result) {
1605
+ const classList = el.classList;
1606
+ if (result.enabled === false) {
1607
+ this.setDisabled(timeValue, classList);
1608
+ }
1609
+ if (result.classes) {
1610
+ const extraClasses = result.classes.split(/\s+/);
1611
+ classList.add(...extraClasses);
1612
+ if (extraClasses.includes('disabled')) {
1613
+ this.setDisabled(timeValue, classList);
1614
+ }
1615
+ }
1616
+ if (result.content) {
1617
+ replaceChildNodes(el, result.content);
1618
+ }
1619
+ }
1620
+ }
1621
+
1622
+ renderCell(el, content, cellVal, date, {selected, range}, outOfScope, extraClasses = []) {
1623
+ el.textContent = content;
1624
+ if (this.isMinView) {
1625
+ el.dataset.date = date;
1626
+ }
1627
+
1628
+ const classList = el.classList;
1629
+ el.className = `datepicker-cell ${this.cellClass}`;
1630
+ if (cellVal < this.first) {
1631
+ classList.add('prev');
1632
+ } else if (cellVal > this.last) {
1633
+ classList.add('next');
1634
+ }
1635
+ classList.add(...extraClasses);
1636
+ if (outOfScope || this.checkDisabled(date, this.id)) {
1637
+ this.setDisabled(date, classList);
1638
+ }
1639
+ if (range) {
1640
+ const [rangeStart, rangeEnd] = range;
1641
+ if (cellVal > rangeStart && cellVal < rangeEnd) {
1642
+ classList.add('range');
1643
+ }
1644
+ if (cellVal === rangeStart) {
1645
+ classList.add('range-start');
1646
+ }
1647
+ if (cellVal === rangeEnd) {
1648
+ classList.add('range-end');
1649
+ }
1650
+ }
1651
+ if (selected.includes(cellVal)) {
1652
+ classList.add('selected');
1653
+ }
1654
+ if (cellVal === this.focused) {
1655
+ classList.add('focused');
1656
+ }
1657
+
1658
+ if (this.beforeShow) {
1659
+ this.performBeforeHook(el, date);
1660
+ }
1661
+ }
1662
+
1663
+ refreshCell(el, cellVal, selected, [rangeStart, rangeEnd]) {
1664
+ const classList = el.classList;
1665
+ classList.remove('range', 'range-start', 'range-end', 'selected', 'focused');
1666
+ if (cellVal > rangeStart && cellVal < rangeEnd) {
1667
+ classList.add('range');
1668
+ }
1669
+ if (cellVal === rangeStart) {
1670
+ classList.add('range-start');
1671
+ }
1672
+ if (cellVal === rangeEnd) {
1673
+ classList.add('range-end');
1674
+ }
1675
+ if (selected.includes(cellVal)) {
1676
+ classList.add('selected');
1677
+ }
1678
+ if (cellVal === this.focused) {
1679
+ classList.add('focused');
1680
+ }
1681
+ }
1682
+
1683
+ changeFocusedCell(cellIndex) {
1684
+ this.grid.querySelectorAll('.focused').forEach((el) => {
1685
+ el.classList.remove('focused');
1686
+ });
1687
+ this.grid.children[cellIndex].classList.add('focused');
1688
+ }
1689
+ }
1690
+
1691
+ class DaysView extends View {
1692
+ constructor(picker) {
1693
+ super(picker, {
1694
+ id: 0,
1695
+ name: 'days',
1696
+ cellClass: 'day',
1697
+ });
1698
+ }
1699
+
1700
+ init(options, onConstruction = true) {
1701
+ if (onConstruction) {
1702
+ const inner = parseHTML(daysTemplate).firstChild;
1703
+ this.dow = inner.firstChild;
1704
+ this.grid = inner.lastChild;
1705
+ this.element.appendChild(inner);
1706
+ }
1707
+ super.init(options);
1708
+ }
1709
+
1710
+ setOptions(options) {
1711
+ let updateDOW;
1712
+
1713
+ if ('minDate' in options) {
1714
+ this.minDate = options.minDate;
1715
+ }
1716
+ if ('maxDate' in options) {
1717
+ this.maxDate = options.maxDate;
1718
+ }
1719
+ if (options.checkDisabled) {
1720
+ this.checkDisabled = options.checkDisabled;
1721
+ }
1722
+ if (options.daysOfWeekDisabled) {
1723
+ this.daysOfWeekDisabled = options.daysOfWeekDisabled;
1724
+ updateDOW = true;
1725
+ }
1726
+ if (options.daysOfWeekHighlighted) {
1727
+ this.daysOfWeekHighlighted = options.daysOfWeekHighlighted;
1728
+ }
1729
+ if ('todayHighlight' in options) {
1730
+ this.todayHighlight = options.todayHighlight;
1731
+ }
1732
+ if ('weekStart' in options) {
1733
+ this.weekStart = options.weekStart;
1734
+ this.weekEnd = options.weekEnd;
1735
+ updateDOW = true;
1736
+ }
1737
+ if (options.locale) {
1738
+ const locale = this.locale = options.locale;
1739
+ this.dayNames = locale.daysMin;
1740
+ this.switchLabelFormat = locale.titleFormat;
1741
+ updateDOW = true;
1742
+ }
1743
+ if ('beforeShowDay' in options) {
1744
+ this.beforeShow = typeof options.beforeShowDay === 'function'
1745
+ ? options.beforeShowDay
1746
+ : undefined;
1747
+ }
1748
+
1749
+ if ('weekNumbers' in options) {
1750
+ if (options.weekNumbers && !this.weekNumbers) {
1751
+ const weeksElem = parseHTML(weekNumbersTemplate).firstChild;
1752
+ this.weekNumbers = {
1753
+ element: weeksElem,
1754
+ dow: weeksElem.firstChild,
1755
+ weeks: weeksElem.lastChild,
1756
+ };
1757
+ this.element.insertBefore(weeksElem, this.element.firstChild);
1758
+ } else if (this.weekNumbers && !options.weekNumbers) {
1759
+ this.element.removeChild(this.weekNumbers.element);
1760
+ this.weekNumbers = null;
1761
+ }
1762
+ }
1763
+
1764
+ if ('getWeekNumber' in options) {
1765
+ this.getWeekNumber = options.getWeekNumber;
1766
+ }
1767
+
1768
+ if ('showDaysOfWeek' in options) {
1769
+ if (options.showDaysOfWeek) {
1770
+ showElement(this.dow);
1771
+ if (this.weekNumbers) {
1772
+ showElement(this.weekNumbers.dow);
1773
+ }
1774
+ } else {
1775
+ hideElement(this.dow);
1776
+ if (this.weekNumbers) {
1777
+ hideElement(this.weekNumbers.dow);
1778
+ }
1779
+ }
1780
+ }
1781
+
1782
+ // update days-of-week when locale, daysOfweekDisabled or weekStart is changed
1783
+ if (updateDOW) {
1784
+ Array.from(this.dow.children).forEach((el, index) => {
1785
+ const dow = (this.weekStart + index) % 7;
1786
+ el.textContent = this.dayNames[dow];
1787
+ el.className = this.daysOfWeekDisabled.includes(dow) ? 'dow disabled' : 'dow';
1788
+ });
1789
+ }
1790
+ }
1791
+
1792
+ // Apply update on the focused date to view's settings
1793
+ updateFocus() {
1794
+ const viewDate = new Date(this.picker.viewDate);
1795
+ const viewYear = viewDate.getFullYear();
1796
+ const viewMonth = viewDate.getMonth();
1797
+ const firstOfMonth = dateValue(viewYear, viewMonth, 1);
1798
+ const start = dayOfTheWeekOf(firstOfMonth, this.weekStart, this.weekStart);
1799
+
1800
+ this.first = firstOfMonth;
1801
+ this.last = dateValue(viewYear, viewMonth + 1, 0);
1802
+ this.start = start;
1803
+ this.focused = this.picker.viewDate;
1804
+ }
1805
+
1806
+ // Apply update on the selected dates to view's settings
1807
+ updateSelection() {
1808
+ const {dates, rangepicker} = this.picker.datepicker;
1809
+ this.selected = dates;
1810
+ if (rangepicker) {
1811
+ this.range = rangepicker.dates;
1812
+ }
1813
+ }
1814
+
1815
+ // Update the entire view UI
1816
+ render() {
1817
+ // update today marker on ever render
1818
+ this.today = this.todayHighlight ? today() : undefined;
1819
+
1820
+ this.prepareForRender(
1821
+ formatDate(this.focused, this.switchLabelFormat, this.locale),
1822
+ this.first <= this.minDate,
1823
+ this.last >= this.maxDate
1824
+ );
1825
+
1826
+ if (this.weekNumbers) {
1827
+ const weekStart = this.weekStart;
1828
+ const startOfWeek = dayOfTheWeekOf(this.first, weekStart, weekStart);
1829
+ Array.from(this.weekNumbers.weeks.children).forEach((el, index) => {
1830
+ const dateOfWeekStart = addWeeks(startOfWeek, index);
1831
+ el.textContent = this.getWeekNumber(dateOfWeekStart, weekStart);
1832
+ if (index > 3) {
1833
+ el.classList[dateOfWeekStart > this.last ? 'add' : 'remove']('next');
1834
+ }
1835
+ });
1836
+ }
1837
+ Array.from(this.grid.children).forEach((el, index) => {
1838
+ const current = addDays(this.start, index);
1839
+ const dateObj = new Date(current);
1840
+ const day = dateObj.getDay();
1841
+ const extraClasses = [];
1842
+
1843
+ if (this.today === current) {
1844
+ extraClasses.push('today');
1845
+ }
1846
+ if (this.daysOfWeekHighlighted.includes(day)) {
1847
+ extraClasses.push('highlighted');
1848
+ }
1849
+
1850
+ this.renderCell(
1851
+ el,
1852
+ dateObj.getDate(),
1853
+ current,
1854
+ current,
1855
+ this,
1856
+ current < this.minDate
1857
+ || current > this.maxDate
1858
+ || this.daysOfWeekDisabled.includes(day),
1859
+ extraClasses
1860
+ );
1861
+ });
1862
+ }
1863
+
1864
+ // Update the view UI by applying the changes of selected and focused items
1865
+ refresh() {
1866
+ const range = this.range || [];
1867
+ Array.from(this.grid.children).forEach((el) => {
1868
+ this.refreshCell(el, Number(el.dataset.date), this.selected, range);
1869
+ });
1870
+ }
1871
+
1872
+ // Update the view UI by applying the change of focused item
1873
+ refreshFocus() {
1874
+ this.changeFocusedCell(Math.round((this.focused - this.start) / 86400000));
1875
+ }
1876
+ }
1877
+
1878
+ function computeMonthRange(range, thisYear) {
1879
+ if (!range || !range[0] || !range[1]) {
1880
+ return;
1881
+ }
1882
+
1883
+ const [[startY, startM], [endY, endM]] = range;
1884
+ if (startY > thisYear || endY < thisYear) {
1885
+ return;
1886
+ }
1887
+ return [
1888
+ startY === thisYear ? startM : -1,
1889
+ endY === thisYear ? endM : 12,
1890
+ ];
1891
+ }
1892
+
1893
+ class MonthsView extends View {
1894
+ constructor(picker) {
1895
+ super(picker, {
1896
+ id: 1,
1897
+ name: 'months',
1898
+ cellClass: 'month',
1899
+ });
1900
+ }
1901
+
1902
+ init(options, onConstruction = true) {
1903
+ if (onConstruction) {
1904
+ this.grid = this.element;
1905
+ this.element.classList.add('months', 'datepicker-grid');
1906
+ this.grid.appendChild(parseHTML(createTagRepeat('span', 12, {'data-month': ix => ix})));
1907
+ this.first = 0;
1908
+ this.last = 11;
1909
+ }
1910
+ super.init(options);
1911
+ }
1912
+
1913
+ setOptions(options) {
1914
+ if (options.locale) {
1915
+ this.monthNames = options.locale.monthsShort;
1916
+ }
1917
+ if ('minDate' in options) {
1918
+ if (options.minDate === undefined) {
1919
+ this.minYear = this.minMonth = this.minDate = undefined;
1920
+ } else {
1921
+ const minDateObj = new Date(options.minDate);
1922
+ this.minYear = minDateObj.getFullYear();
1923
+ this.minMonth = minDateObj.getMonth();
1924
+ this.minDate = minDateObj.setDate(1);
1925
+ }
1926
+ }
1927
+ if ('maxDate' in options) {
1928
+ if (options.maxDate === undefined) {
1929
+ this.maxYear = this.maxMonth = this.maxDate = undefined;
1930
+ } else {
1931
+ const maxDateObj = new Date(options.maxDate);
1932
+ this.maxYear = maxDateObj.getFullYear();
1933
+ this.maxMonth = maxDateObj.getMonth();
1934
+ this.maxDate = dateValue(this.maxYear, this.maxMonth + 1, 0);
1935
+ }
1936
+ }
1937
+ if (options.checkDisabled) {
1938
+ this.checkDisabled = this.isMinView || options.datesDisabled === null
1939
+ ? options.checkDisabled
1940
+ : () => false;
1941
+ }
1942
+ if ('beforeShowMonth' in options) {
1943
+ this.beforeShow = typeof options.beforeShowMonth === 'function'
1944
+ ? options.beforeShowMonth
1945
+ : undefined;
1946
+ }
1947
+ }
1948
+
1949
+ // Update view's settings to reflect the viewDate set on the picker
1950
+ updateFocus() {
1951
+ const viewDate = new Date(this.picker.viewDate);
1952
+ this.year = viewDate.getFullYear();
1953
+ this.focused = viewDate.getMonth();
1954
+ }
1955
+
1956
+ // Update view's settings to reflect the selected dates
1957
+ updateSelection() {
1958
+ const {dates, rangepicker} = this.picker.datepicker;
1959
+ this.selected = dates.reduce((selected, timeValue) => {
1960
+ const date = new Date(timeValue);
1961
+ const year = date.getFullYear();
1962
+ const month = date.getMonth();
1963
+ if (selected[year] === undefined) {
1964
+ selected[year] = [month];
1965
+ } else {
1966
+ pushUnique(selected[year], month);
1967
+ }
1968
+ return selected;
1969
+ }, {});
1970
+ if (rangepicker && rangepicker.dates) {
1971
+ this.range = rangepicker.dates.map(timeValue => {
1972
+ const date = new Date(timeValue);
1973
+ return isNaN(date) ? undefined : [date.getFullYear(), date.getMonth()];
1974
+ });
1975
+ }
1976
+ }
1977
+
1978
+ // Update the entire view UI
1979
+ render() {
1980
+ this.prepareForRender(
1981
+ this.year,
1982
+ this.year <= this.minYear,
1983
+ this.year >= this.maxYear
1984
+ );
1985
+
1986
+ const selected = this.selected[this.year] || [];
1987
+ const yrOutOfRange = this.year < this.minYear || this.year > this.maxYear;
1988
+ const isMinYear = this.year === this.minYear;
1989
+ const isMaxYear = this.year === this.maxYear;
1990
+ const range = computeMonthRange(this.range, this.year);
1991
+
1992
+ Array.from(this.grid.children).forEach((el, index) => {
1993
+ const date = regularizeDate(new Date(this.year, index, 1), 1, this.isRangeEnd);
1994
+
1995
+ this.renderCell(
1996
+ el,
1997
+ this.monthNames[index],
1998
+ index,
1999
+ date,
2000
+ {selected, range},
2001
+ yrOutOfRange
2002
+ || isMinYear && index < this.minMonth
2003
+ || isMaxYear && index > this.maxMonth
2004
+ );
2005
+ });
2006
+ }
2007
+
2008
+ // Update the view UI by applying the changes of selected and focused items
2009
+ refresh() {
2010
+ const selected = this.selected[this.year] || [];
2011
+ const range = computeMonthRange(this.range, this.year) || [];
2012
+ Array.from(this.grid.children).forEach((el, index) => {
2013
+ this.refreshCell(el, index, selected, range);
2014
+ });
2015
+ }
2016
+
2017
+ // Update the view UI by applying the change of focused item
2018
+ refreshFocus() {
2019
+ this.changeFocusedCell(this.focused);
2020
+ }
2021
+ }
2022
+
2023
+ function toTitleCase(word) {
2024
+ return [...word].reduce((str, ch, ix) => str += ix ? ch : ch.toUpperCase(), '');
2025
+ }
2026
+
2027
+ // Class representing the years and decades view elements
2028
+ class YearsView extends View {
2029
+ constructor(picker, config) {
2030
+ super(picker, config);
2031
+ }
2032
+
2033
+ init(options, onConstruction = true) {
2034
+ if (onConstruction) {
2035
+ this.navStep = this.step * 10;
2036
+ this.beforeShowOption = `beforeShow${toTitleCase(this.cellClass)}`;
2037
+ this.grid = this.element;
2038
+ this.element.classList.add(this.name, 'datepicker-grid');
2039
+ this.grid.appendChild(parseHTML(createTagRepeat('span', 12)));
2040
+ }
2041
+ super.init(options);
2042
+ }
2043
+
2044
+ setOptions(options) {
2045
+ if ('minDate' in options) {
2046
+ if (options.minDate === undefined) {
2047
+ this.minYear = this.minDate = undefined;
2048
+ } else {
2049
+ this.minYear = startOfYearPeriod(options.minDate, this.step);
2050
+ this.minDate = dateValue(this.minYear, 0, 1);
2051
+ }
2052
+ }
2053
+ if ('maxDate' in options) {
2054
+ if (options.maxDate === undefined) {
2055
+ this.maxYear = this.maxDate = undefined;
2056
+ } else {
2057
+ this.maxYear = startOfYearPeriod(options.maxDate, this.step);
2058
+ this.maxDate = dateValue(this.maxYear, 11, 31);
2059
+ }
2060
+ }
2061
+ if (options.checkDisabled) {
2062
+ this.checkDisabled = this.isMinView || options.datesDisabled === null
2063
+ ? options.checkDisabled
2064
+ : () => false;
2065
+ }
2066
+ if (this.beforeShowOption in options) {
2067
+ const beforeShow = options[this.beforeShowOption];
2068
+ this.beforeShow = typeof beforeShow === 'function' ? beforeShow : undefined;
2069
+ }
2070
+ }
2071
+
2072
+ // Update view's settings to reflect the viewDate set on the picker
2073
+ updateFocus() {
2074
+ const viewDate = new Date(this.picker.viewDate);
2075
+ const first = startOfYearPeriod(viewDate, this.navStep);
2076
+ const last = first + 9 * this.step;
2077
+
2078
+ this.first = first;
2079
+ this.last = last;
2080
+ this.start = first - this.step;
2081
+ this.focused = startOfYearPeriod(viewDate, this.step);
2082
+ }
2083
+
2084
+ // Update view's settings to reflect the selected dates
2085
+ updateSelection() {
2086
+ const {dates, rangepicker} = this.picker.datepicker;
2087
+ this.selected = dates.reduce((years, timeValue) => {
2088
+ return pushUnique(years, startOfYearPeriod(timeValue, this.step));
2089
+ }, []);
2090
+ if (rangepicker && rangepicker.dates) {
2091
+ this.range = rangepicker.dates.map(timeValue => {
2092
+ if (timeValue !== undefined) {
2093
+ return startOfYearPeriod(timeValue, this.step);
2094
+ }
2095
+ });
2096
+ }
2097
+ }
2098
+
2099
+ // Update the entire view UI
2100
+ render() {
2101
+ this.prepareForRender(
2102
+ `${this.first}-${this.last}`,
2103
+ this.first <= this.minYear,
2104
+ this.last >= this.maxYear
2105
+ );
2106
+
2107
+ Array.from(this.grid.children).forEach((el, index) => {
2108
+ const current = this.start + (index * this.step);
2109
+ const date = regularizeDate(new Date(current, 0, 1), 2, this.isRangeEnd);
2110
+
2111
+ el.dataset.year = current;
2112
+ this.renderCell(
2113
+ el,
2114
+ current,
2115
+ current,
2116
+ date,
2117
+ this,
2118
+ current < this.minYear || current > this.maxYear
2119
+ );
2120
+ });
2121
+ }
2122
+
2123
+ // Update the view UI by applying the changes of selected and focused items
2124
+ refresh() {
2125
+ const range = this.range || [];
2126
+ Array.from(this.grid.children).forEach((el) => {
2127
+ this.refreshCell(el, Number(el.textContent), this.selected, range);
2128
+ });
2129
+ }
2130
+
2131
+ // Update the view UI by applying the change of focused item
2132
+ refreshFocus() {
2133
+ this.changeFocusedCell(Math.round((this.focused - this.start) / this.step));
2134
+ }
2135
+ }
2136
+
2137
+ function triggerDatepickerEvent(datepicker, type) {
2138
+ const detail = {
2139
+ date: datepicker.getDate(),
2140
+ viewDate: new Date(datepicker.picker.viewDate),
2141
+ viewId: datepicker.picker.currentView.id,
2142
+ datepicker,
2143
+ };
2144
+ datepicker.element.dispatchEvent(new CustomEvent(type, {detail}));
2145
+ }
2146
+
2147
+ // direction: -1 (to previous), 1 (to next)
2148
+ function goToPrevOrNext(datepicker, direction) {
2149
+ const {config, picker} = datepicker;
2150
+ const {currentView, viewDate} = picker;
2151
+ let newViewDate;
2152
+ switch (currentView.id) {
2153
+ case 0:
2154
+ newViewDate = addMonths(viewDate, direction);
2155
+ break;
2156
+ case 1:
2157
+ newViewDate = addYears(viewDate, direction);
2158
+ break;
2159
+ default:
2160
+ newViewDate = addYears(viewDate, direction * currentView.navStep);
2161
+ }
2162
+ newViewDate = limitToRange(newViewDate, config.minDate, config.maxDate);
2163
+ picker.changeFocus(newViewDate).render();
2164
+ }
2165
+
2166
+ function switchView(datepicker) {
2167
+ const viewId = datepicker.picker.currentView.id;
2168
+ if (viewId === datepicker.config.maxView) {
2169
+ return;
2170
+ }
2171
+ datepicker.picker.changeView(viewId + 1).render();
2172
+ }
2173
+
2174
+ function clearSelection(datepicker) {
2175
+ datepicker.setDate({clear: true});
2176
+ }
2177
+
2178
+ function goToOrSelectToday(datepicker) {
2179
+ const currentDate = today();
2180
+ if (datepicker.config.todayButtonMode === 1) {
2181
+ datepicker.setDate(currentDate, {forceRefresh: true, viewDate: currentDate});
2182
+ } else {
2183
+ datepicker.setFocusedDate(currentDate, true);
2184
+ }
2185
+ }
2186
+
2187
+ function unfocus(datepicker) {
2188
+ const onBlur = () => {
2189
+ if (datepicker.config.updateOnBlur) {
2190
+ datepicker.update({revert: true});
2191
+ } else {
2192
+ datepicker.refresh('input');
2193
+ }
2194
+ datepicker.hide();
2195
+ };
2196
+ const element = datepicker.element;
2197
+
2198
+ if (isActiveElement(element)) {
2199
+ element.addEventListener('blur', onBlur, {once: true});
2200
+ } else {
2201
+ onBlur();
2202
+ }
2203
+ }
2204
+
2205
+ function goToSelectedMonthOrYear(datepicker, selection) {
2206
+ const picker = datepicker.picker;
2207
+ const viewDate = new Date(picker.viewDate);
2208
+ const viewId = picker.currentView.id;
2209
+ const newDate = viewId === 1
2210
+ ? addMonths(viewDate, selection - viewDate.getMonth())
2211
+ : addYears(viewDate, selection - viewDate.getFullYear());
2212
+
2213
+ picker.changeFocus(newDate).changeView(viewId - 1).render();
2214
+ }
2215
+
2216
+ function onClickViewSwitch(datepicker) {
2217
+ switchView(datepicker);
2218
+ }
2219
+
2220
+ function onClickPrevButton(datepicker) {
2221
+ goToPrevOrNext(datepicker, -1);
2222
+ }
2223
+
2224
+ function onClickNextButton(datepicker) {
2225
+ goToPrevOrNext(datepicker, 1);
2226
+ }
2227
+
2228
+ // For the picker's main block to delegete the events from `datepicker-cell`s
2229
+ function onClickView(datepicker, ev) {
2230
+ const target = findElementInEventPath(ev, '.datepicker-cell');
2231
+ if (!target || target.classList.contains('disabled')) {
2232
+ return;
2233
+ }
2234
+
2235
+ const {id, isMinView} = datepicker.picker.currentView;
2236
+ const data = target.dataset;
2237
+ if (isMinView) {
2238
+ datepicker.setDate(Number(data.date));
2239
+ } else if (id === 1) {
2240
+ goToSelectedMonthOrYear(datepicker, Number(data.month));
2241
+ } else {
2242
+ goToSelectedMonthOrYear(datepicker, Number(data.year));
2243
+ }
2244
+ }
2245
+
2246
+ function onMousedownPicker(ev) {
2247
+ ev.preventDefault();
2248
+ }
2249
+
2250
+ const orientClasses = ['left', 'top', 'right', 'bottom'].reduce((obj, key) => {
2251
+ obj[key] = `datepicker-orient-${key}`;
2252
+ return obj;
2253
+ }, {});
2254
+ const toPx = num => num ? `${num}px` : num;
2255
+
2256
+ function processPickerOptions(picker, options) {
2257
+ if ('title' in options) {
2258
+ if (options.title) {
2259
+ picker.controls.title.textContent = options.title;
2260
+ showElement(picker.controls.title);
2261
+ } else {
2262
+ picker.controls.title.textContent = '';
2263
+ hideElement(picker.controls.title);
2264
+ }
2265
+ }
2266
+ if (options.prevArrow) {
2267
+ const prevButton = picker.controls.prevButton;
2268
+ emptyChildNodes(prevButton);
2269
+ options.prevArrow.forEach((node) => {
2270
+ prevButton.appendChild(node.cloneNode(true));
2271
+ });
2272
+ }
2273
+ if (options.nextArrow) {
2274
+ const nextButton = picker.controls.nextButton;
2275
+ emptyChildNodes(nextButton);
2276
+ options.nextArrow.forEach((node) => {
2277
+ nextButton.appendChild(node.cloneNode(true));
2278
+ });
2279
+ }
2280
+ if (options.locale) {
2281
+ picker.controls.todayButton.textContent = options.locale.today;
2282
+ picker.controls.clearButton.textContent = options.locale.clear;
2283
+ }
2284
+ if ('todayButton' in options) {
2285
+ if (options.todayButton) {
2286
+ showElement(picker.controls.todayButton);
2287
+ } else {
2288
+ hideElement(picker.controls.todayButton);
2289
+ }
2290
+ }
2291
+ if ('minDate' in options || 'maxDate' in options) {
2292
+ const {minDate, maxDate} = picker.datepicker.config;
2293
+ picker.controls.todayButton.disabled = !isInRange(today(), minDate, maxDate);
2294
+ }
2295
+ if ('clearButton' in options) {
2296
+ if (options.clearButton) {
2297
+ showElement(picker.controls.clearButton);
2298
+ } else {
2299
+ hideElement(picker.controls.clearButton);
2300
+ }
2301
+ }
2302
+ }
2303
+
2304
+ // Compute view date to reset, which will be...
2305
+ // - the last item of the selected dates or defaultViewDate if no selection
2306
+ // - limitted to minDate or maxDate if it exceeds the range
2307
+ function computeResetViewDate(datepicker) {
2308
+ const {dates, config, rangeSideIndex} = datepicker;
2309
+ const viewDate = dates.length > 0
2310
+ ? lastItemOf(dates)
2311
+ : regularizeDate(config.defaultViewDate, config.pickLevel, rangeSideIndex);
2312
+ return limitToRange(viewDate, config.minDate, config.maxDate);
2313
+ }
2314
+
2315
+ // Change current view's view date
2316
+ function setViewDate(picker, newDate) {
2317
+ if (!('_oldViewDate' in picker) && newDate !== picker.viewDate) {
2318
+ picker._oldViewDate = picker.viewDate;
2319
+ }
2320
+ picker.viewDate = newDate;
2321
+
2322
+ // return whether the new date is in different period on time from the one
2323
+ // displayed in the current view
2324
+ // when true, the view needs to be re-rendered on the next UI refresh.
2325
+ const {id, year, first, last} = picker.currentView;
2326
+ const viewYear = new Date(newDate).getFullYear();
2327
+ switch (id) {
2328
+ case 0:
2329
+ return newDate < first || newDate > last;
2330
+ case 1:
2331
+ return viewYear !== year;
2332
+ default:
2333
+ return viewYear < first || viewYear > last;
2334
+ }
2335
+ }
2336
+
2337
+ function getTextDirection(el) {
2338
+ return window.getComputedStyle(el).direction;
2339
+ }
2340
+
2341
+ // find the closet scrollable ancestor elemnt under the body
2342
+ function findScrollParents(el) {
2343
+ const parent = getParent(el);
2344
+ if (parent === document.body || !parent) {
2345
+ return;
2346
+ }
2347
+
2348
+ // checking overflow only is enough because computed overflow cannot be
2349
+ // visible or a combination of visible and other when either axis is set
2350
+ // to other than visible.
2351
+ // (Setting one axis to other than 'visible' while the other is 'visible'
2352
+ // results in the other axis turning to 'auto')
2353
+ return window.getComputedStyle(parent).overflow !== 'visible'
2354
+ ? parent
2355
+ : findScrollParents(parent);
2356
+ }
2357
+
2358
+ // Class representing the picker UI
2359
+ class Picker {
2360
+ constructor(datepicker) {
2361
+ const {config, inputField} = this.datepicker = datepicker;
2362
+
2363
+ const template = pickerTemplate.replace(/%buttonClass%/g, config.buttonClass);
2364
+ const element = this.element = parseHTML(template).firstChild;
2365
+ const [header, main, footer] = element.firstChild.children;
2366
+ const title = header.firstElementChild;
2367
+ const [prevButton, viewSwitch, nextButton] = header.lastElementChild.children;
2368
+ const [todayButton, clearButton] = footer.firstChild.children;
2369
+ const controls = {
2370
+ title,
2371
+ prevButton,
2372
+ viewSwitch,
2373
+ nextButton,
2374
+ todayButton,
2375
+ clearButton,
2376
+ };
2377
+ this.main = main;
2378
+ this.controls = controls;
2379
+
2380
+ const elementClass = inputField ? 'dropdown' : 'inline';
2381
+ element.classList.add(`datepicker-${elementClass}`);
2382
+
2383
+ processPickerOptions(this, config);
2384
+ this.viewDate = computeResetViewDate(datepicker);
2385
+
2386
+ // set up event listeners
2387
+ registerListeners(datepicker, [
2388
+ [element, 'mousedown', onMousedownPicker],
2389
+ [main, 'click', onClickView.bind(null, datepicker)],
2390
+ [controls.viewSwitch, 'click', onClickViewSwitch.bind(null, datepicker)],
2391
+ [controls.prevButton, 'click', onClickPrevButton.bind(null, datepicker)],
2392
+ [controls.nextButton, 'click', onClickNextButton.bind(null, datepicker)],
2393
+ [controls.todayButton, 'click', goToOrSelectToday.bind(null, datepicker)],
2394
+ [controls.clearButton, 'click', clearSelection.bind(null, datepicker)],
2395
+ ]);
2396
+
2397
+ // set up views
2398
+ this.views = [
2399
+ new DaysView(this),
2400
+ new MonthsView(this),
2401
+ new YearsView(this, {id: 2, name: 'years', cellClass: 'year', step: 1}),
2402
+ new YearsView(this, {id: 3, name: 'decades', cellClass: 'decade', step: 10}),
2403
+ ];
2404
+ this.currentView = this.views[config.startView];
2405
+
2406
+ this.currentView.render();
2407
+ this.main.appendChild(this.currentView.element);
2408
+ if (config.container) {
2409
+ config.container.appendChild(this.element);
2410
+ } else {
2411
+ inputField.after(this.element);
2412
+ }
2413
+ }
2414
+
2415
+ setOptions(options) {
2416
+ processPickerOptions(this, options);
2417
+ this.views.forEach((view) => {
2418
+ view.init(options, false);
2419
+ });
2420
+ this.currentView.render();
2421
+ }
2422
+
2423
+ detach() {
2424
+ this.element.remove();
2425
+ }
2426
+
2427
+ show() {
2428
+ if (this.active) {
2429
+ return;
2430
+ }
2431
+
2432
+ const {datepicker, element} = this;
2433
+ const inputField = datepicker.inputField;
2434
+ if (inputField) {
2435
+ // ensure picker's direction matches input's
2436
+ const inputDirection = getTextDirection(inputField);
2437
+ if (inputDirection !== getTextDirection(getParent(element))) {
2438
+ element.dir = inputDirection;
2439
+ } else if (element.dir) {
2440
+ element.removeAttribute('dir');
2441
+ }
2442
+
2443
+ element.style.visibility = 'hidden';
2444
+ element.classList.add('active');
2445
+ this.place();
2446
+ element.style.visibility = '';
2447
+
2448
+ if (datepicker.config.disableTouchKeyboard) {
2449
+ inputField.blur();
2450
+ }
2451
+ } else {
2452
+ element.classList.add('active');
2453
+ }
2454
+ this.active = true;
2455
+ triggerDatepickerEvent(datepicker, 'show');
2456
+ }
2457
+
2458
+ hide() {
2459
+ if (!this.active) {
2460
+ return;
2461
+ }
2462
+ this.datepicker.exitEditMode();
2463
+ this.element.classList.remove('active');
2464
+ this.active = false;
2465
+ triggerDatepickerEvent(this.datepicker, 'hide');
2466
+ }
2467
+
2468
+ place() {
2469
+ const {classList, offsetParent, style} = this.element;
2470
+ const {config, inputField} = this.datepicker;
2471
+ const {
2472
+ width: calendarWidth,
2473
+ height: calendarHeight,
2474
+ } = this.element.getBoundingClientRect();
2475
+ const {
2476
+ left: inputLeft,
2477
+ top: inputTop,
2478
+ right: inputRight,
2479
+ bottom: inputBottom,
2480
+ width: inputWidth,
2481
+ height: inputHeight
2482
+ } = inputField.getBoundingClientRect();
2483
+ let {x: orientX, y: orientY} = config.orientation;
2484
+ let left = inputLeft;
2485
+ let top = inputTop;
2486
+
2487
+ // caliculate offsetLeft/Top of inputField
2488
+ if (offsetParent === document.body || !offsetParent) {
2489
+ left += window.scrollX;
2490
+ top += window.scrollY;
2491
+ } else {
2492
+ const offsetParentRect = offsetParent.getBoundingClientRect();
2493
+ left -= offsetParentRect.left - offsetParent.scrollLeft;
2494
+ top -= offsetParentRect.top - offsetParent.scrollTop;
2495
+ }
2496
+
2497
+ // caliculate the boundaries of the visible area that contains inputField
2498
+ const scrollParent = findScrollParents(inputField);
2499
+ let scrollAreaLeft = 0;
2500
+ let scrollAreaTop = 0;
2501
+ let {
2502
+ clientWidth: scrollAreaRight,
2503
+ clientHeight: scrollAreaBottom,
2504
+ } = document.documentElement;
2505
+
2506
+ if (scrollParent) {
2507
+ const scrollParentRect = scrollParent.getBoundingClientRect();
2508
+ if (scrollParentRect.top > 0) {
2509
+ scrollAreaTop = scrollParentRect.top;
2510
+ }
2511
+ if (scrollParentRect.left > 0) {
2512
+ scrollAreaLeft = scrollParentRect.left;
2513
+ }
2514
+ if (scrollParentRect.right < scrollAreaRight) {
2515
+ scrollAreaRight = scrollParentRect.right;
2516
+ }
2517
+ if (scrollParentRect.bottom < scrollAreaBottom) {
2518
+ scrollAreaBottom = scrollParentRect.bottom;
2519
+ }
2520
+ }
2521
+
2522
+ // determine the horizontal orientation and left position
2523
+ let adjustment = 0;
2524
+ if (orientX === 'auto') {
2525
+ if (inputLeft < scrollAreaLeft) {
2526
+ orientX = 'left';
2527
+ adjustment = scrollAreaLeft - inputLeft;
2528
+ } else if (inputLeft + calendarWidth > scrollAreaRight) {
2529
+ orientX = 'right';
2530
+ if (scrollAreaRight < inputRight) {
2531
+ adjustment = scrollAreaRight - inputRight;
2532
+ }
2533
+ } else if (getTextDirection(inputField) === 'rtl') {
2534
+ orientX = inputRight - calendarWidth < scrollAreaLeft ? 'left' : 'right';
2535
+ } else {
2536
+ orientX = 'left';
2537
+ }
2538
+ }
2539
+ if (orientX === 'right') {
2540
+ left += inputWidth - calendarWidth;
2541
+ }
2542
+ left += adjustment;
2543
+
2544
+ // determine the vertical orientation and top position
2545
+ if (orientY === 'auto') {
2546
+ if (inputTop - calendarHeight > scrollAreaTop) {
2547
+ orientY = inputBottom + calendarHeight > scrollAreaBottom ? 'top' : 'bottom';
2548
+ } else {
2549
+ orientY = 'bottom';
2550
+ }
2551
+ }
2552
+ if (orientY === 'top') {
2553
+ top -= calendarHeight;
2554
+ } else {
2555
+ top += inputHeight;
2556
+ }
2557
+
2558
+ classList.remove(...Object.values(orientClasses));
2559
+ classList.add(orientClasses[orientX], orientClasses[orientY]);
2560
+
2561
+ style.left = toPx(left);
2562
+ style.top = toPx(top);
2563
+ }
2564
+
2565
+ setViewSwitchLabel(labelText) {
2566
+ this.controls.viewSwitch.textContent = labelText;
2567
+ }
2568
+
2569
+ setPrevButtonDisabled(disabled) {
2570
+ this.controls.prevButton.disabled = disabled;
2571
+ }
2572
+
2573
+ setNextButtonDisabled(disabled) {
2574
+ this.controls.nextButton.disabled = disabled;
2575
+ }
2576
+
2577
+ changeView(viewId) {
2578
+ const currentView = this.currentView;
2579
+ if (viewId !== currentView.id) {
2580
+ if (!this._oldView) {
2581
+ this._oldView = currentView;
2582
+ }
2583
+ this.currentView = this.views[viewId];
2584
+ this._renderMethod = 'render';
2585
+ }
2586
+ return this;
2587
+ }
2588
+
2589
+ // Change the focused date (view date)
2590
+ changeFocus(newViewDate) {
2591
+ this._renderMethod = setViewDate(this, newViewDate) ? 'render' : 'refreshFocus';
2592
+ this.views.forEach((view) => {
2593
+ view.updateFocus();
2594
+ });
2595
+ return this;
2596
+ }
2597
+
2598
+ // Apply the change of the selected dates
2599
+ update(viewDate = undefined) {
2600
+ const newViewDate = viewDate === undefined
2601
+ ? computeResetViewDate(this.datepicker)
2602
+ : viewDate;
2603
+ this._renderMethod = setViewDate(this, newViewDate) ? 'render' : 'refresh';
2604
+ this.views.forEach((view) => {
2605
+ view.updateFocus();
2606
+ view.updateSelection();
2607
+ });
2608
+ return this;
2609
+ }
2610
+
2611
+ // Refresh the picker UI
2612
+ render(quickRender = true) {
2613
+ const {currentView, datepicker, _oldView: oldView} = this;
2614
+ const oldViewDate = new Date(this._oldViewDate);
2615
+ const renderMethod = (quickRender && this._renderMethod) || 'render';
2616
+ delete this._oldView;
2617
+ delete this._oldViewDate;
2618
+ delete this._renderMethod;
2619
+
2620
+ currentView[renderMethod]();
2621
+ if (oldView) {
2622
+ this.main.replaceChild(currentView.element, oldView.element);
2623
+ triggerDatepickerEvent(datepicker, 'changeView');
2624
+ }
2625
+ if (!isNaN(oldViewDate)) {
2626
+ const newViewDate = new Date(this.viewDate);
2627
+ if (newViewDate.getFullYear() !== oldViewDate.getFullYear()) {
2628
+ triggerDatepickerEvent(datepicker, 'changeYear');
2629
+ }
2630
+ if (newViewDate.getMonth() !== oldViewDate.getMonth()) {
2631
+ triggerDatepickerEvent(datepicker, 'changeMonth');
2632
+ }
2633
+ }
2634
+ }
2635
+ }
2636
+
2637
+ // Find the closest date that doesn't meet the condition for unavailable date
2638
+ // Returns undefined if no available date is found
2639
+ // addFn: function to calculate the next date
2640
+ // - args: time value, amount
2641
+ // increase: amount to pass to addFn
2642
+ // testFn: function to test the unavailability of the date
2643
+ // - args: time value; return: true if unavailable
2644
+ function findNextAvailableOne(date, addFn, increase, testFn, min, max) {
2645
+ if (!isInRange(date, min, max)) {
2646
+ return;
2647
+ }
2648
+ if (testFn(date)) {
2649
+ const newDate = addFn(date, increase);
2650
+ return findNextAvailableOne(newDate, addFn, increase, testFn, min, max);
2651
+ }
2652
+ return date;
2653
+ }
2654
+
2655
+ // direction: -1 (left/up), 1 (right/down)
2656
+ // vertical: true for up/down, false for left/right
2657
+ function moveByArrowKey(datepicker, direction, vertical) {
2658
+ const picker = datepicker.picker;
2659
+ const currentView = picker.currentView;
2660
+ const step = currentView.step || 1;
2661
+ let viewDate = picker.viewDate;
2662
+ let addFn;
2663
+ switch (currentView.id) {
2664
+ case 0:
2665
+ viewDate = addDays(viewDate, vertical ? direction * 7 : direction);
2666
+ addFn = addDays;
2667
+ break;
2668
+ case 1:
2669
+ viewDate = addMonths(viewDate, vertical ? direction * 4 : direction);
2670
+ addFn = addMonths;
2671
+ break;
2672
+ default:
2673
+ viewDate = addYears(viewDate, direction * (vertical ? 4 : 1) * step);
2674
+ addFn = addYears;
2675
+ }
2676
+ viewDate = findNextAvailableOne(
2677
+ viewDate,
2678
+ addFn,
2679
+ direction < 0 ? -step : step,
2680
+ (date) => currentView.disabled.includes(date),
2681
+ currentView.minDate,
2682
+ currentView.maxDate
2683
+ );
2684
+ if (viewDate !== undefined) {
2685
+ picker.changeFocus(viewDate).render();
2686
+ }
2687
+ }
2688
+
2689
+ function onKeydown(datepicker, ev) {
2690
+ const {config, picker, editMode} = datepicker;
2691
+ const active = picker.active;
2692
+ const {key, altKey, shiftKey} = ev;
2693
+ const ctrlOrMetaKey = ev.ctrlKey || ev.metaKey;
2694
+ const cancelEvent = () => {
2695
+ ev.preventDefault();
2696
+ ev.stopPropagation();
2697
+ };
2698
+
2699
+ // tab/enter keys should not be taken by shortcut keys
2700
+ if (key === 'Tab') {
2701
+ unfocus(datepicker);
2702
+ return;
2703
+ }
2704
+ if (key === 'Enter') {
2705
+ if (!active) {
2706
+ datepicker.update();
2707
+ } else if (editMode) {
2708
+ datepicker.exitEditMode({update: true, autohide: config.autohide});
2709
+ } else {
2710
+ const currentView = picker.currentView;
2711
+ if (currentView.isMinView) {
2712
+ datepicker.setDate(picker.viewDate);
2713
+ } else {
2714
+ picker.changeView(currentView.id - 1).render();
2715
+ cancelEvent();
2716
+ }
2717
+ }
2718
+ return;
2719
+ }
2720
+
2721
+ const shortcutKeys = config.shortcutKeys;
2722
+ const keyInfo = {key, ctrlOrMetaKey, altKey, shiftKey};
2723
+ const shortcut = Object.keys(shortcutKeys).find((item) => {
2724
+ const keyDef = shortcutKeys[item];
2725
+ return !Object.keys(keyDef).find(prop => keyDef[prop] !== keyInfo[prop]);
2726
+ });
2727
+ if (shortcut) {
2728
+ let action;
2729
+ if (shortcut === 'toggle') {
2730
+ action = shortcut;
2731
+ } else if (editMode) {
2732
+ if (shortcut === 'exitEditMode') {
2733
+ action = shortcut;
2734
+ }
2735
+ } else if (active) {
2736
+ if (shortcut === 'hide') {
2737
+ action = shortcut;
2738
+ } else if (shortcut === 'prevButton') {
2739
+ action = [goToPrevOrNext, [datepicker, -1]];
2740
+ } else if (shortcut === 'nextButton') {
2741
+ action = [goToPrevOrNext, [datepicker, 1]];
2742
+ } else if (shortcut === 'viewSwitch') {
2743
+ action = [switchView, [datepicker]];
2744
+ } else if (config.clearButton && shortcut === 'clearButton') {
2745
+ action = [clearSelection, [datepicker]];
2746
+ } else if (config.todayButton && shortcut === 'todayButton') {
2747
+ action = [goToOrSelectToday, [datepicker]];
2748
+ }
2749
+ } else if (shortcut === 'show') {
2750
+ action = shortcut;
2751
+ }
2752
+ if (action) {
2753
+ if (Array.isArray(action)) {
2754
+ action[0].apply(null, action[1]);
2755
+ } else {
2756
+ datepicker[action]();
2757
+ }
2758
+ cancelEvent();
2759
+ return;
2760
+ }
2761
+ }
2762
+
2763
+ // perform as a regular <input> when picker in hidden or in edit mode
2764
+ if (!active || editMode) {
2765
+ return;
2766
+ }
2767
+
2768
+ const handleArrowKeyPress = (direction, vertical) => {
2769
+ if (shiftKey || ctrlOrMetaKey || altKey) {
2770
+ datepicker.enterEditMode();
2771
+ } else {
2772
+ moveByArrowKey(datepicker, direction, vertical);
2773
+ ev.preventDefault();
2774
+ }
2775
+ };
2776
+
2777
+ if (key === 'ArrowLeft') {
2778
+ handleArrowKeyPress(-1, false);
2779
+ } else if (key === 'ArrowRight') {
2780
+ handleArrowKeyPress(1, false);
2781
+ } else if (key === 'ArrowUp') {
2782
+ handleArrowKeyPress(-1, true);
2783
+ } else if (key === 'ArrowDown') {
2784
+ handleArrowKeyPress(1, true);
2785
+ } else if (
2786
+ key === 'Backspace'
2787
+ || key === 'Delete'
2788
+ // When autofill is performed, Chromium-based browsers trigger fake
2789
+ // keydown/keyup events that don't have the `key` property (on Edge,
2790
+ // keyup only) in addition to the input event. Therefore, we need to
2791
+ // check the existence of `key`'s value before checking the length.
2792
+ // (issue #144)
2793
+ || (key && key.length === 1 && !ctrlOrMetaKey)
2794
+ ) {
2795
+ datepicker.enterEditMode();
2796
+ }
2797
+ }
2798
+
2799
+ function onFocus(datepicker) {
2800
+ if (datepicker.config.showOnFocus && !datepicker._showing) {
2801
+ datepicker.show();
2802
+ }
2803
+ }
2804
+
2805
+ // for the prevention for entering edit mode while getting focus on click
2806
+ function onMousedown(datepicker, ev) {
2807
+ const el = ev.target;
2808
+ if (datepicker.picker.active || datepicker.config.showOnClick) {
2809
+ el._active = isActiveElement(el);
2810
+ el._clicking = setTimeout(() => {
2811
+ delete el._active;
2812
+ delete el._clicking;
2813
+ }, 2000);
2814
+ }
2815
+ }
2816
+
2817
+ function onClickInput(datepicker, ev) {
2818
+ const el = ev.target;
2819
+ if (!el._clicking) {
2820
+ return;
2821
+ }
2822
+ clearTimeout(el._clicking);
2823
+ delete el._clicking;
2824
+
2825
+ if (el._active) {
2826
+ datepicker.enterEditMode();
2827
+ }
2828
+ delete el._active;
2829
+
2830
+ if (datepicker.config.showOnClick) {
2831
+ datepicker.show();
2832
+ }
2833
+ }
2834
+
2835
+ function onPaste(datepicker, ev) {
2836
+ if (ev.clipboardData.types.includes('text/plain')) {
2837
+ datepicker.enterEditMode();
2838
+ }
2839
+ }
2840
+
2841
+ // for the `document` to delegate the events from outside the picker/input field
2842
+ function onClickOutside(datepicker, ev) {
2843
+ const {element, picker} = datepicker;
2844
+ // check both picker's and input's activeness to make updateOnBlur work in
2845
+ // the cases where...
2846
+ // - picker is hidden by ESC key press → input stays focused
2847
+ // - input is unfocused by closing mobile keyboard → piker is kept shown
2848
+ if (!picker.active && !isActiveElement(element)) {
2849
+ return;
2850
+ }
2851
+ const pickerElem = picker.element;
2852
+ if (findElementInEventPath(ev, el => el === element || el === pickerElem)) {
2853
+ return;
2854
+ }
2855
+ unfocus(datepicker);
2856
+ }
2857
+
2858
+ function stringifyDates(dates, config) {
2859
+ return dates
2860
+ .map(dt => formatDate(dt, config.format, config.locale))
2861
+ .join(config.dateDelimiter);
2862
+ }
2863
+
2864
+ // parse input dates and create an array of time values for selection
2865
+ // returns undefined if there are no valid dates in inputDates
2866
+ // when origDates (current selection) is passed, the function works to mix
2867
+ // the input dates into the current selection
2868
+ function processInputDates(datepicker, inputDates, clear = false) {
2869
+ if (inputDates.length === 0) {
2870
+ // empty input is considered valid unless origiDates is passed
2871
+ return clear ? [] : undefined;
2872
+ }
2873
+
2874
+ const {config, dates: origDates, rangeSideIndex} = datepicker;
2875
+ const {pickLevel, maxNumberOfDates} = config;
2876
+ let newDates = inputDates.reduce((dates, dt) => {
2877
+ let date = parseDate(dt, config.format, config.locale);
2878
+ if (date === undefined) {
2879
+ return dates;
2880
+ }
2881
+ // adjust to 1st of the month/Jan 1st of the year
2882
+ // or to the last day of the monh/Dec 31st of the year if the datepicker
2883
+ // is the range-end picker of a rangepicker
2884
+ date = regularizeDate(date, pickLevel, rangeSideIndex);
2885
+ if (
2886
+ isInRange(date, config.minDate, config.maxDate)
2887
+ && !dates.includes(date)
2888
+ && !config.checkDisabled(date, pickLevel)
2889
+ && (pickLevel > 0 || !config.daysOfWeekDisabled.includes(new Date(date).getDay()))
2890
+ ) {
2891
+ dates.push(date);
2892
+ }
2893
+ return dates;
2894
+ }, []);
2895
+ if (newDates.length === 0) {
2896
+ return;
2897
+ }
2898
+ if (config.multidate && !clear) {
2899
+ // get the synmetric difference between origDates and newDates
2900
+ newDates = newDates.reduce((dates, date) => {
2901
+ if (!origDates.includes(date)) {
2902
+ dates.push(date);
2903
+ }
2904
+ return dates;
2905
+ }, origDates.filter(date => !newDates.includes(date)));
2906
+ }
2907
+ // do length check always because user can input multiple dates regardless of the mode
2908
+ return maxNumberOfDates && newDates.length > maxNumberOfDates
2909
+ ? newDates.slice(maxNumberOfDates * -1)
2910
+ : newDates;
2911
+ }
2912
+
2913
+ // refresh the UI elements
2914
+ // modes: 1: input only, 2, picker only, 3 both
2915
+ function refreshUI(datepicker, mode = 3, quickRender = true, viewDate = undefined) {
2916
+ const {config, picker, inputField} = datepicker;
2917
+ if (mode & 2) {
2918
+ const newView = picker.active ? config.pickLevel : config.startView;
2919
+ picker.update(viewDate).changeView(newView).render(quickRender);
2920
+ }
2921
+ if (mode & 1 && inputField) {
2922
+ inputField.value = stringifyDates(datepicker.dates, config);
2923
+ }
2924
+ }
2925
+
2926
+ function setDate(datepicker, inputDates, options) {
2927
+ const config = datepicker.config;
2928
+ let {clear, render, autohide, revert, forceRefresh, viewDate} = options;
2929
+ if (render === undefined) {
2930
+ render = true;
2931
+ }
2932
+ if (!render) {
2933
+ autohide = forceRefresh = false;
2934
+ } else if (autohide === undefined) {
2935
+ autohide = config.autohide;
2936
+ }
2937
+ viewDate = parseDate(viewDate, config.format, config.locale);
2938
+
2939
+ const newDates = processInputDates(datepicker, inputDates, clear);
2940
+ if (!newDates && !revert) {
2941
+ return;
2942
+ }
2943
+ if (newDates && newDates.toString() !== datepicker.dates.toString()) {
2944
+ datepicker.dates = newDates;
2945
+ refreshUI(datepicker, render ? 3 : 1, true, viewDate);
2946
+ triggerDatepickerEvent(datepicker, 'changeDate');
2947
+ } else {
2948
+ refreshUI(datepicker, forceRefresh ? 3 : 1, true, viewDate);
2949
+ }
2950
+
2951
+ if (autohide) {
2952
+ datepicker.hide();
2953
+ }
2954
+ }
2955
+
2956
+ function getOutputConverter(datepicker, format) {
2957
+ return format
2958
+ ? date => formatDate(date, format, datepicker.config.locale)
2959
+ : date => new Date(date);
2960
+ }
2961
+
2962
+ /**
2963
+ * Class representing a date picker
2964
+ */
2965
+ class Datepicker {
2966
+ /**
2967
+ * Create a date picker
2968
+ * @param {Element} element - element to bind a date picker
2969
+ * @param {Object} [options] - config options
2970
+ * @param {DateRangePicker} [rangepicker] - DateRangePicker instance the
2971
+ * date picker belongs to. Use this only when creating date picker as a part
2972
+ * of date range picker
2973
+ */
2974
+ constructor(element, options = {}, rangepicker = undefined) {
2975
+ element.datepicker = this;
2976
+ this.element = element;
2977
+ this.dates = [];
2978
+
2979
+ // initialize config
2980
+ const config = this.config = Object.assign({
2981
+ buttonClass: (options.buttonClass && String(options.buttonClass)) || 'button',
2982
+ container: null,
2983
+ defaultViewDate: today(),
2984
+ maxDate: undefined,
2985
+ minDate: undefined,
2986
+ }, processOptions(defaultOptions, this));
2987
+
2988
+ // configure by type
2989
+ let inputField;
2990
+ if (element.tagName === 'INPUT') {
2991
+ inputField = this.inputField = element;
2992
+ inputField.classList.add('datepicker-input');
2993
+ if (options.container) {
2994
+ // omit string type check because it doesn't guarantee to avoid errors
2995
+ // (invalid selector string causes abend with sytax error)
2996
+ config.container = options.container instanceof HTMLElement
2997
+ ? options.container
2998
+ : document.querySelector(options.container);
2999
+ }
3000
+ } else {
3001
+ config.container = element;
3002
+ }
3003
+ if (rangepicker) {
3004
+ // check validiry
3005
+ const index = rangepicker.inputs.indexOf(inputField);
3006
+ const datepickers = rangepicker.datepickers;
3007
+ if (index < 0 || index > 1 || !Array.isArray(datepickers)) {
3008
+ throw Error('Invalid rangepicker object.');
3009
+ }
3010
+ // attach itaelf to the rangepicker here so that processInputDates() can
3011
+ // determine if this is the range-end picker of the rangepicker while
3012
+ // setting inital values when pickLevel > 0
3013
+ datepickers[index] = this;
3014
+ this.rangepicker = rangepicker;
3015
+ this.rangeSideIndex = index;
3016
+ }
3017
+
3018
+ // set up config
3019
+ this._options = options;
3020
+ Object.assign(config, processOptions(options, this));
3021
+ config.shortcutKeys = createShortcutKeyConfig(options.shortcutKeys || {});
3022
+
3023
+ // process initial value
3024
+ const initialDates = stringToArray(
3025
+ element.value || element.dataset.date,
3026
+ config.dateDelimiter
3027
+ );
3028
+ delete element.dataset.date;
3029
+ const inputDateValues = processInputDates(this, initialDates);
3030
+ if (inputDateValues && inputDateValues.length > 0) {
3031
+ this.dates = inputDateValues;
3032
+ }
3033
+ if (inputField) {
3034
+ inputField.value = stringifyDates(this.dates, config);
3035
+ }
3036
+
3037
+ // set up picekr element
3038
+ const picker = this.picker = new Picker(this);
3039
+
3040
+ const keydownListener = [element, 'keydown', onKeydown.bind(null, this)];
3041
+ if (inputField) {
3042
+ registerListeners(this, [
3043
+ keydownListener,
3044
+ [inputField, 'focus', onFocus.bind(null, this)],
3045
+ [inputField, 'mousedown', onMousedown.bind(null, this)],
3046
+ [inputField, 'click', onClickInput.bind(null, this)],
3047
+ [inputField, 'paste', onPaste.bind(null, this)],
3048
+ // To detect a click on outside, just listening to mousedown is enough,
3049
+ // no need to listen to touchstart.
3050
+ // Actually, listening to touchstart can be a problem because, while
3051
+ // mousedown is fired only on tapping but not on swiping/pinching,
3052
+ // touchstart is fired on swiping/pinching as well.
3053
+ // (issue #95)
3054
+ [document, 'mousedown', onClickOutside.bind(null, this)],
3055
+ [window, 'resize', picker.place.bind(picker)]
3056
+ ]);
3057
+ } else {
3058
+ registerListeners(this, [keydownListener]);
3059
+ this.show();
3060
+ }
3061
+ }
3062
+
3063
+ /**
3064
+ * Format Date object or time value in given format and language
3065
+ * @param {Date|Number} date - date or time value to format
3066
+ * @param {String|Object} format - format string or object that contains
3067
+ * toDisplay() custom formatter, whose signature is
3068
+ * - args:
3069
+ * - date: {Date} - Date instance of the date passed to the method
3070
+ * - format: {Object} - the format object passed to the method
3071
+ * - locale: {Object} - locale for the language specified by `lang`
3072
+ * - return:
3073
+ * {String} formatted date
3074
+ * @param {String} [lang=en] - language code for the locale to use
3075
+ * @return {String} formatted date
3076
+ */
3077
+ static formatDate(date, format, lang) {
3078
+ return formatDate(date, format, lang && locales[lang] || locales.en);
3079
+ }
3080
+
3081
+ /**
3082
+ * Parse date string
3083
+ * @param {String|Date|Number} dateStr - date string, Date object or time
3084
+ * value to parse
3085
+ * @param {String|Object} format - format string or object that contains
3086
+ * toValue() custom parser, whose signature is
3087
+ * - args:
3088
+ * - dateStr: {String|Date|Number} - the dateStr passed to the method
3089
+ * - format: {Object} - the format object passed to the method
3090
+ * - locale: {Object} - locale for the language specified by `lang`
3091
+ * - return:
3092
+ * {Date|Number} parsed date or its time value
3093
+ * @param {String} [lang=en] - language code for the locale to use
3094
+ * @return {Number} time value of parsed date
3095
+ */
3096
+ static parseDate(dateStr, format, lang) {
3097
+ return parseDate(dateStr, format, lang && locales[lang] || locales.en);
3098
+ }
3099
+
3100
+ /**
3101
+ * @type {Object} - Installed locales in `[languageCode]: localeObject` format
3102
+ * en`:_English (US)_ is pre-installed.
3103
+ */
3104
+ static get locales() {
3105
+ return locales;
3106
+ }
3107
+
3108
+ /**
3109
+ * @type {Boolean} - Whether the picker element is shown. `true` whne shown
3110
+ */
3111
+ get active() {
3112
+ return !!(this.picker && this.picker.active);
3113
+ }
3114
+
3115
+ /**
3116
+ * @type {HTMLDivElement} - DOM object of picker element
3117
+ */
3118
+ get pickerElement() {
3119
+ return this.picker ? this.picker.element : undefined;
3120
+ }
3121
+
3122
+ /**
3123
+ * Set new values to the config options
3124
+ * @param {Object} options - config options to update
3125
+ */
3126
+ setOptions(options) {
3127
+ const newOptions = processOptions(options, this);
3128
+ Object.assign(this._options, options);
3129
+ Object.assign(this.config, newOptions);
3130
+ this.picker.setOptions(newOptions);
3131
+
3132
+ refreshUI(this, 3);
3133
+ }
3134
+
3135
+ /**
3136
+ * Show the picker element
3137
+ */
3138
+ show() {
3139
+ if (this.inputField) {
3140
+ const {config, inputField} = this;
3141
+ if (inputField.disabled || (inputField.readOnly && !config.enableOnReadonly)) {
3142
+ return;
3143
+ }
3144
+ if (!isActiveElement(inputField) && !config.disableTouchKeyboard) {
3145
+ this._showing = true;
3146
+ inputField.focus();
3147
+ delete this._showing;
3148
+ }
3149
+ }
3150
+ this.picker.show();
3151
+ }
3152
+
3153
+ /**
3154
+ * Hide the picker element
3155
+ * Not available on inline picker
3156
+ */
3157
+ hide() {
3158
+ if (!this.inputField) {
3159
+ return;
3160
+ }
3161
+ this.picker.hide();
3162
+ this.picker.update().changeView(this.config.startView).render();
3163
+ }
3164
+
3165
+ /**
3166
+ * Toggle the display of the picker element
3167
+ * Not available on inline picker
3168
+ *
3169
+ * Unlike hide(), the picker does not return to the start view when hiding.
3170
+ */
3171
+ toggle() {
3172
+ if (!this.picker.active) {
3173
+ this.show();
3174
+ } else if (this.inputField) {
3175
+ this.picker.hide();
3176
+ }
3177
+ }
3178
+
3179
+ /**
3180
+ * Destroy the Datepicker instance
3181
+ * @return {Detepicker} - the instance destroyed
3182
+ */
3183
+ destroy() {
3184
+ this.hide();
3185
+ unregisterListeners(this);
3186
+ this.picker.detach();
3187
+ const element = this.element;
3188
+ element.classList.remove('datepicker-input');
3189
+ delete element.datepicker;
3190
+ return this;
3191
+ }
3192
+
3193
+ /**
3194
+ * Get the selected date(s)
3195
+ *
3196
+ * The method returns a Date object of selected date by default, and returns
3197
+ * an array of selected dates in multidate mode. If format string is passed,
3198
+ * it returns date string(s) formatted in given format.
3199
+ *
3200
+ * @param {String} [format] - format string to stringify the date(s)
3201
+ * @return {Date|String|Date[]|String[]} - selected date(s), or if none is
3202
+ * selected, empty array in multidate mode and undefined in sigledate mode
3203
+ */
3204
+ getDate(format = undefined) {
3205
+ const callback = getOutputConverter(this, format);
3206
+
3207
+ if (this.config.multidate) {
3208
+ return this.dates.map(callback);
3209
+ }
3210
+ if (this.dates.length > 0) {
3211
+ return callback(this.dates[0]);
3212
+ }
3213
+ }
3214
+
3215
+ /**
3216
+ * Set selected date(s)
3217
+ *
3218
+ * In multidate mode, you can pass multiple dates as a series of arguments
3219
+ * or an array. (Since each date is parsed individually, the type of the
3220
+ * dates doesn't have to be the same.)
3221
+ * The given dates are used to toggle the select status of each date. The
3222
+ * number of selected dates is kept from exceeding the length set to
3223
+ * maxNumberOfDates.
3224
+ *
3225
+ * With clear: true option, the method can be used to clear the selection
3226
+ * and to replace the selection instead of toggling in multidate mode.
3227
+ * If the option is passed with no date arguments or an empty dates array,
3228
+ * it works as "clear" (clear the selection then set nothing), and if the
3229
+ * option is passed with new dates to select, it works as "replace" (clear
3230
+ * the selection then set the given dates)
3231
+ *
3232
+ * When render: false option is used, the method omits re-rendering the
3233
+ * picker element. In this case, you need to call refresh() method later in
3234
+ * order for the picker element to reflect the changes. The input field is
3235
+ * refreshed always regardless of this option.
3236
+ *
3237
+ * When invalid (unparsable, repeated, disabled or out-of-range) dates are
3238
+ * passed, the method ignores them and applies only valid ones. In the case
3239
+ * that all the given dates are invalid, which is distinguished from passing
3240
+ * no dates, the method considers it as an error and leaves the selection
3241
+ * untouched. (The input field also remains untouched unless revert: true
3242
+ * option is used.)
3243
+ * Replacing the selection with the same date(s) also causes a similar
3244
+ * situation. In both cases, the method does not refresh the picker element
3245
+ * unless forceRefresh: true option is used.
3246
+ *
3247
+ * If viewDate option is used, the method changes the focused date to the
3248
+ * specified date instead of the last item of the selection.
3249
+ *
3250
+ * @param {...(Date|Number|String)|Array} [dates] - Date strings, Date
3251
+ * objects, time values or mix of those for new selection
3252
+ * @param {Object} [options] - function options
3253
+ * - clear: {boolean} - Whether to clear the existing selection
3254
+ * defualt: false
3255
+ * - render: {boolean} - Whether to re-render the picker element
3256
+ * default: true
3257
+ * - autohide: {boolean} - Whether to hide the picker element after re-render
3258
+ * Ignored when used with render: false
3259
+ * default: config.autohide
3260
+ * - revert: {boolean} - Whether to refresh the input field when all the
3261
+ * passed dates are invalid
3262
+ * default: false
3263
+ * - forceRefresh: {boolean} - Whether to refresh the picker element when
3264
+ * passed dates don't change the existing selection
3265
+ * default: false
3266
+ * - viewDate: {Date|Number|String} - Date to be focused after setiing date(s)
3267
+ * default: The last item of the resulting selection, or defaultViewDate
3268
+ * config option if none is selected
3269
+ */
3270
+ setDate(...args) {
3271
+ const dates = [...args];
3272
+ const opts = {};
3273
+ const lastArg = lastItemOf(args);
3274
+ if (
3275
+ lastArg
3276
+ && typeof lastArg === 'object'
3277
+ && !Array.isArray(lastArg)
3278
+ && !(lastArg instanceof Date)
3279
+ ) {
3280
+ Object.assign(opts, dates.pop());
3281
+ }
3282
+
3283
+ const inputDates = Array.isArray(dates[0]) ? dates[0] : dates;
3284
+ setDate(this, inputDates, opts);
3285
+ }
3286
+
3287
+ /**
3288
+ * Update the selected date(s) with input field's value
3289
+ * Not available on inline picker
3290
+ *
3291
+ * The input field will be refreshed with properly formatted date string.
3292
+ *
3293
+ * In the case that all the entered dates are invalid (unparsable, repeated,
3294
+ * disabled or out-of-range), which is distinguished from empty input field,
3295
+ * the method leaves the input field untouched as well as the selection by
3296
+ * default. If revert: true option is used in this case, the input field is
3297
+ * refreshed with the existing selection.
3298
+ * The method also doesn't refresh the picker element in this case and when
3299
+ * the entered dates are the same as the existing selection. If
3300
+ * forceRefresh: true option is used, the picker element is refreshed in
3301
+ * these cases too.
3302
+ *
3303
+ * @param {Object} [options] - function options
3304
+ * - autohide: {boolean} - whether to hide the picker element after refresh
3305
+ * default: false
3306
+ * - revert: {boolean} - Whether to refresh the input field when all the
3307
+ * passed dates are invalid
3308
+ * default: false
3309
+ * - forceRefresh: {boolean} - Whether to refresh the picer element when
3310
+ * input field's value doesn't change the existing selection
3311
+ * default: false
3312
+ */
3313
+ update(options = undefined) {
3314
+ if (!this.inputField) {
3315
+ return;
3316
+ }
3317
+
3318
+ const opts = Object.assign(options || {}, {clear: true, render: true, viewDate: undefined});
3319
+ const inputDates = stringToArray(this.inputField.value, this.config.dateDelimiter);
3320
+ setDate(this, inputDates, opts);
3321
+ }
3322
+
3323
+ /**
3324
+ * Get the focused date
3325
+ *
3326
+ * The method returns a Date object of focused date by default. If format
3327
+ * string is passed, it returns date string formatted in given format.
3328
+ *
3329
+ * @param {String} [format] - format string to stringify the date
3330
+ * @return {Date|String} - focused date (viewDate)
3331
+ */
3332
+ getFocusedDate(format = undefined) {
3333
+ return getOutputConverter(this, format)(this.picker.viewDate);
3334
+ }
3335
+
3336
+ /**
3337
+ * Set focused date
3338
+ *
3339
+ * By default, the method updates the focus on the view shown at the time,
3340
+ * or the one set to the startView config option if the picker is hidden.
3341
+ * When resetView: true is passed, the view displayed is changed to the
3342
+ * pickLevel config option's if the picker is shown.
3343
+ *
3344
+ * @param {Date|Number|String} viewDate - date string, Date object, time
3345
+ * values of the date to focus
3346
+ * @param {Boolean} [resetView] - whether to change the view to pickLevel
3347
+ * config option's when the picker is shown. Ignored when the picker is
3348
+ * hidden
3349
+ */
3350
+ setFocusedDate(viewDate, resetView = false) {
3351
+ const {config, picker, active, rangeSideIndex} = this;
3352
+ const pickLevel = config.pickLevel;
3353
+ const newViewDate = parseDate(viewDate, config.format, config.locale);
3354
+ if (newViewDate === undefined) {
3355
+ return;
3356
+ }
3357
+
3358
+ picker.changeFocus(regularizeDate(newViewDate, pickLevel, rangeSideIndex));
3359
+ if (active && resetView) {
3360
+ picker.changeView(pickLevel);
3361
+ }
3362
+ picker.render();
3363
+ }
3364
+
3365
+ /**
3366
+ * Refresh the picker element and the associated input field
3367
+ * @param {String} [target] - target item when refreshing one item only
3368
+ * 'picker' or 'input'
3369
+ * @param {Boolean} [forceRender] - whether to re-render the picker element
3370
+ * regardless of its state instead of optimized refresh
3371
+ */
3372
+ refresh(target = undefined, forceRender = false) {
3373
+ if (target && typeof target !== 'string') {
3374
+ forceRender = target;
3375
+ target = undefined;
3376
+ }
3377
+
3378
+ let mode;
3379
+ if (target === 'picker') {
3380
+ mode = 2;
3381
+ } else if (target === 'input') {
3382
+ mode = 1;
3383
+ } else {
3384
+ mode = 3;
3385
+ }
3386
+ refreshUI(this, mode, !forceRender);
3387
+ }
3388
+
3389
+ /**
3390
+ * Enter edit mode
3391
+ * Not available on inline picker or when the picker element is hidden
3392
+ */
3393
+ enterEditMode() {
3394
+ const inputField = this.inputField;
3395
+ if (!inputField || inputField.readOnly || !this.picker.active || this.editMode) {
3396
+ return;
3397
+ }
3398
+ this.editMode = true;
3399
+ inputField.classList.add('in-edit');
3400
+ }
3401
+
3402
+ /**
3403
+ * Exit from edit mode
3404
+ * Not available on inline picker
3405
+ * @param {Object} [options] - function options
3406
+ * - update: {boolean} - whether to call update() after exiting
3407
+ * If false, input field is revert to the existing selection
3408
+ * default: false
3409
+ */
3410
+ exitEditMode(options = undefined) {
3411
+ if (!this.inputField || !this.editMode) {
3412
+ return;
3413
+ }
3414
+ const opts = Object.assign({update: false}, options);
3415
+ delete this.editMode;
3416
+ this.inputField.classList.remove('in-edit');
3417
+ if (opts.update) {
3418
+ this.update(opts);
3419
+ }
3420
+ }
3421
+ }
3422
+
3423
+ var DatepickerTypeEnum;
3424
+ (function (DatepickerTypeEnum) {
3425
+ DatepickerTypeEnum[DatepickerTypeEnum["date"] = 0] = "date";
3426
+ DatepickerTypeEnum[DatepickerTypeEnum["month"] = 1] = "month";
3427
+ DatepickerTypeEnum[DatepickerTypeEnum["year"] = 2] = "year";
3428
+ DatepickerTypeEnum[DatepickerTypeEnum["week"] = 3] = "week";
3429
+ })(DatepickerTypeEnum || (DatepickerTypeEnum = {}));
3430
+
3431
+ var _a, _b, _c;
3432
+ 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';
3433
+ const getDefaultDate = (type, selectedDate) => {
3434
+ const date = selectedDate ? dayjs_min(selectedDate).toDate() : today$1();
3435
+ return type === 'week' ? dayjs_min(date).startOf('isoWeek').toDate() : date;
3436
+ };
3437
+ function getDatepickerOptions(type, selectedDate) {
3438
+ const config = {
3439
+ enableOnReadonly: false,
3440
+ pickLevel: DatepickerTypeEnum[type],
3441
+ todayButton: true,
3442
+ todayButtonMode: 1,
3443
+ todayHighlight: true,
3444
+ weekStart: 1,
3445
+ language: 'browser',
3446
+ defaultViewDate: getDefaultDate(type, selectedDate)
3447
+ };
3448
+ return config;
3449
+ }
3450
+ function daysForLocale(weekday = 'long') {
3451
+ const date = new Date();
3452
+ const firstDayOfWeek = new Date(date.setUTCDate(date.getUTCDate() - date.getUTCDay()));
3453
+ const format = new Intl.DateTimeFormat(browserLanguage, { weekday }).format;
3454
+ return [...Array(7).keys()].map(day => format(firstDayOfWeek.setUTCDate(firstDayOfWeek.getUTCDate() + day)));
3455
+ }
3456
+ function monthsForLocale(month = 'long') {
3457
+ const date = new Date();
3458
+ const format = new Intl.DateTimeFormat(browserLanguage, { month }).format;
3459
+ return [...Array(12).keys()].map(month => format(date.setUTCMonth(month)));
3460
+ }
3461
+ if ((_c = Datepicker === null || Datepicker === void 0 ? void 0 : Datepicker.locales) === null || _c === void 0 ? void 0 : _c.browser) {
3462
+ Datepicker.locales.browser = {
3463
+ days: daysForLocale('long'),
3464
+ daysShort: daysForLocale('short'),
3465
+ daysMin: daysForLocale('narrow'),
3466
+ months: monthsForLocale('long'),
3467
+ monthsShort: monthsForLocale('short'),
3468
+ today: catI18nRegistry.t('input.today')
3469
+ };
3470
+ }
3471
+
3472
+ 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}";
3473
+
3474
+ const CatDatepicker = class {
3475
+ constructor(hostRef) {
3476
+ registerInstance(this, hostRef);
3477
+ this.catChange = createEvent(this, "catChange", 7);
3478
+ this.catFocus = createEvent(this, "catFocus", 7);
3479
+ this.catBlur = createEvent(this, "catBlur", 7);
3480
+ this.hasSlottedLabel = false;
3481
+ this.hasSlottedHint = false;
3482
+ this.requiredMarker = 'optional';
3483
+ this.horizontal = false;
3484
+ this.autoComplete = undefined;
3485
+ this.clearable = false;
3486
+ this.disabled = false;
3487
+ this.hint = undefined;
3488
+ this.icon = undefined;
3489
+ this.iconLeft = false;
3490
+ this.identifier = undefined;
3491
+ this.label = '';
3492
+ this.labelHidden = false;
3493
+ this.max = undefined;
3494
+ this.min = undefined;
3495
+ this.name = undefined;
3496
+ this.placeholder = undefined;
3497
+ this.textPrefix = undefined;
3498
+ this.textSuffix = undefined;
3499
+ this.readonly = false;
3500
+ this.required = false;
3501
+ this.format = 'mm/dd/yyyy';
3502
+ this.weekNumbers = true;
3503
+ this.type = 'date';
3504
+ this.datesDisabled = undefined;
3505
+ this.value = undefined;
3506
+ this.errors = undefined;
3507
+ this.errorUpdate = 0;
3508
+ this.nativeAttributes = undefined;
3509
+ }
3510
+ /**
3511
+ * Programmatically move focus to the input. Use this method instead of
525
3512
  * `input.focus()`.
526
3513
  *
527
3514
  * @param options An optional object providing options to control aspects of
@@ -531,37 +3518,176 @@ const CatCheckbox = class {
531
3518
  this.input.focus(options);
532
3519
  }
533
3520
  /**
534
- * Programmatically remove focus from the checkbox. Use this method instead of
3521
+ * Programmatically remove focus from the input. Use this method instead of
535
3522
  * `input.blur()`.
536
3523
  */
537
3524
  async doBlur() {
538
3525
  this.input.blur();
539
3526
  }
540
3527
  /**
541
- * Programmatically simulate a click on the checkbox.
3528
+ * Programmatically simulate a click on the input.
542
3529
  */
543
3530
  async doClick() {
544
3531
  this.input.click();
545
3532
  }
3533
+ /**
3534
+ * Clear the input.
3535
+ */
3536
+ async clear() {
3537
+ this.value = '';
3538
+ }
3539
+ componentWillRender() {
3540
+ this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
3541
+ this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
3542
+ }
546
3543
  render() {
547
- return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } }, 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) })), h("span", { class: "box", "aria-hidden": "true", part: "checkbox" }, h("svg", { class: "check", viewBox: "0 0 12 10" }, h("polyline", { points: "1.5 6 4.5 9 10.5 1" })), h("svg", { class: "dash", viewBox: "0 0 12 10" }, h("polyline", { points: "1.5 5 10.5 5" }))), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }) }))));
3544
+ return (h(Host, null, 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 && (h("span", { slot: "label" }, h("slot", { name: "label" }))), this.hasSlottedHint && (h("span", { slot: "hint" }, h("slot", { name: "hint" }))))));
548
3545
  }
549
- onInput(event) {
550
- this.checked = this.input.checked;
551
- if (!this.value || typeof this.value === 'boolean') {
552
- this.value = this.checked;
3546
+ componentDidLoad() {
3547
+ var _a;
3548
+ if (this.hostElement) {
3549
+ const inputWrapper = (_a = this.catInput.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.input-wrapper');
3550
+ const inputElement = inputWrapper === null || inputWrapper === void 0 ? void 0 : inputWrapper.querySelector('input');
3551
+ if (inputElement) {
3552
+ this.input = inputElement;
3553
+ }
3554
+ else {
3555
+ loglevel.error('[CatInput] Missing input element', this);
3556
+ return;
3557
+ }
3558
+ 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: {
3559
+ toValue: (dateStr) => this.type === 'week' ? this.fromISOWeek(dateStr) : Datepicker.parseDate(dateStr, this.dateFormat),
3560
+ toDisplay: (date) => this.type === 'week' ? this.toISOWeek(date).toString() : Datepicker.formatDate(date, this.dateFormat)
3561
+ }, beforeShowDay: (date) => (this.shouldHighlightAsToday(date) ? 'today' : null), beforeShowMonth: (date) => (this.shouldHighlightAsToday(date) ? 'today' : null), beforeShowYear: (date) => (this.shouldHighlightAsToday(date) ? 'today' : null) }));
3562
+ if (this.type === 'week') {
3563
+ this.datepicker.pickerElement.classList.add('weekly');
3564
+ }
3565
+ this.input.addEventListener('show', this.handleWeekDays.bind(this));
3566
+ this.input.addEventListener('changeDate', this.handleDateChange.bind(this));
3567
+ this.input.addEventListener('changeMonth', this.handleWeekDays.bind(this));
3568
+ this.input.addEventListener('changeView', this.handleWeekDays.bind(this));
3569
+ this.input.addEventListener('keydown', this.focusAllWeekDays.bind(this));
3570
+ }
3571
+ }
3572
+ disconnectedCallback() {
3573
+ this.input.removeEventListener('show', this.handleWeekDays.bind(this));
3574
+ this.input.removeEventListener('changeDate', this.handleDateChange.bind(this));
3575
+ this.input.removeEventListener('changeMonth', this.handleWeekDays.bind(this));
3576
+ this.input.removeEventListener('changeView', this.handleWeekDays.bind(this));
3577
+ this.input.removeEventListener('keydown', this.focusAllWeekDays.bind(this));
3578
+ }
3579
+ handleDateChange(event) {
3580
+ this.selectAllWeekDays(event.detail.date);
3581
+ this.value = this.input.value;
3582
+ this.catChange.emit();
3583
+ }
3584
+ handleWeekDays(event) {
3585
+ this.selectAllWeekDays(event);
3586
+ this.focusAllWeekDays();
3587
+ }
3588
+ selectAllWeekDays(event) {
3589
+ var _a, _b;
3590
+ const date = event instanceof Date ? event : (_a = event.detail) === null || _a === void 0 ? void 0 : _a.date;
3591
+ if (this.type !== 'week') {
3592
+ return;
3593
+ }
3594
+ if ((_b = this.input) === null || _b === void 0 ? void 0 : _b.value) {
3595
+ const firstDayOfWeek = dayjs_min(date).startOf('isoWeek');
3596
+ if (!firstDayOfWeek.isSame(dayjs_min(date).startOf('day'))) {
3597
+ this.datepicker.setDate(firstDayOfWeek.toDate());
3598
+ }
3599
+ else {
3600
+ this.addClassToAllWeekDays('selected');
3601
+ }
3602
+ }
3603
+ }
3604
+ focusAllWeekDays() {
3605
+ const date = dayjs_min(this.datepicker.picker.viewDate);
3606
+ if (this.type !== 'week' || !date) {
3607
+ return;
3608
+ }
3609
+ const firstDayOfWeek = dayjs_min(date).startOf('isoWeek');
3610
+ if (!firstDayOfWeek.isSame(dayjs_min(date).startOf('day'))) {
3611
+ this.datepicker.setFocusedDate(firstDayOfWeek.toDate());
3612
+ }
3613
+ this.addClassToAllWeekDays('focused');
3614
+ }
3615
+ addClassToAllWeekDays(className) {
3616
+ let weekdaysCount = 7;
3617
+ const pickerElement = this.datepicker.pickerElement;
3618
+ let selected = pickerElement.querySelector(`.datepicker-cell:not(.month):not(.year).${className}`);
3619
+ while (weekdaysCount > 1) {
3620
+ if (selected) {
3621
+ selected = selected.nextElementSibling;
3622
+ selected === null || selected === void 0 ? void 0 : selected.classList.add(className);
3623
+ weekdaysCount--;
3624
+ }
3625
+ else {
3626
+ break;
3627
+ }
553
3628
  }
3629
+ }
3630
+ onCatChange(event) {
3631
+ this.value = this.input.value;
554
3632
  this.catChange.emit(event);
555
3633
  }
556
- onFocus(event) {
3634
+ onCatFocus(event) {
557
3635
  this.catFocus.emit(event);
558
3636
  }
559
- onBlur(event) {
3637
+ onCatBlur(event) {
560
3638
  this.catBlur.emit(event);
561
3639
  }
3640
+ shouldHighlightAsToday(date) {
3641
+ const now = new Date();
3642
+ const isSameYear = now.getFullYear() === date.getFullYear();
3643
+ const isSameMonth = now.getMonth() === date.getMonth();
3644
+ const isSameDay = now.getDate() === date.getDate();
3645
+ switch (this.type) {
3646
+ case 'date':
3647
+ return isSameYear && isSameMonth && isSameDay;
3648
+ case 'week':
3649
+ return isSameYear && this.toISOWeek(now) === this.toISOWeek(date);
3650
+ case 'month':
3651
+ return isSameYear && isSameMonth;
3652
+ case 'year':
3653
+ return isSameYear;
3654
+ default:
3655
+ return false;
3656
+ }
3657
+ }
3658
+ // ----- Date handling
3659
+ get dateFormat() {
3660
+ const date = new Date(Date.UTC(3333, 10, 22));
3661
+ const dateStr = new Intl.DateTimeFormat('en-US', {
3662
+ year: 'numeric',
3663
+ month: this.type !== 'year' ? 'numeric' : undefined,
3664
+ day: this.type === 'date' || this.type === 'week' ? 'numeric' : undefined
3665
+ }).format(date);
3666
+ return dateStr.replace('22', 'dd').replace('11', 'mm').replace('3333', 'yyyy');
3667
+ }
3668
+ fromISOWeek(week) {
3669
+ if (typeof week === 'string' || typeof week === 'number') {
3670
+ const weekNumber = parseInt(week.toString(), 10);
3671
+ return isNaN(weekNumber) ? new Date() : this.fromISOWeekNumber(weekNumber);
3672
+ }
3673
+ return week;
3674
+ }
3675
+ fromISOWeekNumber(weekNumber, year = new Date().getFullYear()) {
3676
+ const refDate = new Date(Date.UTC(year, 0, 4)); // January 4th
3677
+ const diffDays = (weekNumber - 1) * 7 - (refDate.getUTCDay() || 7) + 1;
3678
+ const date = new Date(refDate);
3679
+ date.setUTCDate(date.getUTCDate() + diffDays);
3680
+ return date;
3681
+ }
3682
+ toISOWeek(date) {
3683
+ const currentDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
3684
+ currentDate.setUTCDate(currentDate.getUTCDate() + 4 - (currentDate.getUTCDay() || 7));
3685
+ const firstDayOfYear = new Date(Date.UTC(currentDate.getUTCFullYear(), 0, 1));
3686
+ return Math.ceil(((currentDate.getTime() - firstDayOfYear.getTime()) / 86400000 + 1) / 7);
3687
+ }
562
3688
  get hostElement() { return getElement(this); }
563
3689
  };
564
- CatCheckbox.style = catCheckboxCss;
3690
+ CatDatepicker.style = catDatepickerCss;
565
3691
 
566
3692
  function getAlignment(placement) {
567
3693
  return placement.split('-')[1];
@@ -1196,18 +4322,17 @@ const size = function (options) {
1196
4322
  }
1197
4323
  const overflowAvailableHeight = height - overflow[heightSide];
1198
4324
  const overflowAvailableWidth = width - overflow[widthSide];
4325
+ const noShift = !state.middlewareData.shift;
1199
4326
  let availableHeight = overflowAvailableHeight;
1200
4327
  let availableWidth = overflowAvailableWidth;
1201
4328
  if (isXAxis) {
1202
- availableWidth = min$1(
1203
- // Maximum clipping viewport width
1204
- width - overflow.right - overflow.left, overflowAvailableWidth);
4329
+ const maximumClippingWidth = width - overflow.left - overflow.right;
4330
+ availableWidth = alignment || noShift ? min$1(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
1205
4331
  } else {
1206
- availableHeight = min$1(
1207
- // Maximum clipping viewport height
1208
- height - overflow.bottom - overflow.top, overflowAvailableHeight);
4332
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
4333
+ availableHeight = alignment || noShift ? min$1(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
1209
4334
  }
1210
- if (!state.middlewareData.shift && !alignment) {
4335
+ if (noShift && !alignment) {
1211
4336
  const xMin = max$1(overflow.left, 0);
1212
4337
  const xMax = max$1(overflow.right, 0);
1213
4338
  const yMin = max$1(overflow.top, 0);
@@ -1245,28 +4370,9 @@ function getComputedStyle$1(element) {
1245
4370
  return getWindow(element).getComputedStyle(element);
1246
4371
  }
1247
4372
 
1248
- const min = Math.min;
1249
- const max = Math.max;
1250
- const round = Math.round;
1251
-
1252
- function getCssDimensions(element) {
1253
- const css = getComputedStyle$1(element);
1254
- let width = parseFloat(css.width);
1255
- let height = parseFloat(css.height);
1256
- const offsetWidth = element.offsetWidth;
1257
- const offsetHeight = element.offsetHeight;
1258
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1259
- if (shouldFallback) {
1260
- width = offsetWidth;
1261
- height = offsetHeight;
1262
- }
1263
- return {
1264
- width,
1265
- height,
1266
- fallback: shouldFallback
1267
- };
4373
+ function isNode(value) {
4374
+ return value instanceof getWindow(value).Node;
1268
4375
  }
1269
-
1270
4376
  function getNodeName(node) {
1271
4377
  return isNode(node) ? (node.nodeName || '').toLowerCase() : '';
1272
4378
  }
@@ -1290,9 +4396,6 @@ function isHTMLElement(value) {
1290
4396
  function isElement(value) {
1291
4397
  return value instanceof getWindow(value).Element;
1292
4398
  }
1293
- function isNode(value) {
1294
- return value instanceof getWindow(value).Node;
1295
- }
1296
4399
  function isShadowRoot(node) {
1297
4400
  // Browsers without `ShadowRoot` support.
1298
4401
  if (typeof ShadowRoot === 'undefined') {
@@ -1349,6 +4452,31 @@ function isLastTraversableNode(node) {
1349
4452
  return ['html', 'body', '#document'].includes(getNodeName(node));
1350
4453
  }
1351
4454
 
4455
+ const min = Math.min;
4456
+ const max = Math.max;
4457
+ const round = Math.round;
4458
+
4459
+ function getCssDimensions(element) {
4460
+ const css = getComputedStyle$1(element);
4461
+ // In testing environments, the `width` and `height` properties are empty
4462
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
4463
+ let width = parseFloat(css.width) || 0;
4464
+ let height = parseFloat(css.height) || 0;
4465
+ const hasOffset = isHTMLElement(element);
4466
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
4467
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
4468
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
4469
+ if (shouldFallback) {
4470
+ width = offsetWidth;
4471
+ height = offsetHeight;
4472
+ }
4473
+ return {
4474
+ width,
4475
+ height,
4476
+ fallback: shouldFallback
4477
+ };
4478
+ }
4479
+
1352
4480
  function unwrapElement(element) {
1353
4481
  return !isElement(element) ? element.contextElement : element;
1354
4482
  }
@@ -1430,16 +4558,12 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
1430
4558
  currentIFrame = getWindow(currentIFrame).frameElement;
1431
4559
  }
1432
4560
  }
1433
- return {
4561
+ return rectToClientRect({
1434
4562
  width,
1435
4563
  height,
1436
- top: y,
1437
- right: x + width,
1438
- bottom: y + height,
1439
- left: x,
1440
4564
  x,
1441
4565
  y
1442
- };
4566
+ });
1443
4567
  }
1444
4568
 
1445
4569
  function getDocumentElement(node) {
@@ -1638,6 +4762,13 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
1638
4762
  }
1639
4763
  return rectToClientRect(rect);
1640
4764
  }
4765
+ function hasFixedPositionAncestor(element, stopNode) {
4766
+ const parentNode = getParentNode(element);
4767
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
4768
+ return false;
4769
+ }
4770
+ return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
4771
+ }
1641
4772
 
1642
4773
  // A "clipping ancestor" is an `overflow` element with the characteristic of
1643
4774
  // clipping (or hiding) child elements. This returns all clipping ancestors
@@ -1655,19 +4786,17 @@ function getClippingElementAncestors(element, cache) {
1655
4786
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1656
4787
  while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1657
4788
  const computedStyle = getComputedStyle$1(currentNode);
1658
- const containingBlock = isContainingBlock(currentNode);
1659
- const shouldIgnoreCurrentNode = computedStyle.position === 'fixed';
1660
- if (shouldIgnoreCurrentNode) {
4789
+ const currentNodeIsContaining = isContainingBlock(currentNode);
4790
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1661
4791
  currentContainingBlockComputedStyle = null;
4792
+ }
4793
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
4794
+ if (shouldDropCurrentNode) {
4795
+ // Drop non-containing blocks.
4796
+ result = result.filter(ancestor => ancestor !== currentNode);
1662
4797
  } else {
1663
- const shouldDropCurrentNode = elementIsFixed ? !containingBlock && !currentContainingBlockComputedStyle : !containingBlock && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position);
1664
- if (shouldDropCurrentNode) {
1665
- // Drop non-containing blocks.
1666
- result = result.filter(ancestor => ancestor !== currentNode);
1667
- } else {
1668
- // Record last containing block for next iteration.
1669
- currentContainingBlockComputedStyle = computedStyle;
1670
- }
4798
+ // Record last containing block for next iteration.
4799
+ currentContainingBlockComputedStyle = computedStyle;
1671
4800
  }
1672
4801
  currentNode = getParentNode(currentNode);
1673
4802
  }
@@ -1704,10 +4833,7 @@ function getClippingRect(_ref) {
1704
4833
  }
1705
4834
 
1706
4835
  function getDimensions(element) {
1707
- if (isHTMLElement(element)) {
1708
- return getCssDimensions(element);
1709
- }
1710
- return element.getBoundingClientRect();
4836
+ return getCssDimensions(element);
1711
4837
  }
1712
4838
 
1713
4839
  function getTrueOffsetParent(element, polyfill) {
@@ -1735,6 +4861,9 @@ function getContainingBlock(element) {
1735
4861
  // such as table ancestors and cross browser bugs.
1736
4862
  function getOffsetParent(element, polyfill) {
1737
4863
  const window = getWindow(element);
4864
+ if (!isHTMLElement(element)) {
4865
+ return window;
4866
+ }
1738
4867
  let offsetParent = getTrueOffsetParent(element, polyfill);
1739
4868
  while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
1740
4869
  offsetParent = getTrueOffsetParent(offsetParent, polyfill);
@@ -1819,27 +4948,26 @@ function autoUpdate(reference, floating, update, options) {
1819
4948
  options = {};
1820
4949
  }
1821
4950
  const {
1822
- ancestorScroll: _ancestorScroll = true,
4951
+ ancestorScroll = true,
1823
4952
  ancestorResize = true,
1824
4953
  elementResize = true,
1825
4954
  animationFrame = false
1826
4955
  } = options;
1827
- const ancestorScroll = _ancestorScroll && !animationFrame;
1828
4956
  const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : reference.contextElement ? getOverflowAncestors(reference.contextElement) : []), ...getOverflowAncestors(floating)] : [];
1829
4957
  ancestors.forEach(ancestor => {
1830
- ancestorScroll && ancestor.addEventListener('scroll', update, {
1831
- passive: true
1832
- });
4958
+ // ignores Window, checks for [object VisualViewport]
4959
+ const isVisualViewport = !isElement(ancestor) && ancestor.toString().includes('V');
4960
+ if (ancestorScroll && (animationFrame ? isVisualViewport : true)) {
4961
+ ancestor.addEventListener('scroll', update, {
4962
+ passive: true
4963
+ });
4964
+ }
1833
4965
  ancestorResize && ancestor.addEventListener('resize', update);
1834
4966
  });
1835
4967
  let observer = null;
1836
4968
  if (elementResize) {
1837
- let initialUpdate = true;
1838
4969
  observer = new ResizeObserver(() => {
1839
- if (!initialUpdate) {
1840
- update();
1841
- }
1842
- initialUpdate = false;
4970
+ update();
1843
4971
  });
1844
4972
  isElement(reference) && !animationFrame && observer.observe(reference);
1845
4973
  if (!isElement(reference) && reference.contextElement && !animationFrame) {
@@ -1905,17 +5033,66 @@ const computePosition = (reference, floating, options) => {
1905
5033
  const timeTransitionS = 125;
1906
5034
 
1907
5035
  /*!
1908
- * tabbable 6.0.1
5036
+ * tabbable 6.1.2
1909
5037
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
1910
5038
  */
1911
- 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'];
5039
+ // NOTE: separate `:not()` selectors has broader browser support than the newer
5040
+ // `:not([inert], [inert] *)` (Feb 2023)
5041
+ // CAREFUL: JSDom does not support `:not([inert] *)` as a selector; using it causes
5042
+ // the entire query to fail, resulting in no nodes found, which will break a lot
5043
+ // of things... so we have to rely on JS to identify nodes inside an inert container
5044
+ 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])'];
1912
5045
  var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
1913
5046
  var NoElement = typeof Element === 'undefined';
1914
5047
  var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1915
5048
  var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
1916
- return element.getRootNode();
5049
+ var _element$getRootNode;
5050
+ return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
1917
5051
  } : function (element) {
1918
- return element.ownerDocument;
5052
+ return element === null || element === void 0 ? void 0 : element.ownerDocument;
5053
+ };
5054
+
5055
+ /**
5056
+ * Determines if a node is inert or in an inert ancestor.
5057
+ * @param {Element} [node]
5058
+ * @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to
5059
+ * see if any of them are inert. If false, only `node` itself is considered.
5060
+ * @returns {boolean} True if inert itself or by way of being in an inert ancestor.
5061
+ * False if `node` is falsy.
5062
+ */
5063
+ var isInert = function isInert(node, lookUp) {
5064
+ var _node$getAttribute;
5065
+ if (lookUp === void 0) {
5066
+ lookUp = true;
5067
+ }
5068
+ // CAREFUL: JSDom does not support inert at all, so we can't use the `HTMLElement.inert`
5069
+ // JS API property; we have to check the attribute, which can either be empty or 'true';
5070
+ // if it's `null` (not specified) or 'false', it's an active element
5071
+ 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');
5072
+ var inert = inertAtt === '' || inertAtt === 'true';
5073
+
5074
+ // NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
5075
+ // if it weren't for `matches()` not being a function on shadow roots; the following
5076
+ // code works for any kind of node
5077
+ // CAREFUL: JSDom does not appear to support certain selectors like `:not([inert] *)`
5078
+ // so it likely would not support `:is([inert] *)` either...
5079
+ var result = inert || lookUp && node && isInert(node.parentNode); // recursive
5080
+
5081
+ return result;
5082
+ };
5083
+
5084
+ /**
5085
+ * Determines if a node's content is editable.
5086
+ * @param {Element} [node]
5087
+ * @returns True if it's content-editable; false if it's not or `node` is falsy.
5088
+ */
5089
+ var isContentEditable = function isContentEditable(node) {
5090
+ var _node$getAttribute2;
5091
+ // CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have
5092
+ // to use the attribute directly to check for this, which can either be empty or 'true';
5093
+ // if it's `null` (not specified) or 'false', it's a non-editable element
5094
+ 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');
5095
+ return attValue === '' || attValue === 'true';
1919
5096
  };
1920
5097
 
1921
5098
  /**
@@ -1925,6 +5102,11 @@ var getRootNode = !NoElement && Element.prototype.getRootNode ? function (elemen
1925
5102
  * @returns {Element[]}
1926
5103
  */
1927
5104
  var getCandidates = function getCandidates(el, includeContainer, filter) {
5105
+ // even if `includeContainer=false`, we still have to check it for inertness because
5106
+ // if it's inert, all its children are inert
5107
+ if (isInert(el)) {
5108
+ return [];
5109
+ }
1928
5110
  var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
1929
5111
  if (includeContainer && matches.call(el, candidateSelector)) {
1930
5112
  candidates.unshift(el);
@@ -1972,6 +5154,11 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
1972
5154
  var elementsToCheck = Array.from(elements);
1973
5155
  while (elementsToCheck.length) {
1974
5156
  var element = elementsToCheck.shift();
5157
+ if (isInert(element, false)) {
5158
+ // no need to look up since we're drilling down
5159
+ // anything inside this container will also be inert
5160
+ continue;
5161
+ }
1975
5162
  if (element.tagName === 'SLOT') {
1976
5163
  // add shadow dom slot scope (slot itself cannot be focusable)
1977
5164
  var assigned = element.assignedElements();
@@ -1996,7 +5183,11 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
1996
5183
  var shadowRoot = element.shadowRoot ||
1997
5184
  // check for an undisclosed shadow
1998
5185
  typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);
1999
- var validShadowRoot = !options.shadowRootFilter || options.shadowRootFilter(element);
5186
+
5187
+ // no inert look up because we're already drilling down and checking for inertness
5188
+ // on the way down, so all containers to this root node should have already been
5189
+ // vetted as non-inert
5190
+ var validShadowRoot = !isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
2000
5191
  if (shadowRoot && validShadowRoot) {
2001
5192
  // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
2002
5193
  // shadow exists, so look at light dom children as fallback BUT create a scope for any
@@ -2035,7 +5226,7 @@ var getTabindex = function getTabindex(node, isScope) {
2035
5226
  // isScope is positive for custom element with shadow root or slot that by default
2036
5227
  // have tabIndex -1, but need to be sorted by document order in order for their
2037
5228
  // content to be inserted in the correct position
2038
- if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node.isContentEditable) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
5229
+ if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
2039
5230
  return 0;
2040
5231
  }
2041
5232
  }
@@ -2095,7 +5286,7 @@ var isNonTabbableRadio = function isNonTabbableRadio(node) {
2095
5286
 
2096
5287
  // determines if a node is ultimately attached to the window's document
2097
5288
  var isNodeAttached = function isNodeAttached(node) {
2098
- var _nodeRootHost;
5289
+ var _nodeRoot;
2099
5290
  // The root node is the shadow root if the node is in a shadow DOM; some document otherwise
2100
5291
  // (but NOT _the_ document; see second 'If' comment below for more).
2101
5292
  // If rootNode is shadow root, it'll have a host, which is the element to which the shadow
@@ -2115,15 +5306,28 @@ var isNodeAttached = function isNodeAttached(node) {
2115
5306
  // to ignore the rootNode at this point, and use `node.ownerDocument`. Otherwise,
2116
5307
  // using `rootNode.contains(node)` will _always_ be true we'll get false-positives when
2117
5308
  // node is actually detached.
2118
- var nodeRootHost = getRootNode(node).host;
2119
- var attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && _nodeRootHost.ownerDocument.contains(nodeRootHost) || node.ownerDocument.contains(node));
2120
- while (!attached && nodeRootHost) {
2121
- var _nodeRootHost2;
2122
- // since it's not attached and we have a root host, the node MUST be in a nested shadow DOM,
2123
- // which means we need to get the host's host and check if that parent host is contained
2124
- // in (i.e. attached to) the document
2125
- nodeRootHost = getRootNode(nodeRootHost).host;
2126
- attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && _nodeRootHost2.ownerDocument.contains(nodeRootHost));
5309
+ // NOTE: If `nodeRootHost` or `node` happens to be the `document` itself (which is possible
5310
+ // if a tabbable/focusable node was quickly added to the DOM, focused, and then removed
5311
+ // from the DOM as in https://github.com/focus-trap/focus-trap-react/issues/905), then
5312
+ // `ownerDocument` will be `null`, hence the optional chaining on it.
5313
+ var nodeRoot = node && getRootNode(node);
5314
+ var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
5315
+
5316
+ // in some cases, a detached node will return itself as the root instead of a document or
5317
+ // shadow root object, in which case, we shouldn't try to look further up the host chain
5318
+ var attached = false;
5319
+ if (nodeRoot && nodeRoot !== node) {
5320
+ var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
5321
+ 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));
5322
+ while (!attached && nodeRootHost) {
5323
+ var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
5324
+ // since it's not attached and we have a root host, the node MUST be in a nested shadow DOM,
5325
+ // which means we need to get the host's host and check if that parent host is contained
5326
+ // in (i.e. attached to) the document
5327
+ nodeRoot = getRootNode(nodeRootHost);
5328
+ nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
5329
+ attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
5330
+ }
2127
5331
  }
2128
5332
  return attached;
2129
5333
  };
@@ -2258,7 +5462,11 @@ var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
2258
5462
  return false;
2259
5463
  };
2260
5464
  var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
2261
- if (node.disabled || isHiddenInput(node) || isHidden(node, options) ||
5465
+ if (node.disabled ||
5466
+ // we must do an inert look up to filter out any elements inside an inert ancestor
5467
+ // because we're limited in the type of selectors we can use in JSDom (see related
5468
+ // note related to `candidateSelectors`)
5469
+ isInert(node) || isHiddenInput(node) || isHidden(node, options) ||
2262
5470
  // For a details element with a summary, the summary element gets the focus
2263
5471
  isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
2264
5472
  return false;
@@ -2362,7 +5570,7 @@ var isFocusable = function isFocusable(node, options) {
2362
5570
  };
2363
5571
 
2364
5572
  /*!
2365
- * focus-trap 7.2.0
5573
+ * focus-trap 7.4.3
2366
5574
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
2367
5575
  */
2368
5576
 
@@ -2571,23 +5779,24 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2571
5779
  /**
2572
5780
  * Finds the index of the container that contains the element.
2573
5781
  * @param {HTMLElement} element
5782
+ * @param {Event} [event]
2574
5783
  * @returns {number} Index of the container in either `state.containers` or
2575
5784
  * `state.containerGroups` (the order/length of these lists are the same); -1
2576
5785
  * if the element isn't found.
2577
5786
  */
2578
- var findContainerIndex = function findContainerIndex(element) {
5787
+ var findContainerIndex = function findContainerIndex(element, event) {
5788
+ var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === 'function' ? event.composedPath() : undefined;
2579
5789
  // NOTE: search `containerGroups` because it's possible a group contains no tabbable
2580
5790
  // nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
2581
5791
  // and we still need to find the element in there
2582
5792
  return state.containerGroups.findIndex(function (_ref) {
2583
5793
  var container = _ref.container,
2584
5794
  tabbableNodes = _ref.tabbableNodes;
2585
- return container.contains(element) ||
2586
- // fall back to explicit tabbable search which will take into consideration any
5795
+ return container.contains(element) || ( // fall back to explicit tabbable search which will take into consideration any
2587
5796
  // web components if the `tabbableOptions.getShadowRoot` option was used for
2588
5797
  // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
2589
5798
  // look inside web components even if open)
2590
- tabbableNodes.find(function (node) {
5799
+ composedPath === null || composedPath === void 0 ? void 0 : composedPath.includes(container)) || tabbableNodes.find(function (node) {
2591
5800
  return node === element;
2592
5801
  });
2593
5802
  });
@@ -2643,8 +5852,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2643
5852
  if (node === false) {
2644
5853
  return false;
2645
5854
  }
2646
- if (node === undefined) {
2647
- // option not specified: use fallback options
5855
+ if (node === undefined || !isFocusable(node, config.tabbableOptions)) {
5856
+ // option not specified nor focusable: use fallback options
2648
5857
  if (findContainerIndex(doc.activeElement) >= 0) {
2649
5858
  node = doc.activeElement;
2650
5859
  } else {
@@ -2748,25 +5957,20 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2748
5957
  // so that it precedes the focus event.
2749
5958
  var checkPointerDown = function checkPointerDown(e) {
2750
5959
  var target = getActualTarget(e);
2751
- if (findContainerIndex(target) >= 0) {
5960
+ if (findContainerIndex(target, e) >= 0) {
2752
5961
  // allow the click since it ocurred inside the trap
2753
5962
  return;
2754
5963
  }
2755
5964
  if (valueOrHandler(config.clickOutsideDeactivates, e)) {
2756
5965
  // immediately deactivate the trap
2757
5966
  trap.deactivate({
2758
- // if, on deactivation, we should return focus to the node originally-focused
2759
- // when the trap was activated (or the configured `setReturnFocus` node),
2760
- // then assume it's also OK to return focus to the outside node that was
2761
- // just clicked, causing deactivation, as long as that node is focusable;
2762
- // if it isn't focusable, then return focus to the original node focused
2763
- // on activation (or the configured `setReturnFocus` node)
2764
5967
  // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
2765
5968
  // which will result in the outside click setting focus to the node
2766
- // that was clicked, whether it's focusable or not; by setting
5969
+ // that was clicked (and if not focusable, to "nothing"); by setting
2767
5970
  // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
2768
- // on activation (or the configured `setReturnFocus` node)
2769
- returnFocus: config.returnFocusOnDeactivate && !isFocusable(target, config.tabbableOptions)
5971
+ // on activation (or the configured `setReturnFocus` node), whether the
5972
+ // outside click was on a focusable node or not
5973
+ returnFocus: config.returnFocusOnDeactivate
2770
5974
  });
2771
5975
  return;
2772
5976
  }
@@ -2786,7 +5990,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2786
5990
  // In case focus escapes the trap for some strange reason, pull it back in.
2787
5991
  var checkFocusIn = function checkFocusIn(e) {
2788
5992
  var target = getActualTarget(e);
2789
- var targetContained = findContainerIndex(target) >= 0;
5993
+ var targetContained = findContainerIndex(target, e) >= 0;
2790
5994
 
2791
5995
  // In Firefox when you Tab out of an iframe the Document is briefly focused.
2792
5996
  if (targetContained || target instanceof Document) {
@@ -2813,7 +6017,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2813
6017
  // make sure the target is actually contained in a group
2814
6018
  // NOTE: the target may also be the container itself if it's focusable
2815
6019
  // with tabIndex='-1' and was given initial focus
2816
- var containerIndex = findContainerIndex(target);
6020
+ var containerIndex = findContainerIndex(target, event);
2817
6021
  var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;
2818
6022
  if (containerIndex < 0) {
2819
6023
  // target not found in any group: quite possible focus has escaped the trap,
@@ -2914,7 +6118,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2914
6118
  };
2915
6119
  var checkClick = function checkClick(e) {
2916
6120
  var target = getActualTarget(e);
2917
- if (findContainerIndex(target) >= 0) {
6121
+ if (findContainerIndex(target, e) >= 0) {
2918
6122
  return;
2919
6123
  }
2920
6124
  if (valueOrHandler(config.clickOutsideDeactivates, e)) {
@@ -2975,6 +6179,43 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2975
6179
  return trap;
2976
6180
  };
2977
6181
 
6182
+ //
6183
+ // MUTATION OBSERVER
6184
+ //
6185
+
6186
+ var checkDomRemoval = function checkDomRemoval(mutations) {
6187
+ var isFocusedNodeRemoved = mutations.some(function (mutation) {
6188
+ var removedNodes = Array.from(mutation.removedNodes);
6189
+ return removedNodes.some(function (node) {
6190
+ return node === state.mostRecentlyFocusedNode;
6191
+ });
6192
+ });
6193
+
6194
+ // If the currently focused is removed then browsers will move focus to the
6195
+ // <body> element. If this happens, try to move focus back into the trap.
6196
+ if (isFocusedNodeRemoved) {
6197
+ tryFocus(getInitialFocusNode());
6198
+ }
6199
+ };
6200
+
6201
+ // Use MutationObserver - if supported - to detect if focused node is removed
6202
+ // from the DOM.
6203
+ var mutationObserver = typeof window !== 'undefined' && 'MutationObserver' in window ? new MutationObserver(checkDomRemoval) : undefined;
6204
+ var updateObservedNodes = function updateObservedNodes() {
6205
+ if (!mutationObserver) {
6206
+ return;
6207
+ }
6208
+ mutationObserver.disconnect();
6209
+ if (state.active && !state.paused) {
6210
+ state.containers.map(function (container) {
6211
+ mutationObserver.observe(container, {
6212
+ subtree: true,
6213
+ childList: true
6214
+ });
6215
+ });
6216
+ }
6217
+ };
6218
+
2978
6219
  //
2979
6220
  // TRAP DEFINITION
2980
6221
  //
@@ -2999,17 +6240,14 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2999
6240
  state.active = true;
3000
6241
  state.paused = false;
3001
6242
  state.nodeFocusedBeforeActivation = doc.activeElement;
3002
- if (onActivate) {
3003
- onActivate();
3004
- }
6243
+ onActivate === null || onActivate === void 0 ? void 0 : onActivate();
3005
6244
  var finishActivation = function finishActivation() {
3006
6245
  if (checkCanFocusTrap) {
3007
6246
  updateTabbableNodes();
3008
6247
  }
3009
6248
  addListeners();
3010
- if (onPostActivate) {
3011
- onPostActivate();
3012
- }
6249
+ updateObservedNodes();
6250
+ onPostActivate === null || onPostActivate === void 0 ? void 0 : onPostActivate();
3013
6251
  };
3014
6252
  if (checkCanFocusTrap) {
3015
6253
  checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
@@ -3032,22 +6270,19 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
3032
6270
  removeListeners();
3033
6271
  state.active = false;
3034
6272
  state.paused = false;
6273
+ updateObservedNodes();
3035
6274
  activeFocusTraps.deactivateTrap(trapStack, trap);
3036
6275
  var onDeactivate = getOption(options, 'onDeactivate');
3037
6276
  var onPostDeactivate = getOption(options, 'onPostDeactivate');
3038
6277
  var checkCanReturnFocus = getOption(options, 'checkCanReturnFocus');
3039
6278
  var returnFocus = getOption(options, 'returnFocus', 'returnFocusOnDeactivate');
3040
- if (onDeactivate) {
3041
- onDeactivate();
3042
- }
6279
+ onDeactivate === null || onDeactivate === void 0 ? void 0 : onDeactivate();
3043
6280
  var finishDeactivation = function finishDeactivation() {
3044
6281
  delay$1(function () {
3045
6282
  if (returnFocus) {
3046
6283
  tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
3047
6284
  }
3048
- if (onPostDeactivate) {
3049
- onPostDeactivate();
3050
- }
6285
+ onPostDeactivate === null || onPostDeactivate === void 0 ? void 0 : onPostDeactivate();
3051
6286
  });
3052
6287
  };
3053
6288
  if (returnFocus && checkCanReturnFocus) {
@@ -3057,21 +6292,31 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
3057
6292
  finishDeactivation();
3058
6293
  return this;
3059
6294
  },
3060
- pause: function pause() {
6295
+ pause: function pause(pauseOptions) {
3061
6296
  if (state.paused || !state.active) {
3062
6297
  return this;
3063
6298
  }
6299
+ var onPause = getOption(pauseOptions, 'onPause');
6300
+ var onPostPause = getOption(pauseOptions, 'onPostPause');
3064
6301
  state.paused = true;
6302
+ onPause === null || onPause === void 0 ? void 0 : onPause();
3065
6303
  removeListeners();
6304
+ updateObservedNodes();
6305
+ onPostPause === null || onPostPause === void 0 ? void 0 : onPostPause();
3066
6306
  return this;
3067
6307
  },
3068
- unpause: function unpause() {
6308
+ unpause: function unpause(unpauseOptions) {
3069
6309
  if (!state.paused || !state.active) {
3070
6310
  return this;
3071
6311
  }
6312
+ var onUnpause = getOption(unpauseOptions, 'onUnpause');
6313
+ var onPostUnpause = getOption(unpauseOptions, 'onPostUnpause');
3072
6314
  state.paused = false;
6315
+ onUnpause === null || onUnpause === void 0 ? void 0 : onUnpause();
3073
6316
  updateTabbableNodes();
3074
6317
  addListeners();
6318
+ updateObservedNodes();
6319
+ onPostUnpause === null || onPostUnpause === void 0 ? void 0 : onPostUnpause();
3075
6320
  return this;
3076
6321
  },
3077
6322
  updateContainerElements: function updateContainerElements(containerElements) {
@@ -3082,6 +6327,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
3082
6327
  if (state.active) {
3083
6328
  updateTabbableNodes();
3084
6329
  }
6330
+ updateObservedNodes();
3085
6331
  return this;
3086
6332
  }
3087
6333
  };
@@ -3095,7 +6341,7 @@ const firstTabbable = (container) => {
3095
6341
  return (container ? tabbable(container, { includeContainer: true, getShadowRoot: true }) : []).shift();
3096
6342
  };
3097
6343
 
3098
- 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}";
6344
+ 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}";
3099
6345
 
3100
6346
  let nextUniqueId$7 = 0;
3101
6347
  const CatDropdown = class {
@@ -3117,8 +6363,9 @@ const CatDropdown = class {
3117
6363
  this.initTrigger();
3118
6364
  this.toggle();
3119
6365
  }
6366
+ const button = event.target;
3120
6367
  // hide dropdown on button click
3121
- if (!this.noAutoClose && event.composedPath().includes(this.content)) {
6368
+ if (!this.noAutoClose && event.composedPath().includes(this.content) && button.slot !== 'trigger') {
3122
6369
  this.close();
3123
6370
  }
3124
6371
  }
@@ -3151,9 +6398,15 @@ const CatDropdown = class {
3151
6398
  getShadowRoot: true
3152
6399
  },
3153
6400
  allowOutsideClick: true,
3154
- clickOutsideDeactivates: event => !this.noAutoClose &&
3155
- !event.composedPath().includes(this.content) &&
3156
- (!this.trigger || !event.composedPath().includes(this.trigger)),
6401
+ clickOutsideDeactivates: event => {
6402
+ const shouldClose = !this.noAutoClose &&
6403
+ !event.composedPath().includes(this.content) &&
6404
+ (!this.trigger || !event.composedPath().includes(this.trigger));
6405
+ if (shouldClose) {
6406
+ this.close();
6407
+ }
6408
+ return shouldClose;
6409
+ },
3157
6410
  onPostDeactivate: () => this.close()
3158
6411
  });
3159
6412
  this.trap.activate();
@@ -3163,7 +6416,7 @@ const CatDropdown = class {
3163
6416
  * Closes the dropdown.
3164
6417
  */
3165
6418
  async close() {
3166
- if (this.isOpen === null) {
6419
+ if (this.isOpen === null || !this.isOpen) {
3167
6420
  return; // busy
3168
6421
  }
3169
6422
  this.isOpen = null;
@@ -3284,7 +6537,7 @@ const CatFormGroup = class {
3284
6537
  return (h(Host, { style: { '--label-size': this.labelSize } }, h("slot", { onSlotchange: this.onSlotChange.bind(this) })));
3285
6538
  }
3286
6539
  onSlotChange() {
3287
- this.formElements = Array.from(this.hostElement.querySelectorAll('cat-textarea, cat-input, cat-select, cat-label'));
6540
+ this.formElements = Array.from(this.hostElement.querySelectorAll('cat-textarea, cat-input, cat-select, cat-label, cat-datepicker'));
3288
6541
  this.onRequiredMarker(this.requiredMarker);
3289
6542
  this.onHorizontal(this.horizontal);
3290
6543
  }
@@ -3332,7 +6585,7 @@ function isNumberValue(value) {
3332
6585
  return !isNaN(parseFloat(value)) && !isNaN(Number(value));
3333
6586
  }
3334
6587
 
3335
- 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}";
6588
+ 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}";
3336
6589
 
3337
6590
  let nextUniqueId$6 = 0;
3338
6591
  const CatInput = class {
@@ -3441,7 +6694,7 @@ const CatInput = class {
3441
6694
  'input-invalid': this.invalid
3442
6695
  }, onClick: () => this.input.focus() }, this.textPrefix && (h("span", { class: "text-prefix", part: "prefix" }, this.textPrefix)), this.icon && !this.iconRight && h("cat-icon", { icon: this.icon, class: "icon-prefix", size: "l" }), h("div", { class: "input-inner-wrapper" }, h("input", Object.assign({}, this.nativeAttributes, { ref: el => (this.input = el), id: this.id, class: {
3443
6696
  'has-clearable': this.clearable && !this.disabled
3444
- }, 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 && (h("cat-button", { class: "clearable", icon: "cross-circle-outlined", "icon-only": "true", size: "s", variant: "text", "a11y-label": catI18nRegistry.t('input.clear'), onClick: this.clear.bind(this) }))), !this.invalid && this.icon && this.iconRight && (h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" })), this.invalid && (h("cat-icon", { icon: "alert-circle-outlined", class: "icon-suffix cat-text-danger", size: "l" })), this.textSuffix && (h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))), (this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap })))));
6697
+ }, 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 && (h("cat-button", { class: "clearable", icon: "$cat:input-close", "icon-only": "true", size: "s", variant: "text", "a11y-label": catI18nRegistry.t('input.clear'), onClick: this.clear.bind(this) }))), !this.invalid && this.icon && this.iconRight && (h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" })), this.invalid && h("cat-icon", { icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" }), this.textSuffix && (h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))), (this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap })))));
3445
6698
  }
3446
6699
  get invalid() {
3447
6700
  return !!this.errorMap;
@@ -3534,6 +6787,7 @@ const catPaginationCss = ":host{display:inline-block}:host([hidden]){display:non
3534
6787
  const CatPagination = class {
3535
6788
  constructor(hostRef) {
3536
6789
  registerInstance(this, hostRef);
6790
+ this.catChange = createEvent(this, "catChange", 7);
3537
6791
  this.page = 0;
3538
6792
  this.pageCount = 1;
3539
6793
  this.activePadding = 1;
@@ -3542,13 +6796,13 @@ const CatPagination = class {
3542
6796
  this.variant = 'text';
3543
6797
  this.round = false;
3544
6798
  this.compact = false;
3545
- this.iconPrev = 'chevron-left-outlined';
3546
- this.iconNext = 'chevron-right-outlined';
6799
+ this.iconPrev = '$cat:pagination-left';
6800
+ this.iconNext = '$cat:pagination-right';
3547
6801
  }
3548
6802
  render() {
3549
6803
  return (h("nav", { role: "navigation" }, h("ol", { class: {
3550
6804
  [`cat-pagination-${this.size}`]: Boolean(this.size)
3551
- } }, h("li", null, h("cat-button", { variant: this.variant, size: this.size, round: this.round, disabled: this.isFirst, a11yLabel: catI18nRegistry.t('pagination.prev'), icon: this.iconPrev, iconOnly: true, onClick: () => (this.page = this.page - 1) })), this.content, h("li", null, h("cat-button", { variant: this.variant, size: this.size, round: this.round, disabled: this.isLast, a11yLabel: catI18nRegistry.t('pagination.next'), icon: this.iconNext, iconOnly: true, onClick: () => (this.page = this.page + 1) })))));
6805
+ } }, h("li", null, h("cat-button", { variant: this.variant, size: this.size, round: this.round, disabled: this.isFirst, a11yLabel: catI18nRegistry.t('pagination.prev'), icon: this.iconPrev, iconOnly: true, onClick: () => this.setPage(this.page - 1) })), this.content, h("li", null, h("cat-button", { variant: this.variant, size: this.size, round: this.round, disabled: this.isLast, a11yLabel: catI18nRegistry.t('pagination.next'), icon: this.iconNext, iconOnly: true, onClick: () => this.setPage(this.page + 1) })))));
3552
6806
  }
3553
6807
  get isFirst() {
3554
6808
  return this.page === 0;
@@ -3556,6 +6810,10 @@ const CatPagination = class {
3556
6810
  get isLast() {
3557
6811
  return this.page === this.pageCount - 1;
3558
6812
  }
6813
+ setPage(value) {
6814
+ this.page = value;
6815
+ this.catChange.emit(this.page);
6816
+ }
3559
6817
  get pages() {
3560
6818
  if (!this.sidePadding && !this.activePadding) {
3561
6819
  return [this.page];
@@ -3590,13 +6848,13 @@ const CatPagination = class {
3590
6848
  }
3591
6849
  return this.pages.map((page, i) => [
3592
6850
  i > 0 && this.pages[i - 1] !== page - 1 ? h("li", { class: "dots" }, "\u2026") : null,
3593
- h("li", null, h("cat-button", { variant: this.variant, size: this.size, round: this.round, color: this.page === page ? 'primary' : undefined, active: this.page === page, a11yLabel: catI18nRegistry.t('pagination.page', { page: page + 1 }), a11yCurrent: this.page === page ? 'step' : undefined, onClick: () => (this.page = page) }, page + 1))
6851
+ h("li", null, h("cat-button", { variant: this.variant, size: this.size, round: this.round, color: this.page === page ? 'primary' : undefined, active: this.page === page, a11yLabel: catI18nRegistry.t('pagination.page', { page: page + 1 }), a11yCurrent: this.page === page ? 'step' : undefined, onClick: () => this.setPage(page) }, page + 1))
3594
6852
  ]);
3595
6853
  }
3596
6854
  };
3597
6855
  CatPagination.style = catPaginationCss;
3598
6856
 
3599
- 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))}";
6857
+ 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))}";
3600
6858
 
3601
6859
  let nextUniqueId$5 = 0;
3602
6860
  const CatRadio = class {
@@ -3654,7 +6912,7 @@ const CatRadio = class {
3654
6912
  this.input.click();
3655
6913
  }
3656
6914
  render() {
3657
- return (h(Host, null, 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' }, h("span", { class: "radio" }, 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) })), h("span", { class: "circle" })), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }) }))));
6915
+ return (h(Host, null, 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' }, h("span", { class: "radio" }, 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) })), h("span", { class: "circle" })), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (h("div", { class: { 'hint-wrapper': true, 'label-left': this.labelLeft } }, h("div", { class: "circle-placeholder" }), h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }) })))));
3658
6916
  }
3659
6917
  onChange(event) {
3660
6918
  this.checked = true;
@@ -4080,7 +7338,7 @@ class SafeSubscriber extends Subscriber {
4080
7338
  let partialObserver;
4081
7339
  if (isFunction(observerOrNext) || !observerOrNext) {
4082
7340
  partialObserver = {
4083
- next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined,
7341
+ next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
4084
7342
  error: error !== null && error !== void 0 ? error : undefined,
4085
7343
  complete: complete !== null && complete !== void 0 ? complete : undefined,
4086
7344
  };
@@ -4474,6 +7732,7 @@ class AsyncAction extends Action {
4474
7732
  this.pending = false;
4475
7733
  }
4476
7734
  schedule(state, delay = 0) {
7735
+ var _a;
4477
7736
  if (this.closed) {
4478
7737
  return this;
4479
7738
  }
@@ -4485,7 +7744,7 @@ class AsyncAction extends Action {
4485
7744
  }
4486
7745
  this.pending = true;
4487
7746
  this.delay = delay;
4488
- this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
7747
+ this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
4489
7748
  return this;
4490
7749
  }
4491
7750
  requestAsyncId(scheduler, _id, delay = 0) {
@@ -4495,7 +7754,9 @@ class AsyncAction extends Action {
4495
7754
  if (delay != null && this.delay === delay && this.pending === false) {
4496
7755
  return id;
4497
7756
  }
4498
- intervalProvider.clearInterval(id);
7757
+ if (id != null) {
7758
+ intervalProvider.clearInterval(id);
7759
+ }
4499
7760
  return undefined;
4500
7761
  }
4501
7762
  execute(state, delay) {
@@ -4558,7 +7819,6 @@ class AsyncScheduler extends Scheduler {
4558
7819
  super(SchedulerAction, now);
4559
7820
  this.actions = [];
4560
7821
  this._active = false;
4561
- this._scheduled = undefined;
4562
7822
  }
4563
7823
  flush(action) {
4564
7824
  const { actions } = this;
@@ -5310,7 +8570,7 @@ function delayWhen(delayDurationSelector, subscriptionDelay) {
5310
8570
  if (subscriptionDelay) {
5311
8571
  return (source) => concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
5312
8572
  }
5313
- return mergeMap((value, index) => delayDurationSelector(value, index).pipe(take(1), mapTo(value)));
8573
+ return mergeMap((value, index) => innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)));
5314
8574
  }
5315
8575
 
5316
8576
  function delay(due, scheduler = asyncScheduler) {
@@ -5441,7 +8701,7 @@ function tap(observerOrNext, error, complete) {
5441
8701
  identity;
5442
8702
  }
5443
8703
 
5444
- 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}";
8704
+ 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}";
5445
8705
 
5446
8706
  const CatScrollable = class {
5447
8707
  constructor(hostRef) {
@@ -5630,7 +8890,7 @@ var autosizeInput = function (element, options) {
5630
8890
  }
5631
8891
  };
5632
8892
 
5633
- 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))}";
8893
+ 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))}";
5634
8894
 
5635
8895
  const INIT_STATE = {
5636
8896
  term: '',
@@ -5639,6 +8899,7 @@ const INIT_STATE = {
5639
8899
  isResolving: false,
5640
8900
  options: [],
5641
8901
  selection: [],
8902
+ tempSelection: [],
5642
8903
  activeOptionIndex: -1,
5643
8904
  activeSelectionIndex: -1
5644
8905
  };
@@ -5764,6 +9025,7 @@ const CatSelect = class {
5764
9025
  }
5765
9026
  }
5766
9027
  onBlur(event) {
9028
+ var _a;
5767
9029
  if (!this.multiple && this.state.activeOptionIndex >= 0) {
5768
9030
  if (this.tags && this.state.options[this.state.activeOptionIndex].item.id === `select-${this.id}-option-tag`) {
5769
9031
  this.createTag(this.state.term);
@@ -5773,7 +9035,18 @@ const CatSelect = class {
5773
9035
  }
5774
9036
  }
5775
9037
  this.hide();
5776
- this.patchState({ activeSelectionIndex: -1 });
9038
+ if (!this.multiple && ((_a = this.state.tempSelection) === null || _a === void 0 ? void 0 : _a.length)) {
9039
+ this.patchState({
9040
+ activeSelectionIndex: -1,
9041
+ selection: this.state.tempSelection,
9042
+ tempSelection: [],
9043
+ options: [],
9044
+ term: this.state.tempSelection[0].render.label
9045
+ });
9046
+ }
9047
+ else {
9048
+ this.patchState({ activeSelectionIndex: -1 });
9049
+ }
5777
9050
  this.catBlur.emit(event);
5778
9051
  if (coerceBoolean(this.errorUpdate)) {
5779
9052
  this.showErrors();
@@ -5822,7 +9095,10 @@ const CatSelect = class {
5822
9095
  else if (this.state.selection.length) {
5823
9096
  const selectionClone = [...this.state.selection];
5824
9097
  selectionClone.pop();
5825
- this.patchState({ selection: selectionClone });
9098
+ this.patchState({
9099
+ selection: selectionClone,
9100
+ tempSelection: this.state.term ? [...this.state.selection] : []
9101
+ });
5826
9102
  }
5827
9103
  }
5828
9104
  }
@@ -5909,11 +9185,11 @@ const CatSelect = class {
5909
9185
  pill: true,
5910
9186
  'select-no-open': true,
5911
9187
  'select-option-active': this.state.activeSelectionIndex === i
5912
- }, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (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, h("span", null, item.render.label), !this.disabled && (h("cat-button", { size: "xs", variant: "text", icon: "16-cross", iconOnly: true, a11yLabel: catI18nRegistry.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1 }))));
5913
- }))) : this.state.selection.length && this.state.selection[0].render.avatar ? (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, 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 && h("cat-spinner", null), this.invalid && (h("cat-icon", { icon: "alert-circle-outlined", class: "icon-suffix cat-text-danger", size: "l" })), (this.state.selection.length || this.state.term.length) &&
9188
+ }, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (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, h("span", null, item.render.label), !this.disabled && (h("cat-button", { size: "xs", variant: "text", icon: "$cat:select-clear", iconOnly: true, a11yLabel: catI18nRegistry.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1 }))));
9189
+ }))) : this.state.selection.length && this.state.selection[0].render.avatar ? (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, 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 && h("cat-spinner", null), this.invalid && (h("cat-icon", { icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), (this.state.selection.length || this.state.term.length) &&
5914
9190
  !this.disabled &&
5915
9191
  !this.state.isResolving &&
5916
- this.clearable ? (h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "cross-circle-outlined", variant: "text", size: "s", a11yLabel: catI18nRegistry.t('input.clear'), onClick: () => this.clear() })) : null, !this.state.isResolving && (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 ? catI18nRegistry.t('select.close') : 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) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap })))), h("div", { class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (h("cat-scrollable", { class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, 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
9192
+ this.clearable ? (h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "$cat:input-close", variant: "text", size: "s", a11yLabel: catI18nRegistry.t('input.clear'), onClick: () => this.clear() })) : null, !this.state.isResolving && (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 ? catI18nRegistry.t('select.close') : 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) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap })))), h("div", { class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (h("cat-scrollable", { class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, 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
5917
9193
  ? Array.from(Array(CatSelect.SKELETON_COUNT)).map(() => (h("li", { class: "select-option-loading" }, h("cat-skeleton", { variant: "body", lines: 1 }), h("cat-skeleton", { variant: "body", lines: 1 }))))
5918
9194
  : !this.state.options.length &&
5919
9195
  !this.tags && (h("li", { class: "select-option-empty" }, this.noItems ? this.noItems : catI18nRegistry.t('select.empty')))))))));
@@ -5935,11 +9211,11 @@ const CatSelect = class {
5935
9211
  return (h("li", { role: "option", class: "select-option", id: `select-${this.id}-option-${i}`, "aria-selected": isOptionSelected ? 'true' : 'false' }, this.multiple ? (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 => {
5936
9212
  !isTagOption ? this.toggle(item) : this.toggleTag(item);
5937
9213
  e.stopPropagation();
5938
- } }, h("span", { slot: "label", class: "select-option-inner" }, item.render.avatar ? (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, h("span", { class: "select-option-text" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))) : (h("div", { class: {
9214
+ } }, h("span", { slot: "label", class: "select-option-inner" }, item.render.avatar ? (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, h("span", { class: "select-option-text" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))) : (h("div", { class: {
5939
9215
  'select-option-inner': true,
5940
9216
  'select-option-single': true,
5941
9217
  'select-option-active': this.state.activeOptionIndex === i
5942
- }, 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 ? (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, h("span", { class: "select-option-text" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))));
9218
+ }, 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 ? (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, h("span", { class: "select-option-text" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))));
5943
9219
  });
5944
9220
  }
5945
9221
  resolve() {
@@ -5982,7 +9258,7 @@ const CatSelect = class {
5982
9258
  if (!this.state.isOpen) {
5983
9259
  this.patchState({ isOpen: true });
5984
9260
  this.catOpen.emit();
5985
- this.term$.next(this.state.term);
9261
+ this.term$.next('');
5986
9262
  (_a = this.input) === null || _a === void 0 ? void 0 : _a.classList.remove('select-input-transparent-caret');
5987
9263
  }
5988
9264
  }
@@ -6035,12 +9311,12 @@ const CatSelect = class {
6035
9311
  }
6036
9312
  clear() {
6037
9313
  if (this.input && this.state.term) {
6038
- this.patchState({ selection: [], options: [], term: '', activeOptionIndex: -1 });
9314
+ this.patchState({ selection: [], options: [], term: '', activeOptionIndex: -1, tempSelection: [] });
6039
9315
  this.term$.next('');
6040
9316
  this.input.value = '';
6041
9317
  }
6042
9318
  else {
6043
- this.patchState({ selection: [] });
9319
+ this.patchState({ selection: [], tempSelection: [] });
6044
9320
  }
6045
9321
  }
6046
9322
  reset(connector) {
@@ -6066,12 +9342,17 @@ const CatSelect = class {
6066
9342
  }
6067
9343
  }
6068
9344
  onInput() {
6069
- var _a;
9345
+ var _a, _b;
6070
9346
  this.search(((_a = this.input) === null || _a === void 0 ? void 0 : _a.value.trim()) || '');
6071
- if (!this.multiple && this.state.selection.length) {
6072
- const selectionClone = [...this.state.selection];
6073
- selectionClone.pop();
6074
- this.patchState({ selection: selectionClone });
9347
+ if (!this.multiple) {
9348
+ if (this.state.selection.length) {
9349
+ const selectionClone = [...this.state.selection];
9350
+ selectionClone.pop();
9351
+ this.patchState({ selection: selectionClone, tempSelection: [...this.state.selection] });
9352
+ }
9353
+ if (!((_b = this.input) === null || _b === void 0 ? void 0 : _b.value.trim())) {
9354
+ this.patchState({ tempSelection: [] });
9355
+ }
6075
9356
  }
6076
9357
  this.show();
6077
9358
  }
@@ -7646,7 +10927,7 @@ const countries = [
7646
10927
  }
7647
10928
  ];
7648
10929
 
7649
- 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}}";
10930
+ 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}}";
7650
10931
 
7651
10932
  const CatSkeleton = class {
7652
10933
  constructor(hostRef) {
@@ -7806,9 +11087,9 @@ const CatTabs = class {
7806
11087
  };
7807
11088
  CatTabs.style = catTabsCss;
7808
11089
 
7809
- 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;
11090
+ 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;
7810
11091
 
7811
- 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}";
11092
+ 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}";
7812
11093
 
7813
11094
  let nextUniqueId$2 = 0;
7814
11095
  const CatTextarea = class {
@@ -7902,7 +11183,7 @@ const CatTextarea = class {
7902
11183
  'textarea-wrapper': true,
7903
11184
  'textarea-disabled': this.disabled,
7904
11185
  'textarea-invalid': this.invalid
7905
- } }, 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 && (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) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap }))))));
11186
+ } }, 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 && (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) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap }))))));
7906
11187
  }
7907
11188
  get invalid() {
7908
11189
  return !!this.errorMap;
@@ -7946,7 +11227,167 @@ const CatTextarea = class {
7946
11227
  };
7947
11228
  CatTextarea.style = catTextareaCss;
7948
11229
 
7949
- 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))}";
11230
+ const catTimepickerCss = "";
11231
+
11232
+ const CatTimepicker = class {
11233
+ constructor(hostRef) {
11234
+ registerInstance(this, hostRef);
11235
+ this.catOpen = createEvent(this, "catOpen", 7);
11236
+ this.catClose = createEvent(this, "catClose", 7);
11237
+ this.catChange = createEvent(this, "catChange", 7);
11238
+ this.catBlur = createEvent(this, "catBlur", 7);
11239
+ this.state = undefined;
11240
+ this.hasSlottedLabel = false;
11241
+ this.hasSlottedHint = false;
11242
+ this.errorMap = undefined;
11243
+ this.requiredMarker = 'optional';
11244
+ this.horizontal = false;
11245
+ this.multiple = false;
11246
+ this.placement = 'bottom-start';
11247
+ this.value = undefined;
11248
+ this.disabled = false;
11249
+ this.placeholder = undefined;
11250
+ this.hint = undefined;
11251
+ this.identifier = undefined;
11252
+ this.label = '';
11253
+ this.name = undefined;
11254
+ this.labelHidden = false;
11255
+ this.required = false;
11256
+ this.clearable = false;
11257
+ this.max = undefined;
11258
+ this.min = undefined;
11259
+ this.noItems = undefined;
11260
+ this.errors = undefined;
11261
+ this.errorUpdate = 0;
11262
+ this.nativeAttributes = undefined;
11263
+ this.minutesStep = 30;
11264
+ this.hourShort = this.isBrowserHour12();
11265
+ }
11266
+ componentWillRender() {
11267
+ this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
11268
+ this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
11269
+ }
11270
+ componentDidLoad() {
11271
+ var _a;
11272
+ (_a = this.timeSelect) === null || _a === void 0 ? void 0 : _a.connect(this.timeConnector);
11273
+ // IMask spike
11274
+ // const input = this.hostElement.shadowRoot?.querySelector('cat-select')?.shadowRoot?.querySelector('input');
11275
+ // if (input) {
11276
+ // this.timeMask = this.getTimeMask(input);
11277
+ // }
11278
+ }
11279
+ render() {
11280
+ return (h(Host, null, 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 && (h("span", { slot: "label" }, h("slot", { name: "label" }))), this.hasSlottedHint && (h("span", { slot: "hint" }, h("slot", { name: "hint" }))))));
11281
+ }
11282
+ get timeConnector() {
11283
+ return {
11284
+ resolve: (times) => {
11285
+ return of(times.map(t => this.timeArray.find(time => time.hour === this.getHour(t) && time.minutes === this.getMinutes(t))));
11286
+ },
11287
+ retrieve: (term) => {
11288
+ const filteredTimeArray = this.timeArray.filter(t => {
11289
+ if (!term)
11290
+ return true;
11291
+ const formatedTime = this.hourShort ? this.formatAMPM(t.hour, t.minutes) : this.formatTime(t.hour, t.minutes);
11292
+ return formatedTime.toUpperCase().includes(term.toUpperCase());
11293
+ });
11294
+ return of({
11295
+ last: true,
11296
+ totalElements: filteredTimeArray.length,
11297
+ content: filteredTimeArray
11298
+ });
11299
+ },
11300
+ render: ({ hour, minutes }) => ({
11301
+ label: this.hourShort ? this.formatAMPM(hour, minutes) : this.formatTime(hour, minutes)
11302
+ })
11303
+ };
11304
+ }
11305
+ get timeArray() {
11306
+ const times = [];
11307
+ for (let hour = 0; hour < 24; hour++) {
11308
+ for (let minutes = 0; minutes < 60; minutes += this.minutesStep) {
11309
+ if (this.isHigherThanMinValue(hour, minutes) && this.isLowerThanMaxValue(hour, minutes)) {
11310
+ times.push({
11311
+ id: this.hourShort ? this.formatAMPM(hour, minutes) : this.formatTime(hour, minutes),
11312
+ hour,
11313
+ minutes
11314
+ });
11315
+ }
11316
+ }
11317
+ }
11318
+ return times;
11319
+ }
11320
+ isBrowserHour12() {
11321
+ var _a, _b;
11322
+ 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';
11323
+ const hour = new Intl.DateTimeFormat(browserLanguage, { hour: 'numeric' }).format(new Date().setHours(16));
11324
+ return hour.toLowerCase().includes('pm' );
11325
+ }
11326
+ getHour(time) {
11327
+ let hour = Number(time.split(':')[0]);
11328
+ if (time.toLowerCase().includes('pm') && hour < 12)
11329
+ hour = hour + 12;
11330
+ if (time.toLowerCase().includes('am') && hour == 12)
11331
+ hour = hour - 12;
11332
+ return hour;
11333
+ }
11334
+ getMinutes(time) {
11335
+ const minutes = time.match(/:(\d+)/);
11336
+ return Number(minutes ? minutes[1] : 0);
11337
+ }
11338
+ isHigherThanMinValue(hour, minutes) {
11339
+ if (this.min) {
11340
+ const minHour = this.getHour(this.min);
11341
+ const minMinutes = this.getMinutes(this.min);
11342
+ return hour > minHour || (hour === minHour && minutes >= minMinutes);
11343
+ }
11344
+ return true;
11345
+ }
11346
+ isLowerThanMaxValue(hour, minutes) {
11347
+ if (this.max) {
11348
+ const maxHour = this.getHour(this.max);
11349
+ const maxMinutes = this.getMinutes(this.max);
11350
+ return hour < maxHour || (hour === maxHour && minutes <= maxMinutes);
11351
+ }
11352
+ return true;
11353
+ }
11354
+ formatAMPM(hour, minutes) {
11355
+ if (hour === 0) {
11356
+ return `12:${minutes < 10 ? `0${minutes}` : minutes} AM`;
11357
+ }
11358
+ else if (hour < 12) {
11359
+ return `${hour < 10 ? `0${hour}` : hour}:${minutes < 10 ? `0${minutes}` : minutes} AM`;
11360
+ }
11361
+ else {
11362
+ return `${hour % 12 < 10 ? `0${hour % 12}` : hour % 12}:${minutes < 10 ? `0${minutes}` : minutes} PM`;
11363
+ }
11364
+ }
11365
+ formatTime(hour, minutes) {
11366
+ return `${hour < 10 ? `0${hour}` : hour}:${minutes < 10 ? `0${minutes}` : minutes}`;
11367
+ }
11368
+ onCatChange(event) {
11369
+ var _a;
11370
+ event.stopPropagation();
11371
+ this.value = (_a = this.timeSelect) === null || _a === void 0 ? void 0 : _a.value;
11372
+ this.catChange.emit(event);
11373
+ }
11374
+ onCatOpen(event) {
11375
+ event.stopPropagation();
11376
+ this.catOpen.emit(event);
11377
+ }
11378
+ onCatClose(event) {
11379
+ event.stopPropagation();
11380
+ this.catClose.emit(event);
11381
+ }
11382
+ onCatBlur(event) {
11383
+ event.stopPropagation();
11384
+ this.catBlur.emit(event);
11385
+ }
11386
+ get hostElement() { return getElement(this); }
11387
+ };
11388
+ CatTimepicker.style = catTimepickerCss;
11389
+
11390
+ 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))}";
7950
11391
 
7951
11392
  let nextUniqueId$1 = 0;
7952
11393
  const CatToggle = class {
@@ -8004,7 +11445,7 @@ const CatToggle = class {
8004
11445
  this.input.click();
8005
11446
  }
8006
11447
  render() {
8007
- return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } }, 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) })), h("span", { class: "toggle", part: "toggle" }), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }) }))));
11448
+ return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } }, 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) })), h("span", { class: "toggle", part: "toggle" }), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (h("div", { class: { 'hint-wrapper': true, 'label-left': this.labelLeft } }, h("div", { class: "toggle-placeholder" }), h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }) })))));
8008
11449
  }
8009
11450
  onInput(event) {
8010
11451
  this.checked = this.input.checked;
@@ -8025,7 +11466,7 @@ CatToggle.style = catToggleCss;
8025
11466
 
8026
11467
  const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
8027
11468
 
8028
- 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}";
11469
+ 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}";
8029
11470
 
8030
11471
  let nextUniqueId = 0;
8031
11472
  const CatTooltip = class {
@@ -8155,6 +11596,6 @@ CatTooltip.OFFSET = 4;
8155
11596
  CatTooltip.SHIFT_PADDING = 4;
8156
11597
  CatTooltip.style = catTooltipCss;
8157
11598
 
8158
- export { CatAlert as cat_alert, CatAvatar as cat_avatar, CatBadge as cat_badge, CatButton as cat_button, CatButtonGroup as cat_button_group, CatCard as cat_card, CatCheckbox as cat_checkbox, CatDropdown as cat_dropdown, CatFormGroup as cat_form_group, CatIcon as cat_icon, CatInput as cat_input, CatLabel as cat_label, CatPagination as cat_pagination, CatRadio as cat_radio, CatRadioGroup as cat_radio_group, CatScrollable as cat_scrollable, CatSelect as cat_select, CatSelectTest as cat_select_demo, CatSkeleton as cat_skeleton, CatSpinner as cat_spinner, CatTab as cat_tab, CatTabs as cat_tabs, CatTextarea as cat_textarea, CatToggle as cat_toggle, CatTooltip as cat_tooltip };
11599
+ export { CatAlert as cat_alert, CatAvatar as cat_avatar, CatBadge as cat_badge, CatButton as cat_button, CatButtonGroup as cat_button_group, CatCard as cat_card, CatCheckbox as cat_checkbox, CatDatepicker as cat_datepicker, CatDropdown as cat_dropdown, CatFormGroup as cat_form_group, CatIcon as cat_icon, CatInput as cat_input, CatLabel as cat_label, CatPagination as cat_pagination, CatRadio as cat_radio, CatRadioGroup as cat_radio_group, CatScrollable as cat_scrollable, CatSelect as cat_select, CatSelectTest as cat_select_demo, CatSkeleton as cat_skeleton, CatSpinner as cat_spinner, CatTab as cat_tab, CatTabs as cat_tabs, CatTextarea as cat_textarea, CatTimepicker as cat_timepicker, CatToggle as cat_toggle, CatTooltip as cat_tooltip };
8159
11600
 
8160
- //# sourceMappingURL=cat-alert_25.entry.js.map
11601
+ //# sourceMappingURL=cat-alert_27.entry.js.map