@haiilo/catalyst 6.3.1 → 6.3.2

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 (60) hide show
  1. package/dist/catalyst/catalyst.esm.js +1 -1
  2. package/dist/catalyst/catalyst.esm.js.map +1 -1
  3. package/dist/catalyst/p-2257ac13.entry.js +10 -0
  4. package/dist/catalyst/p-2257ac13.entry.js.map +1 -0
  5. package/dist/catalyst/scss/fonts/_fonts.mixins.lato.scss +36 -18
  6. package/dist/catalyst/scss/utils/_color.scss +3 -1
  7. package/dist/catalyst/scss/utils/_typography.mixins.scss +10 -2
  8. package/dist/catalyst/scss/vendor/_flatpickr.scss +5 -2
  9. package/dist/cjs/cat-alert_26.cjs.entry.js +513 -240
  10. package/dist/cjs/cat-alert_26.cjs.entry.js.map +1 -1
  11. package/dist/cjs/catalyst.cjs.js +1 -1
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/collection/components/cat-button/cat-button.css +0 -1
  14. package/dist/collection/components/cat-datepicker/cat-datepicker.config.js +6 -0
  15. package/dist/collection/components/cat-datepicker/cat-datepicker.config.js.map +1 -1
  16. package/dist/collection/components/cat-datepicker/cat-datepicker.js +30 -0
  17. package/dist/collection/components/cat-datepicker/cat-datepicker.js.map +1 -1
  18. package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.js +17 -0
  19. package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.js.map +1 -1
  20. package/dist/collection/components/cat-dropdown/cat-dropdown.js +10 -5
  21. package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
  22. package/dist/collection/components/cat-select/cat-select.js +22 -11
  23. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  24. package/dist/collection/components/cat-tabs/cat-tabs.css +7 -1
  25. package/dist/collection/components/cat-tooltip/cat-tooltip.js +1 -1
  26. package/dist/collection/scss/fonts/_fonts.mixins.lato.scss +36 -18
  27. package/dist/collection/scss/utils/_color.scss +3 -1
  28. package/dist/collection/scss/utils/_typography.mixins.scss +10 -2
  29. package/dist/collection/scss/vendor/_flatpickr.scss +5 -2
  30. package/dist/components/cat-button2.js +1 -1
  31. package/dist/components/cat-button2.js.map +1 -1
  32. package/dist/components/cat-checkbox2.js.map +1 -1
  33. package/dist/components/cat-datepicker-inline.js +4 -1
  34. package/dist/components/cat-datepicker-inline.js.map +1 -1
  35. package/dist/components/cat-datepicker.js +16 -0
  36. package/dist/components/cat-datepicker.js.map +1 -1
  37. package/dist/components/cat-datepicker.locale.js +6 -0
  38. package/dist/components/cat-datepicker.locale.js.map +1 -1
  39. package/dist/components/cat-dropdown2.js +252 -99
  40. package/dist/components/cat-dropdown2.js.map +1 -1
  41. package/dist/components/cat-input2.js.map +1 -1
  42. package/dist/components/cat-select2.js +21 -10
  43. package/dist/components/cat-select2.js.map +1 -1
  44. package/dist/components/cat-tabs.js +1 -1
  45. package/dist/components/cat-tabs.js.map +1 -1
  46. package/dist/components/cat-textarea.js.map +1 -1
  47. package/dist/components/cat-tooltip.js.map +1 -1
  48. package/dist/components/floating-ui.dom.esm.js +215 -129
  49. package/dist/components/floating-ui.dom.esm.js.map +1 -1
  50. package/dist/esm/cat-alert_26.entry.js +513 -240
  51. package/dist/esm/cat-alert_26.entry.js.map +1 -1
  52. package/dist/esm/catalyst.js +1 -1
  53. package/dist/esm/loader.js +1 -1
  54. package/dist/types/components/cat-datepicker/cat-datepicker.config.d.ts +3 -0
  55. package/dist/types/components/cat-datepicker/cat-datepicker.d.ts +7 -0
  56. package/dist/types/components/cat-datepicker-inline/cat-datepicker-inline.d.ts +6 -0
  57. package/dist/types/components.d.ts +16 -0
  58. package/package.json +11 -11
  59. package/dist/catalyst/p-dfc7c716.entry.js +0 -10
  60. package/dist/catalyst/p-dfc7c716.entry.js.map +0 -1
@@ -1039,7 +1039,7 @@ function createEmptyStyleRule(query) {
1039
1039
  }
1040
1040
  }
1041
1041
 
