@haiilo/catalyst 4.1.2 → 5.0.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 (276) hide show
  1. package/dist/catalyst/assets/fonts/Lato-Black.woff +0 -0
  2. package/dist/catalyst/assets/fonts/Lato-Black.woff2 +0 -0
  3. package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff +0 -0
  4. package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff2 +0 -0
  5. package/dist/catalyst/assets/fonts/Lato-Bold.woff +0 -0
  6. package/dist/catalyst/assets/fonts/Lato-Bold.woff2 +0 -0
  7. package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff +0 -0
  8. package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  9. package/dist/catalyst/assets/fonts/Lato-Hairline.woff +0 -0
  10. package/dist/catalyst/assets/fonts/Lato-Hairline.woff2 +0 -0
  11. package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff +0 -0
  12. package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
  13. package/dist/catalyst/assets/fonts/Lato-Heavy.woff +0 -0
  14. package/dist/catalyst/assets/fonts/Lato-Heavy.woff2 +0 -0
  15. package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff +0 -0
  16. package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
  17. package/dist/catalyst/assets/fonts/Lato-Italic.woff +0 -0
  18. package/dist/catalyst/assets/fonts/Lato-Italic.woff2 +0 -0
  19. package/dist/catalyst/assets/fonts/Lato-Light.woff +0 -0
  20. package/dist/catalyst/assets/fonts/Lato-Light.woff2 +0 -0
  21. package/dist/catalyst/assets/fonts/Lato-LightItalic.woff +0 -0
  22. package/dist/catalyst/assets/fonts/Lato-LightItalic.woff2 +0 -0
  23. package/dist/catalyst/assets/fonts/Lato-Medium.woff +0 -0
  24. package/dist/catalyst/assets/fonts/Lato-Medium.woff2 +0 -0
  25. package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff +0 -0
  26. package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff2 +0 -0
  27. package/dist/catalyst/assets/fonts/Lato-Regular.woff +0 -0
  28. package/dist/catalyst/assets/fonts/Lato-Regular.woff2 +0 -0
  29. package/dist/catalyst/assets/fonts/Lato-Semibold.woff +0 -0
  30. package/dist/catalyst/assets/fonts/Lato-Semibold.woff2 +0 -0
  31. package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff +0 -0
  32. package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
  33. package/dist/catalyst/assets/fonts/Lato-Thin.woff +0 -0
  34. package/dist/catalyst/assets/fonts/Lato-Thin.woff2 +0 -0
  35. package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff +0 -0
  36. package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff2 +0 -0
  37. package/dist/catalyst/catalyst.css +6 -27
  38. package/dist/catalyst/catalyst.esm.js +1 -1
  39. package/dist/catalyst/catalyst.esm.js.map +1 -1
  40. package/dist/catalyst/index.esm.js.map +1 -1
  41. package/dist/catalyst/p-50855511.entry.js +10 -0
  42. package/dist/catalyst/p-50855511.entry.js.map +1 -0
  43. package/dist/catalyst/p-ccfebe33.js.map +1 -1
  44. package/dist/catalyst/p-d1fb9d96.js +3 -0
  45. package/dist/catalyst/p-d1fb9d96.js.map +1 -0
  46. package/dist/catalyst/scss/fonts/_fonts-mixins.scss +0 -10
  47. package/dist/cjs/cat-alert_24.cjs.entry.js +932 -1132
  48. package/dist/cjs/cat-alert_24.cjs.entry.js.map +1 -1
  49. package/dist/cjs/catalyst.cjs.js +10 -3
  50. package/dist/cjs/catalyst.cjs.js.map +1 -1
  51. package/dist/cjs/{index-c4542095.js → index-01312a2e.js} +527 -245
  52. package/dist/cjs/index-01312a2e.js.map +1 -0
  53. package/dist/cjs/index.cjs.js.map +1 -1
  54. package/dist/cjs/loader.cjs.js +4 -3
  55. package/dist/cjs/loader.cjs.js.map +1 -1
  56. package/dist/collection/assets/fonts/Lato-Black.woff +0 -0
  57. package/dist/collection/assets/fonts/Lato-Black.woff2 +0 -0
  58. package/dist/collection/assets/fonts/Lato-BlackItalic.woff +0 -0
  59. package/dist/collection/assets/fonts/Lato-BlackItalic.woff2 +0 -0
  60. package/dist/collection/assets/fonts/Lato-Bold.woff +0 -0
  61. package/dist/collection/assets/fonts/Lato-Bold.woff2 +0 -0
  62. package/dist/collection/assets/fonts/Lato-BoldItalic.woff +0 -0
  63. package/dist/collection/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  64. package/dist/collection/assets/fonts/Lato-Hairline.woff +0 -0
  65. package/dist/collection/assets/fonts/Lato-Hairline.woff2 +0 -0
  66. package/dist/collection/assets/fonts/Lato-HairlineItalic.woff +0 -0
  67. package/dist/collection/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
  68. package/dist/collection/assets/fonts/Lato-Heavy.woff +0 -0
  69. package/dist/collection/assets/fonts/Lato-Heavy.woff2 +0 -0
  70. package/dist/collection/assets/fonts/Lato-HeavyItalic.woff +0 -0
  71. package/dist/collection/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
  72. package/dist/collection/assets/fonts/Lato-Italic.woff +0 -0
  73. package/dist/collection/assets/fonts/Lato-Italic.woff2 +0 -0
  74. package/dist/collection/assets/fonts/Lato-Light.woff +0 -0
  75. package/dist/collection/assets/fonts/Lato-Light.woff2 +0 -0
  76. package/dist/collection/assets/fonts/Lato-LightItalic.woff +0 -0
  77. package/dist/collection/assets/fonts/Lato-LightItalic.woff2 +0 -0
  78. package/dist/collection/assets/fonts/Lato-Medium.woff +0 -0
  79. package/dist/collection/assets/fonts/Lato-Medium.woff2 +0 -0
  80. package/dist/collection/assets/fonts/Lato-MediumItalic.woff +0 -0
  81. package/dist/collection/assets/fonts/Lato-MediumItalic.woff2 +0 -0
  82. package/dist/collection/assets/fonts/Lato-Regular.woff +0 -0
  83. package/dist/collection/assets/fonts/Lato-Regular.woff2 +0 -0
  84. package/dist/collection/assets/fonts/Lato-Semibold.woff +0 -0
  85. package/dist/collection/assets/fonts/Lato-Semibold.woff2 +0 -0
  86. package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff +0 -0
  87. package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
  88. package/dist/collection/assets/fonts/Lato-Thin.woff +0 -0
  89. package/dist/collection/assets/fonts/Lato-Thin.woff2 +0 -0
  90. package/dist/collection/assets/fonts/Lato-ThinItalic.woff +0 -0
  91. package/dist/collection/assets/fonts/Lato-ThinItalic.woff2 +0 -0
  92. package/dist/collection/collection-manifest.json +2 -2
  93. package/dist/collection/components/cat-alert/cat-alert.js +69 -71
  94. package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
  95. package/dist/collection/components/cat-avatar/cat-avatar.js +172 -165
  96. package/dist/collection/components/cat-avatar/cat-avatar.js.map +1 -1
  97. package/dist/collection/components/cat-badge/cat-badge.js +102 -111
  98. package/dist/collection/components/cat-badge/cat-badge.js.map +1 -1
  99. package/dist/collection/components/cat-button/cat-button.js +526 -537
  100. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  101. package/dist/collection/components/cat-card/cat-card.js +12 -8
  102. package/dist/collection/components/cat-checkbox/cat-checkbox.js +336 -350
  103. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  104. package/dist/collection/components/cat-dropdown/cat-dropdown.js +137 -137
  105. package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
  106. package/dist/collection/components/cat-form-group/cat-form-group.js +58 -40
  107. package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
  108. package/dist/collection/components/cat-form-hint/cat-form-hint.js +14 -7
  109. package/dist/collection/components/cat-form-hint/cat-form-hint.js.map +1 -1
  110. package/dist/collection/components/cat-i18n/cat-i18n-registry.js +1 -1
  111. package/dist/collection/components/cat-icon/cat-icon-registry.js +1 -1
  112. package/dist/collection/components/cat-icon/cat-icon.js +85 -79
  113. package/dist/collection/components/cat-icon/cat-icon.js.map +1 -1
  114. package/dist/collection/components/cat-input/cat-input.css +32 -3
  115. package/dist/collection/components/cat-input/cat-input.js +662 -660
  116. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  117. package/dist/collection/components/cat-input/input-type.js +1 -1
  118. package/dist/collection/components/cat-label/cat-label.js +69 -78
  119. package/dist/collection/components/cat-label/cat-label.js.map +1 -1
  120. package/dist/collection/components/cat-notification/cat-notification.js +1 -1
  121. package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
  122. package/dist/collection/components/cat-pagination/cat-pagination.js +192 -226
  123. package/dist/collection/components/cat-pagination/cat-pagination.js.map +1 -1
  124. package/dist/collection/components/cat-radio/cat-radio.js +319 -327
  125. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
  126. package/dist/collection/components/cat-radio-group/cat-radio-group.js +173 -165
  127. package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
  128. package/dist/collection/components/cat-scrollable/cat-scrollable.js +200 -208
  129. package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -1
  130. package/dist/collection/components/cat-select/cat-select.js +555 -590
  131. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  132. package/dist/collection/components/cat-select-demo/cat-select-demo.js +3 -28
  133. package/dist/collection/components/cat-select-demo/cat-select-demo.js.map +1 -1
  134. package/dist/collection/components/cat-skeleton/cat-skeleton.js +85 -88
  135. package/dist/collection/components/cat-skeleton/cat-skeleton.js.map +1 -1
  136. package/dist/collection/components/cat-spinner/cat-spinner.js +52 -50
  137. package/dist/collection/components/cat-spinner/cat-spinner.js.map +1 -1
  138. package/dist/collection/components/cat-tab/cat-tab.js +169 -168
  139. package/dist/collection/components/cat-tab/cat-tab.js.map +1 -1
  140. package/dist/collection/components/cat-tabs/cat-tabs.js +73 -66
  141. package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -1
  142. package/dist/collection/components/cat-textarea/cat-textarea.css +32 -1
  143. package/dist/collection/components/cat-textarea/cat-textarea.js +479 -468
  144. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  145. package/dist/collection/components/cat-toggle/cat-toggle.js +319 -326
  146. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  147. package/dist/collection/components/cat-tooltip/cat-tooltip.css +7 -1
  148. package/dist/collection/components/cat-tooltip/cat-tooltip.js +187 -198
  149. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
  150. package/dist/collection/index.js +1 -1
  151. package/dist/collection/scss/fonts/_fonts-mixins.scss +0 -10
  152. package/dist/collection/utils/breakpoints.js +1 -1
  153. package/dist/collection/utils/breakpoints.js.map +1 -1
  154. package/dist/collection/utils/coerce.js +11 -0
  155. package/dist/collection/utils/coerce.js.map +1 -0
  156. package/dist/collection/utils/first-tabbable.js +1 -1
  157. package/dist/collection/utils/is-touch-screen.js +1 -1
  158. package/dist/collection/utils/load-img.js +1 -1
  159. package/dist/collection/utils/media-matcher.js +1 -1
  160. package/dist/collection/utils/platform.js +4 -4
  161. package/dist/collection/utils/setDefault.js +1 -1
  162. package/dist/components/cat-alert.js +1 -6
  163. package/dist/components/cat-alert.js.map +1 -1
  164. package/dist/components/cat-avatar2.js +6 -9
  165. package/dist/components/cat-avatar2.js.map +1 -1
  166. package/dist/components/cat-badge.js +0 -15
  167. package/dist/components/cat-badge.js.map +1 -1
  168. package/dist/components/cat-button2.js +10 -36
  169. package/dist/components/cat-button2.js.map +1 -1
  170. package/dist/components/cat-checkbox2.js +9 -26
  171. package/dist/components/cat-checkbox2.js.map +1 -1
  172. package/dist/components/cat-dropdown2.js +139 -176
  173. package/dist/components/cat-dropdown2.js.map +1 -1
  174. package/dist/components/cat-form-group.js +4 -9
  175. package/dist/components/cat-form-group.js.map +1 -1
  176. package/dist/components/cat-form-hint.js +13 -6
  177. package/dist/components/cat-form-hint.js.map +1 -1
  178. package/dist/components/cat-icon-registry.js +71 -0
  179. package/dist/components/cat-icon-registry.js.map +1 -0
  180. package/dist/components/cat-icon.js +1 -1
  181. package/dist/components/cat-icon2.js +5 -71
  182. package/dist/components/cat-icon2.js.map +1 -1
  183. package/dist/components/cat-input.js +33 -41
  184. package/dist/components/cat-input.js.map +1 -1
  185. package/dist/components/cat-label.js +1 -6
  186. package/dist/components/cat-label.js.map +1 -1
  187. package/dist/components/cat-pagination.js +0 -30
  188. package/dist/components/cat-pagination.js.map +1 -1
  189. package/dist/components/cat-radio-group.js +3 -6
  190. package/dist/components/cat-radio-group.js.map +1 -1
  191. package/dist/components/cat-radio.js +9 -23
  192. package/dist/components/cat-radio.js.map +1 -1
  193. package/dist/components/cat-scrollable2.js +1 -12
  194. package/dist/components/cat-scrollable2.js.map +1 -1
  195. package/dist/components/cat-select-demo.js +2 -12
  196. package/dist/components/cat-select-demo.js.map +1 -1
  197. package/dist/components/cat-select2.js +40 -47
  198. package/dist/components/cat-select2.js.map +1 -1
  199. package/dist/components/cat-skeleton2.js +1 -10
  200. package/dist/components/cat-skeleton2.js.map +1 -1
  201. package/dist/components/cat-spinner2.js +1 -3
  202. package/dist/components/cat-spinner2.js.map +1 -1
  203. package/dist/components/cat-tab.js +3 -12
  204. package/dist/components/cat-tab.js.map +1 -1
  205. package/dist/components/cat-tabs.js +1 -6
  206. package/dist/components/cat-tabs.js.map +1 -1
  207. package/dist/components/cat-textarea.js +28 -33
  208. package/dist/components/cat-textarea.js.map +1 -1
  209. package/dist/components/cat-toggle.js +9 -23
  210. package/dist/components/cat-toggle.js.map +1 -1
  211. package/dist/components/cat-tooltip.js +14 -34
  212. package/dist/components/cat-tooltip.js.map +1 -1
  213. package/dist/components/first-tabbable.js +51 -113
  214. package/dist/components/first-tabbable.js.map +1 -1
  215. package/dist/components/floating-ui.dom.esm.js +577 -441
  216. package/dist/components/floating-ui.dom.esm.js.map +1 -1
  217. package/dist/components/index.d.ts +9 -27
  218. package/dist/components/index.js +2 -26
  219. package/dist/components/index.js.map +1 -1
  220. package/dist/esm/cat-alert_24.entry.js +933 -1133
  221. package/dist/esm/cat-alert_24.entry.js.map +1 -1
  222. package/dist/esm/catalyst.js +7 -3
  223. package/dist/esm/catalyst.js.map +1 -1
  224. package/dist/esm/{index-524906f7.js → index-fc2f91a4.js} +527 -246
  225. package/dist/esm/index-fc2f91a4.js.map +1 -0
  226. package/dist/esm/index.js.map +1 -1
  227. package/dist/esm/loader.js +4 -3
  228. package/dist/esm/loader.js.map +1 -1
  229. package/dist/esm/polyfills/css-shim.js +1 -1
  230. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +1 -1
  231. package/dist/types/components/cat-form-group/cat-form-group.d.ts +4 -0
  232. package/dist/types/components/cat-form-hint/cat-form-hint.d.ts +5 -0
  233. package/dist/types/components/cat-input/cat-input.d.ts +6 -1
  234. package/dist/types/components/cat-input/input-type.d.ts +1 -1
  235. package/dist/types/components/cat-radio/cat-radio.d.ts +1 -1
  236. package/dist/types/components/cat-select/cat-select.d.ts +3 -1
  237. package/dist/types/components/cat-textarea/cat-textarea.d.ts +6 -1
  238. package/dist/types/components/cat-toggle/cat-toggle.d.ts +1 -1
  239. package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +3 -0
  240. package/dist/types/components.d.ts +353 -7
  241. package/dist/types/stencil-public-runtime.d.ts +91 -19
  242. package/dist/types/utils/breakpoints.d.ts +1 -1
  243. package/dist/types/utils/coerce.d.ts +3 -0
  244. package/dist/types/utils/first-tabbable.d.ts +2 -2
  245. package/loader/index.d.ts +9 -0
  246. package/loader/package.json +1 -0
  247. package/package.json +19 -19
  248. package/dist/catalyst/assets/fonts/AzeretMono-Regular.woff2 +0 -0
  249. package/dist/catalyst/assets/fonts/DMSans-Bold.woff2 +0 -0
  250. package/dist/catalyst/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
  251. package/dist/catalyst/assets/fonts/DMSans-Italic.woff2 +0 -0
  252. package/dist/catalyst/assets/fonts/DMSans-Medium.woff2 +0 -0
  253. package/dist/catalyst/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
  254. package/dist/catalyst/assets/fonts/DMSans-Regular.woff2 +0 -0
  255. package/dist/catalyst/p-919eea27.js +0 -3
  256. package/dist/catalyst/p-919eea27.js.map +0 -1
  257. package/dist/catalyst/p-cd8f8639.entry.js +0 -10
  258. package/dist/catalyst/p-cd8f8639.entry.js.map +0 -1
  259. package/dist/catalyst/scss/fonts/_fonts.mixins.azeret.scss +0 -14
  260. package/dist/catalyst/scss/fonts/_fonts.mixins.dm.scss +0 -53
  261. package/dist/cjs/index-c4542095.js.map +0 -1
  262. package/dist/collection/assets/fonts/AzeretMono-Regular.woff2 +0 -0
  263. package/dist/collection/assets/fonts/DMSans-Bold.woff2 +0 -0
  264. package/dist/collection/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
  265. package/dist/collection/assets/fonts/DMSans-Italic.woff2 +0 -0
  266. package/dist/collection/assets/fonts/DMSans-Medium.woff2 +0 -0
  267. package/dist/collection/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
  268. package/dist/collection/assets/fonts/DMSans-Regular.woff2 +0 -0
  269. package/dist/collection/components/cat-form-hint/cat-form-hint-utils.js +0 -13
  270. package/dist/collection/components/cat-form-hint/cat-form-hint-utils.js.map +0 -1
  271. package/dist/collection/scss/fonts/_fonts.mixins.azeret.scss +0 -14
  272. package/dist/collection/scss/fonts/_fonts.mixins.dm.scss +0 -53
  273. package/dist/components/cat-form-hint-utils.js +0 -17
  274. package/dist/components/cat-form-hint-utils.js.map +0 -1
  275. package/dist/esm/index-524906f7.js.map +0 -1
  276. package/dist/types/components/cat-form-hint/cat-form-hint-utils.d.ts +0 -4
@@ -1,5 +1,5 @@
1
- import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-524906f7.js';
2
- import { l as loglevel, d as catIconRegistry, b as catI18nRegistry } from './cat-icon-registry-d6b80490.js';
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';
3
3
 
4
4
  function setAttributeDefault(host, attr, value) {
5
5
  if (!host.hostElement.hasAttribute(attr) && value != null) {
@@ -26,13 +26,8 @@ const CatAlert = class {
26
26
  ['warning', 'alert'],
27
27
  ['danger', 'alert']
28
28
  ]);
29
- /**
30
- * The color palette of the alert.
31
- */
32
29
  this.color = 'primary';
33
- /**
34
- * Whether the icon of the alert is deactivated.
35
- */
30
+ this.icon = undefined;
36
31
  this.noIcon = false;
37
32
  }
