@haiilo/catalyst 4.1.2 → 5.0.1

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