@haiilo/catalyst 6.3.0 → 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 +539 -261
  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 +42 -9
  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 +32 -11
  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 +18 -13
  34. package/dist/components/cat-datepicker-inline.js.map +1 -1
  35. package/dist/components/cat-datepicker.js +28 -9
  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 +539 -261
  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 +8 -2
  56. package/dist/types/components/cat-datepicker-inline/cat-datepicker-inline.d.ts +7 -1
  57. package/dist/types/components.d.ts +16 -0
  58. package/package.json +11 -11
  59. package/dist/catalyst/p-90e9d18f.entry.js +0 -10
  60. package/dist/catalyst/p-90e9d18f.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;
@@ -4144,16 +4151,16 @@ const CatDatepickerFlat = class {
4144
4151
  this.catChange.emit(undefined);
4145
4152
  }
4146
4153
  }
4147
- onDisabledChanged(value) {
4148
- this.pickr?.set('clickOpens', !value && !this.readonly);
4149
- }
4150
- onReadonlyChanged(value) {
4151
- this.pickr?.set('clickOpens', !value && !this.disabled);
4154
+ onDisabledChanged() {
4155
+ // Dynamically changing 'disabled' value is not working due to a bug in the
4156
+ // library. We thus need to fully recreate the date picker after the value
4157
+ // has been updated.
4158
+ this.pickr?.destroy();
4159
+ this.pickr = undefined;
4160
+ setTimeout(() => (this.pickr = this.initDatepicker(this.input)));
4152
4161
  }
4153
4162
  componentDidLoad() {
4154
- if (this.input) {
4155
- this.pickr = this.initDatepicker(this.input);
4156
- }
4163
+ this.pickr = this.initDatepicker(this.input);
4157
4164
  }
4158
4165
  /**
4159
4166
  * Programmatically move focus to the datepicker. Use this method instead of
@@ -4185,6 +4192,12 @@ const CatDatepickerFlat = class {
4185
4192
  } }));
4186
4193
  }
4187
4194
  initDatepicker(input) {
4195
+ if (this.disabled || this.readonly || !input) {
4196
+ return;
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': '' } : {};
4188
4201
  return flatpickr(input, getConfig({
4189
4202
  locale: getLocale(of.catI18nRegistry.getLocale()),
4190
4203
  format: getFormat(of.catI18nRegistry.getLocale(), this.mode),
@@ -4194,13 +4207,24 @@ const CatDatepickerFlat = class {
4194
4207
  step: this.step,
4195
4208
  disabled: this.disabled,
4196
4209
  readonly: this.readonly,
4210
+ nativePickerAttributes: { ...nativePickerAttributes, ...this.nativePickerAttributes },
4197
4211
  applyChange: value => (this.value = value)
4198
4212
  }));
4199
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
+ }
4200
4224
  static get watchers() { return {
4201
4225
  "value": ["onValueChanged"],
4202
4226
  "disabled": ["onDisabledChanged"],
4203
- "readonly": ["onReadonlyChanged"]
4227
+ "readonly": ["onDisabledChanged"]
4204
4228
  }; }
4205
4229
  };
4206
4230
  CatDatepickerFlat.style = catDatepickerCss;
@@ -4218,6 +4242,7 @@ const CatDatepickerInline = class {
4218
4242
  this.readonly = false;
4219
4243
  this.step = 5;
4220
4244
  this.value = undefined;
4245
+ this.nativePickerAttributes = undefined;
4221
4246
  }
4222
4247
  onValueChanged(value) {
4223
4248
  if (value) {
@@ -4229,18 +4254,16 @@ const CatDatepickerInline = class {
4229
4254
  this.catChange.emit(undefined);
4230
4255
  }
4231
4256
  }
4232
- onDisabledChanged(value) {
4257
+ onDisabledChanged() {
4233
4258
  // Dynamically unsetting 'enabled' value to undefined is not working due to
4234
- // a bug in the library. We thus need to fully recreate the date picker.
4259
+ // a bug in the library. We thus need to fully recreate the date picker
4260
+ // after the value has been updated.
4235
4261
  this.pickr?.destroy();
4236
- if (this.input) {
4237
- this.pickr = this.initDatepicker(this.input, value);
4238
- }
4262
+ this.pickr = undefined;
4263
+ setTimeout(() => (this.pickr = this.initDatepicker(this.input)));
4239
4264
  }
4240
4265
  componentDidLoad() {
4241
- if (this.input) {
4242
- this.pickr = this.initDatepicker(this.input, this.disabled);
4243
- }
4266
+ this.pickr = this.initDatepicker(this.input);
4244
4267
  }
4245
4268
  render() {
4246
4269
  return (index.h(index.Host, null, index.h("div", { tabIndex: this.disabled || this.readonly ? -1 : undefined, class: {
@@ -4249,7 +4272,10 @@ const CatDatepickerInline = class {
4249
4272
  'datepicker-readonly': this.readonly
4250
4273
  } }, index.h("input", { ref: el => (this.input = el), value: this.value, disabled: this.disabled, readonly: this.readonly }))));
4251
4274
  }
4252
- initDatepicker(input, disabled) {
4275
+ initDatepicker(input) {
4276
+ if (!input) {
4277
+ return;
4278
+ }
4253
4279
  return flatpickr(input, getConfig({
4254
4280
  locale: getLocale(of.catI18nRegistry.getLocale()),
4255
4281
  format: getFormat(of.catI18nRegistry.getLocale(), this.mode),
@@ -4257,17 +4283,19 @@ const CatDatepickerInline = class {
4257
4283
  min: this.min,
4258
4284
  max: this.max,
4259
4285
  step: this.step,
4260
- disabled,
4286
+ disabled: this.disabled,
4261
4287
  readonly: this.readonly,
4288
+ nativePickerAttributes: this.nativePickerAttributes ?? {},
4262
4289
  applyChange: value => (this.value = value)
4263
4290
  }, {
4264
- ...(disabled ? { enable: [] } : {}),
4291
+ ...(this.disabled ? { enable: [] } : {}),
4265
4292
  inline: true
4266
4293
  }));
4267
4294
  }
4268
4295
  static get watchers() { return {
4269
4296
  "value": ["onValueChanged"],
4270
- "disabled": ["onDisabledChanged"]
4297
+ "disabled": ["onDisabledChanged"],
4298
+ "readonly": ["onDisabledChanged"]
4271
4299
  }; }
4272
4300
  };
4273
4301
  CatDatepickerInline.style = catDatepickerInlineCss;
@@ -4950,7 +4978,7 @@ const size = function (options) {
4950
4978
 
4951
4979
  function getWindow(node) {
4952
4980
  var _node$ownerDocument;
4953
- 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;
4954
4982
  }
4955
4983
 
4956
4984
  function getComputedStyle$1(element) {
@@ -4961,22 +4989,24 @@ function isNode(value) {
4961
4989
  return value instanceof getWindow(value).Node;
4962
4990
  }
4963
4991
  function getNodeName(node) {
4964
- 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';
4965
4999
  }
4966
5000
 
4967
5001
  function isHTMLElement(value) {
4968
- return value instanceof getWindow(value).HTMLElement;
4969
- }
4970
- function isElement(value) {
4971
- return value instanceof getWindow(value).Element;
5002
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
4972
5003
  }
4973
5004
  function isShadowRoot(node) {
4974
5005
  // Browsers without `ShadowRoot` support.
4975
5006
  if (typeof ShadowRoot === 'undefined') {
4976
5007
  return false;
4977
5008
  }
4978
- const OwnElement = getWindow(node).ShadowRoot;
4979
- return node instanceof OwnElement || node instanceof ShadowRoot;
5009
+ return node instanceof getWindow(node).ShadowRoot || node instanceof ShadowRoot;
4980
5010
  }
4981
5011
  function isOverflowElement(element) {
4982
5012
  const {
@@ -4995,7 +5025,7 @@ function isContainingBlock(element) {
4995
5025
  const css = getComputedStyle$1(element);
4996
5026
 
4997
5027
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
4998
- 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));
4999
5029
  }
5000
5030
  function isSafari() {
5001
5031
  if (typeof CSS === 'undefined' || !CSS.supports) return false;
@@ -5008,6 +5038,11 @@ function isLastTraversableNode(node) {
5008
5038
  const min = Math.min;
5009
5039
  const max = Math.max;
5010
5040
  const round = Math.round;
5041
+ const floor = Math.floor;
5042
+ const createCoords = v => ({
5043
+ x: v,
5044
+ y: v
5045
+ });
5011
5046
 
5012
5047
  function getCssDimensions(element) {
5013
5048
  const css = getComputedStyle$1(element);
@@ -5026,31 +5061,31 @@ function getCssDimensions(element) {
5026
5061
  return {
5027
5062
  width,
5028
5063
  height,
5029
- fallback: shouldFallback
5064
+ $: shouldFallback
5030
5065
  };
5031
5066
  }
5032
5067
 
5068
+ function isElement(value) {
5069
+ return value instanceof Element || value instanceof getWindow(value).Element;
5070
+ }
5071
+
5033
5072
  function unwrapElement(element) {
5034
5073
  return !isElement(element) ? element.contextElement : element;
5035
5074
  }
5036
5075
 
5037
- const FALLBACK_SCALE = {
5038
- x: 1,
5039
- y: 1
5040
- };
5041
5076
  function getScale(element) {
5042
5077
  const domElement = unwrapElement(element);
5043
5078
  if (!isHTMLElement(domElement)) {
5044
- return FALLBACK_SCALE;
5079
+ return createCoords(1);
5045
5080
  }
5046
5081
  const rect = domElement.getBoundingClientRect();
5047
5082
  const {
5048
5083
  width,
5049
5084
  height,
5050
- fallback
5085
+ $
5051
5086
  } = getCssDimensions(domElement);
5052
- let x = (fallback ? round(rect.width) : rect.width) / width;
5053
- 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;
5054
5089
 
5055
5090
  // 0, NaN, or Infinity should always fallback to 1.
5056
5091
 
@@ -5066,27 +5101,26 @@ function getScale(element) {
5066
5101
  };
5067
5102
  }
5068
5103
 
5069
- const noOffsets = {
5070
- x: 0,
5071
- y: 0
5072
- };
5073
- function getVisualOffsets(element, isFixed, floatingOffsetParent) {
5074
- var _win$visualViewport, _win$visualViewport2;
5075
- if (isFixed === void 0) {
5076
- isFixed = true;
5077
- }
5078
- if (!isSafari()) {
5079
- return noOffsets;
5080
- }
5081
- const win = element ? getWindow(element) : window;
5082
- 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) {
5083
5108
  return noOffsets;
5084
5109
  }
5085
5110
  return {
5086
- x: ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0,
5087
- y: ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0
5111
+ x: win.visualViewport.offsetLeft,
5112
+ y: win.visualViewport.offsetTop
5088
5113
  };
5089
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
+ }
5090
5124
 
5091
5125
  function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
5092
5126
  if (includeScale === void 0) {
@@ -5097,7 +5131,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
5097
5131
  }
5098
5132
  const clientRect = element.getBoundingClientRect();
5099
5133
  const domElement = unwrapElement(element);
5100
- let scale = FALLBACK_SCALE;
5134
+ let scale = createCoords(1);
5101
5135
  if (includeScale) {
5102
5136
  if (offsetParent) {
5103
5137
  if (isElement(offsetParent)) {
@@ -5107,7 +5141,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
5107
5141
  scale = getScale(element);
5108
5142
  }
5109
5143
  }
5110
- const visualOffsets = getVisualOffsets(domElement, isFixedStrategy, offsetParent);
5144
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
5111
5145
  let x = (clientRect.left + visualOffsets.x) / scale.x;
5112
5146
  let y = (clientRect.top + visualOffsets.y) / scale.y;
5113
5147
  let width = clientRect.width / scale.x;
@@ -5120,14 +5154,14 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
5120
5154
  const iframeScale = getScale(currentIFrame);
5121
5155
  const iframeRect = currentIFrame.getBoundingClientRect();
5122
5156
  const css = getComputedStyle(currentIFrame);
5123
- iframeRect.x += (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
5124
- 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;
5125
5159
  x *= iframeScale.x;
5126
5160
  y *= iframeScale.y;
5127
5161
  width *= iframeScale.x;
5128
5162
  height *= iframeScale.y;
5129
- x += iframeRect.x;
5130
- y += iframeRect.y;
5163
+ x += left;
5164
+ y += top;
5131
5165
  currentIFrame = getWindow(currentIFrame).frameElement;
5132
5166
  }
5133
5167
  }
@@ -5139,10 +5173,6 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
5139
5173
  });
5140
5174
  }
5141
5175
 
5142
- function getDocumentElement(node) {
5143
- return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
5144
- }
5145
-
5146
5176
  function getNodeScroll(element) {
5147
5177
  if (isElement(element)) {
5148
5178
  return {
@@ -5156,6 +5186,11 @@ function getNodeScroll(element) {
5156
5186
  };
5157
5187
  }
5158
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
+
5159
5194
  function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
5160
5195
  let {
5161
5196
  rect,
@@ -5171,14 +5206,8 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
5171
5206
  scrollLeft: 0,
5172
5207
  scrollTop: 0
5173
5208
  };
5174
- let scale = {
5175
- x: 1,
5176
- y: 1
5177
- };
5178
- const offsets = {
5179
- x: 0,
5180
- y: 0
5181
- };
5209
+ let scale = createCoords(1);
5210
+ const offsets = createCoords(0);
5182
5211
  if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
5183
5212
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
5184
5213
  scroll = getNodeScroll(offsetParent);
@@ -5198,6 +5227,10 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
5198
5227
  };
5199
5228
  }
5200
5229
 
5230
+ function getClientRects(element) {
5231
+ return Array.from(element.getClientRects());
5232
+ }
5233
+
5201
5234
  function getWindowScrollBarX(element) {
5202
5235
  // If <html> has a CSS width greater than the viewport, then this will be
5203
5236
  // incorrect for RTL.
@@ -5244,9 +5277,7 @@ function getParentNode(node) {
5244
5277
  function getNearestOverflowAncestor(node) {
5245
5278
  const parentNode = getParentNode(node);
5246
5279
  if (isLastTraversableNode(parentNode)) {
5247
- // `getParentNode` will never return a `Document` due to the fallback
5248
- // check, so it's either the <html> or <body> element.
5249
- return parentNode.ownerDocument.body;
5280
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
5250
5281
  }
5251
5282
  if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
5252
5283
  return parentNode;
@@ -5298,10 +5329,7 @@ function getInnerBoundingClientRect(element, strategy) {
5298
5329
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
5299
5330
  const top = clientRect.top + element.clientTop;
5300
5331
  const left = clientRect.left + element.clientLeft;
5301
- const scale = isHTMLElement(element) ? getScale(element) : {
5302
- x: 1,
5303
- y: 1
5304
- };
5332
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
5305
5333
  const width = element.clientWidth * scale.x;
5306
5334
  const height = element.clientHeight * scale.y;
5307
5335
  const x = left * scale.x;
@@ -5405,6 +5433,36 @@ function getDimensions(element) {
5405
5433
  return getCssDimensions(element);
5406
5434
  }
5407
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
+
5408
5466
  function getTrueOffsetParent(element, polyfill) {
5409
5467
  if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
5410
5468
  return null;
@@ -5443,68 +5501,115 @@ function getOffsetParent(element, polyfill) {
5443
5501
  return offsetParent || getContainingBlock(element) || window;
5444
5502
  }
5445
5503
 
5446
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
5447
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
5448
- const documentElement = getDocumentElement(offsetParent);
5449
- const isFixed = strategy === 'fixed';
5450
- const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
5451
- let scroll = {
5452
- scrollLeft: 0,
5453
- scrollTop: 0
5454
- };
5455
- const offsets = {
5456
- x: 0,
5457
- y: 0
5458
- };
5459
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
5460
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
5461
- scroll = getNodeScroll(offsetParent);
5462
- }
5463
- if (isHTMLElement(offsetParent)) {
5464
- const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
5465
- offsets.x = offsetRect.x + offsetParent.clientLeft;
5466
- offsets.y = offsetRect.y + offsetParent.clientTop;
5467
- } else if (documentElement) {
5468
- offsets.x = getWindowScrollBarX(documentElement);
5469
- }
5470
- }
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;
5471
5512
  return {
5472
- x: rect.left + scroll.scrollLeft - offsets.x,
5473
- y: rect.top + scroll.scrollTop - offsets.y,
5474
- width: rect.width,
5475
- height: rect.height
5513
+ reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
5514
+ floating: {
5515
+ x: 0,
5516
+ y: 0,
5517
+ ...(await getDimensionsFn(floating))
5518
+ }
5476
5519
  };
5520
+ };
5521
+
5522
+ function isRTL(element) {
5523
+ return getComputedStyle(element).direction === 'rtl';
5477
5524
  }
5478
5525
 
5479
5526
  const platform = {
5480
- getClippingRect,
5481
5527
  convertOffsetParentRelativeRectToViewportRelativeRect,
5482
- isElement,
5483
- getDimensions,
5484
- getOffsetParent,
5485
5528
  getDocumentElement,
5529
+ getClippingRect,
5530
+ getOffsetParent,
5531
+ getElementRects,
5532
+ getClientRects,
5533
+ getDimensions,
5486
5534
  getScale,
5487
- async getElementRects(_ref) {
5488
- let {
5489
- reference,
5490
- floating,
5491
- strategy
5492
- } = _ref;
5493
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
5494
- const getDimensionsFn = this.getDimensions;
5495
- return {
5496
- reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
5497
- floating: {
5498
- x: 0,
5499
- y: 0,
5500
- ...(await getDimensionsFn(floating))
5501
- }
5502
- };
5503
- },
5504
- getClientRects: element => Array.from(element.getClientRects()),
5505
- isRTL: element => getComputedStyle$1(element).direction === 'rtl'
5535
+ isElement,
5536
+ isRTL
5506
5537
  };
5507
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
+
5508
5613
  /**
5509
5614
  * Automatically updates the position of the floating element when necessary.
5510
5615
  * Should only be called when the floating element is mounted on the DOM or
@@ -5520,30 +5625,39 @@ function autoUpdate(reference, floating, update, options) {
5520
5625
  const {
5521
5626
  ancestorScroll = true,
5522
5627
  ancestorResize = true,
5523
- elementResize = true,
5628
+ elementResize = typeof ResizeObserver === 'function',
5629
+ layoutShift = typeof IntersectionObserver === 'function',
5524
5630
  animationFrame = false
5525
5631
  } = options;
5526
- 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)] : [];
5527
5634
  ancestors.forEach(ancestor => {
5528
- // ignores Window, checks for [object VisualViewport]
5529
- const isVisualViewport = !isElement(ancestor) && ancestor.toString().includes('V');
5530
- if (ancestorScroll && (animationFrame ? isVisualViewport : true)) {
5531
- ancestor.addEventListener('scroll', update, {
5532
- passive: true
5533
- });
5534
- }
5635
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
5636
+ passive: true
5637
+ });
5535
5638
  ancestorResize && ancestor.addEventListener('resize', update);
5536
5639
  });
5537
- let observer = null;
5640
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
5641
+ let reobserveFrame = -1;
5642
+ let resizeObserver = null;
5538
5643
  if (elementResize) {
5539
- 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
+ }
5540
5655
  update();
5541
5656
  });
5542
- isElement(reference) && !animationFrame && observer.observe(reference);
5543
- if (!isElement(reference) && reference.contextElement && !animationFrame) {
5544
- observer.observe(reference.contextElement);
5657
+ if (referenceEl && !animationFrame) {
5658
+ resizeObserver.observe(referenceEl);
5545
5659
  }
5546
- observer.observe(floating);
5660
+ resizeObserver.observe(floating);
5547
5661
  }
5548
5662
  let frameId;
5549
5663
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
@@ -5560,13 +5674,13 @@ function autoUpdate(reference, floating, update, options) {
5560
5674
  }
5561
5675
  update();
5562
5676
  return () => {
5563
- var _observer;
5564
5677
  ancestors.forEach(ancestor => {
5565
5678
  ancestorScroll && ancestor.removeEventListener('scroll', update);
5566
5679
  ancestorResize && ancestor.removeEventListener('resize', update);
5567
5680
  });
5568
- (_observer = observer) == null ? void 0 : _observer.disconnect();
5569
- observer = null;
5681
+ cleanupIo && cleanupIo();
5682
+ resizeObserver && resizeObserver.disconnect();
5683
+ resizeObserver = null;
5570
5684
  if (animationFrame) {
5571
5685
  cancelAnimationFrame(frameId);
5572
5686
  }
@@ -6172,7 +6286,7 @@ var isFocusable = function isFocusable(node, options) {
6172
6286
  };
6173
6287
 
6174
6288
  /*!
6175
- * focus-trap 7.4.3
6289
+ * focus-trap 7.5.2
6176
6290
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
6177
6291
  */
6178
6292
 
@@ -6257,10 +6371,10 @@ var isSelectableInput = function isSelectableInput(node) {
6257
6371
  return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
6258
6372
  };
6259
6373
  var isEscapeEvent = function isEscapeEvent(e) {
6260
- 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;
6261
6375
  };
6262
6376
  var isTabEvent = function isTabEvent(e) {
6263
- 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;
6264
6378
  };
6265
6379
 
6266
6380
  // checks for TAB by default
@@ -6344,8 +6458,11 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6344
6458
  // container: HTMLElement,
6345
6459
  // tabbableNodes: Array<HTMLElement>, // empty if none
6346
6460
  // focusableNodes: Array<HTMLElement>, // empty if none
6347
- // firstTabbableNode: HTMLElement|null,
6348
- // lastTabbableNode: HTMLElement|null,
6461
+ // posTabIndexesFound: boolean,
6462
+ // firstTabbableNode: HTMLElement|undefined,
6463
+ // lastTabbableNode: HTMLElement|undefined,
6464
+ // firstDomTabbableNode: HTMLElement|undefined,
6465
+ // lastDomTabbableNode: HTMLElement|undefined,
6349
6466
  // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
6350
6467
  // }>}
6351
6468
  containerGroups: [],
@@ -6362,7 +6479,9 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6362
6479
  paused: false,
6363
6480
  // timer ID for when delayInitialFocus is true and initial focus in this trap
6364
6481
  // has been delayed during activation
6365
- delayInitialFocusTimer: undefined
6482
+ delayInitialFocusTimer: undefined,
6483
+ // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
6484
+ recentNavEvent: undefined
6366
6485
  };