38
33
  connectedCallback() {
@@ -66,18 +61,15 @@ const catAvatarCss = ":host{display:contents}:host([hidden]){display:none}.avata
66
61
  const CatAvatar = class {
67
62
  constructor(hostRef) {
68
63
  registerInstance(this, hostRef);
69
- /**
70
- * The size of the avatar.
71
- */
64
+ this.backgroundImage = undefined;
72
65
  this.size = 'm';
73
- /**
74
- * Use round avatar edges.
75
- */
76
66
  this.round = false;
77
- /**
78
- * The label of the avatar.
79
- */
80
67
  this.label = '';
68
+ this.initials = undefined;
69
+ this.src = undefined;
70
+ this.icon = undefined;
71
+ this.url = undefined;
72
+ this.urlTarget = undefined;
81
73
  }
82
74
  onSrcChanged(value) {
83
75
  if (value) {
@@ -136,25 +128,10 @@ const catBadgeCss = ":host([hidden]){display:none}:host{display:inline-flex;max-
136
128
  const CatBadge = class {
137
129
  constructor(hostRef) {
138
130
  registerInstance(this, hostRef);
139
- /**
140
- * The rendering style of the badge.
141
- */
142
131
  this.variant = 'filled';
143
- /**
144
- * The color palette of the badge.
145
- */
146
132
  this.color = 'primary';
147
- /**
148
- * The size of the badge.
149
- */
150
133
  this.size = 'm';
151
- /**
152
- * Use round badge edges.
153
- */
154
134
  this.round = false;
155
- /**
156
- * Draw attention to the badge with a subtle animation.
157
- */
158
135
  this.pulse = false;
159
136
  }
160
137
  render() {
@@ -288,53 +265,27 @@ const CatButton = class {
288
265
  this.catFocus = createEvent(this, "catFocus", 7);
289
266
  this.catBlur = createEvent(this, "catBlur", 7);
290
267
  this._iconOnly = true;
291
- /**
292
- * The rendering style of the button.
293
- */
294
268
  this.variant = 'outlined';
295
- /**
296
- * The color palette of the button.
297
- */
298
269
  this.color = 'secondary';
299
- /**
300
- * Set the button into an active state.
301
- */
302
270
  this.active = false;
303
- /**
304
- * The size of the button.
305
- */
306
271
  this.size = 'm';
307
- /**
308
- * Specifies that the button should be disabled. A disabled button is unusable
309
- * and un-clickable. Corresponds with the native HTML disabled attribute.
310
- */
272
+ this.name = undefined;
273
+ this.value = undefined;
311
274
  this.disabled = false;
312
- /**
313
- * Displays the button in a loading state with a spinner. Just like a disabled
314
- * button, an inactive button is unusable and un-clickable. However, it
315
- * retains the current focus state.
316
- */
317
275
  this.loading = false;
318
- /**
319
- * Allows the button to submit a form.
320
- */
321
276
  this.submit = false;
322
- /**
323
- * Disables ellipse overflowing button content.
324
- */
325
277
  this.noEllipsis = false;
326
- /**
327
- * Use round button edges.
328
- */
329
278
  this.round = false;
330
- /**
331
- * Hide the actual button content and only display the icon.
332
- */
279
+ this.url = undefined;
280
+ this.urlTarget = undefined;
281
+ this.icon = undefined;
282
+ this.iconSrc = undefined;
333
283
  this.iconOnly = false;
334
- /**
335
- * Display the icon on the right.
336
- */
337
284
  this.iconRight = false;
285
+ this.buttonId = undefined;
286
+ this.a11yLabel = undefined;
287
+ this.a11yCurrent = undefined;
288
+ this.nativeAttributes = undefined;
338
289
  }
339
290
  onIconOnlyChanged(value) {
340
291
  var _a, _b;
@@ -491,12 +442,18 @@ CatCard.style = catCardCss;
491
442
  */
492
443
  const CatFormHint = props => {
493
444
  var _a;
494
- const { hint, slottedHint } = props;
495
- return (h("div", { class: "hint-section" }, [
496
- hint &&
497
- (Array.isArray(hint) ? (hint.map(item => { var _a; return h("p", { class: ((_a = props.class) !== null && _a !== void 0 ? _a : '') + ' input-hint' }, item); })) : (h("p", { class: ((_a = props.class) !== null && _a !== void 0 ? _a : '') + ' input-hint' }, hint))),
498
- slottedHint
499
- ]));
445
+ const { id, hint, slottedHint, errorMap } = props;
446
+ const errors = Object.entries(errorMap || {});
447
+ return (h("div", { id: id + '-hint', class: "hint-section" }, errors.length
448
+ ? errors.map(([key, params]) => {
449
+ var _a;
450
+ return (h("p", { class: ((_a = props.class) !== null && _a !== void 0 ? _a : '') + ' input-hint cat-text-danger' }, catI18nRegistry.t(`error.${key}`, params)));
451
+ })
452
+ : [
453
+ hint &&
454
+ (Array.isArray(hint) ? (hint.map(item => { var _a; return h("p", { class: ((_a = props.class) !== null && _a !== void 0 ? _a : '') + ' input-hint' }, item); })) : (h("p", { class: ((_a = props.class) !== null && _a !== void 0 ? _a : '') + ' input-hint' }, hint))),
455
+ slottedHint
456
+ ]));
500
457
  };
501
458
 
502
459
  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, 105, 118, 135))}: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, 105, 118, 135))}";
@@ -510,34 +467,19 @@ const CatCheckbox = class {
510
467
  this.catBlur = createEvent(this, "catBlur", 7);
511
468
  this._id = `cat-checkbox-${nextUniqueId$8++}`;
512
469
  this.hasSlottedLabel = false;
513
- /**
514
- * Checked state of the checkbox
515
- */
470
+ this.hasSlottedHint = false;
516
471
  this.checked = false;
517
- /**
518
- * Disabled state of the checkbox
519
- */
520
472
  this.disabled = false;
521
- /**
522
- * Indeterminate state of the checkbox
523
- */
473
+ this.identifier = undefined;
524
474
  this.indeterminate = false;
525
- /**
526
- * Label of the checkbox which is presented in the UI
527
- */
528
475
  this.label = '';
529
- /**
530
- * Visually hide the label, but still show it to assistive technologies like screen readers.
531
- */
532
476
  this.labelHidden = false;
533
- /**
534
- * Required state of the checkbox
535
- */
477
+ this.name = undefined;
536
478
  this.required = false;
537
- /**
538
- * Whether the label should appear to the left of the checkbox.
539
- */
479
+ this.value = undefined;
480
+ this.hint = undefined;
540
481
  this.labelLeft = false;
482
+ this.nativeAttributes = undefined;
541
483
  }
542
484
  get id() {
543
485
  return this.identifier || this._id;
@@ -549,6 +491,7 @@ const CatCheckbox = class {
549
491
  }
550
492
  componentWillRender() {
551
493
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
494
+ this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
552
495
  if (!this.label && !this.hasSlottedLabel) {
553
496
  loglevel.warn('[A11y] Missing ARIA label on checkbox', this);
554
497
  }
@@ -577,11 +520,7 @@ const CatCheckbox = class {
577
520
  this.input.click();
578
521
  }
579
522
  render() {
580
- 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.hintSection));
581
- }
582
- get hintSection() {
583
- const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
584
- return ((this.hint || hasSlottedHint) && (h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && h("slot", { name: "hint" }) })));
523
+ 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" }) }))));
585
524
  }