1042
- const catButtonCss = ":host{display:inline-block;max-width:100%;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}.cat-button{position:relative;font:inherit;display:flex;align-items:center;justify-content:center;border:none;border-radius:var(--cat-border-radius-m, 0.25rem);text-decoration:none;width:100%;box-sizing:border-box;cursor:pointer;transition:color 125ms linear, border-color 125ms linear, background-color 125ms linear, box-shadow 125ms linear}.cat-button:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-button-content{display:flex;flex-direction:column;min-width:0}.cat-button-content-inner{word-wrap:break-word;word-break:break-word}.cat-button-ellipsed .cat-button-content-inner{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.cat-button-disabled{cursor:not-allowed}.cat-button-round{border-radius:10rem}.cat-button-loading{cursor:default}.cat-button-loading cat-spinner{position:absolute}.cat-button-loading>*:not(cat-spinner){visibility:hidden}.cat-group-button-first{border-top-right-radius:0;border-bottom-right-radius:0}.cat-group-button-middle{border-radius:0}.cat-group-button-last{border-top-left-radius:0;border-bottom-left-radius:0}.cat-group-button:hover{z-index:1}.cat-group-button:focus-visible{z-index:2}.cat-button-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.cat-button-filled.cat-button-disabled{--bg:242, 244, 247;--fill:var(--cat-font-color-muted, 81, 92, 108)}.cat-button-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--base), 0.2);color:rgb(var(--text))}.cat-button-outlined.cat-button-disabled{--base:var(--cat-font-color-muted, 81, 92, 108);--text:var(--cat-font-color-muted, 81, 92, 108)}.cat-button-outlined:hover:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-outlined.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-outlined:active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-text{background-color:transparent;color:rgb(var(--text));text-decoration:var(--cat-link-button-decoration, none)}.cat-button-text.cat-button-disabled{--text:var(--cat-font-color-muted, 81, 92, 108)}.cat-button-text:hover:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:var(--cat-link-button-decoration-hover, none);background-color:rgba(var(--base), 0.1)}.cat-button-text.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:var(--cat-link-button-decoration-hover, none);background-color:rgba(var(--base), 0.1)}.cat-button-primary{--bg:var(--cat-primary-bg, 0, 129, 148);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 0, 129, 148);--base:var(--cat-primary-text, 0, 129, 148)}.cat-button-primary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-hover, 1, 115, 132);--fill:var(--cat-primary-fill-hover, 255, 255, 255);--text:var(--cat-primary-text-hover, 1, 115, 132)}.cat-button-primary.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-primary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-active, 2, 99, 113);--fill:var(--cat-primary-fill-active, 255, 255, 255);--text:var(--cat-primary-text-active, 2, 99, 113)}.cat-button-secondary{--bg:var(--cat-secondary-bg, 105, 118, 135);--fill:var(--cat-secondary-fill, 255, 255, 255);--text:var(--cat-secondary-text, 0, 0, 0);--base:var(--cat-secondary-bg, 105, 118, 135)}.cat-button-secondary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-secondary-bg-hover, 105, 118, 135);--fill:var(--cat-secondary-fill-hover, 255, 255, 255);--text:var(--cat-secondary-text-hover, 0, 0, 0)}.cat-button-secondary.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-secondary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-secondary-bg-active, 105, 118, 135);--fill:var(--cat-secondary-fill-active, 255, 255, 255);--text:var(--cat-secondary-text-active, 0, 0, 0)}.cat-button-success{--bg:var(--cat-success-bg, 0, 132, 88);--fill:var(--cat-success-fill, 255, 255, 255);--text:var(--cat-success-text, 0, 132, 88);--base:var(--cat-success-text, 0, 132, 88)}.cat-button-success:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-success-bg-hover, 0, 117, 78);--fill:var(--cat-success-fill-hover, 255, 255, 255);--text:var(--cat-success-text-hover, 0, 117, 78)}.cat-button-success.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-success:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-success-bg-active, 0, 105, 70);--fill:var(--cat-success-fill-active, 255, 255, 255);--text:var(--cat-success-text-active, 0, 105, 70)}.cat-button-warning{--bg:var(--cat-warning-bg, 255, 206, 128);--fill:var(--cat-warning-fill, 0, 0, 0);--text:var(--cat-warning-text, 159, 97, 0);--base:var(--cat-warning-text, 159, 97, 0)}.cat-button-warning:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-warning-bg-hover, 255, 214, 148);--fill:var(--cat-warning-fill-hover, 0, 0, 0);--text:var(--cat-warning-text-hover, 159, 97, 0)}.cat-button-warning.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-warning:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-warning-bg-active, 255, 222, 168);--fill:var(--cat-warning-fill-active, 0, 0, 0);--text:var(--cat-warning-text-active, 159, 97, 0)}.cat-button-danger{--bg:var(--cat-danger-bg, 217, 52, 13);--fill:var(--cat-danger-fill, 255, 255, 255);--text:var(--cat-danger-text, 217, 52, 13);--base:var(--cat-danger-text, 217, 52, 13)}.cat-button-danger:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-danger-bg-hover, 194, 46, 11);--fill:var(--cat-danger-fill-hover, 255, 255, 255);--text:var(--cat-danger-text-hover, 194, 46, 11)}.cat-button-danger.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-danger:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-danger-bg-active, 174, 42, 10);--fill:var(--cat-danger-fill-active, 255, 255, 255);--text:var(--cat-danger-text-active, 174, 42, 10)}:host(.cat-button-pull:not([size])){margin:-0.625rem -0.75rem}:host(.cat-button-pull-h:not([size])){margin-left:-0.75rem;margin-right:-0.75rem}:host(.cat-button-pull-v:not([size])){margin-top:-0.625rem;margin-bottom:-0.625rem}:host(.cat-button-pull-t:not([size])){margin-top:-0.625rem}:host(.cat-button-pull-l:not([size])){margin-left:-0.75rem}:host(.cat-button-pull-b:not([size])){margin-bottom:-0.625rem}:host(.cat-button-pull-r:not([size])){margin-right:-0.75rem}.cat-button-xs{min-width:1.5rem;padding:0.1875rem 0.25rem;font-size:0.875rem;line-height:1.125rem;gap:0.25rem}.cat-button-xs.cat-button-icon{width:1.5rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=xs]){margin:-0.1875rem -0.25rem}:host(.cat-button-pull-h[size=xs]){margin-left:-0.25rem;margin-right:-0.25rem}:host(.cat-button-pull-v[size=xs]){margin-top:-0.1875rem;margin-bottom:-0.1875rem}:host(.cat-button-pull-t[size=xs]){margin-top:-0.1875rem}:host(.cat-button-pull-l[size=xs]){margin-left:-0.25rem}:host(.cat-button-pull-b[size=xs]){margin-bottom:-0.1875rem}:host(.cat-button-pull-r[size=xs]){margin-right:-0.25rem}.cat-button-s{min-width:2rem;padding:0.375rem 0.5rem;font-size:0.9375rem;line-height:1.25rem;gap:0.25rem}.cat-button-s cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-s.cat-button-icon{width:2rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=s]){margin:-0.375rem -0.5rem}:host(.cat-button-pull-h[size=s]){margin-left:-0.5rem;margin-right:-0.5rem}:host(.cat-button-pull-v[size=s]){margin-top:-0.375rem;margin-bottom:-0.375rem}:host(.cat-button-pull-t[size=s]){margin-top:-0.375rem}:host(.cat-button-pull-l[size=s]){margin-left:-0.5rem}:host(.cat-button-pull-b[size=s]){margin-bottom:-0.375rem}:host(.cat-button-pull-r[size=s]){margin-right:-0.5rem}.cat-button-m{min-width:2.5rem;padding:0.625rem 0.75rem;font-size:0.9375rem;line-height:1.25rem;gap:0.25rem}.cat-button-m cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-m.cat-button-icon{width:2.5rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=m]){margin:-0.625rem -0.75rem}:host(.cat-button-pull-h[size=m]){margin-left:-0.75rem;margin-right:-0.75rem}:host(.cat-button-pull-v[size=m]){margin-top:-0.625rem;margin-bottom:-0.625rem}:host(.cat-button-pull-t[size=m]){margin-top:-0.625rem}:host(.cat-button-pull-l[size=m]){margin-left:-0.75rem}:host(.cat-button-pull-b[size=m]){margin-bottom:-0.625rem}:host(.cat-button-pull-r[size=m]){margin-right:-0.75rem}.cat-button-l{min-width:3rem;padding:0.875rem 1rem;font-size:0.9375rem;line-height:1.25rem;gap:0.25rem}.cat-button-l cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-l.cat-button-icon{width:3rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=l]){margin:-0.875rem -1rem}:host(.cat-button-pull-h[size=l]){margin-left:-1rem;margin-right:-1rem}:host(.cat-button-pull-v[size=l]){margin-top:-0.875rem;margin-bottom:-0.875rem}:host(.cat-button-pull-t[size=l]){margin-top:-0.875rem}:host(.cat-button-pull-l[size=l]){margin-left:-1rem}:host(.cat-button-pull-b[size=l]){margin-bottom:-0.875rem}:host(.cat-button-pull-r[size=l]){margin-right:-1rem}.cat-button-xl{min-width:3.5rem;padding:1rem 1.25rem;font-size:1.125rem;line-height:1.5rem;gap:0.25rem}.cat-button-xl.cat-button-icon{width:3.5rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=xl]){margin:-1rem -1.25rem}:host(.cat-button-pull-h[size=xl]){margin-left:-1.25rem;margin-right:-1.25rem}:host(.cat-button-pull-v[size=xl]){margin-top:-1rem;margin-bottom:-1rem}:host(.cat-button-pull-t[size=xl]){margin-top:-1rem}:host(.cat-button-pull-l[size=xl]){margin-left:-1.25rem}:host(.cat-button-pull-b[size=xl]){margin-bottom:-1rem}:host(.cat-button-pull-r[size=xl]){margin-right:-1.25rem}:host(.cat-tab)::part(button){padding:1.125rem 0.75rem;--cat-primary-text:transparent;--cat-secondary-bg:transparent}:host(.cat-tab)::part(content)::before{content:attr(data-text);content:attr(data-text)/\"\";height:0;visibility:hidden;overflow:hidden;-webkit-user-select:none;user-select:none;pointer-events:none;font-weight:700}:host(.cat-text-left) .cat-button{justify-content:left}:host(.cat-text-right) .cat-button{justify-content:right}:host(.cat-nav-item){width:100%}:host(.cat-nav-item) .cat-button{box-shadow:none;justify-content:left;gap:0.5rem}:host(.cat-nav-item) .cat-button:focus-visible{outline-offset:-2px}";
1042
+ const catButtonCss = ":host{display:inline-block;max-width:100%;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}.cat-button{position:relative;font:inherit;display:flex;align-items:center;justify-content:center;border:none;border-radius:var(--cat-border-radius-m, 0.25rem);text-decoration:none;width:100%;box-sizing:border-box;cursor:pointer;transition:color 125ms linear, border-color 125ms linear, background-color 125ms linear, box-shadow 125ms linear}.cat-button:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-button-content{display:flex;flex-direction:column;min-width:0}.cat-button-content-inner{word-wrap:break-word;word-break:break-word}.cat-button-ellipsed .cat-button-content-inner{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.cat-button-disabled{cursor:not-allowed}.cat-button-round{border-radius:10rem}.cat-button-loading{cursor:default}.cat-button-loading cat-spinner{position:absolute}.cat-button-loading>*:not(cat-spinner){visibility:hidden}.cat-group-button-first{border-top-right-radius:0;border-bottom-right-radius:0}.cat-group-button-middle{border-radius:0}.cat-group-button-last{border-top-left-radius:0;border-bottom-left-radius:0}.cat-group-button:hover{z-index:1}.cat-group-button:focus-visible{z-index:2}.cat-button-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.cat-button-filled.cat-button-disabled{--bg:242, 244, 247;--fill:var(--cat-font-color-muted, 81, 92, 108)}.cat-button-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--base), 0.2);color:rgb(var(--text))}.cat-button-outlined.cat-button-disabled{--base:var(--cat-font-color-muted, 81, 92, 108);--text:var(--cat-font-color-muted, 81, 92, 108)}.cat-button-outlined:hover:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-outlined.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-outlined:active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-text{background-color:transparent;color:rgb(var(--text));text-decoration:var(--cat-link-button-decoration, none)}.cat-button-text.cat-button-disabled{--text:var(--cat-font-color-muted, 81, 92, 108)}.cat-button-text:hover:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:var(--cat-link-button-decoration-hover, none);background-color:rgba(var(--base), 0.1)}.cat-button-text.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:var(--cat-link-button-decoration-hover, none);background-color:rgba(var(--base), 0.1)}.cat-button-primary{--bg:var(--cat-primary-bg, 0, 129, 148);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 0, 129, 148);--base:var(--cat-primary-text, 0, 129, 148)}.cat-button-primary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-hover, 1, 115, 132);--fill:var(--cat-primary-fill-hover, 255, 255, 255);--text:var(--cat-primary-text-hover, 1, 115, 132)}.cat-button-primary.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-primary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-active, 2, 99, 113);--fill:var(--cat-primary-fill-active, 255, 255, 255);--text:var(--cat-primary-text-active, 2, 99, 113)}.cat-button-secondary{--bg:var(--cat-secondary-bg, 105, 118, 135);--fill:var(--cat-secondary-fill, 255, 255, 255);--text:var(--cat-secondary-text, 0, 0, 0);--base:var(--cat-secondary-bg, 105, 118, 135)}.cat-button-secondary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-secondary-bg-hover, 105, 118, 135);--fill:var(--cat-secondary-fill-hover, 255, 255, 255);--text:var(--cat-secondary-text-hover, 0, 0, 0)}.cat-button-secondary.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-secondary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-secondary-bg-active, 105, 118, 135);--fill:var(--cat-secondary-fill-active, 255, 255, 255);--text:var(--cat-secondary-text-active, 0, 0, 0)}.cat-button-success{--bg:var(--cat-success-bg, 0, 132, 88);--fill:var(--cat-success-fill, 255, 255, 255);--text:var(--cat-success-text, 0, 132, 88);--base:var(--cat-success-text, 0, 132, 88)}.cat-button-success:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-success-bg-hover, 0, 117, 78);--fill:var(--cat-success-fill-hover, 255, 255, 255);--text:var(--cat-success-text-hover, 0, 117, 78)}.cat-button-success.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-success:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-success-bg-active, 0, 105, 70);--fill:var(--cat-success-fill-active, 255, 255, 255);--text:var(--cat-success-text-active, 0, 105, 70)}.cat-button-warning{--bg:var(--cat-warning-bg, 255, 206, 128);--fill:var(--cat-warning-fill, 0, 0, 0);--text:var(--cat-warning-text, 159, 97, 0);--base:var(--cat-warning-text, 159, 97, 0)}.cat-button-warning:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-warning-bg-hover, 255, 214, 148);--fill:var(--cat-warning-fill-hover, 0, 0, 0);--text:var(--cat-warning-text-hover, 159, 97, 0)}.cat-button-warning.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-warning:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-warning-bg-active, 255, 222, 168);--fill:var(--cat-warning-fill-active, 0, 0, 0);--text:var(--cat-warning-text-active, 159, 97, 0)}.cat-button-danger{--bg:var(--cat-danger-bg, 217, 52, 13);--fill:var(--cat-danger-fill, 255, 255, 255);--text:var(--cat-danger-text, 217, 52, 13);--base:var(--cat-danger-text, 217, 52, 13)}.cat-button-danger:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-danger-bg-hover, 194, 46, 11);--fill:var(--cat-danger-fill-hover, 255, 255, 255);--text:var(--cat-danger-text-hover, 194, 46, 11)}.cat-button-danger.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading),.cat-button-danger:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-danger-bg-active, 174, 42, 10);--fill:var(--cat-danger-fill-active, 255, 255, 255);--text:var(--cat-danger-text-active, 174, 42, 10)}:host(.cat-button-pull:not([size])){margin:-0.625rem -0.75rem}:host(.cat-button-pull-h:not([size])){margin-left:-0.75rem;margin-right:-0.75rem}:host(.cat-button-pull-v:not([size])){margin-top:-0.625rem;margin-bottom:-0.625rem}:host(.cat-button-pull-t:not([size])){margin-top:-0.625rem}:host(.cat-button-pull-l:not([size])){margin-left:-0.75rem}:host(.cat-button-pull-b:not([size])){margin-bottom:-0.625rem}:host(.cat-button-pull-r:not([size])){margin-right:-0.75rem}.cat-button-xs{min-width:1.5rem;padding:0.1875rem 0.25rem;font-size:0.875rem;line-height:1.125rem;gap:0.25rem}.cat-button-xs.cat-button-icon{width:1.5rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=xs]){margin:-0.1875rem -0.25rem}:host(.cat-button-pull-h[size=xs]){margin-left:-0.25rem;margin-right:-0.25rem}:host(.cat-button-pull-v[size=xs]){margin-top:-0.1875rem;margin-bottom:-0.1875rem}:host(.cat-button-pull-t[size=xs]){margin-top:-0.1875rem}:host(.cat-button-pull-l[size=xs]){margin-left:-0.25rem}:host(.cat-button-pull-b[size=xs]){margin-bottom:-0.1875rem}:host(.cat-button-pull-r[size=xs]){margin-right:-0.25rem}.cat-button-s{min-width:2rem;padding:0.375rem 0.5rem;font-size:0.9375rem;line-height:1.25rem;gap:0.25rem}.cat-button-s cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-s.cat-button-icon{width:2rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=s]){margin:-0.375rem -0.5rem}:host(.cat-button-pull-h[size=s]){margin-left:-0.5rem;margin-right:-0.5rem}:host(.cat-button-pull-v[size=s]){margin-top:-0.375rem;margin-bottom:-0.375rem}:host(.cat-button-pull-t[size=s]){margin-top:-0.375rem}:host(.cat-button-pull-l[size=s]){margin-left:-0.5rem}:host(.cat-button-pull-b[size=s]){margin-bottom:-0.375rem}:host(.cat-button-pull-r[size=s]){margin-right:-0.5rem}.cat-button-m{min-width:2.5rem;padding:0.625rem 0.75rem;font-size:0.9375rem;line-height:1.25rem;gap:0.25rem}.cat-button-m cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-m.cat-button-icon{width:2.5rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=m]){margin:-0.625rem -0.75rem}:host(.cat-button-pull-h[size=m]){margin-left:-0.75rem;margin-right:-0.75rem}:host(.cat-button-pull-v[size=m]){margin-top:-0.625rem;margin-bottom:-0.625rem}:host(.cat-button-pull-t[size=m]){margin-top:-0.625rem}:host(.cat-button-pull-l[size=m]){margin-left:-0.75rem}:host(.cat-button-pull-b[size=m]){margin-bottom:-0.625rem}:host(.cat-button-pull-r[size=m]){margin-right:-0.75rem}.cat-button-l{min-width:3rem;padding:0.875rem 1rem;font-size:0.9375rem;line-height:1.25rem;gap:0.25rem}.cat-button-l cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-l.cat-button-icon{width:3rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=l]){margin:-0.875rem -1rem}:host(.cat-button-pull-h[size=l]){margin-left:-1rem;margin-right:-1rem}:host(.cat-button-pull-v[size=l]){margin-top:-0.875rem;margin-bottom:-0.875rem}:host(.cat-button-pull-t[size=l]){margin-top:-0.875rem}:host(.cat-button-pull-l[size=l]){margin-left:-1rem}:host(.cat-button-pull-b[size=l]){margin-bottom:-0.875rem}:host(.cat-button-pull-r[size=l]){margin-right:-1rem}.cat-button-xl{min-width:3.5rem;padding:1rem 1.25rem;font-size:1.125rem;line-height:1.5rem;gap:0.25rem}.cat-button-xl.cat-button-icon{width:3.5rem;padding-left:0;padding-right:0}:host(.cat-button-pull[size=xl]){margin:-1rem -1.25rem}:host(.cat-button-pull-h[size=xl]){margin-left:-1.25rem;margin-right:-1.25rem}:host(.cat-button-pull-v[size=xl]){margin-top:-1rem;margin-bottom:-1rem}:host(.cat-button-pull-t[size=xl]){margin-top:-1rem}:host(.cat-button-pull-l[size=xl]){margin-left:-1.25rem}:host(.cat-button-pull-b[size=xl]){margin-bottom:-1rem}:host(.cat-button-pull-r[size=xl]){margin-right:-1.25rem}:host(.cat-tab)::part(button){padding:1.125rem 0.75rem;--cat-primary-text:transparent;--cat-secondary-bg:transparent}:host(.cat-tab)::part(content)::before{content:attr(data-text);content:attr(data-text)/\"\";height:0;visibility:hidden;overflow:hidden;user-select:none;pointer-events:none;font-weight:700}:host(.cat-text-left) .cat-button{justify-content:left}:host(.cat-text-right) .cat-button{justify-content:right}:host(.cat-nav-item){width:100%}:host(.cat-nav-item) .cat-button{box-shadow:none;justify-content:left;gap:0.5rem}:host(.cat-nav-item) .cat-button:focus-visible{outline-offset:-2px}";
1043
1043
 