6367
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
6368
6487
 
@@ -6381,7 +6500,9 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6381
6500
  /**
6382
6501
  * Finds the index of the container that contains the element.
6383
6502
  * @param {HTMLElement} element
6384
- * @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.
6385
6506
  * @returns {number} Index of the container in either `state.containers` or
6386
6507
  * `state.containerGroups` (the order/length of these lists are the same); -1
6387
6508
  * if the element isn't found.
@@ -6476,14 +6597,41 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6476
6597
  var tabbableNodes = tabbable(container, config.tabbableOptions);
6477
6598
 
6478
6599
  // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
6479
- // 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
6480
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
+ });
6481
6614
  return {
6482
6615
  container: container,
6483
6616
  tabbableNodes: tabbableNodes,
6484
6617
  focusableNodes: focusableNodes,
6485
- firstTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[0] : null,
6486
- 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,
6487
6635
  /**
6488
6636
  * Finds the __tabbable__ node that follows the given node in the specified direction,
6489
6637
  * in this container, if any.
@@ -6494,30 +6642,24 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6494
6642
  */
6495
6643
  nextTabbableNode: function nextTabbableNode(node) {
6496
6644
  var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
6497
- // NOTE: If tabindex is positive (in order to manipulate the tab order separate
6498
- // from the DOM order), this __will not work__ because the list of focusableNodes,
6499
- // while it contains tabbable nodes, does not sort its nodes in any order other
6500
- // than DOM order, because it can't: Where would you place focusable (but not
6501
- // tabbable) nodes in that order? They have no order, because they aren't tabbale...
6502
- // Support for positive tabindex is already broken and hard to manage (possibly
6503
- // not supportable, TBD), so this isn't going to make things worse than they
6504
- // already are, and at least makes things better for the majority of cases where
6505
- // tabindex is either 0/unset or negative.
6506
- // FYI, positive tabindex issue: https://github.com/focus-trap/focus-trap/issues/375
6507
- var nodeIdx = focusableNodes.findIndex(function (n) {
6508
- return n === node;
6509
- });
6645
+ var nodeIdx = tabbableNodes.indexOf(node);
6510
6646
  if (nodeIdx < 0) {
6511
- return undefined;
6512
- }
6513
- if (forward) {
6514
- return focusableNodes.slice(nodeIdx + 1).find(function (n) {
6515
- 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);
6516
6660
  });
6517
6661
  }