586
525
  onInput(event) {
587
526
  this.checked = this.input.checked;
@@ -600,22 +539,22 @@ const CatCheckbox = class {
600
539
  };
601
540
  CatCheckbox.style = catCheckboxCss;
602
541
 
603
- function getSide(placement) {
604
- return placement.split('-')[0];
605
- }
606
-
607
542
  function getAlignment(placement) {
608
543
  return placement.split('-')[1];
609
544
  }
610
545
 
611
- function getMainAxisFromPlacement(placement) {
612
- return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
613
- }
614
-
615
546
  function getLengthFromAxis(axis) {
616
547
  return axis === 'y' ? 'height' : 'width';
617
548
  }
618
549
 
550
+ function getSide(placement) {
551
+ return placement.split('-')[0];
552
+ }
553
+
554
+ function getMainAxisFromPlacement(placement) {
555
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
556
+ }
557
+
619
558
  function computeCoordsFromPlacement(_ref, placement, rtl) {
620
559
  let {
621
560
  reference,
@@ -629,7 +568,6 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
629
568
  const side = getSide(placement);
630
569
  const isVertical = mainAxis === 'x';
631
570
  let coords;
632
-
633
571
  switch (side) {
634
572
  case 'top':
635
573
  coords = {
@@ -637,45 +575,38 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
637
575
  y: reference.y - floating.height
638
576
  };
639
577
  break;
640
-
641
578
  case 'bottom':
642
579
  coords = {
643
580
  x: commonX,
644
581
  y: reference.y + reference.height
645
582
  };
646
583
  break;
647
-
648
584
  case 'right':
649
585
  coords = {
650
586
  x: reference.x + reference.width,
651
587
  y: commonY
652
588
  };
653
589
  break;
654
-
655
590
  case 'left':
656
591
  coords = {
657
592
  x: reference.x - floating.width,
658
593
  y: commonY
659
594
  };
660
595
  break;
661
-
662
596
  default:
663
597
  coords = {
664
598
  x: reference.x,
665
599
  y: reference.y
666
600
  };
667
601
  }
668
-
669
602
  switch (getAlignment(placement)) {
670
603
  case 'start':
671
604
  coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
672
605
  break;
673
-
674
606
  case 'end':
675
607
  coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
676
608
  break;
677
609
  }
678
-
679
610
  return coords;
680
611
  }
681
612
 
@@ -686,7 +617,6 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
686
617
  * This export does not have any `platform` interface logic. You will need to
687
618
  * write one for the platform you are using Floating UI with.
688
619
  */
689
-
690
620
  const computePosition$1 = async (reference, floating, config) => {
691
621
  const {
692
622
  placement = 'bottom',
@@ -694,8 +624,8 @@ const computePosition$1 = async (reference, floating, config) => {
694
624
  middleware = [],
695
625
  platform
696
626
  } = config;
627
+ const validMiddleware = middleware.filter(Boolean);
697
628
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
698
-
699
629
  let rects = await platform.getElementRects({
700
630
  reference,
701
631
  floating,
@@ -708,12 +638,11 @@ const computePosition$1 = async (reference, floating, config) => {
708
638
  let statefulPlacement = placement;
709
639
  let middlewareData = {};
710
640
  let resetCount = 0;
711
-
712
- for (let i = 0; i < middleware.length; i++) {
641
+ for (let i = 0; i < validMiddleware.length; i++) {
713
642
  const {
714
643
  name,
715
644
  fn
716
- } = middleware[i];
645
+ } = validMiddleware[i];
717
646
  const {
718
647
  x: nextX,
719
648
  y: nextY,
@@ -735,20 +664,19 @@ const computePosition$1 = async (reference, floating, config) => {
735
664
  });
736
665
  x = nextX != null ? nextX : x;
737
666
  y = nextY != null ? nextY : y;
738
- middlewareData = { ...middlewareData,
739
- [name]: { ...middlewareData[name],
667
+ middlewareData = {
668
+ ...middlewareData,
669
+ [name]: {
670
+ ...middlewareData[name],
740
671
  ...data
741
672
  }
742
673
  };
743
-
744
674
  if (reset && resetCount <= 50) {
745
675
  resetCount++;
746
-
747
676
  if (typeof reset === 'object') {
748
677
  if (reset.placement) {
749
678
  statefulPlacement = reset.placement;
750
679
  }
751
-
752
680
  if (reset.rects) {
753
681
  rects = reset.rects === true ? await platform.getElementRects({
754
682
  reference,
@@ -756,18 +684,15 @@ const computePosition$1 = async (reference, floating, config) => {
756
684
  strategy
757
685
  }) : reset.rects;
758
686
  }
759
-
760
687
  ({
761
688
  x,
762
689
  y
763
690
  } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
764
691
  }
765
-
766
692
  i = -1;
767
693
  continue;
768
694
  }
769
695
  }
770
-
771
696
  return {
772
697
  x,
773
698
  y,
@@ -797,7 +722,8 @@ function getSideObjectFromPadding(padding) {
797
722
  }
798
723
 
799
724
  function rectToClientRect(rect) {
800
- return { ...rect,
725
+ return {
726
+ ...rect,
801
727
  top: rect.y,
802
728
  left: rect.x,
803
729
  right: rect.x + rect.width,
@@ -807,19 +733,17 @@ function rectToClientRect(rect) {
807
733
 
808
734
  /**
809
735
  * Resolves with an object of overflow side offsets that determine how much the
810
- * element is overflowing a given clipping boundary.
736
+ * element is overflowing a given clipping boundary on each side.
811
737
  * - positive = overflowing the boundary by that number of pixels
812
738
  * - negative = how many pixels left before it will overflow
813
739
  * - 0 = lies flush with the boundary
814
740
  * @see https://floating-ui.com/docs/detectOverflow
815
741
  */
816
- async function detectOverflow(middlewareArguments, options) {
742
+ async function detectOverflow(state, options) {
817
743
  var _await$platform$isEle;
818
-
819
744
  if (options === void 0) {
820
745
  options = {};
821
746
  }
822
-
823
747
  const {
824
748
  x,
825
749
  y,
@@ -827,7 +751,7 @@ async function detectOverflow(middlewareArguments, options) {
827
751
  rects,
828
752
  elements,
829
753
  strategy
830
- } = middlewareArguments;
754
+ } = state;
831
755
  const {
832
756
  boundary = 'clippingAncestors',
833
757
  rootBoundary = 'viewport',
@@ -844,58 +768,72 @@ async function detectOverflow(middlewareArguments, options) {
844
768
  rootBoundary,
845
769
  strategy
846
770
  }));
771
+ const rect = elementContext === 'floating' ? {
772
+ ...rects.floating,
773
+ x,
774
+ y
775
+ } : rects.reference;
776
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
777
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
778
+ x: 1,
779
+ y: 1
780
+ } : {
781
+ x: 1,
782
+ y: 1
783
+ };
847
784
  const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
848
- rect: elementContext === 'floating' ? { ...rects.floating,
849
- x,
850
- y
851
- } : rects.reference,
852
- offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
785
+ rect,
786
+ offsetParent,
853
787
  strategy
854
- }) : rects[elementContext]);
788
+ }) : rect);
855
789
  return {
856
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
857
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
858
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
859
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
790
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
791
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
792
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
793
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
860
794
  };
861
795
  }
862
796
 
863
- const hash$1 = {
797
+ const min$1 = Math.min;
798
+ const max$1 = Math.max;
799
+
800
+ function within(min$1$1, value, max$1$1) {
801
+ return max$1(min$1$1, min$1(value, max$1$1));
802
+ }
803
+
804
+ const oppositeSideMap = {
864
805
  left: 'right',
865
806
  right: 'left',
866
807
  bottom: 'top',
867
808
  top: 'bottom'
868
809
  };
869
810
  function getOppositePlacement(placement) {
870
- return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
811
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
871
812
  }
872
813
 
873
814
  function getAlignmentSides(placement, rects, rtl) {
874
815
  if (rtl === void 0) {
875
816
  rtl = false;
876
817
  }
877
-
878
818
  const alignment = getAlignment(placement);
879
819
  const mainAxis = getMainAxisFromPlacement(placement);
880
820
  const length = getLengthFromAxis(mainAxis);
881
821
  let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
882
-
883
822
  if (rects.reference[length] > rects.floating[length]) {
884
823
  mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
885
824
  }
886
-
887
825
  return {
888
826
  main: mainAlignmentSide,
889
827
  cross: getOppositePlacement(mainAlignmentSide)
890
828
  };
891
829
  }
892
830
 
893
- const hash = {
831
+ const oppositeAlignmentMap = {
894
832
  start: 'end',
895
833
  end: 'start'
896
834
  };
897
835
  function getOppositeAlignmentPlacement(placement) {
898
- return placement.replace(/start|end/g, matched => hash[matched]);
836
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
899
837
  }
900
838
 
901
839
  function getExpandedPlacements(placement) {
@@ -903,23 +841,50 @@ function getExpandedPlacements(placement) {
903
841
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
904
842
  }
905
843
 
844
+ function getSideList(side, isStart, rtl) {
845
+ const lr = ['left', 'right'];
846
+ const rl = ['right', 'left'];
847
+ const tb = ['top', 'bottom'];
848
+ const bt = ['bottom', 'top'];
849
+ switch (side) {
850
+ case 'top':
851
+ case 'bottom':
852
+ if (rtl) return isStart ? rl : lr;
853
+ return isStart ? lr : rl;
854
+ case 'left':
855
+ case 'right':
856
+ return isStart ? tb : bt;
857
+ default:
858
+ return [];
859
+ }
860
+ }
861
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
862
+ const alignment = getAlignment(placement);
863
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
864
+ if (alignment) {
865
+ list = list.map(side => side + "-" + alignment);
866
+ if (flipAlignment) {
867
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
868
+ }
869
+ }
870
+ return list;
871
+ }
872
+
906
873
  /**
907
- * Changes the placement of the floating element to one that will fit if the
908
- * initially specified `placement` does not.
874
+ * Optimizes the visibility of the floating element by flipping the `placement`
875
+ * in order to keep it in view when the preferred placement(s) will overflow the
876
+ * clipping boundary. Alternative to `autoPlacement`.
909
877
  * @see https://floating-ui.com/docs/flip
910
878
  */
911
879
  const flip = function (options) {
912
880
  if (options === void 0) {
913
881
  options = {};
914
882
  }
915
-
916
883
  return {
917
884
  name: 'flip',
918
885
  options,
919
-
920
- async fn(middlewareArguments) {
886
+ async fn(state) {
921
887
  var _middlewareData$flip;
922
-
923
888
  const {
924
889
  placement,
925
890
  middlewareData,
@@ -927,48 +892,49 @@ const flip = function (options) {
927
892
  initialPlacement,
928
893
  platform,
929
894
  elements
930
- } = middlewareArguments;
895
+ } = state;
931
896
  const {
932
897
  mainAxis: checkMainAxis = true,
933
898
  crossAxis: checkCrossAxis = true,
934
899
  fallbackPlacements: specifiedFallbackPlacements,
935
900
  fallbackStrategy = 'bestFit',
901
+ fallbackAxisSideDirection = 'none',
936
902
  flipAlignment = true,
937
903
  ...detectOverflowOptions
938
904
  } = options;
939
905
  const side = getSide(placement);
940
- const isBasePlacement = side === initialPlacement;
906
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
907
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
941
908
  const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
909
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
910
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
911
+ }
942
912
  const placements = [initialPlacement, ...fallbackPlacements];
943
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
913
+ const overflow = await detectOverflow(state, detectOverflowOptions);
944
914
  const overflows = [];
945
915
  let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
946
-
947
916
  if (checkMainAxis) {
948
917
  overflows.push(overflow[side]);
949
918
  }
950
-
951
919
  if (checkCrossAxis) {
952
920
  const {
953
921
  main,
954
922
  cross
955
- } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
923
+ } = getAlignmentSides(placement, rects, rtl);
956
924
  overflows.push(overflow[main], overflow[cross]);
957
925
  }
958
-
959
926
  overflowsData = [...overflowsData, {
960
927
  placement,
961
928
  overflows
962
- }]; // One or more sides is overflowing
929
+ }];
963
930
 
931
+ // One or more sides is overflowing.
964
932
  if (!overflows.every(side => side <= 0)) {
965
- var _middlewareData$flip$, _middlewareData$flip2;
966
-
967
- const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
933
+ var _middlewareData$flip2, _overflowsData$filter;
934
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
968
935
  const nextPlacement = placements[nextIndex];
969
-
970
936
  if (nextPlacement) {
971
- // Try next placement and re-run the lifecycle
937
+ // Try next placement and re-run the lifecycle.
972
938
  return {
973
939
  data: {
974
940
  index: nextIndex,
@@ -980,27 +946,27 @@ const flip = function (options) {
980
946
  };
981
947
  }
982
948
 
983
- let resetPlacement = 'bottom';
984
-
985
- switch (fallbackStrategy) {
986
- case 'bestFit':
987
- {
988
- var _overflowsData$map$so;
989
-
990
- const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
991
-
992
- if (placement) {
993
- resetPlacement = placement;
949
+ // First, find the candidates that fit on the mainAxis side of overflow,
950
+ // then find the placement that fits the best on the main crossAxis side.
951
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
952
+
953
+ // Otherwise fallback.
954
+ if (!resetPlacement) {
955
+ switch (fallbackStrategy) {
956
+ case 'bestFit':
957
+ {
958
+ var _overflowsData$map$so;
959
+ const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
960
+ if (placement) {
961
+ resetPlacement = placement;
962
+ }
963
+ break;
994
964
  }
995
-
965
+ case 'initialPlacement':
966
+ resetPlacement = initialPlacement;
996
967
  break;
997
- }
998
-
999
- case 'initialPlacement':
1000
- resetPlacement = initialPlacement;
1001
- break;
968
+ }
1002
969
  }
1003
-
1004
970
  if (placement !== resetPlacement) {
1005
971
  return {
1006
972
  reset: {
@@ -1009,27 +975,26 @@ const flip = function (options) {
1009
975
  };
1010
976
  }
1011
977
  }
1012
-
1013
978
  return {};
1014
979
  }
1015
-
1016
980
  };
1017
981
  };
1018
982
 
1019
- async function convertValueToCoords(middlewareArguments, value) {
983
+ async function convertValueToCoords(state, value) {
1020
984
  const {
1021
985
  placement,
1022
986
  platform,
1023
987
  elements
1024
- } = middlewareArguments;
988
+ } = state;
1025
989
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1026
990
  const side = getSide(placement);
1027
991
  const alignment = getAlignment(placement);
1028
992
  const isVertical = getMainAxisFromPlacement(placement) === 'x';
1029
993
  const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
1030
994
  const crossAxisMulti = rtl && isVertical ? -1 : 1;
1031
- const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
995
+ const rawValue = typeof value === 'function' ? value(state) : value;
1032
996
 
997
+ // eslint-disable-next-line prefer-const
1033
998
  let {
1034
999
  mainAxis,
1035
1000
  crossAxis,
@@ -1044,11 +1009,9 @@ async function convertValueToCoords(middlewareArguments, value) {
1044
1009
  alignmentAxis: null,
1045
1010
  ...rawValue
1046
1011
  };
1047
-
1048
1012
  if (alignment && typeof alignmentAxis === 'number') {
1049
1013
  crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
1050
1014
  }
1051
-
1052
1015
  return isVertical ? {
1053
1016
  x: crossAxis * crossAxisMulti,
1054
1017
  y: mainAxis * mainAxisMulti
@@ -1057,67 +1020,159 @@ async function convertValueToCoords(middlewareArguments, value) {
1057
1020
  y: crossAxis * crossAxisMulti
1058
1021
  };
1059
1022
  }
1023
+
1060
1024
  /**
1061
- * Displaces the floating element from its reference element.
1025
+ * Modifies the placement by translating the floating element along the
1026
+ * specified axes.
1027
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
1028
+ * object may be passed.
1062
1029
  * @see https://floating-ui.com/docs/offset
1063
1030
  */
1064
-
1065
1031
  const offset = function (value) {
1066
1032
  if (value === void 0) {
1067
1033
  value = 0;
1068
1034
  }
1069
-
1070
1035
  return {
1071
1036
  name: 'offset',
1072
1037
  options: value,
1073
-
1074
- async fn(middlewareArguments) {
1038
+ async fn(state) {
1075
1039
  const {
1076
1040
  x,
1077
1041
  y
1078
- } = middlewareArguments;
1079
- const diffCoords = await convertValueToCoords(middlewareArguments, value);
1042
+ } = state;
1043
+ const diffCoords = await convertValueToCoords(state, value);
1080
1044
  return {
1081
1045
  x: x + diffCoords.x,
1082
1046
  y: y + diffCoords.y,
1083
1047
  data: diffCoords
1084
1048
  };
1085
1049
  }
1086
-
1087
1050
  };
1088
1051
  };
1089
1052
 
1090
- function isWindow(value) {
1091
- return value && value.document && value.location && value.alert && value.setInterval;
1053
+ function getCrossAxis(axis) {
1054
+ return axis === 'x' ? 'y' : 'x';
1092
1055
  }
1093
- function getWindow(node) {
1094
- if (node == null) {
1095
- return window;
1096
- }
1097
1056
 
1098
- if (!isWindow(node)) {
1099
- const ownerDocument = node.ownerDocument;
1100
- return ownerDocument ? ownerDocument.defaultView || window : window;
1057
+ /**
1058
+ * Optimizes the visibility of the floating element by shifting it in order to
1059
+ * keep it in view when it will overflow the clipping boundary.
1060
+ * @see https://floating-ui.com/docs/shift
1061
+ */
1062
+ const shift = function (options) {
1063
+ if (options === void 0) {
1064
+ options = {};
1101
1065
  }
1066
+ return {
1067
+ name: 'shift',
1068
+ options,
1069
+ async fn(state) {
1070
+ const {
1071
+ x,
1072
+ y,
1073
+ placement
1074
+ } = state;
1075
+ const {
1076
+ mainAxis: checkMainAxis = true,
1077
+ crossAxis: checkCrossAxis = false,
1078
+ limiter = {
1079
+ fn: _ref => {
1080
+ let {
1081
+ x,
1082
+ y
1083
+ } = _ref;
1084
+ return {
1085
+ x,
1086
+ y
1087
+ };
1088
+ }
1089
+ },
1090
+ ...detectOverflowOptions
1091
+ } = options;
1092
+ const coords = {
1093
+ x,
1094
+ y
1095
+ };
1096
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1097
+ const mainAxis = getMainAxisFromPlacement(getSide(placement));
1098
+ const crossAxis = getCrossAxis(mainAxis);
1099
+ let mainAxisCoord = coords[mainAxis];
1100
+ let crossAxisCoord = coords[crossAxis];
1101
+ if (checkMainAxis) {
1102
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
1103
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
1104
+ const min = mainAxisCoord + overflow[minSide];
1105
+ const max = mainAxisCoord - overflow[maxSide];
1106
+ mainAxisCoord = within(min, mainAxisCoord, max);
1107
+ }
1108
+ if (checkCrossAxis) {
1109
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
1110
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
1111
+ const min = crossAxisCoord + overflow[minSide];
1112
+ const max = crossAxisCoord - overflow[maxSide];
1113
+ crossAxisCoord = within(min, crossAxisCoord, max);
1114
+ }
1115
+ const limitedCoords = limiter.fn({
1116
+ ...state,
1117
+ [mainAxis]: mainAxisCoord,
1118
+ [crossAxis]: crossAxisCoord
1119
+ });
1120
+ return {
1121
+ ...limitedCoords,
1122
+ data: {
1123
+ x: limitedCoords.x - x,
1124
+ y: limitedCoords.y - y
1125
+ }
1126
+ };
1127
+ }
1128
+ };
1129
+ };
1102
1130
 
1103
- return node;
1131
+ function getWindow(node) {
1132
+ var _node$ownerDocument;
1133
+ return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1104
1134
  }
1105
1135
 
1106
1136
  function getComputedStyle$1(element) {
1107
1137
  return getWindow(element).getComputedStyle(element);
1108
1138
  }
1109
1139
 
1140
+ const min = Math.min;
1141
+ const max = Math.max;
1142
+ const round = Math.round;
1143
+
1144
+ function getCssDimensions(element) {
1145
+ const css = getComputedStyle$1(element);
1146
+ let width = parseFloat(css.width);
1147
+ let height = parseFloat(css.height);
1148
+ const offsetWidth = element.offsetWidth;
1149
+ const offsetHeight = element.offsetHeight;
1150
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1151
+ if (shouldFallback) {
1152
+ width = offsetWidth;
1153
+ height = offsetHeight;
1154
+ }
1155
+ return {
1156
+ width,
1157
+ height,
1158
+ fallback: shouldFallback
1159
+ };
1160
+ }
1161
+
1110
1162
  function getNodeName(node) {
1111
- return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
1163
+ return isNode(node) ? (node.nodeName || '').toLowerCase() : '';
1112
1164
  }
1113
1165
 
1166
+ let uaString;
1114
1167
  function getUAString() {
1168
+ if (uaString) {
1169
+ return uaString;
1170
+ }
1115
1171
  const uaData = navigator.userAgentData;
1116
-
1117
- if (uaData != null && uaData.brands) {
1118
- return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
1172
+ if (uaData && Array.isArray(uaData.brands)) {
1173
+ uaString = uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
1174
+ return uaString;
1119
1175
  }
1120
-
1121
1176
  return navigator.userAgent;
1122
1177
  }
1123
1178
 
@@ -1131,82 +1186,142 @@ function isNode(value) {
1131
1186
  return value instanceof getWindow(value).Node;
1132
1187
  }
1133
1188
  function isShadowRoot(node) {
1134
- // Browsers without `ShadowRoot` support
1189
+ // Browsers without `ShadowRoot` support.
1135
1190
  if (typeof ShadowRoot === 'undefined') {
1136
1191
  return false;
1137
1192
  }
1138
-
1139
1193
  const OwnElement = getWindow(node).ShadowRoot;
1140
1194
  return node instanceof OwnElement || node instanceof ShadowRoot;
1141
1195
  }
1142
1196
  function isOverflowElement(element) {
1143
- // Firefox wants us to check `-x` and `-y` variations as well
1144
1197
  const {
1145
1198
  overflow,
1146
1199
  overflowX,
1147
1200
  overflowY,
1148
1201
  display
1149
1202
  } = getComputedStyle$1(element);
1150
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1203
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1151
1204
  }
1152
1205
  function isTableElement(element) {
1153
1206
  return ['table', 'td', 'th'].includes(getNodeName(element));
1154
1207
  }
1155
1208
  function isContainingBlock(element) {
1156
- // TODO: Try and use feature detection here instead
1209
+ // TODO: Try to use feature detection here instead.
1157
1210
  const isFirefox = /firefox/i.test(getUAString());
1158
- const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
1211
+ const css = getComputedStyle$1(element);
1212
+ const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter;
1213
+
1214
+ // This is non-exhaustive but covers the most common CSS properties that
1159
1215
  // create a containing block.
1160
1216
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1161
-
1162
- return css.transform !== 'none' || css.perspective !== 'none' || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat
1163
- value => {
1217
+ return css.transform !== 'none' || css.perspective !== 'none' || (backdropFilter ? backdropFilter !== 'none' : false) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => {
1218
+ // Add type check for old browsers.
1164
1219
  const contain = css.contain;
1165
1220
  return contain != null ? contain.includes(value) : false;
1166
1221
  });
1167
1222
  }
1168
- function isLayoutViewport() {
1169
- // Not Safari
1170
- return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
1223
+
1224
+ /**
1225
+ * Determines whether or not `.getBoundingClientRect()` is affected by visual
1226
+ * viewport offsets. In Safari, the `x`/`y` offsets are values relative to the
1227
+ * visual viewport, while in other engines, they are values relative to the
1228
+ * layout viewport.
1229
+ */
1230
+ function isClientRectVisualViewportBased() {
1231
+ // TODO: Try to use feature detection here instead. Feature detection for
1232
+ // this can fail in various ways, making the userAgent check the most
1233
+ // reliable:
1171
1234
  // • Always-visible scrollbar or not
1172
- // • Width of <html>, etc.
1173
- // const vV = win.visualViewport;
1174
- // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
1235
+ // • Width of <html>
1236
+
1237
+ // Is Safari.
1238
+ return /^((?!chrome|android).)*safari/i.test(getUAString());
1175
1239
  }
1176
1240
  function isLastTraversableNode(node) {
1177
1241
  return ['html', 'body', '#document'].includes(getNodeName(node));
1178
1242
  }
1179
1243
 
1180
- const min = Math.min;
1181
- const max = Math.max;
1182
- const round = Math.round;
1244
+ function unwrapElement(element) {
1245
+ return !isElement(element) ? element.contextElement : element;
1246
+ }
1183
1247
 
1184
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
1185
- var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
1248
+ const FALLBACK_SCALE = {
1249
+ x: 1,
1250
+ y: 1
1251
+ };
1252
+ function getScale(element) {
1253
+ const domElement = unwrapElement(element);
1254
+ if (!isHTMLElement(domElement)) {
1255
+ return FALLBACK_SCALE;
1256
+ }
1257
+ const rect = domElement.getBoundingClientRect();
1258
+ const {
1259
+ width,
1260
+ height,
1261
+ fallback
1262
+ } = getCssDimensions(domElement);
1263
+ let x = (fallback ? round(rect.width) : rect.width) / width;
1264
+ let y = (fallback ? round(rect.height) : rect.height) / height;
1265
+
1266
+ // 0, NaN, or Infinity should always fallback to 1.
1186
1267
 
1268
+ if (!x || !Number.isFinite(x)) {
1269
+ x = 1;
1270
+ }
1271
+ if (!y || !Number.isFinite(y)) {
1272
+ y = 1;
1273
+ }
1274
+ return {
1275
+ x,
1276
+ y
1277
+ };
1278
+ }
1279
+
1280
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1281
+ var _win$visualViewport, _win$visualViewport2;
1187
1282
  if (includeScale === void 0) {
1188
1283
  includeScale = false;
1189
1284
  }
1190
-
1191
1285
  if (isFixedStrategy === void 0) {
1192
1286
  isFixedStrategy = false;
1193
1287
  }
1194
-
1195
1288
  const clientRect = element.getBoundingClientRect();
1196
- let scaleX = 1;
1197
- let scaleY = 1;
1198
-
1199
- if (includeScale && isHTMLElement(element)) {
1200
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
1201
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
1289
+ const domElement = unwrapElement(element);
1290
+ let scale = FALLBACK_SCALE;
1291
+ if (includeScale) {
1292
+ if (offsetParent) {
1293
+ if (isElement(offsetParent)) {
1294
+ scale = getScale(offsetParent);
1295
+ }
1296
+ } else {
1297
+ scale = getScale(element);
1298
+ }
1299
+ }
1300
+ const win = domElement ? getWindow(domElement) : window;
1301
+ const addVisualOffsets = isClientRectVisualViewportBased() && isFixedStrategy;
1302
+ let x = (clientRect.left + (addVisualOffsets ? ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0 : 0)) / scale.x;
1303
+ let y = (clientRect.top + (addVisualOffsets ? ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0 : 0)) / scale.y;
1304
+ let width = clientRect.width / scale.x;
1305
+ let height = clientRect.height / scale.y;
1306
+ if (domElement) {
1307
+ const win = getWindow(domElement);
1308
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1309
+ let currentIFrame = win.frameElement;
1310
+ while (currentIFrame && offsetParent && offsetWin !== win) {
1311
+ const iframeScale = getScale(currentIFrame);
1312
+ const iframeRect = currentIFrame.getBoundingClientRect();
1313
+ const css = getComputedStyle(currentIFrame);
1314
+ iframeRect.x += (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1315
+ iframeRect.y += (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1316
+ x *= iframeScale.x;
1317
+ y *= iframeScale.y;
1318
+ width *= iframeScale.x;
1319
+ height *= iframeScale.y;
1320
+ x += iframeRect.x;
1321
+ y += iframeRect.y;
1322
+ currentIFrame = getWindow(currentIFrame).frameElement;
1323
+ }
1202
1324
  }
1203
-
1204
- const win = isElement(element) ? getWindow(element) : window;
1205
- const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
1206
- const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
1207
- const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
1208
- const width = clientRect.width / scaleX;
1209
- const height = clientRect.height / scaleY;
1210
1325
  return {
1211
1326
  width,
1212
1327
  height,
@@ -1230,134 +1345,12 @@ function getNodeScroll(element) {
1230
1345
  scrollTop: element.scrollTop
1231
1346
  };
1232
1347
  }
1233
-
1234
1348
  return {
1235
1349
  scrollLeft: element.pageXOffset,
1236
1350
  scrollTop: element.pageYOffset
1237
1351
  };
1238
1352
  }
1239
1353
 
1240
- function getWindowScrollBarX(element) {
1241
- // If <html> has a CSS width greater than the viewport, then this will be
1242
- // incorrect for RTL.
1243
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1244
- }
1245
-
1246
- function isScaled(element) {
1247
- const rect = getBoundingClientRect(element);
1248
- return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
1249
- }
1250
-
1251
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1252
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1253
- const documentElement = getDocumentElement(offsetParent);
1254
- const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
1255
- isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
1256
- let scroll = {
1257
- scrollLeft: 0,
1258
- scrollTop: 0
1259
- };
1260
- const offsets = {
1261
- x: 0,
1262
- y: 0
1263
- };
1264
-
1265
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1266
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1267
- scroll = getNodeScroll(offsetParent);
1268
- }
1269
-
1270
- if (isHTMLElement(offsetParent)) {
1271
- const offsetRect = getBoundingClientRect(offsetParent, true);
1272
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1273
- offsets.y = offsetRect.y + offsetParent.clientTop;
1274
- } else if (documentElement) {
1275
- offsets.x = getWindowScrollBarX(documentElement);
1276
- }
1277
- }
1278
-
1279
- return {
1280
- x: rect.left + scroll.scrollLeft - offsets.x,
1281
- y: rect.top + scroll.scrollTop - offsets.y,
1282
- width: rect.width,
1283
- height: rect.height
1284
- };
1285
- }
1286
-
1287
- function getParentNode(node) {
1288
- if (getNodeName(node) === 'html') {
1289
- return node;
1290
- }
1291
-
1292
- return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
1293
- // @ts-ignore
1294
- node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
1295
- node.parentNode || ( // DOM Element detected
1296
- isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
1297
- getDocumentElement(node) // fallback
1298
-
1299
- );
1300
- }
1301
-
1302
- function getTrueOffsetParent(element) {
1303
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
1304
- return null;
1305
- }
1306
-
1307
- return element.offsetParent;
1308
- }
1309
-
1310
- function getContainingBlock(element) {
1311
- let currentNode = getParentNode(element);
1312
-
1313
- if (isShadowRoot(currentNode)) {
1314
- currentNode = currentNode.host;
1315
- }
1316
-
1317
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1318
- if (isContainingBlock(currentNode)) {
1319
- return currentNode;
1320
- } else {
1321
- const parent = currentNode.parentNode;
1322
- currentNode = isShadowRoot(parent) ? parent.host : parent;
1323
- }
1324
- }
1325
-
1326
- return null;
1327
- } // Gets the closest ancestor positioned element. Handles some edge cases,
1328
- // such as table ancestors and cross browser bugs.
1329
-
1330
-
1331
- function getOffsetParent(element) {
1332
- const window = getWindow(element);
1333
- let offsetParent = getTrueOffsetParent(element);
1334
-
1335
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
1336
- offsetParent = getTrueOffsetParent(offsetParent);
1337
- }
1338
-
1339
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1340
- return window;
1341
- }
1342
-
1343
- return offsetParent || getContainingBlock(element) || window;
1344
- }
1345
-
1346
- function getDimensions(element) {
1347
- if (isHTMLElement(element)) {
1348
- return {
1349
- width: element.offsetWidth,
1350
- height: element.offsetHeight
1351
- };
1352
- }
1353
-
1354
- const rect = getBoundingClientRect(element);
1355
- return {
1356
- width: rect.width,
1357
- height: rect.height
1358
- };
1359
- }
1360
-
1361
1354
  function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1362
1355
  let {
1363
1356
  rect,
@@ -1366,87 +1359,59 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1366
1359
  } = _ref;
1367
1360
  const isOffsetParentAnElement = isHTMLElement(offsetParent);
1368
1361
  const documentElement = getDocumentElement(offsetParent);
1369
-
1370
1362
  if (offsetParent === documentElement) {
1371
1363
  return rect;
1372
1364
  }
1373
-
1374
1365
  let scroll = {
1375
1366
  scrollLeft: 0,
1376
1367
  scrollTop: 0
1377
1368
  };
1369
+ let scale = {
1370
+ x: 1,
1371
+ y: 1
1372
+ };
1378
1373
  const offsets = {
1379
1374
  x: 0,
1380
1375
  y: 0
1381
1376
  };
1382
-
1383
1377
  if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1384
1378
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1385
1379
  scroll = getNodeScroll(offsetParent);
1386
1380
  }
1387
-
1388
1381
  if (isHTMLElement(offsetParent)) {
1389
- const offsetRect = getBoundingClientRect(offsetParent, true);
1382
+ const offsetRect = getBoundingClientRect(offsetParent);
1383
+ scale = getScale(offsetParent);
1390
1384
  offsets.x = offsetRect.x + offsetParent.clientLeft;
1391
1385
  offsets.y = offsetRect.y + offsetParent.clientTop;
1392
- } // This doesn't appear to be need to be negated.
1393
- // else if (documentElement) {
1394
- // offsets.x = getWindowScrollBarX(documentElement);
1395
- // }
1396
-
1397
- }
1398
-
1399
- return { ...rect,
1400
- x: rect.x - scroll.scrollLeft + offsets.x,
1401
- y: rect.y - scroll.scrollTop + offsets.y
1402
- };
1403
- }
1404
-
1405
- function getViewportRect(element, strategy) {
1406
- const win = getWindow(element);
1407
- const html = getDocumentElement(element);
1408
- const visualViewport = win.visualViewport;
1409
- let width = html.clientWidth;
1410
- let height = html.clientHeight;
1411
- let x = 0;
1412
- let y = 0;
1413
-
1414
- if (visualViewport) {
1415
- width = visualViewport.width;
1416
- height = visualViewport.height;
1417
- const layoutViewport = isLayoutViewport();
1418
-
1419
- if (layoutViewport || !layoutViewport && strategy === 'fixed') {
1420
- x = visualViewport.offsetLeft;
1421
- y = visualViewport.offsetTop;
1422
1386
  }
1423
1387
  }
1424
-
1425
1388
  return {
1426
- width,
1427
- height,
1428
- x,
1429
- y
1389
+ width: rect.width * scale.x,
1390
+ height: rect.height * scale.y,
1391
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
1392
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
1430
1393
  };
1431
1394
  }
1432
1395
 
1433
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable
1396
+ function getWindowScrollBarX(element) {
1397
+ // If <html> has a CSS width greater than the viewport, then this will be
1398
+ // incorrect for RTL.
1399
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1400
+ }
1434
1401
 
1402
+ // Gets the entire size of the scrollable document area, even extending outside
1403
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1435
1404
  function getDocumentRect(element) {
1436
- var _element$ownerDocumen;
1437
-
1438
1405
  const html = getDocumentElement(element);
1439
1406
  const scroll = getNodeScroll(element);
1440
- const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
1441
- const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
1442
- const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
1407
+ const body = element.ownerDocument.body;
1408
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1409
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1443
1410
  let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1444
1411
  const y = -scroll.scrollTop;
1445
-
1446
- if (getComputedStyle$1(body || html).direction === 'rtl') {
1447
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
1412
+ if (getComputedStyle$1(body).direction === 'rtl') {
1413
+ x += max(html.clientWidth, body.clientWidth) - width;
1448
1414
  }
1449
-
1450
1415
  return {
1451
1416
  width,
1452
1417
  height,
@@ -1455,132 +1420,155 @@ function getDocumentRect(element) {
1455
1420
  };
1456
1421
  }
1457
1422
 
1423
+ function getParentNode(node) {
1424
+ if (getNodeName(node) === 'html') {
1425
+ return node;
1426
+ }
1427
+ const result =
1428
+ // Step into the shadow DOM of the parent of a slotted node.
1429
+ node.assignedSlot ||
1430
+ // DOM Element detected.
1431
+ node.parentNode ||
1432
+ // ShadowRoot detected.
1433
+ isShadowRoot(node) && node.host ||
1434
+ // Fallback.
1435
+ getDocumentElement(node);
1436
+ return isShadowRoot(result) ? result.host : result;
1437
+ }
1438
+
1458
1439
  function getNearestOverflowAncestor(node) {
1459
1440
  const parentNode = getParentNode(node);
1460
-
1461
1441
  if (isLastTraversableNode(parentNode)) {
1462
- // @ts-ignore assume body is always available
1463
- return node.ownerDocument.body;
1442
+ // `getParentNode` will never return a `Document` due to the fallback
1443
+ // check, so it's either the <html> or <body> element.
1444
+ return parentNode.ownerDocument.body;
1464
1445
  }
1465
-
1466
1446
  if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1467
1447
  return parentNode;
1468
1448
  }
1469
-
1470
1449
  return getNearestOverflowAncestor(parentNode);
1471
1450
  }
1472
1451
 
1473
1452
  function getOverflowAncestors(node, list) {
1474
1453
  var _node$ownerDocument;
1475
-
1476
1454
  if (list === void 0) {
1477
1455
  list = [];
1478
1456
  }
1479
-
1480
1457
  const scrollableAncestor = getNearestOverflowAncestor(node);
1481
1458
  const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
1482
1459
  const win = getWindow(scrollableAncestor);
1483
- const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
1484
- const updatedList = list.concat(target);
1485
- return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
1486
- updatedList.concat(getOverflowAncestors(target));
1487
- }
1488
-
1489
- function contains(parent, child) {
1490
- const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
1491
-
1492
- if (parent.contains(child)) {
1493
- return true;
1494
- } // then fallback to custom implementation with Shadow DOM support
1495
- else if (rootNode && isShadowRoot(rootNode)) {
1496
- let next = child;
1497
-
1498
- do {
1499
- // use `===` replace node.isSameNode()
1500
- if (next && parent === next) {
1501
- return true;
1502
- } // @ts-ignore: need a better way to handle this...
1503
-
1504
-
1505
- next = next.parentNode || next.host;
1506
- } while (next);
1460
+ if (isBody) {
1461
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []);
1507
1462
  }
1508
-
1509
- return false;
1463
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor));
1510
1464
  }
1511
1465
 
1512
- function getNearestParentCapableOfEscapingClipping(element, clippingAncestors) {
1513
- let currentNode = element;
1514
-
1515
- while (currentNode && !isLastTraversableNode(currentNode) && // @ts-expect-error
1516
- !clippingAncestors.includes(currentNode)) {
1517
- if (isElement(currentNode) && ['absolute', 'fixed'].includes(getComputedStyle$1(currentNode).position)) {
1518
- break;
1466
+ function getViewportRect(element, strategy) {
1467
+ const win = getWindow(element);
1468
+ const html = getDocumentElement(element);
1469
+ const visualViewport = win.visualViewport;
1470
+ let width = html.clientWidth;
1471
+ let height = html.clientHeight;
1472
+ let x = 0;
1473
+ let y = 0;
1474
+ if (visualViewport) {
1475
+ width = visualViewport.width;
1476
+ height = visualViewport.height;
1477
+ const visualViewportBased = isClientRectVisualViewportBased();
1478
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1479
+ x = visualViewport.offsetLeft;
1480
+ y = visualViewport.offsetTop;
1519
1481
  }
1520
-
1521
- const parentNode = getParentNode(currentNode);
1522
- currentNode = isShadowRoot(parentNode) ? parentNode.host : parentNode;
1523
1482
  }
1524
-
1525
- return currentNode;
1483
+ return {
1484
+ width,
1485
+ height,
1486
+ x,
1487
+ y
1488
+ };
1526
1489
  }
1527
1490
 
1491
+ // Returns the inner client rect, subtracting scrollbars if present.
1528
1492
  function getInnerBoundingClientRect(element, strategy) {
1529
- const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
1493
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1530
1494
  const top = clientRect.top + element.clientTop;
1531
1495
  const left = clientRect.left + element.clientLeft;
1496
+ const scale = isHTMLElement(element) ? getScale(element) : {
1497
+ x: 1,
1498
+ y: 1
1499
+ };
1500
+ const width = element.clientWidth * scale.x;
1501
+ const height = element.clientHeight * scale.y;
1502
+ const x = left * scale.x;
1503
+ const y = top * scale.y;
1532
1504
  return {
1533
- top,
1534
- left,
1535
- x: left,
1536
- y: top,
1537
- right: left + element.clientWidth,
1538
- bottom: top + element.clientHeight,
1539
- width: element.clientWidth,
1540
- height: element.clientHeight
1505
+ width,
1506
+ height,
1507
+ x,
1508
+ y
1541
1509
  };
1542
1510
  }
1543
-
1544
- function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
1545
- if (clippingParent === 'viewport') {
1546
- return rectToClientRect(getViewportRect(element, strategy));
1511
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1512
+ let rect;
1513
+ if (clippingAncestor === 'viewport') {
1514
+ rect = getViewportRect(element, strategy);
1515
+ } else if (clippingAncestor === 'document') {
1516
+ rect = getDocumentRect(getDocumentElement(element));
1517
+ } else if (isElement(clippingAncestor)) {
1518
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1519
+ } else {
1520
+ const mutableRect = {
1521
+ ...clippingAncestor
1522
+ };
1523
+ if (isClientRectVisualViewportBased()) {
1524
+ var _win$visualViewport, _win$visualViewport2;
1525
+ const win = getWindow(element);
1526
+ mutableRect.x -= ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0;
1527
+ mutableRect.y -= ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0;
1528
+ }
1529
+ rect = mutableRect;
1547
1530
  }
1531
+ return rectToClientRect(rect);
1532
+ }
1548
1533
 
1549
- if (isElement(clippingParent)) {
1550
- return getInnerBoundingClientRect(clippingParent, strategy);
1534
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1535
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1536
+ // of the given element up the tree.
1537
+ function getClippingElementAncestors(element, cache) {
1538
+ const cachedResult = cache.get(element);
1539
+ if (cachedResult) {
1540
+ return cachedResult;
1551
1541
  }
1542
+ let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
1543
+ let currentContainingBlockComputedStyle = null;
1544
+ const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
1545
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1552
1546
 
1553
- return rectToClientRect(getDocumentRect(getDocumentElement(element)));
1554
- } // A "clipping ancestor" is an overflowable container with the characteristic of
1555
- // clipping (or hiding) overflowing elements with a position different from
1556
- // `initial`
1557
-
1558
-
1559
- function getClippingAncestors(element) {
1560
- const clippingAncestors = getOverflowAncestors(element);
1561
- const nearestEscapableParent = getNearestParentCapableOfEscapingClipping(element, clippingAncestors);
1562
- let clipperElement = null;
1563
-
1564
- if (nearestEscapableParent && isHTMLElement(nearestEscapableParent)) {
1565
- const offsetParent = getOffsetParent(nearestEscapableParent);
1566
-
1567
- if (isOverflowElement(nearestEscapableParent)) {
1568
- clipperElement = nearestEscapableParent;
1569
- } else if (isHTMLElement(offsetParent)) {
1570
- clipperElement = offsetParent;
1547
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1548
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1549
+ const computedStyle = getComputedStyle$1(currentNode);
1550
+ const containingBlock = isContainingBlock(currentNode);
1551
+ const shouldIgnoreCurrentNode = computedStyle.position === 'fixed';
1552
+ if (shouldIgnoreCurrentNode) {
1553
+ currentContainingBlockComputedStyle = null;
1554
+ } else {
1555
+ const shouldDropCurrentNode = elementIsFixed ? !containingBlock && !currentContainingBlockComputedStyle : !containingBlock && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position);
1556
+ if (shouldDropCurrentNode) {
1557
+ // Drop non-containing blocks.
1558
+ result = result.filter(ancestor => ancestor !== currentNode);
1559
+ } else {
1560
+ // Record last containing block for next iteration.
1561
+ currentContainingBlockComputedStyle = computedStyle;
1562
+ }
1571
1563
  }
1564
+ currentNode = getParentNode(currentNode);
1572
1565
  }
1566
+ cache.set(element, result);
1567
+ return result;
1568
+ }
1573
1569
 
1574
- if (!isElement(clipperElement)) {
1575
- return [];
1576
- } // @ts-ignore isElement check ensures we return Array<Element>
1577
-
1578
-
1579
- return clippingAncestors.filter(clippingAncestors => clipperElement && isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
1580
- } // Gets the maximum area that the element is visible in due to any number of
1581
- // clipping ancestors
1582
-
1583
-
1570
+ // Gets the maximum area that the element is visible in due to any number of
1571
+ // clipping ancestors.
1584
1572
  function getClippingRect(_ref) {
1585
1573
  let {
1586
1574
  element,
@@ -1588,8 +1576,8 @@ function getClippingRect(_ref) {
1588
1576
  rootBoundary,
1589
1577
  strategy
1590
1578
  } = _ref;
1591
- const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
1592
- const clippingAncestors = [...mainClippingAncestors, rootBoundary];
1579
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
1580
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1593
1581
  const firstClippingAncestor = clippingAncestors[0];
1594
1582
  const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1595
1583
  const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
@@ -1607,6 +1595,80 @@ function getClippingRect(_ref) {
1607
1595
  };
1608
1596
  }
1609
1597
 
1598
+ function getDimensions(element) {
1599
+ if (isHTMLElement(element)) {
1600
+ return getCssDimensions(element);
1601
+ }
1602
+ return element.getBoundingClientRect();
1603
+ }
1604
+
1605
+ function getTrueOffsetParent(element, polyfill) {
1606
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
1607
+ return null;
1608
+ }
1609
+ if (polyfill) {
1610
+ return polyfill(element);
1611
+ }
1612
+ return element.offsetParent;
1613
+ }
1614
+ function getContainingBlock(element) {
1615
+ let currentNode = getParentNode(element);
1616
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1617
+ if (isContainingBlock(currentNode)) {
1618
+ return currentNode;
1619
+ } else {
1620
+ currentNode = getParentNode(currentNode);
1621
+ }
1622
+ }
1623
+ return null;
1624
+ }
1625
+
1626
+ // Gets the closest ancestor positioned element. Handles some edge cases,
1627
+ // such as table ancestors and cross browser bugs.
1628
+ function getOffsetParent(element, polyfill) {
1629
+ const window = getWindow(element);
1630
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1631
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
1632
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1633
+ }
1634
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1635
+ return window;
1636
+ }
1637
+ return offsetParent || getContainingBlock(element) || window;
1638
+ }
1639
+
1640
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1641
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1642
+ const documentElement = getDocumentElement(offsetParent);
1643
+ const rect = getBoundingClientRect(element, true, strategy === 'fixed', offsetParent);
1644
+ let scroll = {
1645
+ scrollLeft: 0,
1646
+ scrollTop: 0
1647
+ };
1648
+ const offsets = {
1649
+ x: 0,
1650
+ y: 0
1651
+ };
1652
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1653
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1654
+ scroll = getNodeScroll(offsetParent);
1655
+ }
1656
+ if (isHTMLElement(offsetParent)) {
1657
+ const offsetRect = getBoundingClientRect(offsetParent, true);
1658
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1659
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1660
+ } else if (documentElement) {
1661
+ offsets.x = getWindowScrollBarX(documentElement);
1662
+ }
1663
+ }
1664
+ return {
1665
+ x: rect.left + scroll.scrollLeft - offsets.x,
1666
+ y: rect.top + scroll.scrollTop - offsets.y,
1667
+ width: rect.width,
1668
+ height: rect.height
1669
+ };
1670
+ }
1671
+
1610
1672
  const platform = {
1611
1673
  getClippingRect,
1612
1674
  convertOffsetParentRelativeRectToViewportRelativeRect,
@@ -1614,17 +1676,21 @@ const platform = {
1614
1676
  getDimensions,
1615
1677
  getOffsetParent,
1616
1678
  getDocumentElement,
1617
- getElementRects: _ref => {
1679
+ getScale,
1680
+ async getElementRects(_ref) {
1618
1681
  let {
1619
1682
  reference,
1620
1683
  floating,
1621
1684
  strategy
1622
1685
  } = _ref;
1686
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1687
+ const getDimensionsFn = this.getDimensions;
1623
1688
  return {
1624
- reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
1625
- floating: { ...getDimensions(floating),
1689
+ reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
1690
+ floating: {
1626
1691
  x: 0,
1627
- y: 0
1692
+ y: 0,
1693
+ ...(await getDimensionsFn(floating))
1628
1694
  }
1629
1695
  };
1630
1696
  },
@@ -1634,13 +1700,16 @@ const platform = {
1634
1700
 
1635
1701
  /**
1636
1702
  * Automatically updates the position of the floating element when necessary.
1703
+ * Should only be called when the floating element is mounted on the DOM or
1704
+ * visible on the screen.
1705
+ * @returns cleanup function that should be invoked when the floating element is
1706
+ * removed from the DOM or hidden from the screen.
1637
1707
  * @see https://floating-ui.com/docs/autoUpdate
1638
1708
  */
1639
1709
  function autoUpdate(reference, floating, update, options) {
1640
1710
  if (options === void 0) {
1641
1711
  options = {};
1642
1712
  }
1643
-
1644
1713
  const {
1645
1714
  ancestorScroll: _ancestorScroll = true,
1646
1715
  ancestorResize = true,
@@ -1648,7 +1717,7 @@ function autoUpdate(reference, floating, update, options) {
1648
1717
  animationFrame = false
1649
1718
  } = options;
1650
1719
  const ancestorScroll = _ancestorScroll && !animationFrame;
1651
- const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
1720
+ const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : reference.contextElement ? getOverflowAncestors(reference.contextElement) : []), ...getOverflowAncestors(floating)] : [];
1652
1721
  ancestors.forEach(ancestor => {
1653
1722
  ancestorScroll && ancestor.addEventListener('scroll', update, {
1654
1723
  passive: true
@@ -1656,49 +1725,42 @@ function autoUpdate(reference, floating, update, options) {
1656
1725
  ancestorResize && ancestor.addEventListener('resize', update);
1657
1726
  });
1658
1727
  let observer = null;
1659
-
1660
1728
  if (elementResize) {
1661
1729
  let initialUpdate = true;
1662
1730
  observer = new ResizeObserver(() => {
1663
1731
  if (!initialUpdate) {
1664
1732
  update();
1665
1733
  }
1666
-
1667
1734
  initialUpdate = false;
1668
1735
  });
1669
1736
  isElement(reference) && !animationFrame && observer.observe(reference);
1737
+ if (!isElement(reference) && reference.contextElement && !animationFrame) {
1738
+ observer.observe(reference.contextElement);
1739
+ }
1670
1740
  observer.observe(floating);
1671
1741
  }
1672
-
1673
1742
  let frameId;
1674
1743
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1675
-
1676
1744
  if (animationFrame) {
1677
1745
  frameLoop();
1678
1746
  }
1679
-
1680
1747
  function frameLoop() {
1681
1748
  const nextRefRect = getBoundingClientRect(reference);
1682
-
1683
1749
  if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1684
1750
  update();
1685
1751
  }
1686
-
1687
1752
  prevRefRect = nextRefRect;
1688
1753
  frameId = requestAnimationFrame(frameLoop);
1689
1754
  }
1690
-
1691
1755
  update();
1692
1756
  return () => {
1693
1757
  var _observer;
1694
-
1695
1758
  ancestors.forEach(ancestor => {
1696
1759
  ancestorScroll && ancestor.removeEventListener('scroll', update);
1697
1760
  ancestorResize && ancestor.removeEventListener('resize', update);
1698
1761
  });
1699
1762
  (_observer = observer) == null ? void 0 : _observer.disconnect();
1700
1763
  observer = null;
1701
-
1702
1764
  if (animationFrame) {
1703
1765
  cancelAnimationFrame(frameId);
1704
1766
  }
@@ -1710,11 +1772,24 @@ function autoUpdate(reference, floating, update, options) {
1710
1772
  * next to a reference element when it is given a certain CSS positioning
1711
1773
  * strategy.
1712
1774
  */
1713
-
1714
- const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
1715
- platform,
1716
- ...options
1717
- });
1775
+ const computePosition = (reference, floating, options) => {
1776
+ // This caches the expensive `getClippingElementAncestors` function so that
1777
+ // multiple lifecycle resets re-use the same result. It only lives for a
1778
+ // single call. If other functions become expensive, we can add them as well.
1779
+ const cache = new Map();
1780
+ const mergedOptions = {
1781
+ platform,
1782
+ ...options
1783
+ };
1784
+ const platformWithCache = {
1785
+ ...mergedOptions.platform,
1786
+ _c: cache
1787
+ };
1788
+ return computePosition$1(reference, floating, {
1789
+ ...mergedOptions,
1790
+ platform: platformWithCache
1791
+ });
1792
+ };
1718
1793
 
1719
1794
  /**
1720
1795
  * Auto-generated file. Do not edit directly.
@@ -1722,7 +1797,7 @@ const computePosition = (reference, floating, options) => computePosition$1(refe
1722
1797
  const timeTransitionS = 125;
1723
1798
 
1724
1799
  /*!
1725
- * tabbable 6.0.0
1800
+ * tabbable 6.0.1
1726
1801
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
1727
1802
  */
1728
1803
  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'];
@@ -1734,23 +1809,22 @@ var getRootNode = !NoElement && Element.prototype.getRootNode ? function (elemen
1734
1809
  } : function (element) {
1735
1810
  return element.ownerDocument;
1736
1811
  };
1812
+
1737
1813
  /**
1738
1814
  * @param {Element} el container to check in
1739
1815
  * @param {boolean} includeContainer add container to check
1740
1816
  * @param {(node: Element) => boolean} filter filter candidates
1741
1817
  * @returns {Element[]}
1742
1818
  */
1743
-
1744
1819
  var getCandidates = function getCandidates(el, includeContainer, filter) {
1745
1820
  var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
1746
-
1747
1821
  if (includeContainer && matches.call(el, candidateSelector)) {
1748
1822
  candidates.unshift(el);
1749
1823
  }
1750
-
1751
1824
  candidates = candidates.filter(filter);
1752
1825
  return candidates;
1753
1826
  };
1827
+
1754
1828
  /**
1755
1829
  * @callback GetShadowRoot
1756
1830
  * @param {Element} element to check for shadow root
@@ -1764,9 +1838,9 @@ var getCandidates = function getCandidates(el, includeContainer, filter) {
1764
1838
  */
1765
1839
 
1766
1840
  /**
1767
- * @typedef {Object} CandidatesScope
1768
- * @property {Element} scope contains inner candidates
1769
- * @property {Element[]} candidates
1841
+ * @typedef {Object} CandidateScope
1842
+ * @property {Element} scopeParent contains inner candidates
1843
+ * @property {Element[]} candidates list of candidates found in the scope parent
1770
1844
  */
1771
1845
 
1772
1846
  /**
@@ -1775,7 +1849,7 @@ var getCandidates = function getCandidates(el, includeContainer, filter) {
1775
1849
  * if a function, implies shadow support is enabled and either returns the shadow root of an element
1776
1850
  * or a boolean stating if it has an undisclosed shadow root
1777
1851
  * @property {(node: Element) => boolean} filter filter candidates
1778
- * @property {boolean} flatten if true then result will flatten any CandidatesScope into the returned list
1852
+ * @property {boolean} flatten if true then result will flatten any CandidateScope into the returned list
1779
1853
  * @property {ShadowRootFilter} shadowRootFilter filter shadow roots;
1780
1854
  */
1781
1855
 
@@ -1783,44 +1857,38 @@ var getCandidates = function getCandidates(el, includeContainer, filter) {
1783
1857
  * @param {Element[]} elements list of element containers to match candidates from
1784
1858
  * @param {boolean} includeContainer add container list to check
1785
1859
  * @param {IterativeOptions} options
1786
- * @returns {Array.<Element|CandidatesScope>}
1860
+ * @returns {Array.<Element|CandidateScope>}
1787
1861
  */
1788
-
1789
-
1790
1862
  var getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
1791
1863
  var candidates = [];
1792
1864
  var elementsToCheck = Array.from(elements);
1793
-
1794
1865
  while (elementsToCheck.length) {
1795
1866
  var element = elementsToCheck.shift();
1796
-
1797
1867
  if (element.tagName === 'SLOT') {
1798
1868
  // add shadow dom slot scope (slot itself cannot be focusable)
1799
1869
  var assigned = element.assignedElements();
1800
1870
  var content = assigned.length ? assigned : element.children;
1801
1871
  var nestedCandidates = getCandidatesIteratively(content, true, options);
1802
-
1803
1872
  if (options.flatten) {
1804
1873
  candidates.push.apply(candidates, nestedCandidates);
1805
1874
  } else {
1806
1875
  candidates.push({
1807
- scope: element,
1876
+ scopeParent: element,
1808
1877
  candidates: nestedCandidates
1809
1878
  });
1810
1879
  }
1811
1880
  } else {
1812
1881
  // check candidate element
1813
1882
  var validCandidate = matches.call(element, candidateSelector);
1814
-
1815
1883
  if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
1816
1884
  candidates.push(element);
1817
- } // iterate over shadow content if possible
1818
-
1885
+ }
1819
1886
 
1820
- var shadowRoot = element.shadowRoot || // check for an undisclosed shadow
1887
+ // iterate over shadow content if possible
1888
+ var shadowRoot = element.shadowRoot ||
1889
+ // check for an undisclosed shadow
1821
1890
  typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);
1822
1891
  var validShadowRoot = !options.shadowRootFilter || options.shadowRootFilter(element);
1823
-
1824
1892
  if (shadowRoot && validShadowRoot) {
1825
1893
  // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
1826
1894
  // shadow exists, so look at light dom children as fallback BUT create a scope for any
@@ -1829,12 +1897,11 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
1829
1897
  // slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,
1830
1898
  // _after_ we return from this recursive call
1831
1899
  var _nestedCandidates = getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
1832
-
1833
1900
  if (options.flatten) {
1834
1901
  candidates.push.apply(candidates, _nestedCandidates);
1835
1902
  } else {
1836
1903
  candidates.push({
1837
- scope: element,
1904
+ scopeParent: element,
1838
1905
  candidates: _nestedCandidates
1839
1906
  });
1840
1907
  }
@@ -1845,10 +1912,8 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
1845
1912
  }
1846
1913
  }
1847
1914
  }
1848
-
1849
1915
  return candidates;
1850
1916
  };
1851
-
1852
1917
  var getTabindex = function getTabindex(node, isScope) {
1853
1918
  if (node.tabIndex < 0) {
1854
1919
  // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
@@ -1866,29 +1931,23 @@ var getTabindex = function getTabindex(node, isScope) {
1866
1931
  return 0;
1867
1932
  }
1868
1933
  }
1869
-
1870
1934
  return node.tabIndex;
1871
1935
  };
1872
-
1873
1936
  var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
1874
1937
  return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
1875
1938
  };
1876
-
1877
1939
  var isInput = function isInput(node) {
1878
1940
  return node.tagName === 'INPUT';
1879
1941
  };
1880
-
1881
1942
  var isHiddenInput = function isHiddenInput(node) {
1882
1943
  return isInput(node) && node.type === 'hidden';
1883
1944
  };
1884
-
1885
1945
  var isDetailsWithSummary = function isDetailsWithSummary(node) {
1886
1946
  var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) {
1887
1947
  return child.tagName === 'SUMMARY';
1888
1948
  });
1889
1949
  return r;
1890
1950
  };
1891
-
1892
1951
  var getCheckedRadio = function getCheckedRadio(nodes, form) {
1893
1952
  for (var i = 0; i < nodes.length; i++) {
1894
1953
  if (nodes[i].checked && nodes[i].form === form) {
@@ -1896,20 +1955,15 @@ var getCheckedRadio = function getCheckedRadio(nodes, form) {
1896
1955
  }
1897
1956
  }
1898
1957
  };
1899
-
1900
1958
  var isTabbableRadio = function isTabbableRadio(node) {
1901
1959
  if (!node.name) {
1902
1960
  return true;
1903
1961
  }
1904
-
1905
1962
  var radioScope = node.form || getRootNode(node);
1906
-
1907
1963
  var queryRadios = function queryRadios(name) {
1908
1964
  return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
1909
1965
  };
1910
-
1911
1966
  var radioSet;
1912
-
1913
1967
  if (typeof window !== 'undefined' && typeof window.CSS !== 'undefined' && typeof window.CSS.escape === 'function') {
1914
1968
  radioSet = queryRadios(window.CSS.escape(node.name));
1915
1969
  } else {
@@ -1921,23 +1975,19 @@ var isTabbableRadio = function isTabbableRadio(node) {
1921
1975
  return false;
1922
1976
  }
1923
1977
  }
1924
-
1925
1978
  var checked = getCheckedRadio(radioSet, node.form);
1926
1979
  return !checked || checked === node;
1927
1980
  };
1928
-
1929
1981
  var isRadio = function isRadio(node) {
1930
1982
  return isInput(node) && node.type === 'radio';
1931
1983
  };
1932
-
1933
1984
  var isNonTabbableRadio = function isNonTabbableRadio(node) {
1934
1985
  return isRadio(node) && !isTabbableRadio(node);
1935
- }; // determines if a node is ultimately attached to the window's document
1936
-
1986
+ };
1937
1987
 
1988
+ // determines if a node is ultimately attached to the window's document
1938
1989
  var isNodeAttached = function isNodeAttached(node) {
1939
1990
  var _nodeRootHost;
1940
-
1941
1991
  // The root node is the shadow root if the node is in a shadow DOM; some document otherwise
1942
1992
  // (but NOT _the_ document; see second 'If' comment below for more).
1943
1993
  // If rootNode is shadow root, it'll have a host, which is the element to which the shadow
@@ -1959,32 +2009,25 @@ var isNodeAttached = function isNodeAttached(node) {
1959
2009
  // node is actually detached.
1960
2010
  var nodeRootHost = getRootNode(node).host;
1961
2011
  var attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && _nodeRootHost.ownerDocument.contains(nodeRootHost) || node.ownerDocument.contains(node));
1962
-
1963
2012
  while (!attached && nodeRootHost) {
1964
2013
  var _nodeRootHost2;
1965
-
1966
2014
  // since it's not attached and we have a root host, the node MUST be in a nested shadow DOM,
1967
2015
  // which means we need to get the host's host and check if that parent host is contained
1968
2016
  // in (i.e. attached to) the document
1969
2017
  nodeRootHost = getRootNode(nodeRootHost).host;
1970
2018
  attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && _nodeRootHost2.ownerDocument.contains(nodeRootHost));
1971
2019
  }
1972
-
1973
2020
  return attached;
1974
2021
  };
1975
-
1976
2022
  var isZeroArea = function isZeroArea(node) {
1977
2023
  var _node$getBoundingClie = node.getBoundingClientRect(),
1978
- width = _node$getBoundingClie.width,
1979
- height = _node$getBoundingClie.height;
1980
-
2024
+ width = _node$getBoundingClie.width,
2025
+ height = _node$getBoundingClie.height;
1981
2026
  return width === 0 && height === 0;
1982
2027
  };
1983
-
1984
2028
  var isHidden = function isHidden(node, _ref) {
1985
2029
  var displayCheck = _ref.displayCheck,
1986
- getShadowRoot = _ref.getShadowRoot;
1987
-
2030
+ getShadowRoot = _ref.getShadowRoot;
1988
2031
  // NOTE: visibility will be `undefined` if node is detached from the document
1989
2032
  // (see notes about this further down), which means we will consider it visible
1990
2033
  // (this is legacy behavior from a very long way back)
@@ -1993,24 +2036,19 @@ var isHidden = function isHidden(node, _ref) {
1993
2036
  if (getComputedStyle(node).visibility === 'hidden') {
1994
2037
  return true;
1995
2038
  }
1996
-
1997
2039
  var isDirectSummary = matches.call(node, 'details>summary:first-of-type');
1998
2040
  var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
1999
-
2000
2041
  if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
2001
2042
  return true;
2002
2043
  }
2003
-
2004
2044
  if (!displayCheck || displayCheck === 'full' || displayCheck === 'legacy-full') {
2005
2045
  if (typeof getShadowRoot === 'function') {
2006
2046
  // figure out if we should consider the node to be in an undisclosed shadow and use the
2007
2047
  // 'non-zero-area' fallback
2008
2048
  var originalNode = node;
2009
-
2010
2049
  while (node) {
2011
2050
  var parentElement = node.parentElement;
2012
2051
  var rootNode = getRootNode(node);
2013
-
2014
2052
  if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true // check if there's an undisclosed shadow
2015
2053
  ) {
2016
2054
  // node has an undisclosed shadow which means we can only treat it as a black box, so we
@@ -2027,25 +2065,27 @@ var isHidden = function isHidden(node, _ref) {
2027
2065
  node = parentElement;
2028
2066
  }
2029
2067
  }
2030
-
2031
2068
  node = originalNode;
2032
- } // else, `getShadowRoot` might be true, but all that does is enable shadow DOM support
2069
+ }
2070
+ // else, `getShadowRoot` might be true, but all that does is enable shadow DOM support
2033
2071
  // (i.e. it does not also presume that all nodes might have undisclosed shadows); or
2034
2072
  // it might be a falsy value, which means shadow DOM support is disabled
2073
+
2035
2074
  // Since we didn't find it sitting in an undisclosed shadow (or shadows are disabled)
2036
2075
  // now we can just test to see if it would normally be visible or not, provided it's
2037
2076
  // attached to the main document.
2038
2077
  // NOTE: We must consider case where node is inside a shadow DOM and given directly to
2039
2078
  // `isTabbable()` or `isFocusable()` -- regardless of `getShadowRoot` option setting.
2040
2079
 
2041
-
2042
2080
  if (isNodeAttached(node)) {
2043
2081
  // this works wherever the node is: if there's at least one client rect, it's
2044
2082
  // somehow displayed; it also covers the CSS 'display: contents' case where the
2045
2083
  // node itself is hidden in place of its contents; and there's no need to search
2046
2084
  // up the hierarchy either
2047
2085
  return !node.getClientRects().length;
2048
- } // Else, the node isn't attached to the document, which means the `getClientRects()`
2086
+ }
2087
+
2088
+ // Else, the node isn't attached to the document, which means the `getClientRects()`
2049
2089
  // API will __always__ return zero rects (this can happen, for example, if React
2050
2090
  // is used to render nodes onto a detached tree, as confirmed in this thread:
2051
2091
  // https://github.com/facebook/react/issues/9117#issuecomment-284228870)
@@ -2061,12 +2101,10 @@ var isHidden = function isHidden(node, _ref) {
2061
2101
  //
2062
2102
  // v6.0.0: As of this major release, the default 'full' option __no longer treats detached
2063
2103
  // nodes as visible with the 'none' fallback.__
2064
-
2065
-
2066
2104
  if (displayCheck !== 'legacy-full') {
2067
2105
  return true; // hidden
2068
- } // else, fallback to 'none' mode and consider the node visible
2069
-
2106
+ }
2107
+ // else, fallback to 'none' mode and consider the node visible
2070
2108
  } else if (displayCheck === 'non-zero-area') {
2071
2109
  // NOTE: Even though this tests that the node's client rect is non-zero to determine
2072
2110
  // whether it's displayed, and that a detached node will __always__ have a zero-area
@@ -2074,89 +2112,79 @@ var isHidden = function isHidden(node, _ref) {
2074
2112
  // this mode, we do want to consider nodes that have a zero area to be hidden at all
2075
2113
  // times, and that includes attached or not.
2076
2114
  return isZeroArea(node);
2077
- } // visible, as far as we can tell, or per current `displayCheck=none` mode, we assume
2078
- // it's visible
2079
-
2115
+ }
2080
2116
 
2117
+ // visible, as far as we can tell, or per current `displayCheck=none` mode, we assume
2118
+ // it's visible
2081
2119
  return false;
2082
- }; // form fields (nested) inside a disabled fieldset are not focusable/tabbable
2120
+ };
2121
+
2122
+ // form fields (nested) inside a disabled fieldset are not focusable/tabbable
2083
2123
  // unless they are in the _first_ <legend> element of the top-most disabled
2084
2124
  // fieldset
2085
-
2086
-
2087
2125
  var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
2088
2126
  if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
2089
- var parentNode = node.parentElement; // check if `node` is contained in a disabled <fieldset>
2090
-
2127
+ var parentNode = node.parentElement;
2128
+ // check if `node` is contained in a disabled <fieldset>
2091
2129
  while (parentNode) {
2092
2130
  if (parentNode.tagName === 'FIELDSET' && parentNode.disabled) {
2093
2131
  // look for the first <legend> among the children of the disabled <fieldset>
2094
2132
  for (var i = 0; i < parentNode.children.length; i++) {
2095
- var child = parentNode.children.item(i); // when the first <legend> (in document order) is found
2096
-
2133
+ var child = parentNode.children.item(i);
2134
+ // when the first <legend> (in document order) is found
2097
2135
  if (child.tagName === 'LEGEND') {
2098
2136
  // if its parent <fieldset> is not nested in another disabled <fieldset>,
2099
2137
  // return whether `node` is a descendant of its first <legend>
2100
2138
  return matches.call(parentNode, 'fieldset[disabled] *') ? true : !child.contains(node);
2101
2139
  }
2102
- } // the disabled <fieldset> containing `node` has no <legend>
2103
-
2104
-
2140
+ }
2141
+ // the disabled <fieldset> containing `node` has no <legend>
2105
2142
  return true;
2106
2143
  }
2107
-
2108
2144
  parentNode = parentNode.parentElement;
2109
2145
  }
2110
- } // else, node's tabbable/focusable state should not be affected by a fieldset's
2111
- // enabled/disabled state
2112
-
2146
+ }
2113
2147
 
2148
+ // else, node's tabbable/focusable state should not be affected by a fieldset's
2149
+ // enabled/disabled state
2114
2150
  return false;
2115
2151
  };
2116
-
2117
2152
  var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
2118
- if (node.disabled || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus
2153
+ if (node.disabled || isHiddenInput(node) || isHidden(node, options) ||
2154
+ // For a details element with a summary, the summary element gets the focus
2119
2155
  isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
2120
2156
  return false;
2121
2157
  }
2122
-
2123
2158
  return true;
2124
2159
  };
2125
-
2126
2160
  var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
2127
2161
  if (isNonTabbableRadio(node) || getTabindex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
2128
2162
  return false;
2129
2163
  }
2130
-
2131
2164
  return true;
2132
2165
  };
2133
-
2134
2166
  var isValidShadowRootTabbable = function isValidShadowRootTabbable(shadowHostNode) {
2135
2167
  var tabIndex = parseInt(shadowHostNode.getAttribute('tabindex'), 10);
2136
-
2137
2168
  if (isNaN(tabIndex) || tabIndex >= 0) {
2138
2169
  return true;
2139
- } // If a custom element has an explicit negative tabindex,
2170
+ }
2171
+ // If a custom element has an explicit negative tabindex,
2140
2172
  // browsers will not allow tab targeting said element's children.
2141
-
2142
-
2143
2173
  return false;
2144
2174
  };