1044
1044
  const CatButton = class {
1045
1045
  constructor(hostRef) {
@@ -4004,6 +4004,12 @@ function getConfig(options, more = {}) {
4004
4004
  weekNumbers: true,
4005
4005
  minuteIncrement: options.step,
4006
4006
  clickOpens: !options.disabled && !options.readonly,
4007
+ onReady: (_dates, _dateStr, flatpickr) => {
4008
+ for (const key in options.nativePickerAttributes) {
4009
+ const value = options.nativePickerAttributes[key];
4010
+ flatpickr.calendarContainer.setAttribute(key, value);
4011
+ }
4012
+ },
4007
4013
  onChange: (dates, dateStr, flatpickr) => {
4008
4014
  let value = dateStr || undefined;
4009
4015
  if (options.mode === 'week') {
@@ -4130,6 +4136,7 @@ const CatDatepickerFlat = class {
4130
4136
  this.errors = undefined;
4131
4137
  this.errorUpdate = 0;
4132
4138
  this.nativeAttributes = undefined;
4139
+ this.nativePickerAttributes = undefined;
4133
4140
  }
4134
4141
  get input() {
4135
4142
  return this._input?.shadowRoot?.querySelector('input') ?? undefined;
@@ -4188,6 +4195,9 @@ const CatDatepickerFlat = class {
4188
4195
  if (this.disabled || this.readonly || !input) {
4189
4196
  return;
4190
4197
  }
4198
+ // avoid dropdown closing if datepicker is part of a dropdown
4199
+ const withinDropdown = !!this.findClosest('cat-dropdown', input);
4200
+ const nativePickerAttributes = withinDropdown ? { 'data-dropdown-no-close': '' } : {};
4191
4201
  return flatpickr(input, getConfig({
4192
4202
  locale: getLocale(of.catI18nRegistry.getLocale()),
4193
4203
  format: getFormat(of.catI18nRegistry.getLocale(), this.mode),
@@ -4197,9 +4207,20 @@ const CatDatepickerFlat = class {
4197
4207
  step: this.step,
4198
4208
  disabled: this.disabled,
4199
4209
  readonly: this.readonly,
4210
+ nativePickerAttributes: { ...nativePickerAttributes, ...this.nativePickerAttributes },
4200
4211
  applyChange: value => (this.value = value)
4201
4212
  }));
4202
4213
  }
4214
+ findClosest(selector, element) {
4215
+ if (element instanceof Element && element.matches(selector)) {
4216
+ return element;
4217
+ }
4218
+ // Search in parent element or Shadow DOM host
4219
+ const nextElement = element instanceof ShadowRoot
4220
+ ? element.host
4221
+ : element.parentElement || element.getRootNode().host;
4222
+ return nextElement ? this.findClosest(selector, nextElement) : null;
4223
+ }
4203
4224
  static get watchers() { return {
4204
4225
  "value": ["onValueChanged"],
4205
4226
  "disabled": ["onDisabledChanged"],
@@ -4221,6 +4242,7 @@ const CatDatepickerInline = class {
4221
4242
  this.readonly = false;
4222
4243
  this.step = 5;
4223
4244
  this.value = undefined;
4245
+ this.nativePickerAttributes = undefined;
4224
4246
  }
4225
4247
  onValueChanged(value) {
4226
4248
  if (value) {
@@ -4263,6 +4285,7 @@ const CatDatepickerInline = class {
4263
4285
  step: this.step,
4264
4286
  disabled: this.disabled,
4265
4287
  readonly: this.readonly,
4288
+ nativePickerAttributes: this.nativePickerAttributes ?? {},
4266
4289
  applyChange: value => (this.value = value)
4267
4290
  }, {
4268
4291
  ...(this.disabled ? { enable: [] } : {}),
@@ -4955,7 +4978,7 @@ const size = function (options) {
4955
4978
 
4956
4979
  function getWindow(node) {
4957
4980
  var _node$ownerDocument;
4958
- return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
4981
+ return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
4959
4982
  }
4960
4983
 
4961
4984
  function getComputedStyle$1(element) {
@@ -4966,22 +4989,24 @@ function isNode(value) {
4966
4989
  return value instanceof getWindow(value).Node;
4967
4990
  }
4968
4991
  function getNodeName(node) {
4969
- return isNode(node) ? (node.nodeName || '').toLowerCase() : '';
4992
+ if (isNode(node)) {
4993
+ return (node.nodeName || '').toLowerCase();
4994
+ }
4995
+ // Mocked nodes in testing environments may not be instances of Node. By
4996
+ // returning `#document` an infinite loop won't occur.
4997
+ // https://github.com/floating-ui/floating-ui/issues/2317
4998
+ return '#document';
4970
4999
  }
4971
5000
 
4972
5001
  function isHTMLElement(value) {
4973
- return value instanceof getWindow(value).HTMLElement;
4974
- }
4975
- function isElement(value) {
4976
- return value instanceof getWindow(value).Element;
5002
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
4977
5003
  }
4978
5004
  function isShadowRoot(node) {
4979
5005
  // Browsers without `ShadowRoot` support.
4980
5006
  if (typeof ShadowRoot === 'undefined') {
4981
5007
  return false;
4982
5008
  }
4983
- const OwnElement = getWindow(node).ShadowRoot;
4984
- return node instanceof OwnElement || node instanceof ShadowRoot;
5009
+ return node instanceof getWindow(node).ShadowRoot || node instanceof ShadowRoot;
4985
5010
  }
4986
5011
  function isOverflowElement(element) {
4987
5012
  const {
@@ -5000,7 +5025,7 @@ function isContainingBlock(element) {
5000
5025
  const css = getComputedStyle$1(element);
5001
5026
 
5002
5027
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
5003
- return css.transform !== 'none' || css.perspective !== 'none' || !safari && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !safari && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
5028
+ return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !safari && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !safari && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
5004
5029
  }
5005
5030
  function isSafari() {
5006
5031
  if (typeof CSS === 'undefined' || !CSS.supports) return false;
@@ -5013,6 +5038,11 @@ function isLastTraversableNode(node) {
5013
5038
  const min = Math.min;
5014
5039
  const max = Math.max;
5015
5040
  const round = Math.round;
5041
+ const floor = Math.floor;
5042
+ const createCoords = v => ({
5043
+ x: v,
5044
+ y: v
5045
+ });
5016
5046
 
5017
5047
  function getCssDimensions(element) {
5018
5048
  const css = getComputedStyle$1(element);
@@ -5031,31 +5061,31 @@ function getCssDimensions(element) {
5031
5061
  return {
5032
5062
  width,
5033
5063
  height,
5034
- fallback: shouldFallback
5064
+ $: shouldFallback
5035
5065
  };
5036
5066
  }
5037
5067
 
5068
+ function isElement(value) {
5069
+ return value instanceof Element || value instanceof getWindow(value).Element;
5070
+ }
5071
+
5038
5072
  function unwrapElement(element) {
5039
5073
  return !isElement(element) ? element.contextElement : element;
5040
5074
  }
5041
5075
 
5042
- const FALLBACK_SCALE = {
5043
- x: 1,
5044
- y: 1
5045
- };
5046
5076
  function getScale(element) {
5047
5077
  const domElement = unwrapElement(element);
5048
5078
  if (!isHTMLElement(domElement)) {
5049
- return FALLBACK_SCALE;
5079
+ return createCoords(1);
5050
5080
  }
5051
5081
  const rect = domElement.getBoundingClientRect();
5052
5082
  const {
5053
5083
  width,
5054
5084
  height,
5055
- fallback
5085
+ $
5056
5086
  } = getCssDimensions(domElement);
5057
- let x = (fallback ? round(rect.width) : rect.width) / width;
5058
- let y = (fallback ? round(rect.height) : rect.height) / height;
5087
+ let x = ($ ? round(rect.width) : rect.width) / width;
5088
+ let y = ($ ? round(rect.height) : rect.height) / height;
5059
5089
 
5060
5090
  // 0, NaN, or Infinity should always fallback to 1.
5061
5091
 
@@ -5071,27 +5101,26 @@ function getScale(element) {
5071
5101
  };
5072
5102
  }
5073
5103
 
5074
- const noOffsets = {
5075
- x: 0,
5076
- y: 0
5077
- };
5078
- function getVisualOffsets(element, isFixed, floatingOffsetParent) {
5079
- var _win$visualViewport, _win$visualViewport2;
5080
- if (isFixed === void 0) {
5081
- isFixed = true;
5082
- }
5083
- if (!isSafari()) {
5084
- return noOffsets;
5085
- }
5086
- const win = element ? getWindow(element) : window;
5087
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== win) {
5104
+ const noOffsets = /*#__PURE__*/createCoords(0);
5105
+ function getVisualOffsets(element) {
5106
+ const win = getWindow(element);
5107
+ if (!isSafari() || !win.visualViewport) {
5088
5108
  return noOffsets;
5089
5109
  }
5090
5110
  return {
5091
- x: ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0,
5092
- y: ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0
5111
+ x: win.visualViewport.offsetLeft,
5112
+ y: win.visualViewport.offsetTop
5093
5113
  };
5094
5114
  }
5115
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
5116
+ if (isFixed === void 0) {
5117
+ isFixed = false;
5118
+ }
5119
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
5120
+ return false;
5121
+ }
5122
+ return isFixed;
5123
+ }
5095
5124
 
5096
5125
  function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
5097
5126
  if (includeScale === void 0) {
@@ -5102,7 +5131,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
5102
5131
  }
5103
5132
  const clientRect = element.getBoundingClientRect();
5104
5133
  const domElement = unwrapElement(element);
5105
- let scale = FALLBACK_SCALE;
5134
+ let scale = createCoords(1);
5106
5135
  if (includeScale) {
5107
5136
  if (offsetParent) {
5108
5137
  if (isElement(offsetParent)) {
@@ -5112,7 +5141,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
5112
5141
  scale = getScale(element);
5113
5142
  }
5114
5143
  }
5115
- const visualOffsets = getVisualOffsets(domElement, isFixedStrategy, offsetParent);
5144
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
5116
5145
  let x = (clientRect.left + visualOffsets.x) / scale.x;
5117
5146
  let y = (clientRect.top + visualOffsets.y) / scale.y;
5118
5147
  let width = clientRect.width / scale.x;
@@ -5125,14 +5154,14 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
5125
5154
  const iframeScale = getScale(currentIFrame);
5126
5155
  const iframeRect = currentIFrame.getBoundingClientRect();
5127
5156
  const css = getComputedStyle(currentIFrame);
5128
- iframeRect.x += (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
5129
- iframeRect.y += (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
5157
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
5158
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
5130
5159
  x *= iframeScale.x;
5131
5160
  y *= iframeScale.y;
5132
5161
  width *= iframeScale.x;
5133
5162
  height *= iframeScale.y;
5134
- x += iframeRect.x;
5135
- y += iframeRect.y;
5163
+ x += left;
5164
+ y += top;
5136
5165
  currentIFrame = getWindow(currentIFrame).frameElement;
5137
5166
  }
5138
5167
  }
@@ -5144,10 +5173,6 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
5144
5173
  });
5145
5174
  }
5146
5175
 
5147
- function getDocumentElement(node) {
5148
- return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
5149
- }
5150
-
5151
5176
  function getNodeScroll(element) {
5152
5177
  if (isElement(element)) {
5153
5178
  return {
@@ -5161,6 +5186,11 @@ function getNodeScroll(element) {
5161
5186
  };
5162
5187
  }
5163
5188
 
5189
+ function getDocumentElement(node) {
5190
+ var _ref;
5191
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
5192
+ }
5193
+
5164
5194
  function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
5165
5195
  let {
5166
5196
  rect,
@@ -5176,14 +5206,8 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
5176
5206
  scrollLeft: 0,
5177
5207
  scrollTop: 0
5178
5208
  };
5179
- let scale = {
5180
- x: 1,
5181
- y: 1
5182
- };
5183
- const offsets = {
5184
- x: 0,
5185
- y: 0
5186
- };
5209
+ let scale = createCoords(1);
5210
+ const offsets = createCoords(0);
5187
5211
  if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
5188
5212
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
5189
5213
  scroll = getNodeScroll(offsetParent);
@@ -5203,6 +5227,10 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
5203
5227
  };
5204
5228
  }
5205
5229
 
5230
+ function getClientRects(element) {
5231
+ return Array.from(element.getClientRects());
5232
+ }
5233
+
5206
5234
  function getWindowScrollBarX(element) {
5207
5235
  // If <html> has a CSS width greater than the viewport, then this will be
5208
5236
  // incorrect for RTL.
@@ -5249,9 +5277,7 @@ function getParentNode(node) {
5249
5277
  function getNearestOverflowAncestor(node) {
5250
5278
  const parentNode = getParentNode(node);
5251
5279
  if (isLastTraversableNode(parentNode)) {
5252
- // `getParentNode` will never return a `Document` due to the fallback
5253
- // check, so it's either the <html> or <body> element.
5254
- return parentNode.ownerDocument.body;
5280
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
5255
5281
  }
5256
5282
  if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
5257
5283
  return parentNode;
@@ -5303,10 +5329,7 @@ function getInnerBoundingClientRect(element, strategy) {
5303
5329
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
5304
5330
  const top = clientRect.top + element.clientTop;
5305
5331
  const left = clientRect.left + element.clientLeft;
5306
- const scale = isHTMLElement(element) ? getScale(element) : {
5307
- x: 1,
5308
- y: 1
5309
- };
5332
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
5310
5333
  const width = element.clientWidth * scale.x;
5311
5334
  const height = element.clientHeight * scale.y;
5312
5335
  const x = left * scale.x;
@@ -5410,6 +5433,36 @@ function getDimensions(element) {
5410
5433
  return getCssDimensions(element);
5411
5434
  }
5412
5435
 
5436
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
5437
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
5438
+ const documentElement = getDocumentElement(offsetParent);
5439
+ const isFixed = strategy === 'fixed';
5440
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
5441
+ let scroll = {
5442
+ scrollLeft: 0,
5443
+ scrollTop: 0
5444
+ };
5445
+ const offsets = createCoords(0);
5446
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
5447
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
5448
+ scroll = getNodeScroll(offsetParent);
5449
+ }
5450
+ if (isHTMLElement(offsetParent)) {
5451
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
5452
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
5453
+ offsets.y = offsetRect.y + offsetParent.clientTop;
5454
+ } else if (documentElement) {
5455
+ offsets.x = getWindowScrollBarX(documentElement);
5456
+ }
5457
+ }
5458
+ return {
5459
+ x: rect.left + scroll.scrollLeft - offsets.x,
5460
+ y: rect.top + scroll.scrollTop - offsets.y,
5461
+ width: rect.width,
5462
+ height: rect.height
5463
+ };
5464
+ }
5465
+
5413
5466
  function getTrueOffsetParent(element, polyfill) {
5414
5467
  if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
5415
5468
  return null;
@@ -5448,68 +5501,115 @@ function getOffsetParent(element, polyfill) {
5448
5501
  return offsetParent || getContainingBlock(element) || window;
5449
5502
  }
5450
5503
 
5451
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
5452
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
5453
- const documentElement = getDocumentElement(offsetParent);
5454
- const isFixed = strategy === 'fixed';
5455
- const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
5456
- let scroll = {
5457
- scrollLeft: 0,
5458
- scrollTop: 0
5459
- };
5460
- const offsets = {
5461
- x: 0,
5462
- y: 0
5463
- };
5464
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
5465
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
5466
- scroll = getNodeScroll(offsetParent);
5467
- }
5468
- if (isHTMLElement(offsetParent)) {
5469
- const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
5470
- offsets.x = offsetRect.x + offsetParent.clientLeft;
5471
- offsets.y = offsetRect.y + offsetParent.clientTop;
5472
- } else if (documentElement) {
5473
- offsets.x = getWindowScrollBarX(documentElement);
5474
- }
5475
- }
5504
+ const getElementRects = async function (_ref) {
5505
+ let {
5506
+ reference,
5507
+ floating,
5508
+ strategy
5509
+ } = _ref;
5510
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
5511
+ const getDimensionsFn = this.getDimensions;
5476
5512
  return {
5477
- x: rect.left + scroll.scrollLeft - offsets.x,
5478
- y: rect.top + scroll.scrollTop - offsets.y,
5479
- width: rect.width,
5480
- height: rect.height
5513
+ reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
5514
+ floating: {
5515
+ x: 0,
5516
+ y: 0,
5517
+ ...(await getDimensionsFn(floating))
5518
+ }
5481
5519
  };
5520
+ };
5521
+
5522
+ function isRTL(element) {
5523
+ return getComputedStyle(element).direction === 'rtl';
5482
5524
  }
5483
5525
 
5484
5526
  const platform = {
5485
- getClippingRect,
5486
5527
  convertOffsetParentRelativeRectToViewportRelativeRect,
5487
- isElement,
5488
- getDimensions,
5489
- getOffsetParent,
5490
5528
  getDocumentElement,
5529
+ getClippingRect,
5530
+ getOffsetParent,
5531
+ getElementRects,
5532
+ getClientRects,
5533
+ getDimensions,
5491
5534
  getScale,
5492
- async getElementRects(_ref) {
5493
- let {
5494
- reference,
5495
- floating,
5496
- strategy
5497
- } = _ref;
5498
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
5499
- const getDimensionsFn = this.getDimensions;
5500
- return {
5501
- reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
5502
- floating: {
5503
- x: 0,
5504
- y: 0,
5505
- ...(await getDimensionsFn(floating))
5506
- }
5507
- };
5508
- },
5509
- getClientRects: element => Array.from(element.getClientRects()),
5510
- isRTL: element => getComputedStyle$1(element).direction === 'rtl'
5535
+ isElement,
5536
+ isRTL
5511
5537
  };
5512
5538
 
5539
+ // https://samthor.au/2021/observing-dom/
5540
+ function observeMove(element, onMove) {
5541
+ let io = null;
5542
+ let timeoutId;
5543
+ const root = getDocumentElement(element);
5544
+ function cleanup() {
5545
+ clearTimeout(timeoutId);
5546
+ io && io.disconnect();
5547
+ io = null;
5548
+ }
5549
+ function refresh(skip, threshold) {
5550
+ if (skip === void 0) {
5551
+ skip = false;
5552
+ }
5553
+ if (threshold === void 0) {
5554
+ threshold = 1;
5555
+ }
5556
+ cleanup();
5557
+ const {
5558
+ left,
5559
+ top,
5560
+ width,
5561
+ height
5562
+ } = element.getBoundingClientRect();
5563
+ if (!skip) {
5564
+ onMove();
5565
+ }
5566
+ if (!width || !height) {
5567
+ return;
5568
+ }
5569
+ const insetTop = floor(top);
5570
+ const insetRight = floor(root.clientWidth - (left + width));
5571
+ const insetBottom = floor(root.clientHeight - (top + height));
5572
+ const insetLeft = floor(left);
5573
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
5574
+ const options = {
5575
+ rootMargin,
5576
+ threshold: max(0, min(1, threshold)) || 1
5577
+ };
5578
+ let isFirstUpdate = true;
5579
+ function handleObserve(entries) {
5580
+ const ratio = entries[0].intersectionRatio;
5581
+ if (ratio !== threshold) {
5582
+ if (!isFirstUpdate) {
5583
+ return refresh();
5584
+ }
5585
+ if (!ratio) {
5586
+ timeoutId = setTimeout(() => {
5587
+ refresh(false, 1e-7);
5588
+ }, 100);
5589
+ } else {
5590
+ refresh(false, ratio);
5591
+ }
5592
+ }
5593
+ isFirstUpdate = false;
5594
+ }
5595
+
5596
+ // Older browsers don't support a `document` as the root and will throw an
5597
+ // error.
5598
+ try {
5599
+ io = new IntersectionObserver(handleObserve, {
5600
+ ...options,
5601
+ // Handle <iframe>s
5602
+ root: root.ownerDocument
5603
+ });
5604
+ } catch (e) {
5605
+ io = new IntersectionObserver(handleObserve, options);
5606
+ }
5607
+ io.observe(element);
5608
+ }
5609
+ refresh(true);
5610
+ return cleanup;
5611
+ }
5612
+
5513
5613
  /**
5514
5614
  * Automatically updates the position of the floating element when necessary.
5515
5615
  * Should only be called when the floating element is mounted on the DOM or
@@ -5525,30 +5625,39 @@ function autoUpdate(reference, floating, update, options) {
5525
5625
  const {
5526
5626
  ancestorScroll = true,
5527
5627
  ancestorResize = true,
5528
- elementResize = true,
5628
+ elementResize = typeof ResizeObserver === 'function',
5629
+ layoutShift = typeof IntersectionObserver === 'function',
5529
5630
  animationFrame = false
5530
5631
  } = options;
5531
- const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : reference.contextElement ? getOverflowAncestors(reference.contextElement) : []), ...getOverflowAncestors(floating)] : [];
5632
+ const referenceEl = unwrapElement(reference);
5633
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
5532
5634
  ancestors.forEach(ancestor => {
5533
- // ignores Window, checks for [object VisualViewport]
5534
- const isVisualViewport = !isElement(ancestor) && ancestor.toString().includes('V');
5535
- if (ancestorScroll && (animationFrame ? isVisualViewport : true)) {
5536
- ancestor.addEventListener('scroll', update, {
5537
- passive: true
5538
- });
5539
- }
5635
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
5636
+ passive: true
5637
+ });
5540
5638
  ancestorResize && ancestor.addEventListener('resize', update);
5541
5639
  });
5542
- let observer = null;
5640
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
5641
+ let reobserveFrame = -1;
5642
+ let resizeObserver = null;
5543
5643
  if (elementResize) {
5544
- observer = new ResizeObserver(() => {
5644
+ resizeObserver = new ResizeObserver(_ref => {
5645
+ let [firstEntry] = _ref;
5646
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
5647
+ // Prevent update loops when using the `size` middleware.
5648
+ // https://github.com/floating-ui/floating-ui/issues/1740
5649
+ resizeObserver.unobserve(floating);
5650
+ cancelAnimationFrame(reobserveFrame);
5651
+ reobserveFrame = requestAnimationFrame(() => {
5652
+ resizeObserver && resizeObserver.observe(floating);
5653
+ });
5654
+ }
5545
5655
  update();
5546
5656
  });
5547
- isElement(reference) && !animationFrame && observer.observe(reference);
5548
- if (!isElement(reference) && reference.contextElement && !animationFrame) {
5549
- observer.observe(reference.contextElement);
5657
+ if (referenceEl && !animationFrame) {
5658
+ resizeObserver.observe(referenceEl);
5550
5659
  }
5551
- observer.observe(floating);
5660
+ resizeObserver.observe(floating);
5552
5661
  }
5553
5662
  let frameId;
5554
5663
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
@@ -5565,13 +5674,13 @@ function autoUpdate(reference, floating, update, options) {
5565
5674
  }
5566
5675
  update();
5567
5676
  return () => {
5568
- var _observer;
5569
5677
  ancestors.forEach(ancestor => {
5570
5678
  ancestorScroll && ancestor.removeEventListener('scroll', update);
5571
5679
  ancestorResize && ancestor.removeEventListener('resize', update);
5572
5680
  });
5573
- (_observer = observer) == null ? void 0 : _observer.disconnect();
5574
- observer = null;
5681
+ cleanupIo && cleanupIo();
5682
+ resizeObserver && resizeObserver.disconnect();
5683
+ resizeObserver = null;
5575
5684
  if (animationFrame) {
5576
5685
  cancelAnimationFrame(frameId);
5577
5686
  }
@@ -6177,7 +6286,7 @@ var isFocusable = function isFocusable(node, options) {
6177
6286
  };
6178
6287
 
6179
6288
  /*!
6180
- * focus-trap 7.4.3
6289
+ * focus-trap 7.5.2
6181
6290
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
6182
6291
  */
6183
6292
 
@@ -6262,10 +6371,10 @@ var isSelectableInput = function isSelectableInput(node) {
6262
6371
  return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
6263
6372
  };
6264
6373
  var isEscapeEvent = function isEscapeEvent(e) {
6265
- return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
6374
+ return (e === null || e === void 0 ? void 0 : e.key) === 'Escape' || (e === null || e === void 0 ? void 0 : e.key) === 'Esc' || (e === null || e === void 0 ? void 0 : e.keyCode) === 27;
6266
6375
  };
6267
6376
  var isTabEvent = function isTabEvent(e) {
6268
- return e.key === 'Tab' || e.keyCode === 9;
6377
+ return (e === null || e === void 0 ? void 0 : e.key) === 'Tab' || (e === null || e === void 0 ? void 0 : e.keyCode) === 9;
6269
6378
  };
6270
6379
 
6271
6380
  // checks for TAB by default
@@ -6349,8 +6458,11 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6349
6458
  // container: HTMLElement,
6350
6459
  // tabbableNodes: Array<HTMLElement>, // empty if none
6351
6460
  // focusableNodes: Array<HTMLElement>, // empty if none
6352
- // firstTabbableNode: HTMLElement|null,
6353
- // lastTabbableNode: HTMLElement|null,
6461
+ // posTabIndexesFound: boolean,
6462
+ // firstTabbableNode: HTMLElement|undefined,
6463
+ // lastTabbableNode: HTMLElement|undefined,
6464
+ // firstDomTabbableNode: HTMLElement|undefined,
6465
+ // lastDomTabbableNode: HTMLElement|undefined,
6354
6466
  // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
6355
6467
  // }>}
6356
6468
  containerGroups: [],
@@ -6367,7 +6479,9 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6367
6479
  paused: false,
6368
6480
  // timer ID for when delayInitialFocus is true and initial focus in this trap
6369
6481
  // has been delayed during activation
6370
- delayInitialFocusTimer: undefined
6482
+ delayInitialFocusTimer: undefined,
6483
+ // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
6484
+ recentNavEvent: undefined
6371
6485
  };
6372
6486
  var trap; // eslint-disable-line prefer-const -- some private functions reference it, and its methods reference private functions, so we must declare here and define later
6373
6487
 
@@ -6386,7 +6500,9 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6386
6500
  /**
6387
6501
  * Finds the index of the container that contains the element.
6388
6502
  * @param {HTMLElement} element
6389
- * @param {Event} [event]
6503
+ * @param {Event} [event] If available, and `element` isn't directly found in any container,
6504
+ * the event's composed path is used to see if includes any known trap containers in the
6505
+ * case where the element is inside a Shadow DOM.
6390
6506
  * @returns {number} Index of the container in either `state.containers` or
6391
6507
  * `state.containerGroups` (the order/length of these lists are the same); -1
6392
6508
  * if the element isn't found.
@@ -6481,14 +6597,41 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6481
6597
  var tabbableNodes = tabbable(container, config.tabbableOptions);
6482
6598
 
6483
6599
  // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
6484
- // are a superset of tabbable nodes
6600
+ // are a superset of tabbable nodes since nodes with negative `tabindex` attributes
6601
+ // are focusable but not tabbable
6485
6602
  var focusableNodes = focusable(container, config.tabbableOptions);
6603
+ var firstTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[0] : undefined;
6604
+ var lastTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : undefined;
6605
+ var firstDomTabbableNode = focusableNodes.find(function (node) {
6606
+ return isTabbable(node);
6607
+ });
6608
+ var lastDomTabbableNode = focusableNodes.slice().reverse().find(function (node) {
6609
+ return isTabbable(node);
6610
+ });
6611
+ var posTabIndexesFound = !!tabbableNodes.find(function (node) {
6612
+ return getTabIndex(node) > 0;
6613
+ });
6486
6614
  return {
6487
6615
  container: container,
6488
6616
  tabbableNodes: tabbableNodes,
6489
6617
  focusableNodes: focusableNodes,
6490
- firstTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[0] : null,
6491
- lastTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : null,
6618
+ /** True if at least one node with positive `tabindex` was found in this container. */
6619
+ posTabIndexesFound: posTabIndexesFound,
6620
+ /** First tabbable node in container, __tabindex__ order; `undefined` if none. */
6621
+ firstTabbableNode: firstTabbableNode,
6622
+ /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
6623
+ lastTabbableNode: lastTabbableNode,
6624
+ // NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
6625
+ // would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
6626
+ // because that API doesn't work with Shadow DOM as well as it should (@see
6627
+ // https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
6628
+ // to address an edge case related to positive tabindex support, this seems like a much easier,
6629
+ // "close enough most of the time" alternative for positive tabindexes which should generally
6630
+ // be avoided anyway...
6631
+ /** First tabbable node in container, __DOM__ order; `undefined` if none. */
6632
+ firstDomTabbableNode: firstDomTabbableNode,
6633
+ /** Last tabbable node in container, __DOM__ order; `undefined` if none. */
6634
+ lastDomTabbableNode: lastDomTabbableNode,
6492
6635
  /**
6493
6636
  * Finds the __tabbable__ node that follows the given node in the specified direction,
6494
6637
  * in this container, if any.
@@ -6499,30 +6642,24 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6499
6642
  */
6500
6643
  nextTabbableNode: function nextTabbableNode(node) {
6501
6644
  var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
6502
- // NOTE: If tabindex is positive (in order to manipulate the tab order separate
6503
- // from the DOM order), this __will not work__ because the list of focusableNodes,
6504
- // while it contains tabbable nodes, does not sort its nodes in any order other
6505
- // than DOM order, because it can't: Where would you place focusable (but not
6506
- // tabbable) nodes in that order? They have no order, because they aren't tabbale...
6507
- // Support for positive tabindex is already broken and hard to manage (possibly
6508
- // not supportable, TBD), so this isn't going to make things worse than they
6509
- // already are, and at least makes things better for the majority of cases where
6510
- // tabindex is either 0/unset or negative.
6511
- // FYI, positive tabindex issue: https://github.com/focus-trap/focus-trap/issues/375
6512
- var nodeIdx = focusableNodes.findIndex(function (n) {
6513
- return n === node;
6514
- });
6645
+ var nodeIdx = tabbableNodes.indexOf(node);
6515
6646
  if (nodeIdx < 0) {
6516
- return undefined;
6517
- }
6518
- if (forward) {
6519
- return focusableNodes.slice(nodeIdx + 1).find(function (n) {
6520
- return isTabbable(n, config.tabbableOptions);
6647
+ // either not tabbable nor focusable, or was focused but not tabbable (negative tabindex):
6648
+ // since `node` should at least have been focusable, we assume that's the case and mimic
6649
+ // what browsers do, which is set focus to the next node in __document position order__,
6650
+ // regardless of positive tabindexes, if any -- and for reasons explained in the NOTE
6651
+ // above related to `firstDomTabbable` and `lastDomTabbable` properties, we fall back to
6652
+ // basic DOM order
6653
+ if (forward) {
6654
+ return focusableNodes.slice(focusableNodes.indexOf(node) + 1).find(function (el) {
6655
+ return isTabbable(el);
6656
+ });
6657
+ }
6658
+ return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find(function (el) {
6659
+ return isTabbable(el);
6521
6660
  });
6522
6661
  }
6523
- return focusableNodes.slice(0, nodeIdx).reverse().find(function (n) {
6524
- return isTabbable(n, config.tabbableOptions);
6525
- });
6662
+ return tabbableNodes[nodeIdx + (forward ? 1 : -1)];
6526
6663
  }
6527
6664
  };
6528
6665
  });
@@ -6535,6 +6672,19 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6535
6672
  ) {
6536
6673
  throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
6537
6674
  }
6675
+
6676
+ // NOTE: Positive tabindexes are only properly supported in single-container traps because
6677
+ // doing it across multiple containers where tabindexes could be all over the place
6678
+ // would require Tabbable to support multiple containers, would require additional
6679
+ // specialized Shadow DOM support, and would require Tabbable's multi-container support
6680
+ // to look at those containers in document position order rather than user-provided
6681
+ // order (as they are treated in Focus-trap, for legacy reasons). See discussion on
6682
+ // https://github.com/focus-trap/focus-trap/issues/375 for more details.
6683
+ if (state.containerGroups.find(function (g) {
6684
+ return g.posTabIndexesFound;
6685
+ }) && state.containerGroups.length > 1) {
6686
+ throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
6687
+ }
6538
6688
  };
6539
6689
  var tryFocus = function tryFocus(node) {
6540
6690
  if (node === false) {
@@ -6550,6 +6700,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6550
6700
  node.focus({
6551
6701
  preventScroll: !!config.preventScroll
6552
6702
  });
6703
+ // NOTE: focus() API does not trigger focusIn event so set MRU node manually
6553
6704
  state.mostRecentlyFocusedNode = node;
6554
6705
  if (isSelectableInput(node)) {
6555
6706
  node.select();
@@ -6560,64 +6711,23 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6560
6711
  return node ? node : node === false ? false : previousActiveElement;
6561
6712
  };
6562
6713
 
6563
- // This needs to be done on mousedown and touchstart instead of click
6564
- // so that it precedes the focus event.
6565
- var checkPointerDown = function checkPointerDown(e) {
6566
- var target = getActualTarget(e);
6567
- if (findContainerIndex(target, e) >= 0) {
6568
- // allow the click since it ocurred inside the trap
6569
- return;
6570
- }
6571
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
6572
- // immediately deactivate the trap
6573
- trap.deactivate({
6574
- // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
6575
- // which will result in the outside click setting focus to the node
6576
- // that was clicked (and if not focusable, to "nothing"); by setting
6577
- // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
6578
- // on activation (or the configured `setReturnFocus` node), whether the
6579
- // outside click was on a focusable node or not
6580
- returnFocus: config.returnFocusOnDeactivate
6581
- });
6582
- return;
6583
- }
6584
-
6585
- // This is needed for mobile devices.
6586
- // (If we'll only let `click` events through,
6587
- // then on mobile they will be blocked anyways if `touchstart` is blocked.)
6588
- if (valueOrHandler(config.allowOutsideClick, e)) {
6589
- // allow the click outside the trap to take place
6590
- return;
6591
- }
6592
-
6593
- // otherwise, prevent the click
6594
- e.preventDefault();
6595
- };
6596
-
6597
- // In case focus escapes the trap for some strange reason, pull it back in.
6598
- var checkFocusIn = function checkFocusIn(e) {
6599
- var target = getActualTarget(e);
6600
- var targetContained = findContainerIndex(target, e) >= 0;
6601
-
6602
- // In Firefox when you Tab out of an iframe the Document is briefly focused.
6603
- if (targetContained || target instanceof Document) {
6604
- if (targetContained) {
6605
- state.mostRecentlyFocusedNode = target;
6606
- }
6607
- } else {
6608
- // escaped! pull it back in to where it just left
6609
- e.stopImmediatePropagation();
6610
- tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
6611
- }
6612
- };
6613
-
6614
- // Hijack key nav events on the first and last focusable nodes of the trap,
6615
- // in order to prevent focus from escaping. If it escapes for even a
6616
- // moment it can end up scrolling the page and causing confusion so we
6617
- // kind of need to capture the action at the keydown phase.
6618
- var checkKeyNav = function checkKeyNav(event) {
6619
- var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6620
- var target = getActualTarget(event);
6714
+ /**
6715
+ * Finds the next node (in either direction) where focus should move according to a
6716
+ * keyboard focus-in event.
6717
+ * @param {Object} params
6718
+ * @param {Node} [params.target] Known target __from which__ to navigate, if any.
6719
+ * @param {KeyboardEvent|FocusEvent} [params.event] Event to use if `target` isn't known (event
6720
+ * will be used to determine the `target`). Ignored if `target` is specified.
6721
+ * @param {boolean} [params.isBackward] True if focus should move backward.
6722
+ * @returns {Node|undefined} The next node, or `undefined` if a next node couldn't be
6723
+ * determined given the current state of the trap.
6724
+ */
6725
+ var findNextNavNode = function findNextNavNode(_ref2) {
6726
+ var target = _ref2.target,
6727
+ event = _ref2.event,
6728
+ _ref2$isBackward = _ref2.isBackward,
6729
+ isBackward = _ref2$isBackward === void 0 ? false : _ref2$isBackward;
6730
+ target = target || getActualTarget(event);
6621
6731
  updateTabbableNodes();
6622
6732
  var destinationNode = null;
6623
6733
  if (state.tabbableGroups.length > 0) {
@@ -6640,8 +6750,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6640
6750
  // REVERSE
6641
6751
 
6642
6752
  // is the target the first tabbable node in a group?
6643
- var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref2) {
6644
- var firstTabbableNode = _ref2.firstTabbableNode;
6753
+ var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
6754
+ var firstTabbableNode = _ref3.firstTabbableNode;
6645
6755
  return target === firstTabbableNode;
6646
6756
  });
6647
6757
  if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
@@ -6659,7 +6769,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6659
6769
  // the LAST group if it's the first tabbable node of the FIRST group)
6660
6770
  var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
6661
6771
  var destinationGroup = state.tabbableGroups[destinationGroupIndex];
6662
- destinationNode = destinationGroup.lastTabbableNode;
6772
+ destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode;
6663
6773
  } else if (!isTabEvent(event)) {
6664
6774
  // user must have customized the nav keys so we have to move focus manually _within_
6665
6775
  // the active group: do this based on the order determined by tabbable()
@@ -6669,8 +6779,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6669
6779
  // FORWARD
6670
6780
 
6671
6781
  // is the target the last tabbable node in a group?
6672
- var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
6673
- var lastTabbableNode = _ref3.lastTabbableNode;
6782
+ var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref4) {
6783
+ var lastTabbableNode = _ref4.lastTabbableNode;
6674
6784
  return target === lastTabbableNode;
6675
6785
  });
6676
6786
  if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
@@ -6688,7 +6798,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6688
6798
  // group if it's the last tabbable node of the LAST group)
6689
6799
  var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
6690
6800
  var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
6691
- destinationNode = _destinationGroup.firstTabbableNode;
6801
+ destinationNode = getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode;
6692
6802
  } else if (!isTabEvent(event)) {
6693
6803
  // user must have customized the nav keys so we have to move focus manually _within_
6694
6804
  // the active group: do this based on the order determined by tabbable()
@@ -6700,6 +6810,153 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6700
6810
  // NOTE: the fallbackFocus option does not support returning false to opt-out
6701
6811
  destinationNode = getNodeForOption('fallbackFocus');
6702
6812
  }
6813
+ return destinationNode;
6814
+ };
6815
+
6816
+ // This needs to be done on mousedown and touchstart instead of click
6817
+ // so that it precedes the focus event.
6818
+ var checkPointerDown = function checkPointerDown(e) {
6819
+ var target = getActualTarget(e);
6820
+ if (findContainerIndex(target, e) >= 0) {
6821
+ // allow the click since it ocurred inside the trap
6822
+ return;
6823
+ }
6824
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
6825
+ // immediately deactivate the trap
6826
+ trap.deactivate({
6827
+ // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
6828
+ // which will result in the outside click setting focus to the node
6829
+ // that was clicked (and if not focusable, to "nothing"); by setting
6830
+ // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
6831
+ // on activation (or the configured `setReturnFocus` node), whether the
6832
+ // outside click was on a focusable node or not
6833
+ returnFocus: config.returnFocusOnDeactivate
6834
+ });
6835
+ return;
6836
+ }
6837
+
6838
+ // This is needed for mobile devices.
6839
+ // (If we'll only let `click` events through,
6840
+ // then on mobile they will be blocked anyways if `touchstart` is blocked.)
6841
+ if (valueOrHandler(config.allowOutsideClick, e)) {
6842
+ // allow the click outside the trap to take place
6843
+ return;
6844
+ }
6845
+
6846
+ // otherwise, prevent the click
6847
+ e.preventDefault();
6848
+ };
6849
+
6850
+ // In case focus escapes the trap for some strange reason, pull it back in.
6851
+ // NOTE: the focusIn event is NOT cancelable, so if focus escapes, it may cause unexpected
6852
+ // scrolling if the node that got focused was out of view; there's nothing we can do to
6853
+ // prevent that from happening by the time we discover that focus escaped
6854
+ var checkFocusIn = function checkFocusIn(event) {
6855
+ var target = getActualTarget(event);
6856
+ var targetContained = findContainerIndex(target, event) >= 0;
6857
+
6858
+ // In Firefox when you Tab out of an iframe the Document is briefly focused.
6859
+ if (targetContained || target instanceof Document) {
6860
+ if (targetContained) {
6861
+ state.mostRecentlyFocusedNode = target;
6862
+ }
6863
+ } else {
6864
+ // escaped! pull it back in to where it just left
6865
+ event.stopImmediatePropagation();
6866
+
6867
+ // focus will escape if the MRU node had a positive tab index and user tried to nav forward;
6868
+ // it will also escape if the MRU node had a 0 tab index and user tried to nav backward
6869
+ // toward a node with a positive tab index
6870
+ var nextNode; // next node to focus, if we find one
6871
+ var navAcrossContainers = true;
6872
+ if (state.mostRecentlyFocusedNode) {
6873
+ if (getTabIndex(state.mostRecentlyFocusedNode) > 0) {
6874
+ // MRU container index must be >=0 otherwise we wouldn't have it as an MRU node...
6875
+ var mruContainerIdx = findContainerIndex(state.mostRecentlyFocusedNode);
6876
+ // there MAY not be any tabbable nodes in the container if there are at least 2 containers
6877
+ // and the MRU node is focusable but not tabbable (focus-trap requires at least 1 container
6878
+ // with at least one tabbable node in order to function, so this could be the other container
6879
+ // with nothing tabbable in it)
6880
+ var tabbableNodes = state.containerGroups[mruContainerIdx].tabbableNodes;
6881
+ if (tabbableNodes.length > 0) {
6882
+ // MRU tab index MAY not be found if the MRU node is focusable but not tabbable
6883
+ var mruTabIdx = tabbableNodes.findIndex(function (node) {
6884
+ return node === state.mostRecentlyFocusedNode;
6885
+ });
6886
+ if (mruTabIdx >= 0) {
6887
+ if (config.isKeyForward(state.recentNavEvent)) {
6888
+ if (mruTabIdx + 1 < tabbableNodes.length) {
6889
+ nextNode = tabbableNodes[mruTabIdx + 1];
6890
+ navAcrossContainers = false;
6891
+ }
6892
+ // else, don't wrap within the container as focus should move to next/previous
6893
+ // container
6894
+ } else {
6895
+ if (mruTabIdx - 1 >= 0) {
6896
+ nextNode = tabbableNodes[mruTabIdx - 1];
6897
+ navAcrossContainers = false;
6898
+ }
6899
+ // else, don't wrap within the container as focus should move to next/previous
6900
+ // container
6901
+ }
6902
+ // else, don't find in container order without considering direction too
6903
+ }
6904
+ }
6905
+ // else, no tabbable nodes in that container (which means we must have at least one other
6906
+ // container with at least one tabbable node in it, otherwise focus-trap would've thrown
6907
+ // an error the last time updateTabbableNodes() was run): find next node among all known
6908
+ // containers
6909
+ } else {
6910
+ // check to see if there's at least one tabbable node with a positive tab index inside
6911
+ // the trap because focus seems to escape when navigating backward from a tabbable node
6912
+ // with tabindex=0 when this is the case (instead of wrapping to the tabbable node with
6913
+ // the greatest positive tab index like it should)
6914
+ if (!state.containerGroups.some(function (g) {
6915
+ return g.tabbableNodes.some(function (n) {
6916
+ return getTabIndex(n) > 0;
6917
+ });
6918
+ })) {
6919
+ // no containers with tabbable nodes with positive tab indexes which means the focus
6920
+ // escaped for some other reason and we should just execute the fallback to the
6921
+ // MRU node or initial focus node, if any
6922
+ navAcrossContainers = false;
6923
+ }
6924
+ }
6925
+ } else {
6926
+ // no MRU node means we're likely in some initial condition when the trap has just
6927
+ // been activated and initial focus hasn't been given yet, in which case we should
6928
+ // fall through to trying to focus the initial focus node, which is what should
6929
+ // happen below at this point in the logic
6930
+ navAcrossContainers = false;
6931
+ }
6932
+ if (navAcrossContainers) {
6933
+ nextNode = findNextNavNode({
6934
+ // move FROM the MRU node, not event-related node (which will be the node that is
6935
+ // outside the trap causing the focus escape we're trying to fix)
6936
+ target: state.mostRecentlyFocusedNode,
6937
+ isBackward: config.isKeyBackward(state.recentNavEvent)
6938
+ });
6939
+ }
6940
+ if (nextNode) {
6941
+ tryFocus(nextNode);
6942
+ } else {
6943
+ tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
6944
+ }
6945
+ }
6946
+ state.recentNavEvent = undefined; // clear
6947
+ };
6948
+
6949
+ // Hijack key nav events on the first and last focusable nodes of the trap,
6950
+ // in order to prevent focus from escaping. If it escapes for even a
6951
+ // moment it can end up scrolling the page and causing confusion so we
6952
+ // kind of need to capture the action at the keydown phase.
6953
+ var checkKeyNav = function checkKeyNav(event) {
6954
+ var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6955
+ state.recentNavEvent = event;
6956
+ var destinationNode = findNextNavNode({
6957
+ event: event,
6958
+ isBackward: isBackward
6959
+ });
6703
6960
  if (destinationNode) {
6704
6961
  if (isTabEvent(event)) {
6705
6962
  // since tab natively moves focus, we wouldn't have a destination node unless we
@@ -6970,9 +7227,11 @@ const CatDropdown = class {
6970
7227
  this.initTrigger();
6971
7228
  this.toggle();
6972
7229
  }
6973
- const button = event.target;
6974
- // hide dropdown on button click
6975
- if (!this.noAutoClose && event.composedPath().includes(this.content) && button.slot !== 'trigger') {
7230
+ // hide dropdown on button clicks inside the dropdown content
7231
+ if (!this.noAutoClose &&
7232
+ event.composedPath().includes(this.content) &&
7233
+ event.target instanceof Element &&
7234
+ event.target.slot !== 'trigger') {
6976
7235
  this.close();
6977
7236
  }
6978
7237
  }
@@ -7007,6 +7266,9 @@ const CatDropdown = class {
7007
7266
  clickOutsideDeactivates: event => {
7008
7267
  const shouldClose = !this.noAutoClose &&
7009
7268
  !event.composedPath().includes(this.content) &&
7269
+ !event
7270
+ .composedPath()
7271
+ .find(el => el instanceof HTMLElement && el.hasAttribute('data-dropdown-no-close')) &&
7010
7272
  (!this.trigger || !event.composedPath().includes(this.trigger));
7011
7273
  if (shouldClose) {
7012
7274
  this.close();
@@ -7022,7 +7284,7 @@ const CatDropdown = class {
7022
7284
  * Closes the dropdown.
7023
7285
  */
7024
7286
  async close() {
7025
- if (this.isOpen === null || !this.isOpen) {
7287
+ if (this.isOpen === null) {
7026
7288
  return; // busy
7027
7289
  }
7028
7290
  this.isOpen = null;
@@ -7899,14 +8161,25 @@ const CatSelect = class {
7899
8161
  }
7900
8162
  this.hide();
7901
8163
  // Conditionally remove selection if the option was not manually selected through click or enter key press
7902
- if (!this.multiple && (!this.tags || !this.state.selection?.length) && this.state.tempSelection?.length) {
7903
- this.patchState({
7904
- activeSelectionIndex: -1,
7905
- selection: this.state.tempSelection,
7906
- tempSelection: [],
7907
- options: [],
7908
- term: this.state.tempSelection[0].render.label
7909
- });
8164
+ if (!this.multiple && (!this.tags || !this.state.selection?.length)) {
8165
+ if (this.state.tempSelection?.length) {
8166
+ this.patchState({
8167
+ activeSelectionIndex: -1,
8168
+ selection: this.state.tempSelection,
8169
+ tempSelection: [],
8170
+ options: [],
8171
+ term: this.state.tempSelection[0].render.label
8172
+ });
8173
+ }
8174
+ else if (!this.state.selection?.length) {
8175
+ this.patchState({
8176
+ activeSelectionIndex: -1,
8177
+ selection: [],
8178
+ tempSelection: [],
8179
+ options: [],
8180
+ term: ''
8181
+ });
8182
+ }
7910
8183
  }
7911
8184
  else {
7912
8185
  this.patchState({ activeSelectionIndex: -1 });
@@ -8140,7 +8413,7 @@ const CatSelect = class {
8140
8413
  newSelection = [item];
8141
8414
  this.search(item.render.label);
8142
8415
  }
8143
- this.patchState({ selection: newSelection });
8416
+ this.patchState({ selection: newSelection, tempSelection: [] });
8144
8417
  if (this.multiple && this.state.term.trim() && this.input) {
8145
8418
  this.patchState({ term: '', activeOptionIndex: -1 });
8146
8419
  this.term$.next('');
@@ -8166,7 +8439,7 @@ const CatSelect = class {
8166
8439
  }
8167
8440
  clear() {
8168
8441
  if (this.input && this.state.term) {
8169
- this.patchState({ selection: [], options: [], term: '', activeOptionIndex: -1, tempSelection: [] });
8442
+ this.patchState({ selection: [], term: '', activeOptionIndex: -1, tempSelection: [] });
8170
8443
  this.term$.next('');
8171
8444
  this.input.value = '';
8172
8445
  }
@@ -9864,7 +10137,7 @@ const CatTab = class {
9864
10137
  };
9865
10138
  CatTab.style = catTabCss;
9866
10139
 
9867
- const catTabsCss = ":host{display:flex;flex-direction:row;box-shadow:inset 0 -1px 0 0 rgb(var(--cat-border-color-dark, 215, 219, 224))}:host([hidden]){display:none}:host([tabs-align=center]){justify-content:center}:host([tabs-align=right]){justify-content:end}:host([tabs-align=justify]) cat-button{flex:1 0 auto}.cat-tab{display:inline-flex;flex-direction:column;align-items:center;justify-content:space-between;position:relative;transition:none}.cat-tab::after{opacity:0;content:\"\";position:absolute;background:currentColor;left:0.75rem;right:0.75rem;bottom:0;height:2px}.cat-tab:hover::after{opacity:0.25}.cat-tab.cat-tab-active{font-weight:700;color:rgb(var(--cat-primary-text-active, 2, 99, 113))}.cat-tab.cat-tab-active::after{opacity:1}";
10140
+ const catTabsCss = ":host{display:flex;flex-direction:row;box-shadow:inset 0 -1px 0 0 rgb(var(--cat-border-color, 235, 236, 240))}:host([hidden]){display:none}:host([tabs-align=center]){justify-content:center}:host([tabs-align=right]){justify-content:end}:host([tabs-align=justify]) cat-button{flex:1 0 auto}.cat-tab{display:inline-flex;flex-direction:column;align-items:center;justify-content:space-between;position:relative;transition:none}.cat-tab:first-of-type{margin-left:-0.75rem}.cat-tab:last-of-type{margin-right:-0.75rem}.cat-tab::after{opacity:0;content:\"\";position:absolute;background:currentColor;left:0.75rem;right:0.75rem;bottom:0;height:2px}.cat-tab:hover::after{opacity:0.25}.cat-tab.cat-tab-active{font-weight:700;color:rgb(var(--cat-primary-text-active, 2, 99, 113))}.cat-tab.cat-tab-active::after{opacity:1}";
9868
10141
 
9869
10142
  const CatTabs = class {
9870
10143
  constructor(hostRef) {