6518
- return focusableNodes.slice(0, nodeIdx).reverse().find(function (n) {
6519
- return isTabbable(n, config.tabbableOptions);
6520
- });
6662
+ return tabbableNodes[nodeIdx + (forward ? 1 : -1)];
6521
6663
  }
6522
6664
  };
6523
6665
  });
@@ -6530,6 +6672,19 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6530
6672
  ) {
6531
6673
  throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
6532
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
+ }
6533
6688
  };
6534
6689
  var tryFocus = function tryFocus(node) {
6535
6690
  if (node === false) {
@@ -6545,6 +6700,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6545
6700
  node.focus({
6546
6701
  preventScroll: !!config.preventScroll
6547
6702
  });
6703
+ // NOTE: focus() API does not trigger focusIn event so set MRU node manually
6548
6704
  state.mostRecentlyFocusedNode = node;
6549
6705
  if (isSelectableInput(node)) {
6550
6706
  node.select();
@@ -6555,64 +6711,23 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6555
6711
  return node ? node : node === false ? false : previousActiveElement;
6556
6712
  };
6557
6713
 
6558
- // This needs to be done on mousedown and touchstart instead of click
6559
- // so that it precedes the focus event.
6560
- var checkPointerDown = function checkPointerDown(e) {
6561
- var target = getActualTarget(e);
6562
- if (findContainerIndex(target, e) >= 0) {
6563
- // allow the click since it ocurred inside the trap
6564
- return;
6565
- }
6566
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
6567
- // immediately deactivate the trap
6568
- trap.deactivate({
6569
- // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
6570
- // which will result in the outside click setting focus to the node
6571
- // that was clicked (and if not focusable, to "nothing"); by setting
6572
- // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
6573
- // on activation (or the configured `setReturnFocus` node), whether the
6574
- // outside click was on a focusable node or not
6575
- returnFocus: config.returnFocusOnDeactivate
6576
- });
6577
- return;
6578
- }
6579
-
6580
- // This is needed for mobile devices.
6581
- // (If we'll only let `click` events through,
6582
- // then on mobile they will be blocked anyways if `touchstart` is blocked.)
6583
- if (valueOrHandler(config.allowOutsideClick, e)) {
6584
- // allow the click outside the trap to take place
6585
- return;
6586
- }
6587
-
6588
- // otherwise, prevent the click
6589
- e.preventDefault();
6590
- };
6591
-
6592
- // In case focus escapes the trap for some strange reason, pull it back in.
6593
- var checkFocusIn = function checkFocusIn(e) {
6594
- var target = getActualTarget(e);
6595
- var targetContained = findContainerIndex(target, e) >= 0;
6596
-
6597
- // In Firefox when you Tab out of an iframe the Document is briefly focused.
6598
- if (targetContained || target instanceof Document) {
6599
- if (targetContained) {
6600
- state.mostRecentlyFocusedNode = target;
6601
- }
6602
- } else {
6603
- // escaped! pull it back in to where it just left
6604
- e.stopImmediatePropagation();
6605
- tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
6606
- }
6607
- };
6608
-
6609
- // Hijack key nav events on the first and last focusable nodes of the trap,
6610
- // in order to prevent focus from escaping. If it escapes for even a
6611
- // moment it can end up scrolling the page and causing confusion so we
6612
- // kind of need to capture the action at the keydown phase.
6613
- var checkKeyNav = function checkKeyNav(event) {
6614
- var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6615
- 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);
6616
6731
  updateTabbableNodes();
6617
6732
  var destinationNode = null;
6618
6733
  if (state.tabbableGroups.length > 0) {
@@ -6635,8 +6750,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6635
6750
  // REVERSE
6636
6751
 
6637
6752
  // is the target the first tabbable node in a group?
6638
- var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref2) {
6639
- var firstTabbableNode = _ref2.firstTabbableNode;
6753
+ var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
6754
+ var firstTabbableNode = _ref3.firstTabbableNode;
6640
6755
  return target === firstTabbableNode;
6641
6756
  });