2175
+
2145
2176
  /**
2146
- * @param {Array.<Element|CandidatesScope>} candidates
2177
+ * @param {Array.<Element|CandidateScope>} candidates
2147
2178
  * @returns Element[]
2148
2179
  */
2149
-
2150
-
2151
2180
  var sortByOrder = function sortByOrder(candidates) {
2152
2181
  var regularTabbables = [];
2153
2182
  var orderedTabbables = [];
2154
2183
  candidates.forEach(function (item, i) {
2155
- var isScope = !!item.scope;
2156
- var element = isScope ? item.scope : item;
2184
+ var isScope = !!item.scopeParent;
2185
+ var element = isScope ? item.scopeParent : item;
2157
2186
  var candidateTabindex = getTabindex(element, isScope);
2158
2187
  var elements = isScope ? sortByOrder(item.candidates) : element;
2159
-
2160
2188
  if (candidateTabindex === 0) {
2161
2189
  isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
2162
2190
  } else {
@@ -2174,11 +2202,9 @@ var sortByOrder = function sortByOrder(candidates) {
2174
2202
  return acc;
2175
2203
  }, []).concat(regularTabbables);
2176
2204
  };
2177
-
2178
2205
  var tabbable = function tabbable(el, options) {
2179
2206
  options = options || {};
2180
2207
  var candidates;
2181
-
2182
2208
  if (options.getShadowRoot) {
2183
2209
  candidates = getCandidatesIteratively([el], options.includeContainer, {
2184
2210
  filter: isNodeMatchingSelectorTabbable.bind(null, options),
@@ -2189,14 +2215,11 @@ var tabbable = function tabbable(el, options) {
2189
2215
  } else {
2190
2216
  candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
2191
2217
  }
2192
-
2193
2218
  return sortByOrder(candidates);
2194
2219
  };
2195
-
2196
2220
  var focusable = function focusable(el, options) {
2197
2221
  options = options || {};
2198
2222
  var candidates;
2199
-
2200
2223
  if (options.getShadowRoot) {
2201
2224
  candidates = getCandidatesIteratively([el], options.includeContainer, {
2202
2225
  filter: isNodeMatchingSelectorFocusable.bind(null, options),
@@ -2206,58 +2229,45 @@ var focusable = function focusable(el, options) {
2206
2229
  } else {
2207
2230
  candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
2208
2231
  }
2209
-
2210
2232
  return candidates;
2211
2233
  };
2212
-
2213
2234
  var isTabbable = function isTabbable(node, options) {
2214
2235
  options = options || {};
2215
-
2216
2236
  if (!node) {
2217
2237
  throw new Error('No node provided');
2218
2238
  }
2219
-
2220
2239
  if (matches.call(node, candidateSelector) === false) {
2221
2240
  return false;
2222
2241
  }
2223
-
2224
2242
  return isNodeMatchingSelectorTabbable(options, node);
2225
2243
  };
2226
-
2227
2244
  var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
2228
-
2229
2245
  var isFocusable = function isFocusable(node, options) {
2230
2246
  options = options || {};
2231
-
2232
2247
  if (!node) {
2233
2248
  throw new Error('No node provided');
2234
2249
  }
2235
-
2236
2250
  if (matches.call(node, focusableCandidateSelector) === false) {
2237
2251
  return false;
2238
2252
  }
2239
-
2240
2253
  return isNodeMatchingSelectorFocusable(options, node);
2241
2254
  };
2242
2255
 
2243
2256
  /*!
2244
- * focus-trap 7.0.0
2257
+ * focus-trap 7.2.0
2245
2258
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
2246
2259
  */
2247
2260
 
2248
2261
  function ownKeys(object, enumerableOnly) {
2249
2262
  var keys = Object.keys(object);
2250
-
2251
2263
  if (Object.getOwnPropertySymbols) {
2252
2264
  var symbols = Object.getOwnPropertySymbols(object);
2253
2265
  enumerableOnly && (symbols = symbols.filter(function (sym) {
2254
2266
  return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2255
2267
  })), keys.push.apply(keys, symbols);
2256
2268
  }
2257
-
2258
2269
  return keys;
2259
2270
  }
2260
-
2261
2271
  function _objectSpread2(target) {
2262
2272
  for (var i = 1; i < arguments.length; i++) {
2263
2273
  var source = null != arguments[i] ? arguments[i] : {};
@@ -2267,11 +2277,10 @@ function _objectSpread2(target) {
2267
2277
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2268
2278
  });
2269
2279
  }
2270
-
2271
2280
  return target;
2272
2281
  }
2273
-
2274
2282
  function _defineProperty(obj, key, value) {
2283
+ key = _toPropertyKey(key);
2275
2284
  if (key in obj) {
2276
2285
  Object.defineProperty(obj, key, {
2277
2286
  value: value,
@@ -2282,64 +2291,75 @@ function _defineProperty(obj, key, value) {
2282
2291
  } else {
2283
2292
  obj[key] = value;
2284
2293
  }
2285
-
2286
2294
  return obj;
2287
2295
  }
2296
+ function _toPrimitive(input, hint) {
2297
+ if (typeof input !== "object" || input === null) return input;
2298
+ var prim = input[Symbol.toPrimitive];
2299
+ if (prim !== undefined) {
2300
+ var res = prim.call(input, hint || "default");
2301
+ if (typeof res !== "object") return res;
2302
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2303
+ }
2304
+ return (hint === "string" ? String : Number)(input);
2305
+ }
2306
+ function _toPropertyKey(arg) {
2307
+ var key = _toPrimitive(arg, "string");
2308
+ return typeof key === "symbol" ? key : String(key);
2309
+ }
2288
2310
 
2289
- var activeFocusTraps = function () {
2290
- var trapQueue = [];
2291
- return {
2292
- activateTrap: function activateTrap(trap) {
2293
- if (trapQueue.length > 0) {
2294
- var activeTrap = trapQueue[trapQueue.length - 1];
2295
-
2296
- if (activeTrap !== trap) {
2297
- activeTrap.pause();
2298
- }
2299
- }
2300
-
2301
- var trapIndex = trapQueue.indexOf(trap);
2302
-
2303
- if (trapIndex === -1) {
2304
- trapQueue.push(trap);
2305
- } else {
2306
- // move this existing trap to the front of the queue
2307
- trapQueue.splice(trapIndex, 1);
2308
- trapQueue.push(trap);
2309
- }
2310
- },
2311
- deactivateTrap: function deactivateTrap(trap) {
2312
- var trapIndex = trapQueue.indexOf(trap);
2313
-
2314
- if (trapIndex !== -1) {
2315
- trapQueue.splice(trapIndex, 1);
2316
- }
2317
-
2318
- if (trapQueue.length > 0) {
2319
- trapQueue[trapQueue.length - 1].unpause();
2311
+ var activeFocusTraps = {
2312
+ activateTrap: function activateTrap(trapStack, trap) {
2313
+ if (trapStack.length > 0) {
2314
+ var activeTrap = trapStack[trapStack.length - 1];
2315
+ if (activeTrap !== trap) {
2316
+ activeTrap.pause();
2320
2317
  }
2321
2318
  }
2322
- };
2323
- }();
2324
-
2319
+ var trapIndex = trapStack.indexOf(trap);
2320
+ if (trapIndex === -1) {
2321
+ trapStack.push(trap);
2322
+ } else {
2323
+ // move this existing trap to the front of the queue
2324
+ trapStack.splice(trapIndex, 1);
2325
+ trapStack.push(trap);
2326
+ }
2327
+ },
2328
+ deactivateTrap: function deactivateTrap(trapStack, trap) {
2329
+ var trapIndex = trapStack.indexOf(trap);
2330
+ if (trapIndex !== -1) {
2331
+ trapStack.splice(trapIndex, 1);
2332
+ }
2333
+ if (trapStack.length > 0) {
2334
+ trapStack[trapStack.length - 1].unpause();
2335
+ }
2336
+ }
2337
+ };
2325
2338
  var isSelectableInput = function isSelectableInput(node) {
2326
2339
  return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
2327
2340
  };
2328
-
2329
2341
  var isEscapeEvent = function isEscapeEvent(e) {
2330
2342
  return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
2331
2343
  };
2332
-
2333
2344
  var isTabEvent = function isTabEvent(e) {
2334
2345
  return e.key === 'Tab' || e.keyCode === 9;
2335
2346
  };
2336
2347
 
2348
+ // checks for TAB by default
2349
+ var isKeyForward = function isKeyForward(e) {
2350
+ return isTabEvent(e) && !e.shiftKey;
2351
+ };
2352
+
2353
+ // checks for SHIFT+TAB by default
2354
+ var isKeyBackward = function isKeyBackward(e) {
2355
+ return isTabEvent(e) && e.shiftKey;
2356
+ };
2337
2357
  var delay$1 = function delay(fn) {
2338
2358
  return setTimeout(fn, 0);
2339
- }; // Array.find/findIndex() are not supported on IE; this replicates enough
2340
- // of Array.findIndex() for our needs
2341
-
2359
+ };
2342
2360
 
2361
+ // Array.find/findIndex() are not supported on IE; this replicates enough
2362
+ // of Array.findIndex() for our needs
2343
2363
  var findIndex = function findIndex(arr, fn) {
2344
2364
  var idx = -1;
2345
2365
  arr.every(function (value, i) {
@@ -2350,8 +2370,10 @@ var findIndex = function findIndex(arr, fn) {
2350
2370
 
2351
2371
  return true; // next
2352
2372
  });
2373
+
2353
2374
  return idx;
2354
2375
  };
2376
+
2355
2377
  /**
2356
2378
  * Get an option's value when it could be a plain value, or a handler that provides
2357
2379
  * the value.
@@ -2359,16 +2381,12 @@ var findIndex = function findIndex(arr, fn) {
2359
2381
  * @param {...*} [params] Any parameters to pass to the handler, if `value` is a function.
2360
2382
  * @returns {*} The `value`, or the handler's returned value.
2361
2383
  */
2362
-
2363
-
2364
2384
  var valueOrHandler = function valueOrHandler(value) {
2365
2385
  for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2366
2386
  params[_key - 1] = arguments[_key];
2367
2387
  }
2368
-
2369
2388
  return typeof value === 'function' ? value.apply(void 0, params) : value;
2370
2389
  };
2371
-
2372
2390
  var getActualTarget = function getActualTarget(event) {
2373
2391
  // NOTE: If the trap is _inside_ a shadow DOM, event.target will always be the
2374
2392
  // shadow host. However, event.target.composedPath() will be an array of
@@ -2380,17 +2398,21 @@ var getActualTarget = function getActualTarget(event) {
2380
2398
  return event.target.shadowRoot && typeof event.composedPath === 'function' ? event.composedPath()[0] : event.target;
2381
2399
  };
2382
2400
 
2401
+ // NOTE: this must be _outside_ `createFocusTrap()` to make sure all traps in this
2402
+ // current instance use the same stack if `userOptions.trapStack` isn't specified
2403
+ var internalTrapStack = [];
2383
2404
  var createFocusTrap = function createFocusTrap(elements, userOptions) {
2384
2405
  // SSR: a live trap shouldn't be created in this type of environment so this
2385
2406
  // should be safe code to execute if the `document` option isn't specified
2386
2407
  var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document;
2387
-
2408
+ var trapStack = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.trapStack) || internalTrapStack;
2388
2409
  var config = _objectSpread2({
2389
2410
  returnFocusOnDeactivate: true,
2390
2411
  escapeDeactivates: true,
2391
- delayInitialFocus: true
2412
+ delayInitialFocus: true,
2413
+ isKeyForward: isKeyForward,
2414
+ isKeyBackward: isKeyBackward
2392
2415
  }, userOptions);
2393
-
2394
2416
  var state = {
2395
2417
  // containers given to createFocusTrap()
2396
2418
  // @type {Array<HTMLElement>}
@@ -2410,6 +2432,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2410
2432
  // }>}
2411
2433
  containerGroups: [],
2412
2434
  // same order/length as `containers` list
2435
+
2413
2436
  // references to objects in `containerGroups`, but only those that actually have
2414
2437
  // tabbable nodes in them
2415
2438
  // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
@@ -2433,10 +2456,10 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2433
2456
  * @param {string|undefined} [configOptionName] Name of option to use __instead of__ `optionName`
2434
2457
  * IIF `configOverrideOptions` is not defined. Otherwise, `optionName` is used.
2435
2458
  */
2436
-
2437
2459
  var getOption = function getOption(configOverrideOptions, optionName, configOptionName) {
2438
2460
  return configOverrideOptions && configOverrideOptions[optionName] !== undefined ? configOverrideOptions[optionName] : config[configOptionName || optionName];
2439
2461
  };
2462
+
2440
2463
  /**
2441
2464
  * Finds the index of the container that contains the element.
2442
2465
  * @param {HTMLElement} element
@@ -2444,16 +2467,15 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2444
2467
  * `state.containerGroups` (the order/length of these lists are the same); -1
2445
2468
  * if the element isn't found.
2446
2469
  */
2447
-
2448
-
2449
2470
  var findContainerIndex = function findContainerIndex(element) {
2450
2471
  // NOTE: search `containerGroups` because it's possible a group contains no tabbable
2451
2472
  // nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
2452
2473
  // and we still need to find the element in there
2453
2474
  return state.containerGroups.findIndex(function (_ref) {
2454
2475
  var container = _ref.container,
2455
- tabbableNodes = _ref.tabbableNodes;
2456
- return container.contains(element) || // fall back to explicit tabbable search which will take into consideration any
2476
+ tabbableNodes = _ref.tabbableNodes;
2477
+ return container.contains(element) ||
2478
+ // fall back to explicit tabbable search which will take into consideration any
2457
2479
  // web components if the `tabbableOptions.getShadowRoot` option was used for
2458
2480
  // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
2459
2481
  // look inside web components even if open)
@@ -2462,6 +2484,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2462
2484
  });
2463
2485
  });
2464
2486
  };
2487
+
2465
2488
  /**
2466
2489
  * Gets the node for the given option, which is expected to be an option that
2467
2490
  * can be either a DOM node, a string that is a selector to get a node, `false`
@@ -2475,19 +2498,14 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2475
2498
  * @throws {Error} If the option is set, not `false`, and is not, or does not
2476
2499
  * resolve to a node.
2477
2500
  */
2478
-
2479
-
2480
2501
  var getNodeForOption = function getNodeForOption(optionName) {
2481
2502
  var optionValue = config[optionName];
2482
-
2483
2503
  if (typeof optionValue === 'function') {
2484
2504
  for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2485
2505
  params[_key2 - 1] = arguments[_key2];
2486
2506
  }
2487
-
2488
2507
  optionValue = optionValue.apply(void 0, params);
2489
2508
  }
2490
-
2491
2509
  if (optionValue === true) {
2492
2510
  optionValue = undefined; // use default value
2493
2511
  }
@@ -2495,56 +2513,51 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2495
2513
  if (!optionValue) {
2496
2514
  if (optionValue === undefined || optionValue === false) {
2497
2515
  return optionValue;
2498
- } // else, empty string (invalid), null (invalid), 0 (invalid)
2499
-
2516
+ }
2517
+ // else, empty string (invalid), null (invalid), 0 (invalid)
2500
2518
 
2501
2519
  throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node"));
2502
2520
  }
2503
-
2504
2521
  var node = optionValue; // could be HTMLElement, SVGElement, or non-empty string at this point
2505
2522
 
2506
2523
  if (typeof optionValue === 'string') {
2507
2524
  node = doc.querySelector(optionValue); // resolve to node, or null if fails
2508
-
2509
2525
  if (!node) {
2510
2526
  throw new Error("`".concat(optionName, "` as selector refers to no known node"));
2511
2527
  }
2512
2528
  }
2513
-
2514
2529
  return node;
2515
2530
  };
2516
-
2517
2531
  var getInitialFocusNode = function getInitialFocusNode() {
2518
- var node = getNodeForOption('initialFocus'); // false explicitly indicates we want no initialFocus at all
2532
+ var node = getNodeForOption('initialFocus');
2519
2533
 
2534
+ // false explicitly indicates we want no initialFocus at all
2520
2535
  if (node === false) {
2521
2536
  return false;
2522
2537
  }
2523
-
2524
2538
  if (node === undefined) {
2525
2539
  // option not specified: use fallback options
2526
2540
  if (findContainerIndex(doc.activeElement) >= 0) {
2527
2541
  node = doc.activeElement;
2528
2542
  } else {
2529
2543
  var firstTabbableGroup = state.tabbableGroups[0];
2530
- var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode; // NOTE: `fallbackFocus` option function cannot return `false` (not supported)
2544
+ var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
2531
2545
 
2546
+ // NOTE: `fallbackFocus` option function cannot return `false` (not supported)
2532
2547
  node = firstTabbableNode || getNodeForOption('fallbackFocus');
2533
2548
  }
2534
2549
  }
2535
-
2536
2550
  if (!node) {
2537
2551
  throw new Error('Your focus-trap needs to have at least one focusable element');
2538
2552
  }
2539
-
2540
2553
  return node;
2541
2554
  };
2542
-
2543
2555
  var updateTabbableNodes = function updateTabbableNodes() {
2544
2556
  state.containerGroups = state.containers.map(function (container) {
2545
- var tabbableNodes = tabbable(container, config.tabbableOptions); // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
2546
- // are a superset of tabbable nodes
2557
+ var tabbableNodes = tabbable(container, config.tabbableOptions);
2547
2558
 
2559
+ // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
2560
+ // are a superset of tabbable nodes
2548
2561
  var focusableNodes = focusable(container, config.tabbableOptions);
2549
2562
  return {
2550
2563
  container: container,
@@ -2552,7 +2565,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2552
2565
  focusableNodes: focusableNodes,
2553
2566
  firstTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[0] : null,
2554
2567
  lastTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : null,
2555
-
2556
2568
  /**
2557
2569
  * Finds the __tabbable__ node that follows the given node in the specified direction,
2558
2570
  * in this container, if any.
@@ -2576,17 +2588,14 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2576
2588
  var nodeIdx = focusableNodes.findIndex(function (n) {
2577
2589
  return n === node;
2578
2590
  });
2579
-
2580
2591
  if (nodeIdx < 0) {
2581
2592
  return undefined;
2582
2593
  }
2583
-
2584
2594
  if (forward) {
2585
2595
  return focusableNodes.slice(nodeIdx + 1).find(function (n) {
2586
2596
  return isTabbable(n, config.tabbableOptions);
2587
2597
  });
2588
2598
  }
2589
-
2590
2599
  return focusableNodes.slice(0, nodeIdx).reverse().find(function (n) {
2591
2600
  return isTabbable(n, config.tabbableOptions);
2592
2601
  });
@@ -2595,53 +2604,46 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2595
2604
  });
2596
2605
  state.tabbableGroups = state.containerGroups.filter(function (group) {
2597
2606
  return group.tabbableNodes.length > 0;
2598
- }); // throw if no groups have tabbable nodes and we don't have a fallback focus node either
2607
+ });
2599
2608
 
2609
+ // throw if no groups have tabbable nodes and we don't have a fallback focus node either
2600
2610
  if (state.tabbableGroups.length <= 0 && !getNodeForOption('fallbackFocus') // returning false not supported for this option
2601
2611
  ) {
2602
2612
  throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
2603
2613
  }
2604
2614
  };
2605
-
2606
2615
  var tryFocus = function tryFocus(node) {
2607
2616
  if (node === false) {
2608
2617
  return;
2609
2618
  }
2610
-
2611
2619
  if (node === doc.activeElement) {
2612
2620
  return;
2613
2621
  }
2614
-
2615
2622
  if (!node || !node.focus) {
2616
2623
  tryFocus(getInitialFocusNode());
2617
2624
  return;
2618
2625
  }
2619
-
2620
2626
  node.focus({
2621
2627
  preventScroll: !!config.preventScroll
2622
2628
  });
2623
2629
  state.mostRecentlyFocusedNode = node;
2624
-
2625
2630
  if (isSelectableInput(node)) {
2626
2631
  node.select();
2627
2632
  }
2628
2633
  };
2629
-
2630
2634
  var getReturnFocusNode = function getReturnFocusNode(previousActiveElement) {
2631
2635
  var node = getNodeForOption('setReturnFocus', previousActiveElement);
2632
2636
  return node ? node : node === false ? false : previousActiveElement;
2633
- }; // This needs to be done on mousedown and touchstart instead of click
2634
- // so that it precedes the focus event.
2635
-
2637
+ };
2636
2638
 
2639
+ // This needs to be done on mousedown and touchstart instead of click
2640
+ // so that it precedes the focus event.
2637
2641
  var checkPointerDown = function checkPointerDown(e) {
2638
2642
  var target = getActualTarget(e);
2639
-
2640
2643
  if (findContainerIndex(target) >= 0) {
2641
2644
  // allow the click since it ocurred inside the trap
2642
2645
  return;
2643
2646
  }
2644
-
2645
2647
  if (valueOrHandler(config.clickOutsideDeactivates, e)) {
2646
2648
  // immediately deactivate the trap
2647
2649
  trap.deactivate({
@@ -2659,25 +2661,26 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2659
2661
  returnFocus: config.returnFocusOnDeactivate && !isFocusable(target, config.tabbableOptions)
2660
2662
  });
2661
2663
  return;
2662
- } // This is needed for mobile devices.
2664
+ }
2665
+
2666
+ // This is needed for mobile devices.
2663
2667
  // (If we'll only let `click` events through,
2664
2668
  // then on mobile they will be blocked anyways if `touchstart` is blocked.)
2665
-
2666
-
2667
2669
  if (valueOrHandler(config.allowOutsideClick, e)) {
2668
2670
  // allow the click outside the trap to take place
2669
2671
  return;
2670
- } // otherwise, prevent the click
2671
-
2672
+ }
2672
2673
 
2674
+ // otherwise, prevent the click
2673
2675
  e.preventDefault();
2674
- }; // In case focus escapes the trap for some strange reason, pull it back in.
2675
-
2676
+ };
2676
2677
 
2678
+ // In case focus escapes the trap for some strange reason, pull it back in.
2677
2679
  var checkFocusIn = function checkFocusIn(e) {
2678
2680
  var target = getActualTarget(e);
2679
- var targetContained = findContainerIndex(target) >= 0; // In Firefox when you Tab out of an iframe the Document is briefly focused.
2681
+ var targetContained = findContainerIndex(target) >= 0;
2680
2682
 
2683
+ // In Firefox when you Tab out of an iframe the Document is briefly focused.
2681
2684
  if (targetContained || target instanceof Document) {
2682
2685
  if (targetContained) {
2683
2686
  state.mostRecentlyFocusedNode = target;
@@ -2687,42 +2690,41 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2687
2690
  e.stopImmediatePropagation();
2688
2691
  tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
2689
2692
  }
2690
- }; // Hijack Tab events on the first and last focusable nodes of the trap,
2693
+ };
2694
+
2695
+ // Hijack key nav events on the first and last focusable nodes of the trap,
2691
2696
  // in order to prevent focus from escaping. If it escapes for even a
2692
2697
  // moment it can end up scrolling the page and causing confusion so we
2693
2698
  // kind of need to capture the action at the keydown phase.
2694
-
2695
-
2696
- var checkTab = function checkTab(e) {
2697
- var target = getActualTarget(e);
2699
+ var checkKeyNav = function checkKeyNav(event) {
2700
+ var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2701
+ var target = getActualTarget(event);
2698
2702
  updateTabbableNodes();
2699
2703
  var destinationNode = null;
2700
-
2701
2704
  if (state.tabbableGroups.length > 0) {
2702
2705
  // make sure the target is actually contained in a group
2703
2706
  // NOTE: the target may also be the container itself if it's focusable
2704
2707
  // with tabIndex='-1' and was given initial focus
2705
2708
  var containerIndex = findContainerIndex(target);
2706
2709
  var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;
2707
-
2708
2710
  if (containerIndex < 0) {
2709
2711
  // target not found in any group: quite possible focus has escaped the trap,
2710
- // so bring it back in to...
2711
- if (e.shiftKey) {
2712
+ // so bring it back into...
2713
+ if (isBackward) {
2712
2714
  // ...the last node in the last group
2713
2715
  destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
2714
2716
  } else {
2715
2717
  // ...the first node in the first group
2716
2718
  destinationNode = state.tabbableGroups[0].firstTabbableNode;
2717
2719
  }
2718
- } else if (e.shiftKey) {
2720
+ } else if (isBackward) {
2719
2721
  // REVERSE
2722
+
2720
2723
  // is the target the first tabbable node in a group?
2721
2724
  var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref2) {
2722
2725
  var firstTabbableNode = _ref2.firstTabbableNode;
2723
2726
  return target === firstTabbableNode;
2724
2727
  });
2725
-
2726
2728
  if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
2727
2729
  // an exception case where the target is either the container itself, or
2728
2730
  // a non-tabbable node that was given focus (i.e. tabindex is negative
@@ -2732,7 +2734,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2732
2734
  // first tabbable node, and go to the last tabbable node of the LAST group
2733
2735
  startOfGroupIndex = containerIndex;
2734
2736
  }
2735
-
2736
2737
  if (startOfGroupIndex >= 0) {
2737
2738
  // YES: then shift+tab should go to the last tabbable node in the
2738
2739
  // previous group (and wrap around to the last tabbable node of
@@ -2740,15 +2741,19 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2740
2741
  var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
2741
2742
  var destinationGroup = state.tabbableGroups[destinationGroupIndex];
2742
2743
  destinationNode = destinationGroup.lastTabbableNode;
2744
+ } else if (!isTabEvent(event)) {
2745
+ // user must have customized the nav keys so we have to move focus manually _within_
2746
+ // the active group: do this based on the order determined by tabbable()
2747
+ destinationNode = containerGroup.nextTabbableNode(target, false);
2743
2748
  }
2744
2749
  } else {
2745
2750
  // FORWARD
2751
+
2746
2752
  // is the target the last tabbable node in a group?
2747
2753
  var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
2748
2754
  var lastTabbableNode = _ref3.lastTabbableNode;
2749
2755
  return target === lastTabbableNode;
2750
2756
  });
2751
-
2752
2757
  if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
2753
2758
  // an exception case where the target is the container itself, or
2754
2759
  // a non-tabbable node that was given focus (i.e. tabindex is negative
@@ -2758,73 +2763,76 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2758
2763
  // last tabbable node, and go to the first tabbable node of the FIRST group
2759
2764
  lastOfGroupIndex = containerIndex;
2760
2765
  }
2761
-
2762
2766
  if (lastOfGroupIndex >= 0) {
2763
2767
  // YES: then tab should go to the first tabbable node in the next
2764
2768
  // group (and wrap around to the first tabbable node of the FIRST
2765
2769
  // group if it's the last tabbable node of the LAST group)
2766
2770
  var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
2767
-
2768
2771
  var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
2769
2772
  destinationNode = _destinationGroup.firstTabbableNode;
2773
+ } else if (!isTabEvent(event)) {
2774
+ // user must have customized the nav keys so we have to move focus manually _within_
2775
+ // the active group: do this based on the order determined by tabbable()
2776
+ destinationNode = containerGroup.nextTabbableNode(target);
2770
2777
  }
2771
2778
  }
2772
2779
  } else {
2780
+ // no groups available
2773
2781
  // NOTE: the fallbackFocus option does not support returning false to opt-out
2774
2782
  destinationNode = getNodeForOption('fallbackFocus');
2775
2783
  }
2776
-
2777
2784
  if (destinationNode) {
2778
- e.preventDefault();
2785
+ if (isTabEvent(event)) {
2786
+ // since tab natively moves focus, we wouldn't have a destination node unless we
2787
+ // were on the edge of a container and had to move to the next/previous edge, in
2788
+ // which case we want to prevent default to keep the browser from moving focus
2789
+ // to where it normally would
2790
+ event.preventDefault();
2791
+ }
2779
2792
  tryFocus(destinationNode);
2780
- } // else, let the browser take care of [shift+]tab and move the focus
2781
-
2793
+ }
2794
+ // else, let the browser take care of [shift+]tab and move the focus
2782
2795
  };
2783
2796
 
2784
- var checkKey = function checkKey(e) {
2785
- if (isEscapeEvent(e) && valueOrHandler(config.escapeDeactivates, e) !== false) {
2786
- e.preventDefault();
2797
+ var checkKey = function checkKey(event) {
2798
+ if (isEscapeEvent(event) && valueOrHandler(config.escapeDeactivates, event) !== false) {
2799
+ event.preventDefault();
2787
2800
  trap.deactivate();
2788
2801
  return;
2789
2802
  }
2790
-
2791
- if (isTabEvent(e)) {
2792
- checkTab(e);
2793
- return;
2803
+ if (config.isKeyForward(event) || config.isKeyBackward(event)) {
2804
+ checkKeyNav(event, config.isKeyBackward(event));
2794
2805
  }
2795
2806
  };
2796
-
2797
2807
  var checkClick = function checkClick(e) {
2798
2808
  var target = getActualTarget(e);
2799
-
2800
2809
  if (findContainerIndex(target) >= 0) {
2801
2810
  return;
2802
2811
  }
2803
-
2804
2812
  if (valueOrHandler(config.clickOutsideDeactivates, e)) {
2805
2813
  return;
2806
2814
  }
2807
-
2808
2815
  if (valueOrHandler(config.allowOutsideClick, e)) {
2809
2816
  return;
2810
2817
  }
2811
-
2812
2818
  e.preventDefault();
2813
2819
  e.stopImmediatePropagation();
2814
- }; //
2820
+ };
2821
+
2822
+ //
2815
2823
  // EVENT LISTENERS
2816
2824
  //
2817
2825
 
2818
-
2819
2826
  var addListeners = function addListeners() {
2820
2827
  if (!state.active) {
2821
2828
  return;
2822
- } // There can be only one listening focus trap at a time
2829
+ }
2823
2830
 
2831
+ // There can be only one listening focus trap at a time
2832
+ activeFocusTraps.activateTrap(trapStack, trap);
2824
2833
 
2825
- activeFocusTraps.activateTrap(trap); // Delay ensures that the focused element doesn't capture the event
2834
+ // Delay ensures that the focused element doesn't capture the event
2826
2835
  // that caused the focus trap activation.
2827
-
2828
2836
  state.delayInitialFocusTimer = config.delayInitialFocus ? delay$1(function () {
2829
2837
  tryFocus(getInitialFocusNode());
2830
2838
  }) : tryFocus(getInitialFocusNode());
@@ -2847,70 +2855,58 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2847
2855
  });
2848
2856
  return trap;
2849
2857
  };
2850
-
2851
2858
  var removeListeners = function removeListeners() {
2852
2859
  if (!state.active) {
2853
2860
  return;
2854
2861
  }
2855
-
2856
2862
  doc.removeEventListener('focusin', checkFocusIn, true);
2857
2863
  doc.removeEventListener('mousedown', checkPointerDown, true);
2858
2864
  doc.removeEventListener('touchstart', checkPointerDown, true);
2859
2865
  doc.removeEventListener('click', checkClick, true);
2860
2866
  doc.removeEventListener('keydown', checkKey, true);
2861
2867
  return trap;
2862
- }; //
2868
+ };
2869
+
2870
+ //
2863
2871
  // TRAP DEFINITION
2864
2872
  //
2865
2873
 
2866
-
2867
2874
  trap = {
2868
2875
  get active() {
2869
2876
  return state.active;
2870
2877
  },
2871
-
2872
2878
  get paused() {
2873
2879
  return state.paused;
2874
2880
  },
2875
-
2876
2881
  activate: function activate(activateOptions) {
2877
2882
  if (state.active) {
2878
2883
  return this;
2879
2884
  }
2880
-
2881
2885
  var onActivate = getOption(activateOptions, 'onActivate');
2882
2886
  var onPostActivate = getOption(activateOptions, 'onPostActivate');
2883
2887
  var checkCanFocusTrap = getOption(activateOptions, 'checkCanFocusTrap');
2884
-
2885
2888
  if (!checkCanFocusTrap) {
2886
2889
  updateTabbableNodes();
2887
2890
  }
2888
-
2889
2891
  state.active = true;
2890
2892
  state.paused = false;
2891
2893
  state.nodeFocusedBeforeActivation = doc.activeElement;
2892
-
2893
2894
  if (onActivate) {
2894
2895
  onActivate();
2895
2896
  }
2896
-
2897
2897
  var finishActivation = function finishActivation() {
2898
2898
  if (checkCanFocusTrap) {
2899
2899
  updateTabbableNodes();
2900
2900
  }
2901
-
2902
2901
  addListeners();
2903
-
2904
2902
  if (onPostActivate) {
2905
2903
  onPostActivate();
2906
2904
  }
2907
2905
  };
2908
-
2909
2906
  if (checkCanFocusTrap) {
2910
2907
  checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
2911
2908
  return this;
2912
2909
  }
2913
-
2914
2910
  finishActivation();
2915
2911
  return this;
2916
2912
  },
@@ -2918,46 +2914,38 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2918
2914
  if (!state.active) {
2919
2915
  return this;
2920
2916
  }
2921
-
2922
2917
  var options = _objectSpread2({
2923
2918
  onDeactivate: config.onDeactivate,
2924
2919
  onPostDeactivate: config.onPostDeactivate,
2925
2920
  checkCanReturnFocus: config.checkCanReturnFocus
2926
2921
  }, deactivateOptions);
2927
-
2928
2922
  clearTimeout(state.delayInitialFocusTimer); // noop if undefined
2929
-
2930
2923
  state.delayInitialFocusTimer = undefined;
2931
2924
  removeListeners();
2932
2925
  state.active = false;
2933
2926
  state.paused = false;
2934
- activeFocusTraps.deactivateTrap(trap);
2927
+ activeFocusTraps.deactivateTrap(trapStack, trap);
2935
2928
  var onDeactivate = getOption(options, 'onDeactivate');
2936
2929
  var onPostDeactivate = getOption(options, 'onPostDeactivate');
2937
2930
  var checkCanReturnFocus = getOption(options, 'checkCanReturnFocus');
2938
2931
  var returnFocus = getOption(options, 'returnFocus', 'returnFocusOnDeactivate');
2939
-
2940
2932
  if (onDeactivate) {
2941
2933
  onDeactivate();
2942
2934
  }
2943
-
2944
2935
  var finishDeactivation = function finishDeactivation() {
2945
2936
  delay$1(function () {
2946
2937
  if (returnFocus) {
2947
2938
  tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
2948
2939
  }
2949
-
2950
2940
  if (onPostDeactivate) {
2951
2941
  onPostDeactivate();
2952
2942
  }
2953
2943
  });
2954
2944
  };
2955
-
2956
2945
  if (returnFocus && checkCanReturnFocus) {
2957
2946
  checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
2958
2947
  return this;
2959
2948
  }
2960
-
2961
2949
  finishDeactivation();
2962
2950
  return this;
2963
2951
  },
@@ -2965,7 +2953,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2965
2953
  if (state.paused || !state.active) {
2966
2954
  return this;
2967
2955
  }
2968
-
2969
2956
  state.paused = true;
2970
2957
  removeListeners();
2971
2958
  return this;
@@ -2974,7 +2961,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2974
2961
  if (!state.paused || !state.active) {
2975
2962
  return this;
2976
2963
  }
2977
-
2978
2964
  state.paused = false;
2979
2965
  updateTabbableNodes();
2980
2966
  addListeners();
@@ -2985,15 +2971,14 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2985
2971
  state.containers = elementsAsArray.map(function (element) {
2986
2972
  return typeof element === 'string' ? doc.querySelector(element) : element;
2987
2973
  });
2988
-
2989
2974
  if (state.active) {
2990
2975
  updateTabbableNodes();
2991
2976
  }
2992
-
2993
2977
  return this;
2994
2978
  }
2995
- }; // initialize container elements
2979
+ };
2996
2980
 
2981
+ // initialize container elements
2997
2982
  trap.updateContainerElements(elements);
2998
2983
  return trap;
2999
2984
  };
@@ -3012,17 +2997,8 @@ const CatDropdown = class {
3012
2997
  this.catClose = createEvent(this, "catClose", 7);
3013
2998
  this.id = nextUniqueId$7++;
3014
2999
  this.isOpen = false;
3015
- /**
3016
- * The placement of the dropdown.
3017
- */
3018
3000
  this.placement = 'bottom-start';
3019
- /**
3020
- * Do not close the dropdown on outside clicks.
3021
- */
3022
3001
  this.noAutoClose = false;
3023
- /**
3024
- * Allow overflow when dropdown is open.
3025
- */
3026
3002
  this.overflow = false;
3027
3003
  }
3028
3004
  clickHandler(event) {
@@ -3170,21 +3146,15 @@ const CatFormGroup = class {
3170
3146
  constructor(hostRef) {
3171
3147
  registerInstance(this, hostRef);
3172
3148
  this.formElements = [];
3173
- /**
3174
- * Whether the labels need a marker to shown if the forms fields are required or optional.<br /><br />
3175
- * By default, it is set to auto, it will display the mark depending on the number of required and optional fields: <br />
3176
- * - If there are more required, the optional will be marked.<br />
3177
- * - If there are less required, it will mark the required.<br /><br />
3178
- * If a form field had "!", the requiredMarked of the field would not change.
3179
- */
3180
3149
  this.requiredMarker = 'auto';
3150
+ this.labelSize = undefined;
3181
3151
  }
3182
3152
  onRequiredMarker(newRequiredMarker) {
3183
3153
  const updateMarker = newRequiredMarker === 'auto' ? this.calculate(this.formElements) : newRequiredMarker;
3184
3154
  this.formElements.forEach(element => { var _a; return !((_a = element.requiredMarker) === null || _a === void 0 ? void 0 : _a.endsWith('!')) && (element.requiredMarker = updateMarker); });
3185
3155
  }
3186
3156
  render() {
3187
- return (h(Host, null, h("slot", { onSlotchange: this.onSlotChange.bind(this) })));
3157
+ return (h(Host, { style: { '--label-size': this.labelSize } }, h("slot", { onSlotchange: this.onSlotChange.bind(this) })));
3188
3158
  }
3189
3159
  onSlotChange() {
3190
3160
  this.formElements = Array.from(this.hostElement.querySelectorAll('cat-textarea, cat-input, cat-select, cat-label'));
@@ -3208,10 +3178,10 @@ const catIconCss = ":host{display:inline-flex;vertical-align:middle;-webkit-user
3208
3178
  const CatIcon = class {
3209
3179
  constructor(hostRef) {
3210
3180
  registerInstance(this, hostRef);
3211
- /**
3212
- * The size of the icon.
3213
- */
3181
+ this.icon = undefined;
3182
+ this.iconSrc = undefined;
3214
3183
  this.size = 'm';
3184
+ this.a11yLabel = undefined;
3215
3185
  }
3216
3186
  render() {
3217
3187
  return (h("span", { innerHTML: this.iconSrc || (this.icon ? catIconRegistry.getIcon(this.icon) : ''), "aria-label": this.a11yLabel, "aria-hidden": this.a11yLabel ? null : 'true', part: "icon", class: {
@@ -3222,17 +3192,7 @@ const CatIcon = class {
3222
3192
  };
3223
3193
  CatIcon.style = catIconCss;
3224
3194
 
3225
- function buildHintSection(hostElement, id, hint, errorMap) {
3226
- const errors = Object.entries(errorMap || {});
3227
- if (errors.length) {
3228
- return (h("div", { id: id + '-hint' }, errors.map(([key, params]) => (h(CatFormHint, { hint: catI18nRegistry.t(`error.${key}`, params), class: "cat-text-danger" })))));
3229
- }
3230
- const hasSlottedHint = !!hostElement.querySelector('[slot="hint"]');
3231
- return ((hint || hasSlottedHint) && (h("div", { id: id + '-hint' },
3232
- h(CatFormHint, { hint: hint, slottedHint: hasSlottedHint && h("slot", { name: "hint" }) }))));
3233
- }
3234
-
3235
- 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, 105, 118, 135)) !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}: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}.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, 105, 118, 135))}.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}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}.label-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, 105, 118, 135))}.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, 105, 118, 135))}input.has-clearable{padding-right:1.5rem}input::placeholder{color:rgb(var(--cat-font-color-muted, 105, 118, 135))}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}";
3195
+ 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, 105, 118, 135)) !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}: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, 105, 118, 135))}.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}label{align-self:flex-start;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-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, 105, 118, 135))}.input-horizontal label{min-height:2.5rem;display:inline-flex;align-items:center}.input-horizontal .label-optional{display:block;margin-top:0.25rem;margin-left:0}.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, 105, 118, 135))}input.has-clearable{padding-right:1.5rem}input::placeholder{color:rgb(var(--cat-font-color-muted, 105, 118, 135))}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}";
3236
3196
 