6642
6757
  if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
@@ -6654,7 +6769,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6654
6769
  // the LAST group if it's the first tabbable node of the FIRST group)
6655
6770
  var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
6656
6771
  var destinationGroup = state.tabbableGroups[destinationGroupIndex];
6657
- destinationNode = destinationGroup.lastTabbableNode;
6772
+ destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode;
6658
6773
  } else if (!isTabEvent(event)) {
6659
6774
  // user must have customized the nav keys so we have to move focus manually _within_
6660
6775
  // the active group: do this based on the order determined by tabbable()
@@ -6664,8 +6779,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6664
6779
  // FORWARD
6665
6780
 
6666
6781
  // is the target the last tabbable node in a group?
6667
- var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
6668
- var lastTabbableNode = _ref3.lastTabbableNode;
6782
+ var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref4) {
6783
+ var lastTabbableNode = _ref4.lastTabbableNode;
6669
6784
  return target === lastTabbableNode;
6670
6785
  });
6671
6786
  if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
@@ -6683,7 +6798,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6683
6798
  // group if it's the last tabbable node of the LAST group)
6684
6799
  var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
6685
6800
  var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
6686
- destinationNode = _destinationGroup.firstTabbableNode;
6801
+ destinationNode = getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode;
6687
6802
  } else if (!isTabEvent(event)) {
6688
6803
  // user must have customized the nav keys so we have to move focus manually _within_
6689
6804
  // the active group: do this based on the order determined by tabbable()
@@ -6695,6 +6810,153 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
6695
6810
  // NOTE: the fallbackFocus option does not support returning false to opt-out
6696
6811
  destinationNode = getNodeForOption('fallbackFocus');
6697
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
+ });
6698
6960
  if (destinationNode) {
6699
6961
  if (isTabEvent(event)) {
6700
6962
  // since tab natively moves focus, we wouldn't have a destination node unless we
@@ -6965,9 +7227,11 @@ const CatDropdown = class {
6965
7227
  this.initTrigger();
6966
7228
  this.toggle();
6967
7229
  }
6968
- const button = event.target;
6969
- // hide dropdown on button click
6970
- 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') {
6971
7235
  this.close();
6972
7236
  }
6973
7237
  }
@@ -7002,6 +7266,9 @@ const CatDropdown = class {
7002
7266
  clickOutsideDeactivates: event => {
7003
7267
  const shouldClose = !this.noAutoClose &&
7004
7268
  !event.composedPath().includes(this.content) &&
7269
+ !event
7270
+ .composedPath()
7271
+ .find(el => el instanceof HTMLElement && el.hasAttribute('data-dropdown-no-close')) &&
7005
7272
  (!this.trigger || !event.composedPath().includes(this.trigger));
7006
7273
  if (shouldClose) {
7007
7274
  this.close();
@@ -7017,7 +7284,7 @@ const CatDropdown = class {
7017
7284
  * Closes the dropdown.
7018
7285
  */
7019
7286
  async close() {
7020
- if (this.isOpen === null || !this.isOpen) {
7287
+ if (this.isOpen === null) {
7021
7288
  return; // busy
7022
7289
  }
7023
7290
  this.isOpen = null;
@@ -7894,14 +8161,25 @@ const CatSelect = class {
7894
8161
  }
7895
8162
  this.hide();
7896
8163
  // Conditionally remove selection if the option was not manually selected through click or enter key press
7897
- if (!this.multiple && (!this.tags || !this.state.selection?.length) && this.state.tempSelection?.length) {
7898
- this.patchState({
7899
- activeSelectionIndex: -1,
7900
- selection: this.state.tempSelection,
7901
- tempSelection: [],
7902
- options: [],
7903
- term: this.state.tempSelection[0].render.label
7904
- });
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
+ }
7905
8183
  }
7906
8184
  else {
7907
8185
  this.patchState({ activeSelectionIndex: -1 });
@@ -8135,7 +8413,7 @@ const CatSelect = class {
8135
8413
  newSelection = [item];
8136
8414
  this.search(item.render.label);
8137
8415
  }
8138
- this.patchState({ selection: newSelection });
8416
+ this.patchState({ selection: newSelection, tempSelection: [] });
8139
8417
  if (this.multiple && this.state.term.trim() && this.input) {
8140
8418
  this.patchState({ term: '', activeOptionIndex: -1 });
8141
8419
  this.term$.next('');
@@ -8161,7 +8439,7 @@ const CatSelect = class {
8161
8439
  }
8162
8440
  clear() {
8163
8441
  if (this.input && this.state.term) {
8164
- this.patchState({ selection: [], options: [], term: '', activeOptionIndex: -1, tempSelection: [] });
8442
+ this.patchState({ selection: [], term: '', activeOptionIndex: -1, tempSelection: [] });
8165
8443
  this.term$.next('');
8166
8444
  this.input.value = '';
8167
8445
  }
@@ -9859,7 +10137,7 @@ const CatTab = class {
9859
10137
  };
9860
10138
  CatTab.style = catTabCss;
9861
10139
 
9862
- 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}";
9863
10141
 
9864
10142
  const CatTabs = class {
9865
10143
  constructor(hostRef) {