3237
3197
  let nextUniqueId$6 = 0;
3238
3198
  const CatInput = class {
@@ -3243,52 +3203,35 @@ const CatInput = class {
3243
3203
  this.catBlur = createEvent(this, "catBlur", 7);
3244
3204
  this._id = `cat-input-${nextUniqueId$6++}`;
3245
3205
  this.hasSlottedLabel = false;
3246
- /**
3247
- * Whether the label need a marker to shown if the input is required or optional.
3248
- */
3206
+ this.hasSlottedHint = false;
3207
+ this.errorMap = undefined;
3249
3208
  this.requiredMarker = 'optional';
3250
- /**
3251
- * Whether the input should show a clear button.
3252
- */
3209
+ this.horizontal = false;
3210
+ this.autoComplete = undefined;
3253
3211
  this.clearable = false;
3254
- /**
3255
- * Whether the input is disabled.
3256
- */
3257
3212
  this.disabled = false;
3258
- /**
3259
- * Display the icon on the right.
3260
- */
3213
+ this.hint = undefined;
3214
+ this.icon = undefined;
3261
3215
  this.iconRight = false;
3262
- /**
3263
- * The label for the input.
3264
- */
3216
+ this.identifier = undefined;
3265
3217
  this.label = '';
3266
- /**
3267
- * Visually hide the label, but still show it to assistive technologies like screen readers.
3268
- */
3269
3218
  this.labelHidden = false;
3270
- /**
3271
- * The value is not editable.
3272
- */
3219
+ this.max = undefined;
3220
+ this.maxLength = undefined;
3221
+ this.min = undefined;
3222
+ this.minLength = undefined;
3223
+ this.name = undefined;
3224
+ this.placeholder = undefined;
3225
+ this.textPrefix = undefined;
3226
+ this.textSuffix = undefined;
3273
3227
  this.readonly = false;
3274
- /**
3275
- * A value is required or must be check for the form to be submittable.
3276
- */
3277
3228
  this.required = false;
3278
- /**
3279
- * Use round input edges.
3280
- */
3281
3229
  this.round = false;
3282
- /**
3283
- * Type of form control.
3284
- */
3285
3230
  this.type = 'text';
3286
- /**
3287
- * Fine-grained control over when the errors are shown. Can be `false` to
3288
- * never show errors, `true` to show errors on blur, or a number to show
3289
- * errors on change with the given delay in milliseconds.
3290
- */
3231
+ this.value = undefined;
3232
+ this.errors = undefined;
3291
3233
  this.errorUpdate = 0;
3234
+ this.nativeAttributes = undefined;
3292
3235
  }
3293
3236
  get id() {
3294
3237
  return this.identifier || this._id;
@@ -3296,6 +3239,7 @@ const CatInput = class {
3296
3239
  componentWillRender() {
3297
3240
  this.watchErrorsHandler(this.errors);
3298
3241
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
3242
+ this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
3299
3243
  if (!this.label && !this.hasSlottedLabel) {
3300
3244
  loglevel.warn('[A11y] Missing ARIA label on input', this);
3301
3245
  }
@@ -3335,7 +3279,7 @@ const CatInput = class {
3335
3279
  }
3336
3280
  else {
3337
3281
  this.errorMapSrc = Array.isArray(value)
3338
- ? value.map(error => ({ [error]: undefined }))
3282
+ ? value.reduce((acc, err) => (Object.assign(Object.assign({}, acc), { [err]: undefined })), {})
3339
3283
  : value === true
3340
3284
  ? {}
3341
3285
  : value || undefined;
@@ -3343,14 +3287,20 @@ const CatInput = class {
3343
3287
  }
3344
3288
  render() {
3345
3289
  var _a;
3346
- return (h(Host, null, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, h("span", { part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.required'), ")"))))), h("div", { class: {
3290
+ return (h("div", { class: {
3291
+ 'input-field': true,
3292
+ 'input-horizontal': this.horizontal
3293
+ } }, h("div", { class: {
3294
+ hidden: this.labelHidden,
3295
+ 'label-container': true
3296
+ } }, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id }, h("span", { class: "label-wrapper", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.required'), ")")))))), h("div", { class: "input-container" }, h("div", { class: {
3347
3297
  'input-wrapper': true,
3348
3298
  'input-round': this.round,
3349
3299
  'input-disabled': this.disabled,
3350
3300
  'input-invalid': this.invalid
3351
3301
  }, 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: {
3352
3302
  'has-clearable': this.clearable && !this.disabled
3353
- }, 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": ((_a = this.hint) === null || _a === void 0 ? void 0 : _a.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))), buildHintSection(this.hostElement, this.id, this.hint, this.errorMap)));
3303
+ }, 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": ((_a = this.hint) === null || _a === void 0 ? void 0 : _a.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 })))));
3354
3304
  }
3355
3305
  get invalid() {
3356
3306
  return !!this.errorMap;
@@ -3384,13 +3334,8 @@ const catLabelCss = ":host{display:inline-flex;align-items:center;min-height:2.5
3384
3334
  const CatLabel = class {
3385
3335
  constructor(hostRef) {
3386
3336
  registerInstance(this, hostRef);
3387
- /**
3388
- * Whether the label need a marker to shown if the input is required or optional.
3389
- */
3390
3337
  this.requiredMarker = 'optional';
3391
- /**
3392
- * A value is required or must be check for the form to be submittable.
3393
- */
3338
+ this.for = undefined;
3394
3339
  this.required = false;
3395
3340
  }
3396
3341
  onClick() {
@@ -3432,45 +3377,15 @@ const catPaginationCss = ":host{display:inline-block}:host([hidden]){display:non
3432
3377
  const CatPagination = class {
3433
3378
  constructor(hostRef) {
3434
3379
  registerInstance(this, hostRef);
3435
- /**
3436
- * The current page.
3437
- */
3438
3380
  this.page = 0;
3439
- /**
3440
- * The total number of pages.
3441
- */
3442
3381
  this.pageCount = 1;
3443
- /**
3444
- * The number of pages to be shown around the current page.
3445
- */
3446
3382
  this.activePadding = 1;
3447
- /**
3448
- * The number of pages to be shown at the edges.
3449
- */
3450
3383
  this.sidePadding = 1;
3451
- /**
3452
- * The size of the buttons.
3453
- */
3454
3384
  this.size = 'm';
3455
- /**
3456
- * The rendering style of the buttons.
3457
- */
3458
3385
  this.variant = 'text';
3459
- /**
3460
- * Use round button edges.
3461
- */
3462
3386
  this.round = false;
3463
- /**
3464
- * Use compact pagination mode.
3465
- */
3466
3387
  this.compact = false;
3467
- /**
3468
- * The icon of the "previous" button.
3469
- */
3470
3388
  this.iconPrev = 'chevron-left-outlined';
3471
- /**
3472
- * The icon of the "next" button.
3473
- */
3474
3389
  this.iconNext = 'chevron-right-outlined';
3475
3390
  }
3476
3391
  render() {
@@ -3535,36 +3450,25 @@ const CatRadio = class {
3535
3450
  this.catBlur = createEvent(this, "catBlur", 7);
3536
3451
  this._id = `cat-radio-${++nextUniqueId$5}`;
3537
3452
  this.hasSlottedLabel = false;
3538
- /**
3539
- * Whether this radio is checked.
3540
- */
3453
+ this.hasSlottedHint = false;
3541
3454
  this.checked = false;
3542
- /**
3543
- * Whether this radio is disabled.
3544
- */
3545
3455
  this.disabled = false;
3546
- /**
3547
- * The label of the radio that is visible.
3548
- */
3456
+ this.identifier = undefined;
3549
3457
  this.label = '';
3550
- /**
3551
- * Visually hide the label, but still show it to assistive technologies like screen readers.
3552
- */
3553
3458
  this.labelHidden = false;
3554
- /**
3555
- * Whether the radio is required.
3556
- */
3459
+ this.name = undefined;
3557
3460
  this.required = false;
3558
- /**
3559
- * Whether the label should appear to the left of the radio component.
3560
- */
3461
+ this.value = undefined;
3462
+ this.hint = undefined;
3561
3463
  this.labelLeft = false;
3464
+ this.nativeAttributes = undefined;
3562
3465
  }
3563
3466
  get id() {
3564
3467
  return this.identifier || this._id;
3565
3468
  }
3566
3469
  componentWillRender() {
3567
3470
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
3471
+ this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
3568
3472
  if (!this.label && !this.hasSlottedLabel) {
3569
3473
  loglevel.warn('[A11y] Missing ARIA label on radio', this);
3570
3474
  }
@@ -3593,11 +3497,7 @@ const CatRadio = class {
3593
3497
  this.input.click();
3594
3498
  }
3595
3499
  render() {
3596
- 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.hintSection));
3597
- }
3598
- get hintSection() {
3599
- const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
3600
- return ((this.hint || hasSlottedHint) && (h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && h("slot", { name: "hint" }) })));
3500
+ 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" }) }))));
3601
3501
  }
3602
3502
  onChange(event) {
3603
3503
  this.checked = true;
@@ -3621,13 +3521,10 @@ const CatRadioGroup = class {
3621
3521
  this.catChange = createEvent(this, "catChange", 7);
3622
3522
  this.catBlur = createEvent(this, "catBlur", 7);
3623
3523
  this.catRadioGroup = [];
3624
- /**
3625
- * Whether this radio group is disabled.
3626
- */
3524
+ this.name = undefined;
3525
+ this.value = undefined;
3627
3526
  this.disabled = false;
3628
- /**
3629
- * Whether the label of the radios should appear to the left of them.
3630
- */
3527
+ this.a11yLabel = undefined;
3631
3528
  this.labelLeft = false;
3632
3529
  }
3633
3530
  onNameChanged(newName) {
@@ -5400,23 +5297,12 @@ const CatScrollable = class {
5400
5297
  this.destroyed = new Subject();
5401
5298
  this.resizedEntries = new Subject();
5402
5299
  this.resizedObserver = new ResizeObserver(entries => this.resizedEntries.next(entries));
5403
- /** Flags to disable/enable scroll shadowX. */
5404
5300
  this.noShadowX = false;
5405
- /** Flags to disable/enable scroll shadowY. */
5406
5301
  this.noShadowY = false;
5407
- /** Flags to disable/enable overflowX. */
5408
5302
  this.noOverflowX = false;
5409
- /** Flags to disable/enable overflowY. */
5410
5303
  this.noOverflowY = false;
5411
- /** Flag to disable/enable overscroll behavior. */
5412
5304
  this.noOverscroll = false;
5413
- /**
5414
- * Flag to not fire an initial event after content initialization.
5415
- */
5416
5305
  this.noScrolledInit = false;
5417
- /**
5418
- * Buffer to be used to calculate the scroll distance.
5419
- */
5420
5306
  this.scrolledBuffer = 0;
5421
5307
  }
5422
5308
  componentDidRender() {
@@ -5587,6 +5473,17 @@ var autosizeInput = function (element, options) {
5587
5473
  }
5588
5474
  };
5589
5475
 
5476
+ /* eslint-disable @typescript-eslint/no-explicit-any */
5477
+ function coerceBoolean(value) {
5478
+ return value != null && `${value}` !== 'false';
5479
+ }
5480
+ function coerceNumber(value, fallbackValue = 0) {
5481
+ return isNumberValue(value) ? Number(value) : fallbackValue;
5482
+ }
5483
+ function isNumberValue(value) {
5484
+ return !isNaN(parseFloat(value)) && !isNaN(Number(value));
5485
+ }
5486
+
5590
5487
  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, 105, 118, 135)) !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}: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}.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, 105, 118, 135))}.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, 105, 118, 135));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{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 0 0 1px rgb(var(--cat-border-color, 235, 236, 240)), 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, 105, 118, 135))}";
5591
5488
 
5592
5489
  const INIT_STATE = {
@@ -5611,54 +5508,31 @@ const CatSelect = class {
5611
5508
  this.term$ = new Subject();
5612
5509
  this.more$ = new Subject();
5613
5510
  this.valueChangedBySelection = false;
5511
+ this.connector = undefined;
5614
5512
  this.state = INIT_STATE;
5615
5513
  this.hasSlottedLabel = false;
5616
- /**
5617
- * Whether the label need a marker to shown if the select is required or optional.
5618
- */
5514
+ this.hasSlottedHint = false;
5515
+ this.errorMap = undefined;
5619
5516
  this.requiredMarker = 'optional';
5620
- /**
5621
- * Enable multiple selection.
5622
- */
5623
5517
  this.multiple = false;
5624
- /**
5625
- * The debounce time for the search.
5626
- */
5627
5518
  this.debounce = 250;
5628
- /**
5629
- * The placement of the select.
5630
- */
5631
5519
  this.placement = 'bottom-start';
5632
- /**
5633
- * Whether the select is disabled.
5634
- */
5520
+ this.value = undefined;
5635
5521
  this.disabled = false;
5636
- /**
5637
- * The label for the select.
5638
- */
5522
+ this.placeholder = undefined;
5523
+ this.hint = undefined;
5524
+ this.identifier = undefined;
5639
5525
  this.label = '';
5640
- /**
5641
- * Visually hide the label, but still show it to assistive technologies like screen readers.
5642
- */
5526
+ this.name = undefined;
5643
5527
  this.labelHidden = false;
5644
- /**
5645
- * A value is required or must be checked for the form to be submittable.
5646
- */
5647
5528
  this.required = false;
5648
- /**
5649
- * Whether the select should show a clear button.
5650
- */
5651
5529
  this.clearable = false;
5652
- /**
5653
- * Whether the select should add new items.
5654
- */
5655
5530
  this.tags = false;
5656
- /**
5657
- * Fine-grained control over when the errors are shown. Can be `false` to
5658
- * never show errors, `true` to show errors on blur, or a number to show
5659
- * errors on change with the given delay in milliseconds.
5660
- */
5531
+ this.tagHint = undefined;
5532
+ this.noItems = undefined;
5533
+ this.errors = undefined;
5661
5534
  this.errorUpdate = 0;
5535
+ this.nativeAttributes = undefined;
5662
5536
  }
5663
5537
  get id() {
5664
5538
  return this.identifier || this._id;
@@ -5671,12 +5545,12 @@ const CatSelect = class {
5671
5545
  !this.valueChangedBySelection ? this.resolve() : (this.valueChangedBySelection = false);
5672
5546
  }
5673
5547
  watchErrorsHandler(value) {
5674
- if (this.errorUpdate === false) {
5548
+ if (coerceBoolean(this.errorUpdate) === false) {
5675
5549
  this.errorMap = undefined;
5676
5550
  }
5677
5551
  else {
5678
5552
  this.errorMapSrc = Array.isArray(value)
5679
- ? value.map(error => ({ [error]: undefined }))
5553
+ ? value.reduce((acc, err) => (Object.assign(Object.assign({}, acc), { [err]: undefined })), {})
5680
5554
  : value === true
5681
5555
  ? {}
5682
5556
  : value || undefined;
@@ -5722,9 +5596,10 @@ const CatSelect = class {
5722
5596
  this.value = newValue;
5723
5597
  }
5724
5598
  this.catChange.emit();
5725
- if (typeof this.errorUpdate === 'number') {
5599
+ const errorUpdate = coerceNumber(this.errorUpdate, null);
5600
+ if (errorUpdate !== null) {
5726
5601
  typeof this.errorUpdateTimeoutId === 'number' && window.clearTimeout(this.errorUpdateTimeoutId);
5727
- this.errorUpdateTimeoutId = window.setTimeout(() => (this.errorMap = this.errorMapSrc), this.errorUpdate);
5602
+ this.errorUpdateTimeoutId = window.setTimeout(() => (this.errorMap = this.errorMapSrc), errorUpdate);
5728
5603
  }
5729
5604
  }
5730
5605
  }
@@ -5732,13 +5607,11 @@ const CatSelect = class {
5732
5607
  if (this.input) {
5733
5608
  autosizeInput(this.input);
5734
5609
  }
5735
- if (this.trigger && this.dropdown) {
5736
- autoUpdate(this.trigger, this.dropdown, () => this.update());
5737
- }
5738
5610
  }
5739
5611
  componentWillRender() {
5740
5612
  this.watchErrorsHandler(this.errors);
5741
5613
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
5614
+ this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
5742
5615
  if (!this.label && !this.hasSlottedLabel) {
5743
5616
  loglevel.warn('[A11y] Missing ARIA label on select', this);
5744
5617
  }
@@ -5755,7 +5628,7 @@ const CatSelect = class {
5755
5628
  this.hide();
5756
5629
  this.patchState({ activeSelectionIndex: -1 });
5757
5630
  this.catBlur.emit(event);
5758
- if (this.errorUpdate !== false) {
5631
+ if (`${this.errorUpdate}` !== 'false') {
5759
5632
  this.errorMap = this.errorMapSrc;
5760
5633
  }
5761
5634
  }
@@ -5884,10 +5757,10 @@ const CatSelect = class {
5884
5757
  'select-no-open': true,
5885
5758
  'select-option-active': this.state.activeSelectionIndex === i
5886
5759
  }, 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 }))));
5887
- }))) : 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(), 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) &&
5760
+ }))) : 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) &&
5888
5761
  !this.disabled &&
5889
5762
  !this.state.isResolving &&
5890
- 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 }))), buildHintSection(this.hostElement, this.id, this.hint, 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
5763
+ 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
5891
5764
  ? 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 }))))
5892
5765
  : !this.state.options.length &&
5893
5766
  !this.tags && (h("li", { class: "select-option-empty" }, this.noItems ? this.noItems : catI18nRegistry.t('select.empty')))))))));
@@ -5958,12 +5831,17 @@ const CatSelect = class {
5958
5831
  this.catOpen.emit();
5959
5832
  this.term$.next(this.state.term);
5960
5833
  (_a = this.input) === null || _a === void 0 ? void 0 : _a.classList.remove('select-input-transparent-caret');
5834
+ if (this.trigger && this.dropdown) {
5835
+ this.cleanupAutoUpdate = autoUpdate(this.trigger, this.dropdown, () => this.update());
5836
+ }
5961
5837
  }
5962
5838
  }
5963
5839
  hide() {
5840
+ var _a;
5964
5841
  if (this.state.isOpen) {
5965
5842
  this.patchState({ isOpen: false, activeOptionIndex: -1 });
5966
5843
  this.catClose.emit();
5844
+ (_a = this.cleanupAutoUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
5967
5845
  }
5968
5846
  }
5969
5847
  search(term) {
@@ -6220,7 +6098,6 @@ const CatSelectTest = class {
6220
6098
  var _a, _b, _c, _d, _e, _f, _g, _h;
6221
6099
  (_a = this.multipleSelect) === null || _a === void 0 ? void 0 : _a.connect({
6222
6100
  resolve: (ids) => {
6223
- console.info(`Resolving data... (${ids.join(', ')})`);
6224
6101
  return of(ids.map(id => ({
6225
6102
  id,
6226
6103
  firstName: 'John',
@@ -6229,7 +6106,6 @@ const CatSelectTest = class {
6229
6106
  }))).pipe(delay(500));
6230
6107
  },
6231
6108
  retrieve: (term, page) => {
6232
- console.info(`Retrieving data... ("${term}", ${page})`);
6233
6109
  return term === 'no'
6234
6110
  ? of({ last: true, content: [], totalElements: 0 })
6235
6111
  : of({
@@ -6250,7 +6126,6 @@ const CatSelectTest = class {
6250
6126
  });
6251
6127
  (_b = this.multipleSelectAvatar) === null || _b === void 0 ? void 0 : _b.connect({
6252
6128
  resolve: (ids) => {
6253
- console.info(`Resolving data... (${ids.join(', ')})`);
6254
6129
  return of(ids.map(id => ({
6255
6130
  id,
6256
6131
  firstName: 'John',
@@ -6259,7 +6134,6 @@ const CatSelectTest = class {
6259
6134
  }))).pipe(delay(500));
6260
6135
  },
6261
6136
  retrieve: (term, page) => {
6262
- console.info(`Retrieving data... ("${term}", ${page})`);
6263
6137
  return term === 'no'
6264
6138
  ? of({ last: true, content: [], totalElements: 0 })
6265
6139
  : of({
@@ -6284,7 +6158,6 @@ const CatSelectTest = class {
6284
6158
  });
6285
6159
  (_c = this.multipleSelectAvatarInitials) === null || _c === void 0 ? void 0 : _c.connect({
6286
6160
  resolve: (ids) => {
6287
- console.info(`Resolving data... (${ids.join(', ')})`);
6288
6161
  return of(ids.map(id => ({
6289
6162
  id,
6290
6163
  firstName: 'John',
@@ -6293,7 +6166,6 @@ const CatSelectTest = class {
6293
6166
  }))).pipe(delay(500));
6294
6167
  },
6295
6168
  retrieve: (term, page) => {
6296
- console.info(`Retrieving data... ("${term}", ${page})`);
6297
6169
  return term === 'no'
6298
6170
  ? of({ last: true, content: [], totalElements: 0 })
6299
6171
  : of({
@@ -6319,7 +6191,6 @@ const CatSelectTest = class {
6319
6191
  (_d = this.multipleSelectTagging) === null || _d === void 0 ? void 0 : _d.connect(this.countryConnector);
6320
6192
  (_e = this.singleSelect) === null || _e === void 0 ? void 0 : _e.connect({
6321
6193
  resolve: (ids) => {
6322
- console.info(`Resolving data... (${ids.join(', ')})`);
6323
6194
  return of(ids.map(id => ({
6324
6195
  id,
6325
6196
  firstName: 'John',
@@ -6328,7 +6199,6 @@ const CatSelectTest = class {
6328
6199
  }))).pipe(delay(500));
6329
6200
  },
6330
6201
  retrieve: (term, page) => {
6331
- console.info(`Retrieving data... ("${term}", ${page})`);
6332
6202
  return term === 'no'
6333
6203
  ? of({ last: true, content: [], totalElements: 0 })
6334
6204
  : of({
@@ -6363,16 +6233,14 @@ const CatSelectTest = class {
6363
6233
  setTimeout(() => this.multipleSelect && (this.multipleSelect.value = []), 5000);
6364
6234
  }
6365
6235
  render() {
6366
- return (h(Host, { style: { display: 'flex', flexDirection: 'column' } }, h("cat-select", { label: "Multiple Select", hint: "This is a hint!", ref: el => (this.multipleSelect = el), value: ['1'], placeholder: "Hello World", onCatChange: () => { var _a; return console.log((_a = this.multipleSelect) === null || _a === void 0 ? void 0 : _a.value); }, onCatBlur: e => console.log('Multiple blur', e), multiple: true, noItems: "No results", clearable: true }, h("span", { slot: "hint" }, "Searching for \"no\" -", '>', " no options are returned!")), h("cat-select", { label: "Multiple with img", ref: el => (this.multipleSelectAvatar = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true }), h("cat-select", { label: "Multiple with initials", ref: el => (this.multipleSelectAvatarInitials = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true }), h("cat-select", { label: "Multiple with tagging support", hint: "This is a hint!", ref: el => (this.multipleSelectTagging = el), value: { ids: ['1'], tags: ['Test', 'Albania', 'Algeria'] }, placeholder: "Select country", onCatChange: () => { var _a; return console.log((_a = this.multipleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, multiple: true, tags: true, clearable: true }), h("cat-select", { label: "Single Select", hint: "This is a hint!", ref: el => (this.singleSelect = el), placeholder: "Search for a country or capital", onCatBlur: e => console.log('Single blur', e), clearable: true }), h("cat-select", { label: "Single with img", ref: el => (this.singleSelectAvatar = el), value: '1', onCatChange: () => { var _a; return console.log((_a = this.singleSelectAvatar) === null || _a === void 0 ? void 0 : _a.value); }, placeholder: "Search for a country or capital", clearable: true }), h("cat-select", { label: "Single with initials", ref: el => (this.singleSelectAvatarInitials = el), placeholder: "Hello World", clearable: true }), h("cat-dropdown", { overflow: true, noAutoClose: true }, h("cat-button", { slot: "trigger", style: { width: '50%' } }, "Open select"), h("div", { slot: "content", style: { width: '400px' } }, h("cat-select", { label: "Single with tagging support", ref: el => (this.singleSelectTagging = el), value: { id: '', tag: 'Albania' }, placeholder: "Search for a country or capital", onCatChange: () => { var _a; return console.log('Single', (_a = this.singleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, tagHint: "new country", tags: true, clearable: true, style: { width: '90%' } })))));
6236
+ return (h(Host, { style: { display: 'flex', flexDirection: 'column' } }, h("cat-select", { label: "Multiple Select", hint: "This is a hint!", ref: el => (this.multipleSelect = el), value: ['1'], placeholder: "Hello World", onCatChange: () => { var _a; return console.log('Multiple change', (_a = this.multipleSelect) === null || _a === void 0 ? void 0 : _a.value); }, onCatBlur: e => console.log('Multiple blur', e), multiple: true, noItems: "No results", clearable: true }, h("span", { slot: "hint" }, "Searching for \"no\" -", '>', " no options are returned!")), h("cat-select", { label: "Multiple with img", ref: el => (this.multipleSelectAvatar = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true }), h("cat-select", { label: "Multiple with initials", ref: el => (this.multipleSelectAvatarInitials = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true }), h("cat-select", { label: "Multiple with tagging support", hint: "This is a hint!", ref: el => (this.multipleSelectTagging = el), value: { ids: ['1'], tags: ['Test', 'Albania', 'Algeria'] }, placeholder: "Select country", onCatChange: () => { var _a; return console.log('Multiple tagging change', (_a = this.multipleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, multiple: true, tags: true, clearable: true }), h("cat-select", { label: "Single Select", hint: "This is a hint!", ref: el => (this.singleSelect = el), placeholder: "Search for a country or capital", onCatBlur: e => console.log('Single blur', e), clearable: true }), h("cat-select", { label: "Single with img", ref: el => (this.singleSelectAvatar = el), value: '1', placeholder: "Search for a country or capital", clearable: true }), h("cat-select", { label: "Single with initials", ref: el => (this.singleSelectAvatarInitials = el), placeholder: "Hello World", clearable: true }), h("cat-dropdown", { overflow: true, noAutoClose: true }, h("cat-button", { slot: "trigger", style: { width: '50%' } }, "Open select"), h("div", { slot: "content", style: { width: '400px' } }, h("cat-select", { label: "Single with tagging support", ref: el => (this.singleSelectTagging = el), value: { id: '', tag: 'Albania' }, placeholder: "Search for a country or capital", onCatChange: () => { var _a; return console.log('Single change', (_a = this.singleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, tagHint: "new country", tags: true, clearable: true, style: { width: '90%' } })))));
6367
6237
  }
6368
6238
  get countryConnector() {
6369
6239
  return {
6370
6240
  resolve: (ids) => {
6371
- console.info(`Resolving data... (${ids.join(', ')})`);
6372
6241
  return of(ids.map(id => countries.find(value => value.id === id))).pipe(delay(500));
6373
6242
  },
6374
6243
  retrieve: (term, page) => {
6375
- console.info(`Retrieving data... ("${term}", ${page})`);
6376
6244
  const filter = countries.filter(value => {
6377
6245
  var _a;
6378
6246
  return value.country.toLowerCase().indexOf(term.toLowerCase()) === 0 ||
@@ -7617,19 +7485,10 @@ const catSkeletonCss = ":host{display:flex;flex-direction:column;position:relati
7617
7485
  const CatSkeleton = class {
7618
7486
  constructor(hostRef) {
7619
7487
  registerInstance(this, hostRef);
7620
- /**
7621
- * The animation style of the skeleton.
7622
- */
7623
7488
  this.effect = 'sheen';
7624
- /**
7625
- * The rendering style of the skeleton.
7626
- */
7627
7489
  this.variant = 'rectangle';
7628
- /**
7629
- * The size of the skeleton. If the variant is set to "head", the size values
7630
- * "xs" to "xl" translate to the head levels `h1` to `h5`.
7631
- */
7632
7490
  this.size = 'm';
7491
+ this.lines = undefined;
7633
7492
  }
7634
7493
  render() {
7635
7494
  return (h(Host, null, Array.from(Array(this.count)).map(() => (h("div", { style: this.style, class: {
@@ -7667,10 +7526,8 @@ const catSpinnerCss = ":host{display:inline-flex;vertical-align:middle;-webkit-u
7667
7526
  const CatSpinner = class {
7668
7527
  constructor(hostRef) {
7669
7528
  registerInstance(this, hostRef);
7670
- /**
7671
- * The size of the spinner.
7672
- */
7673
7529
  this.size = 'm';
7530
+ this.a11yLabel = undefined;
7674
7531
  }
7675
7532
  render() {
7676
7533
  return (h("span", { "aria-label": this.a11yLabel, "aria-hidden": this.a11yLabel ? null : 'true', class: {
@@ -7687,21 +7544,12 @@ const CatTab = class {
7687
7544
  constructor(hostRef) {
7688
7545
  registerInstance(this, hostRef);
7689
7546
  this.tabClick = createEvent(this, "tabClick", 7);
7690
- /**
7691
- * The label of the tab.
7692
- */
7693
7547
  this.label = '';
7694
- /**
7695
- * Hide the actual button content and only display the tab.
7696
- */
7548
+ this.icon = undefined;
7697
7549
  this.iconOnly = false;
7698
- /**
7699
- * Display the icon on the right.
7700
- */
7701
7550
  this.iconRight = false;
7702
- /**
7703
- * Specifies that the tab should be deactivated.
7704
- */
7551
+ this.url = undefined;
7552
+ this.urlTarget = undefined;
7705
7553
  this.deactivated = false;
7706
7554
  }
7707
7555
  connectedCallback() {
@@ -7726,13 +7574,8 @@ const CatTabs = class {
7726
7574
  registerInstance(this, hostRef);
7727
7575
  this.buttons = [];
7728
7576
  this.tabs = [];
7729
- /**
7730
- * The ID of the active tab.
7731
- */
7577
+ this.activeTabId = undefined;
7732
7578
  this.activeTab = '';
7733
- /**
7734
- * The alignment of the tabs.
7735
- */
7736
7579
  this.tabsAlign = 'left';
7737
7580
  }
7738
7581
  onActiveTabChanged(newActiveTab) {
@@ -7797,9 +7640,9 @@ const CatTabs = class {
7797
7640
  };
7798
7641
  CatTabs.style = catTabsCss;
7799
7642
 
7800
- var e,t,n="function"==typeof Map?new Map:(e=[],t=[],{has:function(t){return e.indexOf(t)>-1},get:function(n){return t[e.indexOf(n)]},set:function(n,o){-1===e.indexOf(n)&&(e.push(n),t.push(o));},delete:function(n){var o=e.indexOf(n);o>-1&&(e.splice(o,1),t.splice(o,1));}}),o=function(e){return new Event(e,{bubbles:!0})};try{new Event("test");}catch(e){o=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t};}function r(e){var t=n.get(e);t&&t.destroy();}function i(e){var t=n.get(e);t&&t.update();}var l=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((l=function(e){return e}).destroy=function(e){return e},l.update=function(e){return e}):((l=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return function(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!n.has(e)){var t,r=null,i=null,l=null,d=function(){e.clientWidth!==i&&c();},a=function(t){window.removeEventListener("resize",d,!1),e.removeEventListener("input",c,!1),e.removeEventListener("keyup",c,!1),e.removeEventListener("autosize:destroy",a,!1),e.removeEventListener("autosize:update",c,!1),Object.keys(t).forEach(function(n){e.style[n]=t[n];}),n.delete(e);}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",a,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",c,!1),window.addEventListener("resize",d,!1),e.addEventListener("input",c,!1),e.addEventListener("autosize:update",c,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",n.set(e,{destroy:a,update:c}),"vertical"===(t=window.getComputedStyle(e,null)).resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),r="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(r)&&(r=0),c();}function u(t){var n=e.style.width;e.style.width="0px",e.style.width=n,e.style.overflowY=t;}function s(){if(0!==e.scrollHeight){var t=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}(e),n=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+r+"px",i=e.clientWidth,t.forEach(function(e){e.node.scrollTop=e.scrollTop;}),n&&(document.documentElement.scrollTop=n);}}function c(){s();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),r="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(r<t?"hidden"===n.overflowY&&(u("scroll"),s(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==n.overflowY&&(u("hidden"),s(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),l!==r){l=r;var i=o("autosize:resized");try{e.dispatchEvent(i);}catch(e){}}}}(e)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e},l.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],i),e});var d=l;
7643
+ 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;
7801
7644
 
7802
- 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, 105, 118, 135)) !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}: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}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}.label-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, 105, 118, 135))}.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, 105, 118, 135));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, 105, 118, 135))}textarea:-webkit-autofill,textarea:-webkit-autofill:hover,textarea:-webkit-autofill:focus{-webkit-box-shadow:0 0 0 9999px #e8f0fe inset}";
7645
+ 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, 105, 118, 135)) !important}.cat-text-reset{color:inherit !important}.cat-link-reset{color:inherit !important;text-decoration:inherit !important}: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}label{align-self:flex-start;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-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, 105, 118, 135))}.textarea-horizontal label{min-height:2.5rem;display:inline-flex;align-items:center}.textarea-horizontal .label-optional{display:block;margin-top:0.25rem;margin-left:0}.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, 105, 118, 135));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, 105, 118, 135))}textarea:-webkit-autofill,textarea:-webkit-autofill:hover,textarea:-webkit-autofill:focus{-webkit-box-shadow:0 0 0 9999px #e8f0fe inset}";
7803
7646
 
7804
7647
  let nextUniqueId$2 = 0;
7805
7648
  const CatTextarea = class {
@@ -7810,40 +7653,26 @@ const CatTextarea = class {
7810
7653
  this.catBlur = createEvent(this, "catBlur", 7);
7811
7654
  this._id = `cat-textarea-${nextUniqueId$2++}`;
7812
7655
  this.hasSlottedLabel = false;
7813
- /**
7814
- * Whether the label need a marker to shown if the textarea is required or optional.
7815
- */
7656
+ this.hasSlottedHint = false;
7657
+ this.errorMap = undefined;
7816
7658
  this.requiredMarker = 'optional';
7817
- /**
7818
- * Whether the textarea is disabled.
7819
- */
7659
+ this.horizontal = false;
7820
7660
  this.disabled = false;
7821
- /**
7822
- * The label for the textarea.
7823
- */
7661
+ this.hint = undefined;
7662
+ this.identifier = undefined;
7824
7663
  this.label = '';
7825
- /**
7826
- * Visually hide the label, but still show it to assistive technologies like screen readers.
7827
- */
7828
7664
  this.labelHidden = false;
7829
- /**
7830
- * The value is not editable.
7831
- */
7665
+ this.maxLength = undefined;
7666
+ this.minLength = undefined;
7667
+ this.name = undefined;
7668
+ this.placeholder = undefined;
7832
7669
  this.readonly = false;
7833
- /**
7834
- * A value is required or must be check for the form to be submittable.
7835
- */
7836
7670
  this.required = false;
7837
- /**
7838
- * Specifies the initial number of lines in the textarea.
7839
- */
7840
7671
  this.rows = 3;
7841
- /**
7842
- * Fine-grained control over when the errors are shown. Can be `false` to
7843
- * never show errors, `true` to show errors on blur, or a number to show
7844
- * errors on change with the given delay in milliseconds.
7845
- */
7672
+ this.value = undefined;
7673
+ this.errors = undefined;
7846
7674
  this.errorUpdate = 0;
7675
+ this.nativeAttributes = undefined;
7847
7676
  }
7848
7677
  get id() {
7849
7678
  return this.identifier || this._id;
@@ -7851,12 +7680,13 @@ const CatTextarea = class {
7851
7680
  componentWillRender() {
7852
7681
  this.watchErrorsHandler(this.errors);
7853
7682
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
7683
+ this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
7854
7684
  if (!this.label && !this.hasSlottedLabel) {
7855
7685
  loglevel.warn('[A11y] Missing ARIA label on textarea', this);
7856
7686
  }
7857
7687
  }
7858
7688
  componentDidLoad() {
7859
- d(this.textarea);
7689
+ n(this.textarea);
7860
7690
  }
7861
7691
  /**
7862
7692
  * Programmatically move focus to the textarea. Use this method instead of
@@ -7887,7 +7717,7 @@ const CatTextarea = class {
7887
7717
  }
7888
7718
  else {
7889
7719
  this.errorMapSrc = Array.isArray(value)
7890
- ? value.map(error => ({ [error]: undefined }))
7720
+ ? value.reduce((acc, err) => (Object.assign(Object.assign({}, acc), { [err]: undefined })), {})
7891
7721
  : value === true
7892
7722
  ? {}
7893
7723
  : value || undefined;
@@ -7895,11 +7725,17 @@ const CatTextarea = class {
7895
7725
  }
7896
7726
  render() {
7897
7727
  var _a;
7898
- return (h(Host, null, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, h("span", { part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.required'), ")"))))), h("div", { class: {
7728
+ return (h(Host, null, h("div", { class: {
7729
+ 'textarea-field': true,
7730
+ 'textarea-horizontal': this.horizontal
7731
+ } }, h("div", { class: {
7732
+ hidden: this.labelHidden,
7733
+ 'label-container': true
7734
+ } }, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, h("span", { part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.required'), ")")))))), h("div", { class: "textarea-container" }, h("div", { class: {
7899
7735
  'textarea-wrapper': true,
7900
7736
  'textarea-disabled': this.disabled,
7901
7737
  'textarea-invalid': this.invalid
7902
- } }, 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": ((_a = this.hint) === null || _a === void 0 ? void 0 : _a.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() }))), buildHintSection(this.hostElement, this.id, this.hint, this.errorMap)));
7738
+ } }, 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": ((_a = this.hint) === null || _a === void 0 ? void 0 : _a.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 }))))));
7903
7739
  }
7904
7740
  get invalid() {
7905
7741
  return !!this.errorMap;
@@ -7939,36 +7775,25 @@ const CatToggle = class {
7939
7775
  this.catBlur = createEvent(this, "catBlur", 7);
7940
7776
  this._id = `cat-toggle-${nextUniqueId$1++}`;
7941
7777
  this.hasSlottedLabel = false;
7942
- /**
7943
- * Checked state of the toggle.
7944
- */
7778
+ this.hasSlottedHint = false;
7945
7779
  this.checked = false;
7946
- /**
7947
- * Disabled state of the toggle.
7948
- */
7949
7780
  this.disabled = false;
7950
- /**
7951
- * The label of the toggle that is visible.
7952
- */
7781
+ this.identifier = undefined;
7953
7782
  this.label = '';
7954
- /**
7955
- * Visually hide the label, but still show it to assistive technologies like screen readers.
7956
- */
7957
7783
  this.labelHidden = false;
7958
- /**
7959
- * Required state of the toggle.
7960
- */
7784
+ this.name = undefined;
7961
7785
  this.required = false;
7962
- /**
7963
- * Whether the label should appear to the left of the toggle.
7964
- */
7786
+ this.value = undefined;
7787
+ this.hint = undefined;
7965
7788
  this.labelLeft = false;
7789
+ this.nativeAttributes = undefined;
7966
7790
  }
7967
7791
  get id() {
7968
7792
  return this.identifier || this._id;
7969
7793
  }
7970
7794
  componentWillRender() {
7971
7795
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
7796
+ this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
7972
7797
  if (!this.label && !this.hasSlottedLabel) {
7973
7798
  loglevel.warn('[A11y] Missing ARIA label on toggle', this);
7974
7799
  }
@@ -7997,11 +7822,7 @@ const CatToggle = class {
7997
7822
  this.input.click();
7998
7823
  }
7999
7824
  render() {
8000
- 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.hintSection));
8001
- }
8002
- get hintSection() {
8003
- const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
8004
- return ((this.hint || hasSlottedHint) && (h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && h("slot", { name: "hint" }) })));
7825
+ 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" }) }))));
8005
7826
  }
8006
7827
  onInput(event) {
8007
7828
  this.checked = this.input.checked;
@@ -8022,7 +7843,7 @@ CatToggle.style = catToggleCss;
8022
7843
 
8023
7844
  const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
8024
7845
 
8025
- const catTooltipCss = ":host{display:contents}:host([hidden]){display:none}.tooltip{position:absolute;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: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}.tooltip-trigger{display:inline-block}.tooltip-trigger:focus{outline:none}";
7846
+ 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:absolute;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}.tooltip-trigger{display:inline-block}.tooltip-trigger:focus{outline:none}";
8026
7847
 
8027
7848
  let nextUniqueId = 0;
8028
7849
  const CatTooltip = class {
@@ -8030,38 +7851,14 @@ const CatTooltip = class {
8030
7851
  registerInstance(this, hostRef);
8031
7852
  this.id = `cat-tooltip-${nextUniqueId++}`;
8032
7853
  this.hidden = false;
8033
- /**
8034
- * The content of the tooltip.
8035
- */
7854
+ this.hasSlottedContent = false;
8036
7855
  this.content = '';
8037
- /**
8038
- * Specifies that the tooltip should be disabled. A disabled tooltip is unusable,
8039
- * and invisible. Corresponds with the native HTML disabled attribute.
8040
- */
8041
7856
  this.disabled = false;
8042
- /**
8043
- * The placement of the tooltip.
8044
- */
8045
7857
  this.placement = 'top';
8046
- /**
8047
- * Use round tooltip edges.
8048
- */
8049
7858
  this.round = false;
8050
- /**
8051
- * The size of the tooltip.
8052
- */
8053
7859
  this.size = 'm';
8054
- /**
8055
- * The delay time for showing tooltip in ms.
8056
- */
8057
7860
  this.showDelay = 250;
8058
- /**
8059
- * The delay time for hiding tooltip in ms.
8060
- */
8061
7861
  this.hideDelay = 0;
8062
- /**
8063
- * The duration of tap to show the tooltip.
8064
- */
8065
7862
  this.longTouchDuration = 1000;
8066
7863
  }
8067
7864
  handleKeyDown({ key }) {
@@ -8089,7 +7886,8 @@ const CatTooltip = class {
8089
7886
  }
8090
7887
  }
8091
7888
  componentWillRender() {
8092
- this.hidden = !this.content || this.disabled;
7889
+ this.hasSlottedContent = !!this.hostElement.querySelector('[slot="content"]');
7890
+ this.hidden = this.disabled || (!this.content && !this.hasSlottedContent);
8093
7891
  }
8094
7892
  disconnectedCallback() {
8095
7893
  var _a, _b, _c, _d, _e, _f;
@@ -8111,16 +7909,16 @@ const CatTooltip = class {
8111
7909
  'tooltip-hidden': this.hidden,
8112
7910
  'tooltip-round': this.round,
8113
7911
  [`tooltip-${this.size}`]: Boolean(this.size)
8114
- } }, this.content)));
7912
+ } }, this.hasSlottedContent ? h("slot", { name: "content" }) : this.content)));
8115
7913
  }
8116
7914
  get isTabbable() {
8117
7915
  return firstTabbable(this.trigger);
8118
7916
  }
8119
- update() {
7917
+ async update() {
8120
7918
  if (this.trigger && this.tooltip) {
8121
- computePosition(this.trigger, this.tooltip, {
7919
+ await computePosition(this.trigger, this.tooltip, {
8122
7920
  placement: this.placement,
8123
- middleware: [offset(CatTooltip.OFFSET), flip()]
7921
+ middleware: [offset(CatTooltip.OFFSET), flip(), shift({ padding: CatTooltip.SHIFT_PADDING })]
8124
7922
  }).then(({ x, y }) => {
8125
7923
  if (this.tooltip) {
8126
7924
  Object.assign(this.tooltip.style, {
@@ -8163,8 +7961,10 @@ const CatTooltip = class {
8163
7961
  var _a;
8164
7962
  !this.hidden && ((_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show'));
8165
7963
  }
7964
+ get hostElement() { return getElement(this); }
8166
7965
  };
8167
7966
  CatTooltip.OFFSET = 4;
7967
+ CatTooltip.SHIFT_PADDING = 4;
8168
7968
  CatTooltip.style = catTooltipCss;
8169
7969
 
8170
7970
  export { CatAlert as cat_alert, CatAvatar as cat_avatar, CatBadge as cat_badge, CatButton as cat_button, 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 };