@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.
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/p-2257ac13.entry.js +10 -0
- package/dist/catalyst/p-2257ac13.entry.js.map +1 -0
- package/dist/catalyst/scss/fonts/_fonts.mixins.lato.scss +36 -18
- package/dist/catalyst/scss/utils/_color.scss +3 -1
- package/dist/catalyst/scss/utils/_typography.mixins.scss +10 -2
- package/dist/catalyst/scss/vendor/_flatpickr.scss +5 -2
- package/dist/cjs/cat-alert_26.cjs.entry.js +539 -261
- package/dist/cjs/cat-alert_26.cjs.entry.js.map +1 -1
- package/dist/cjs/catalyst.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/cat-button/cat-button.css +0 -1
- package/dist/collection/components/cat-datepicker/cat-datepicker.config.js +6 -0
- package/dist/collection/components/cat-datepicker/cat-datepicker.config.js.map +1 -1
- package/dist/collection/components/cat-datepicker/cat-datepicker.js +42 -9
- package/dist/collection/components/cat-datepicker/cat-datepicker.js.map +1 -1
- package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.js +32 -11
- package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.js.map +1 -1
- package/dist/collection/components/cat-dropdown/cat-dropdown.js +10 -5
- package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
- package/dist/collection/components/cat-select/cat-select.js +22 -11
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/collection/components/cat-tabs/cat-tabs.css +7 -1
- package/dist/collection/components/cat-tooltip/cat-tooltip.js +1 -1
- package/dist/collection/scss/fonts/_fonts.mixins.lato.scss +36 -18
- package/dist/collection/scss/utils/_color.scss +3 -1
- package/dist/collection/scss/utils/_typography.mixins.scss +10 -2
- package/dist/collection/scss/vendor/_flatpickr.scss +5 -2
- package/dist/components/cat-button2.js +1 -1
- package/dist/components/cat-button2.js.map +1 -1
- package/dist/components/cat-checkbox2.js.map +1 -1
- package/dist/components/cat-datepicker-inline.js +18 -13
- package/dist/components/cat-datepicker-inline.js.map +1 -1
- package/dist/components/cat-datepicker.js +28 -9
- package/dist/components/cat-datepicker.js.map +1 -1
- package/dist/components/cat-datepicker.locale.js +6 -0
- package/dist/components/cat-datepicker.locale.js.map +1 -1
- package/dist/components/cat-dropdown2.js +252 -99
- package/dist/components/cat-dropdown2.js.map +1 -1
- package/dist/components/cat-input2.js.map +1 -1
- package/dist/components/cat-select2.js +21 -10
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/components/cat-tabs.js +1 -1
- package/dist/components/cat-tabs.js.map +1 -1
- package/dist/components/cat-textarea.js.map +1 -1
- package/dist/components/cat-tooltip.js.map +1 -1
- package/dist/components/floating-ui.dom.esm.js +215 -129
- package/dist/components/floating-ui.dom.esm.js.map +1 -1
- package/dist/esm/cat-alert_26.entry.js +539 -261
- package/dist/esm/cat-alert_26.entry.js.map +1 -1
- package/dist/esm/catalyst.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/cat-datepicker/cat-datepicker.config.d.ts +3 -0
- package/dist/types/components/cat-datepicker/cat-datepicker.d.ts +8 -2
- package/dist/types/components/cat-datepicker-inline/cat-datepicker-inline.d.ts +7 -1
- package/dist/types/components.d.ts +16 -0
- package/package.json +11 -11
- package/dist/catalyst/p-90e9d18f.entry.js +0 -10
- package/dist/catalyst/p-90e9d18f.entry.js.map +0 -1
|
@@ -1035,7 +1035,7 @@ function createEmptyStyleRule(query) {
|
|
|
1035
1035
|
}
|
|
1036
1036
|
}
|
|
1037
1037
|
|
|
1038
|
-
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}";
|
|
1038
|
+
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}";
|
|
1039
1039
|
|
|
1040
1040
|
const CatButton = class {
|
|
1041
1041
|
constructor(hostRef) {
|
|
@@ -4000,6 +4000,12 @@ function getConfig(options, more = {}) {
|
|
|
4000
4000
|
weekNumbers: true,
|
|
4001
4001
|
minuteIncrement: options.step,
|
|
4002
4002
|
clickOpens: !options.disabled && !options.readonly,
|
|
4003
|
+
onReady: (_dates, _dateStr, flatpickr) => {
|
|
4004
|
+
for (const key in options.nativePickerAttributes) {
|
|
4005
|
+
const value = options.nativePickerAttributes[key];
|
|
4006
|
+
flatpickr.calendarContainer.setAttribute(key, value);
|
|
4007
|
+
}
|
|
4008
|
+
},
|
|
4003
4009
|
onChange: (dates, dateStr, flatpickr) => {
|
|
4004
4010
|
let value = dateStr || undefined;
|
|
4005
4011
|
if (options.mode === 'week') {
|
|
@@ -4126,6 +4132,7 @@ const CatDatepickerFlat = class {
|
|
|
4126
4132
|
this.errors = undefined;
|
|
4127
4133
|
this.errorUpdate = 0;
|
|
4128
4134
|
this.nativeAttributes = undefined;
|
|
4135
|
+
this.nativePickerAttributes = undefined;
|
|
4129
4136
|
}
|
|
4130
4137
|
get input() {
|
|
4131
4138
|
return this._input?.shadowRoot?.querySelector('input') ?? undefined;
|
|
@@ -4140,16 +4147,16 @@ const CatDatepickerFlat = class {
|
|
|
4140
4147
|
this.catChange.emit(undefined);
|
|
4141
4148
|
}
|
|
4142
4149
|
}
|
|
4143
|
-
onDisabledChanged(
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
this.pickr?.
|
|
4150
|
+
onDisabledChanged() {
|
|
4151
|
+
// Dynamically changing 'disabled' value is not working due to a bug in the
|
|
4152
|
+
// library. We thus need to fully recreate the date picker after the value
|
|
4153
|
+
// has been updated.
|
|
4154
|
+
this.pickr?.destroy();
|
|
4155
|
+
this.pickr = undefined;
|
|
4156
|
+
setTimeout(() => (this.pickr = this.initDatepicker(this.input)));
|
|
4148
4157
|
}
|
|
4149
4158
|
componentDidLoad() {
|
|
4150
|
-
|
|
4151
|
-
this.pickr = this.initDatepicker(this.input);
|
|
4152
|
-
}
|
|
4159
|
+
this.pickr = this.initDatepicker(this.input);
|
|
4153
4160
|
}
|
|
4154
4161
|
/**
|
|
4155
4162
|
* Programmatically move focus to the datepicker. Use this method instead of
|
|
@@ -4181,6 +4188,12 @@ const CatDatepickerFlat = class {
|
|
|
4181
4188
|
} }));
|
|
4182
4189
|
}
|
|
4183
4190
|
initDatepicker(input) {
|
|
4191
|
+
if (this.disabled || this.readonly || !input) {
|
|
4192
|
+
return;
|
|
4193
|
+
}
|
|
4194
|
+
// avoid dropdown closing if datepicker is part of a dropdown
|
|
4195
|
+
const withinDropdown = !!this.findClosest('cat-dropdown', input);
|
|
4196
|
+
const nativePickerAttributes = withinDropdown ? { 'data-dropdown-no-close': '' } : {};
|
|
4184
4197
|
return flatpickr(input, getConfig({
|
|
4185
4198
|
locale: getLocale(catI18nRegistry.getLocale()),
|
|
4186
4199
|
format: getFormat(catI18nRegistry.getLocale(), this.mode),
|
|
@@ -4190,13 +4203,24 @@ const CatDatepickerFlat = class {
|
|
|
4190
4203
|
step: this.step,
|
|
4191
4204
|
disabled: this.disabled,
|
|
4192
4205
|
readonly: this.readonly,
|
|
4206
|
+
nativePickerAttributes: { ...nativePickerAttributes, ...this.nativePickerAttributes },
|
|
4193
4207
|
applyChange: value => (this.value = value)
|
|
4194
4208
|
}));
|
|
4195
4209
|
}
|
|
4210
|
+
findClosest(selector, element) {
|
|
4211
|
+
if (element instanceof Element && element.matches(selector)) {
|
|
4212
|
+
return element;
|
|
4213
|
+
}
|
|
4214
|
+
// Search in parent element or Shadow DOM host
|
|
4215
|
+
const nextElement = element instanceof ShadowRoot
|
|
4216
|
+
? element.host
|
|
4217
|
+
: element.parentElement || element.getRootNode().host;
|
|
4218
|
+
return nextElement ? this.findClosest(selector, nextElement) : null;
|
|
4219
|
+
}
|
|
4196
4220
|
static get watchers() { return {
|
|
4197
4221
|
"value": ["onValueChanged"],
|
|
4198
4222
|
"disabled": ["onDisabledChanged"],
|
|
4199
|
-
"readonly": ["
|
|
4223
|
+
"readonly": ["onDisabledChanged"]
|
|
4200
4224
|
}; }
|
|
4201
4225
|
};
|
|
4202
4226
|
CatDatepickerFlat.style = catDatepickerCss;
|
|
@@ -4214,6 +4238,7 @@ const CatDatepickerInline = class {
|
|
|
4214
4238
|
this.readonly = false;
|
|
4215
4239
|
this.step = 5;
|
|
4216
4240
|
this.value = undefined;
|
|
4241
|
+
this.nativePickerAttributes = undefined;
|
|
4217
4242
|
}
|
|
4218
4243
|
onValueChanged(value) {
|
|
4219
4244
|
if (value) {
|
|
@@ -4225,18 +4250,16 @@ const CatDatepickerInline = class {
|
|
|
4225
4250
|
this.catChange.emit(undefined);
|
|
4226
4251
|
}
|
|
4227
4252
|
}
|
|
4228
|
-
onDisabledChanged(
|
|
4253
|
+
onDisabledChanged() {
|
|
4229
4254
|
// Dynamically unsetting 'enabled' value to undefined is not working due to
|
|
4230
|
-
// a bug in the library. We thus need to fully recreate the date picker
|
|
4255
|
+
// a bug in the library. We thus need to fully recreate the date picker
|
|
4256
|
+
// after the value has been updated.
|
|
4231
4257
|
this.pickr?.destroy();
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
}
|
|
4258
|
+
this.pickr = undefined;
|
|
4259
|
+
setTimeout(() => (this.pickr = this.initDatepicker(this.input)));
|
|
4235
4260
|
}
|
|
4236
4261
|
componentDidLoad() {
|
|
4237
|
-
|
|
4238
|
-
this.pickr = this.initDatepicker(this.input, this.disabled);
|
|
4239
|
-
}
|
|
4262
|
+
this.pickr = this.initDatepicker(this.input);
|
|
4240
4263
|
}
|
|
4241
4264
|
render() {
|
|
4242
4265
|
return (h(Host, null, h("div", { tabIndex: this.disabled || this.readonly ? -1 : undefined, class: {
|
|
@@ -4245,7 +4268,10 @@ const CatDatepickerInline = class {
|
|
|
4245
4268
|
'datepicker-readonly': this.readonly
|
|
4246
4269
|
} }, h("input", { ref: el => (this.input = el), value: this.value, disabled: this.disabled, readonly: this.readonly }))));
|
|
4247
4270
|
}
|
|
4248
|
-
initDatepicker(input
|
|
4271
|
+
initDatepicker(input) {
|
|
4272
|
+
if (!input) {
|
|
4273
|
+
return;
|
|
4274
|
+
}
|
|
4249
4275
|
return flatpickr(input, getConfig({
|
|
4250
4276
|
locale: getLocale(catI18nRegistry.getLocale()),
|
|
4251
4277
|
format: getFormat(catI18nRegistry.getLocale(), this.mode),
|
|
@@ -4253,17 +4279,19 @@ const CatDatepickerInline = class {
|
|
|
4253
4279
|
min: this.min,
|
|
4254
4280
|
max: this.max,
|
|
4255
4281
|
step: this.step,
|
|
4256
|
-
disabled,
|
|
4282
|
+
disabled: this.disabled,
|
|
4257
4283
|
readonly: this.readonly,
|
|
4284
|
+
nativePickerAttributes: this.nativePickerAttributes ?? {},
|
|
4258
4285
|
applyChange: value => (this.value = value)
|
|
4259
4286
|
}, {
|
|
4260
|
-
...(disabled ? { enable: [] } : {}),
|
|
4287
|
+
...(this.disabled ? { enable: [] } : {}),
|
|
4261
4288
|
inline: true
|
|
4262
4289
|
}));
|
|
4263
4290
|
}
|
|
4264
4291
|
static get watchers() { return {
|
|
4265
4292
|
"value": ["onValueChanged"],
|
|
4266
|
-
"disabled": ["onDisabledChanged"]
|
|
4293
|
+
"disabled": ["onDisabledChanged"],
|
|
4294
|
+
"readonly": ["onDisabledChanged"]
|
|
4267
4295
|
}; }
|
|
4268
4296
|
};
|
|
4269
4297
|
CatDatepickerInline.style = catDatepickerInlineCss;
|
|
@@ -4946,7 +4974,7 @@ const size = function (options) {
|
|
|
4946
4974
|
|
|
4947
4975
|
function getWindow(node) {
|
|
4948
4976
|
var _node$ownerDocument;
|
|
4949
|
-
return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
4977
|
+
return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
4950
4978
|
}
|
|
4951
4979
|
|
|
4952
4980
|
function getComputedStyle$1(element) {
|
|
@@ -4957,22 +4985,24 @@ function isNode(value) {
|
|
|
4957
4985
|
return value instanceof getWindow(value).Node;
|
|
4958
4986
|
}
|
|
4959
4987
|
function getNodeName(node) {
|
|
4960
|
-
|
|
4988
|
+
if (isNode(node)) {
|
|
4989
|
+
return (node.nodeName || '').toLowerCase();
|
|
4990
|
+
}
|
|
4991
|
+
// Mocked nodes in testing environments may not be instances of Node. By
|
|
4992
|
+
// returning `#document` an infinite loop won't occur.
|
|
4993
|
+
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
4994
|
+
return '#document';
|
|
4961
4995
|
}
|
|
4962
4996
|
|
|
4963
4997
|
function isHTMLElement(value) {
|
|
4964
|
-
return value instanceof getWindow(value).HTMLElement;
|
|
4965
|
-
}
|
|
4966
|
-
function isElement(value) {
|
|
4967
|
-
return value instanceof getWindow(value).Element;
|
|
4998
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
4968
4999
|
}
|
|
4969
5000
|
function isShadowRoot(node) {
|
|
4970
5001
|
// Browsers without `ShadowRoot` support.
|
|
4971
5002
|
if (typeof ShadowRoot === 'undefined') {
|
|
4972
5003
|
return false;
|
|
4973
5004
|
}
|
|
4974
|
-
|
|
4975
|
-
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
5005
|
+
return node instanceof getWindow(node).ShadowRoot || node instanceof ShadowRoot;
|
|
4976
5006
|
}
|
|
4977
5007
|
function isOverflowElement(element) {
|
|
4978
5008
|
const {
|
|
@@ -4991,7 +5021,7 @@ function isContainingBlock(element) {
|
|
|
4991
5021
|
const css = getComputedStyle$1(element);
|
|
4992
5022
|
|
|
4993
5023
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
4994
|
-
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));
|
|
5024
|
+
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));
|
|
4995
5025
|
}
|
|
4996
5026
|
function isSafari() {
|
|
4997
5027
|
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
@@ -5004,6 +5034,11 @@ function isLastTraversableNode(node) {
|
|
|
5004
5034
|
const min = Math.min;
|
|
5005
5035
|
const max = Math.max;
|
|
5006
5036
|
const round = Math.round;
|
|
5037
|
+
const floor = Math.floor;
|
|
5038
|
+
const createCoords = v => ({
|
|
5039
|
+
x: v,
|
|
5040
|
+
y: v
|
|
5041
|
+
});
|
|
5007
5042
|
|
|
5008
5043
|
function getCssDimensions(element) {
|
|
5009
5044
|
const css = getComputedStyle$1(element);
|
|
@@ -5022,31 +5057,31 @@ function getCssDimensions(element) {
|
|
|
5022
5057
|
return {
|
|
5023
5058
|
width,
|
|
5024
5059
|
height,
|
|
5025
|
-
|
|
5060
|
+
$: shouldFallback
|
|
5026
5061
|
};
|
|
5027
5062
|
}
|
|
5028
5063
|
|
|
5064
|
+
function isElement(value) {
|
|
5065
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
5066
|
+
}
|
|
5067
|
+
|
|
5029
5068
|
function unwrapElement(element) {
|
|
5030
5069
|
return !isElement(element) ? element.contextElement : element;
|
|
5031
5070
|
}
|
|
5032
5071
|
|
|
5033
|
-
const FALLBACK_SCALE = {
|
|
5034
|
-
x: 1,
|
|
5035
|
-
y: 1
|
|
5036
|
-
};
|
|
5037
5072
|
function getScale(element) {
|
|
5038
5073
|
const domElement = unwrapElement(element);
|
|
5039
5074
|
if (!isHTMLElement(domElement)) {
|
|
5040
|
-
return
|
|
5075
|
+
return createCoords(1);
|
|
5041
5076
|
}
|
|
5042
5077
|
const rect = domElement.getBoundingClientRect();
|
|
5043
5078
|
const {
|
|
5044
5079
|
width,
|
|
5045
5080
|
height,
|
|
5046
|
-
|
|
5081
|
+
$
|
|
5047
5082
|
} = getCssDimensions(domElement);
|
|
5048
|
-
let x = (
|
|
5049
|
-
let y = (
|
|
5083
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
5084
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
5050
5085
|
|
|
5051
5086
|
// 0, NaN, or Infinity should always fallback to 1.
|
|
5052
5087
|
|
|
@@ -5062,27 +5097,26 @@ function getScale(element) {
|
|
|
5062
5097
|
};
|
|
5063
5098
|
}
|
|
5064
5099
|
|
|
5065
|
-
const noOffsets =
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
function getVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
5070
|
-
var _win$visualViewport, _win$visualViewport2;
|
|
5071
|
-
if (isFixed === void 0) {
|
|
5072
|
-
isFixed = true;
|
|
5073
|
-
}
|
|
5074
|
-
if (!isSafari()) {
|
|
5075
|
-
return noOffsets;
|
|
5076
|
-
}
|
|
5077
|
-
const win = element ? getWindow(element) : window;
|
|
5078
|
-
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== win) {
|
|
5100
|
+
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
5101
|
+
function getVisualOffsets(element) {
|
|
5102
|
+
const win = getWindow(element);
|
|
5103
|
+
if (!isSafari() || !win.visualViewport) {
|
|
5079
5104
|
return noOffsets;
|
|
5080
5105
|
}
|
|
5081
5106
|
return {
|
|
5082
|
-
x:
|
|
5083
|
-
y:
|
|
5107
|
+
x: win.visualViewport.offsetLeft,
|
|
5108
|
+
y: win.visualViewport.offsetTop
|
|
5084
5109
|
};
|
|
5085
5110
|
}
|
|
5111
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
5112
|
+
if (isFixed === void 0) {
|
|
5113
|
+
isFixed = false;
|
|
5114
|
+
}
|
|
5115
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
5116
|
+
return false;
|
|
5117
|
+
}
|
|
5118
|
+
return isFixed;
|
|
5119
|
+
}
|
|
5086
5120
|
|
|
5087
5121
|
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
5088
5122
|
if (includeScale === void 0) {
|
|
@@ -5093,7 +5127,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
5093
5127
|
}
|
|
5094
5128
|
const clientRect = element.getBoundingClientRect();
|
|
5095
5129
|
const domElement = unwrapElement(element);
|
|
5096
|
-
let scale =
|
|
5130
|
+
let scale = createCoords(1);
|
|
5097
5131
|
if (includeScale) {
|
|
5098
5132
|
if (offsetParent) {
|
|
5099
5133
|
if (isElement(offsetParent)) {
|
|
@@ -5103,7 +5137,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
5103
5137
|
scale = getScale(element);
|
|
5104
5138
|
}
|
|
5105
5139
|
}
|
|
5106
|
-
const visualOffsets =
|
|
5140
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
5107
5141
|
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
5108
5142
|
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
5109
5143
|
let width = clientRect.width / scale.x;
|
|
@@ -5116,14 +5150,14 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
5116
5150
|
const iframeScale = getScale(currentIFrame);
|
|
5117
5151
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
5118
5152
|
const css = getComputedStyle(currentIFrame);
|
|
5119
|
-
iframeRect.
|
|
5120
|
-
iframeRect.
|
|
5153
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
5154
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
5121
5155
|
x *= iframeScale.x;
|
|
5122
5156
|
y *= iframeScale.y;
|
|
5123
5157
|
width *= iframeScale.x;
|
|
5124
5158
|
height *= iframeScale.y;
|
|
5125
|
-
x +=
|
|
5126
|
-
y +=
|
|
5159
|
+
x += left;
|
|
5160
|
+
y += top;
|
|
5127
5161
|
currentIFrame = getWindow(currentIFrame).frameElement;
|
|
5128
5162
|
}
|
|
5129
5163
|
}
|
|
@@ -5135,10 +5169,6 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
5135
5169
|
});
|
|
5136
5170
|
}
|
|
5137
5171
|
|
|
5138
|
-
function getDocumentElement(node) {
|
|
5139
|
-
return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
|
|
5140
|
-
}
|
|
5141
|
-
|
|
5142
5172
|
function getNodeScroll(element) {
|
|
5143
5173
|
if (isElement(element)) {
|
|
5144
5174
|
return {
|
|
@@ -5152,6 +5182,11 @@ function getNodeScroll(element) {
|
|
|
5152
5182
|
};
|
|
5153
5183
|
}
|
|
5154
5184
|
|
|
5185
|
+
function getDocumentElement(node) {
|
|
5186
|
+
var _ref;
|
|
5187
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
5188
|
+
}
|
|
5189
|
+
|
|
5155
5190
|
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
5156
5191
|
let {
|
|
5157
5192
|
rect,
|
|
@@ -5167,14 +5202,8 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
5167
5202
|
scrollLeft: 0,
|
|
5168
5203
|
scrollTop: 0
|
|
5169
5204
|
};
|
|
5170
|
-
let scale =
|
|
5171
|
-
|
|
5172
|
-
y: 1
|
|
5173
|
-
};
|
|
5174
|
-
const offsets = {
|
|
5175
|
-
x: 0,
|
|
5176
|
-
y: 0
|
|
5177
|
-
};
|
|
5205
|
+
let scale = createCoords(1);
|
|
5206
|
+
const offsets = createCoords(0);
|
|
5178
5207
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
|
|
5179
5208
|
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
5180
5209
|
scroll = getNodeScroll(offsetParent);
|
|
@@ -5194,6 +5223,10 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
5194
5223
|
};
|
|
5195
5224
|
}
|
|
5196
5225
|
|
|
5226
|
+
function getClientRects(element) {
|
|
5227
|
+
return Array.from(element.getClientRects());
|
|
5228
|
+
}
|
|
5229
|
+
|
|
5197
5230
|
function getWindowScrollBarX(element) {
|
|
5198
5231
|
// If <html> has a CSS width greater than the viewport, then this will be
|
|
5199
5232
|
// incorrect for RTL.
|
|
@@ -5240,9 +5273,7 @@ function getParentNode(node) {
|
|
|
5240
5273
|
function getNearestOverflowAncestor(node) {
|
|
5241
5274
|
const parentNode = getParentNode(node);
|
|
5242
5275
|
if (isLastTraversableNode(parentNode)) {
|
|
5243
|
-
|
|
5244
|
-
// check, so it's either the <html> or <body> element.
|
|
5245
|
-
return parentNode.ownerDocument.body;
|
|
5276
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
5246
5277
|
}
|
|
5247
5278
|
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
5248
5279
|
return parentNode;
|
|
@@ -5294,10 +5325,7 @@ function getInnerBoundingClientRect(element, strategy) {
|
|
|
5294
5325
|
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
5295
5326
|
const top = clientRect.top + element.clientTop;
|
|
5296
5327
|
const left = clientRect.left + element.clientLeft;
|
|
5297
|
-
const scale = isHTMLElement(element) ? getScale(element) :
|
|
5298
|
-
x: 1,
|
|
5299
|
-
y: 1
|
|
5300
|
-
};
|
|
5328
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
5301
5329
|
const width = element.clientWidth * scale.x;
|
|
5302
5330
|
const height = element.clientHeight * scale.y;
|
|
5303
5331
|
const x = left * scale.x;
|
|
@@ -5401,6 +5429,36 @@ function getDimensions(element) {
|
|
|
5401
5429
|
return getCssDimensions(element);
|
|
5402
5430
|
}
|
|
5403
5431
|
|
|
5432
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
5433
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
5434
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
5435
|
+
const isFixed = strategy === 'fixed';
|
|
5436
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
5437
|
+
let scroll = {
|
|
5438
|
+
scrollLeft: 0,
|
|
5439
|
+
scrollTop: 0
|
|
5440
|
+
};
|
|
5441
|
+
const offsets = createCoords(0);
|
|
5442
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
5443
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
5444
|
+
scroll = getNodeScroll(offsetParent);
|
|
5445
|
+
}
|
|
5446
|
+
if (isHTMLElement(offsetParent)) {
|
|
5447
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
5448
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
5449
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
5450
|
+
} else if (documentElement) {
|
|
5451
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
5452
|
+
}
|
|
5453
|
+
}
|
|
5454
|
+
return {
|
|
5455
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
5456
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
|
5457
|
+
width: rect.width,
|
|
5458
|
+
height: rect.height
|
|
5459
|
+
};
|
|
5460
|
+
}
|
|
5461
|
+
|
|
5404
5462
|
function getTrueOffsetParent(element, polyfill) {
|
|
5405
5463
|
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
5406
5464
|
return null;
|
|
@@ -5439,68 +5497,115 @@ function getOffsetParent(element, polyfill) {
|
|
|
5439
5497
|
return offsetParent || getContainingBlock(element) || window;
|
|
5440
5498
|
}
|
|
5441
5499
|
|
|
5442
|
-
function
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
};
|
|
5451
|
-
const offsets = {
|
|
5452
|
-
x: 0,
|
|
5453
|
-
y: 0
|
|
5454
|
-
};
|
|
5455
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
5456
|
-
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
5457
|
-
scroll = getNodeScroll(offsetParent);
|
|
5458
|
-
}
|
|
5459
|
-
if (isHTMLElement(offsetParent)) {
|
|
5460
|
-
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
5461
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
5462
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
5463
|
-
} else if (documentElement) {
|
|
5464
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
5465
|
-
}
|
|
5466
|
-
}
|
|
5500
|
+
const getElementRects = async function (_ref) {
|
|
5501
|
+
let {
|
|
5502
|
+
reference,
|
|
5503
|
+
floating,
|
|
5504
|
+
strategy
|
|
5505
|
+
} = _ref;
|
|
5506
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
5507
|
+
const getDimensionsFn = this.getDimensions;
|
|
5467
5508
|
return {
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5509
|
+
reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
|
|
5510
|
+
floating: {
|
|
5511
|
+
x: 0,
|
|
5512
|
+
y: 0,
|
|
5513
|
+
...(await getDimensionsFn(floating))
|
|
5514
|
+
}
|
|
5472
5515
|
};
|
|
5516
|
+
};
|
|
5517
|
+
|
|
5518
|
+
function isRTL(element) {
|
|
5519
|
+
return getComputedStyle(element).direction === 'rtl';
|
|
5473
5520
|
}
|
|
5474
5521
|
|
|
5475
5522
|
const platform = {
|
|
5476
|
-
getClippingRect,
|
|
5477
5523
|
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
5478
|
-
isElement,
|
|
5479
|
-
getDimensions,
|
|
5480
|
-
getOffsetParent,
|
|
5481
5524
|
getDocumentElement,
|
|
5525
|
+
getClippingRect,
|
|
5526
|
+
getOffsetParent,
|
|
5527
|
+
getElementRects,
|
|
5528
|
+
getClientRects,
|
|
5529
|
+
getDimensions,
|
|
5482
5530
|
getScale,
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
reference,
|
|
5486
|
-
floating,
|
|
5487
|
-
strategy
|
|
5488
|
-
} = _ref;
|
|
5489
|
-
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
5490
|
-
const getDimensionsFn = this.getDimensions;
|
|
5491
|
-
return {
|
|
5492
|
-
reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
|
|
5493
|
-
floating: {
|
|
5494
|
-
x: 0,
|
|
5495
|
-
y: 0,
|
|
5496
|
-
...(await getDimensionsFn(floating))
|
|
5497
|
-
}
|
|
5498
|
-
};
|
|
5499
|
-
},
|
|
5500
|
-
getClientRects: element => Array.from(element.getClientRects()),
|
|
5501
|
-
isRTL: element => getComputedStyle$1(element).direction === 'rtl'
|
|
5531
|
+
isElement,
|
|
5532
|
+
isRTL
|
|
5502
5533
|
};
|
|
5503
5534
|
|
|
5535
|
+
// https://samthor.au/2021/observing-dom/
|
|
5536
|
+
function observeMove(element, onMove) {
|
|
5537
|
+
let io = null;
|
|
5538
|
+
let timeoutId;
|
|
5539
|
+
const root = getDocumentElement(element);
|
|
5540
|
+
function cleanup() {
|
|
5541
|
+
clearTimeout(timeoutId);
|
|
5542
|
+
io && io.disconnect();
|
|
5543
|
+
io = null;
|
|
5544
|
+
}
|
|
5545
|
+
function refresh(skip, threshold) {
|
|
5546
|
+
if (skip === void 0) {
|
|
5547
|
+
skip = false;
|
|
5548
|
+
}
|
|
5549
|
+
if (threshold === void 0) {
|
|
5550
|
+
threshold = 1;
|
|
5551
|
+
}
|
|
5552
|
+
cleanup();
|
|
5553
|
+
const {
|
|
5554
|
+
left,
|
|
5555
|
+
top,
|
|
5556
|
+
width,
|
|
5557
|
+
height
|
|
5558
|
+
} = element.getBoundingClientRect();
|
|
5559
|
+
if (!skip) {
|
|
5560
|
+
onMove();
|
|
5561
|
+
}
|
|
5562
|
+
if (!width || !height) {
|
|
5563
|
+
return;
|
|
5564
|
+
}
|
|
5565
|
+
const insetTop = floor(top);
|
|
5566
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
5567
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
5568
|
+
const insetLeft = floor(left);
|
|
5569
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
5570
|
+
const options = {
|
|
5571
|
+
rootMargin,
|
|
5572
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
5573
|
+
};
|
|
5574
|
+
let isFirstUpdate = true;
|
|
5575
|
+
function handleObserve(entries) {
|
|
5576
|
+
const ratio = entries[0].intersectionRatio;
|
|
5577
|
+
if (ratio !== threshold) {
|
|
5578
|
+
if (!isFirstUpdate) {
|
|
5579
|
+
return refresh();
|
|
5580
|
+
}
|
|
5581
|
+
if (!ratio) {
|
|
5582
|
+
timeoutId = setTimeout(() => {
|
|
5583
|
+
refresh(false, 1e-7);
|
|
5584
|
+
}, 100);
|
|
5585
|
+
} else {
|
|
5586
|
+
refresh(false, ratio);
|
|
5587
|
+
}
|
|
5588
|
+
}
|
|
5589
|
+
isFirstUpdate = false;
|
|
5590
|
+
}
|
|
5591
|
+
|
|
5592
|
+
// Older browsers don't support a `document` as the root and will throw an
|
|
5593
|
+
// error.
|
|
5594
|
+
try {
|
|
5595
|
+
io = new IntersectionObserver(handleObserve, {
|
|
5596
|
+
...options,
|
|
5597
|
+
// Handle <iframe>s
|
|
5598
|
+
root: root.ownerDocument
|
|
5599
|
+
});
|
|
5600
|
+
} catch (e) {
|
|
5601
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
5602
|
+
}
|
|
5603
|
+
io.observe(element);
|
|
5604
|
+
}
|
|
5605
|
+
refresh(true);
|
|
5606
|
+
return cleanup;
|
|
5607
|
+
}
|
|
5608
|
+
|
|
5504
5609
|
/**
|
|
5505
5610
|
* Automatically updates the position of the floating element when necessary.
|
|
5506
5611
|
* Should only be called when the floating element is mounted on the DOM or
|
|
@@ -5516,30 +5621,39 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
5516
5621
|
const {
|
|
5517
5622
|
ancestorScroll = true,
|
|
5518
5623
|
ancestorResize = true,
|
|
5519
|
-
elementResize =
|
|
5624
|
+
elementResize = typeof ResizeObserver === 'function',
|
|
5625
|
+
layoutShift = typeof IntersectionObserver === 'function',
|
|
5520
5626
|
animationFrame = false
|
|
5521
5627
|
} = options;
|
|
5522
|
-
const
|
|
5628
|
+
const referenceEl = unwrapElement(reference);
|
|
5629
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
|
|
5523
5630
|
ancestors.forEach(ancestor => {
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
ancestor.addEventListener('scroll', update, {
|
|
5528
|
-
passive: true
|
|
5529
|
-
});
|
|
5530
|
-
}
|
|
5631
|
+
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
5632
|
+
passive: true
|
|
5633
|
+
});
|
|
5531
5634
|
ancestorResize && ancestor.addEventListener('resize', update);
|
|
5532
5635
|
});
|
|
5533
|
-
|
|
5636
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
5637
|
+
let reobserveFrame = -1;
|
|
5638
|
+
let resizeObserver = null;
|
|
5534
5639
|
if (elementResize) {
|
|
5535
|
-
|
|
5640
|
+
resizeObserver = new ResizeObserver(_ref => {
|
|
5641
|
+
let [firstEntry] = _ref;
|
|
5642
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
5643
|
+
// Prevent update loops when using the `size` middleware.
|
|
5644
|
+
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
5645
|
+
resizeObserver.unobserve(floating);
|
|
5646
|
+
cancelAnimationFrame(reobserveFrame);
|
|
5647
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
5648
|
+
resizeObserver && resizeObserver.observe(floating);
|
|
5649
|
+
});
|
|
5650
|
+
}
|
|
5536
5651
|
update();
|
|
5537
5652
|
});
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
observer.observe(reference.contextElement);
|
|
5653
|
+
if (referenceEl && !animationFrame) {
|
|
5654
|
+
resizeObserver.observe(referenceEl);
|
|
5541
5655
|
}
|
|
5542
|
-
|
|
5656
|
+
resizeObserver.observe(floating);
|
|
5543
5657
|
}
|
|
5544
5658
|
let frameId;
|
|
5545
5659
|
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
@@ -5556,13 +5670,13 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
5556
5670
|
}
|
|
5557
5671
|
update();
|
|
5558
5672
|
return () => {
|
|
5559
|
-
var _observer;
|
|
5560
5673
|
ancestors.forEach(ancestor => {
|
|
5561
5674
|
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
5562
5675
|
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
5563
5676
|
});
|
|
5564
|
-
|
|
5565
|
-
|
|
5677
|
+
cleanupIo && cleanupIo();
|
|
5678
|
+
resizeObserver && resizeObserver.disconnect();
|
|
5679
|
+
resizeObserver = null;
|
|
5566
5680
|
if (animationFrame) {
|
|
5567
5681
|
cancelAnimationFrame(frameId);
|
|
5568
5682
|
}
|
|
@@ -6168,7 +6282,7 @@ var isFocusable = function isFocusable(node, options) {
|
|
|
6168
6282
|
};
|
|
6169
6283
|
|
|
6170
6284
|
/*!
|
|
6171
|
-
* focus-trap 7.
|
|
6285
|
+
* focus-trap 7.5.2
|
|
6172
6286
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
6173
6287
|
*/
|
|
6174
6288
|
|
|
@@ -6253,10 +6367,10 @@ var isSelectableInput = function isSelectableInput(node) {
|
|
|
6253
6367
|
return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
|
|
6254
6368
|
};
|
|
6255
6369
|
var isEscapeEvent = function isEscapeEvent(e) {
|
|
6256
|
-
return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
|
|
6370
|
+
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;
|
|
6257
6371
|
};
|
|
6258
6372
|
var isTabEvent = function isTabEvent(e) {
|
|
6259
|
-
return e.key === 'Tab' || e.keyCode === 9;
|
|
6373
|
+
return (e === null || e === void 0 ? void 0 : e.key) === 'Tab' || (e === null || e === void 0 ? void 0 : e.keyCode) === 9;
|
|
6260
6374
|
};
|
|
6261
6375
|
|
|
6262
6376
|
// checks for TAB by default
|
|
@@ -6340,8 +6454,11 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6340
6454
|
// container: HTMLElement,
|
|
6341
6455
|
// tabbableNodes: Array<HTMLElement>, // empty if none
|
|
6342
6456
|
// focusableNodes: Array<HTMLElement>, // empty if none
|
|
6343
|
-
//
|
|
6344
|
-
//
|
|
6457
|
+
// posTabIndexesFound: boolean,
|
|
6458
|
+
// firstTabbableNode: HTMLElement|undefined,
|
|
6459
|
+
// lastTabbableNode: HTMLElement|undefined,
|
|
6460
|
+
// firstDomTabbableNode: HTMLElement|undefined,
|
|
6461
|
+
// lastDomTabbableNode: HTMLElement|undefined,
|
|
6345
6462
|
// nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
|
|
6346
6463
|
// }>}
|
|
6347
6464
|
containerGroups: [],
|
|
@@ -6358,7 +6475,9 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6358
6475
|
paused: false,
|
|
6359
6476
|
// timer ID for when delayInitialFocus is true and initial focus in this trap
|
|
6360
6477
|
// has been delayed during activation
|
|
6361
|
-
delayInitialFocusTimer: undefined
|
|
6478
|
+
delayInitialFocusTimer: undefined,
|
|
6479
|
+
// the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
|
|
6480
|
+
recentNavEvent: undefined
|
|
6362
6481
|
};
|
|
6363
6482
|
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
|
|
6364
6483
|
|
|
@@ -6377,7 +6496,9 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6377
6496
|
/**
|
|
6378
6497
|
* Finds the index of the container that contains the element.
|
|
6379
6498
|
* @param {HTMLElement} element
|
|
6380
|
-
* @param {Event} [event]
|
|
6499
|
+
* @param {Event} [event] If available, and `element` isn't directly found in any container,
|
|
6500
|
+
* the event's composed path is used to see if includes any known trap containers in the
|
|
6501
|
+
* case where the element is inside a Shadow DOM.
|
|
6381
6502
|
* @returns {number} Index of the container in either `state.containers` or
|
|
6382
6503
|
* `state.containerGroups` (the order/length of these lists are the same); -1
|
|
6383
6504
|
* if the element isn't found.
|
|
@@ -6472,14 +6593,41 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6472
6593
|
var tabbableNodes = tabbable(container, config.tabbableOptions);
|
|
6473
6594
|
|
|
6474
6595
|
// NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
|
|
6475
|
-
// are a superset of tabbable nodes
|
|
6596
|
+
// are a superset of tabbable nodes since nodes with negative `tabindex` attributes
|
|
6597
|
+
// are focusable but not tabbable
|
|
6476
6598
|
var focusableNodes = focusable(container, config.tabbableOptions);
|
|
6599
|
+
var firstTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[0] : undefined;
|
|
6600
|
+
var lastTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : undefined;
|
|
6601
|
+
var firstDomTabbableNode = focusableNodes.find(function (node) {
|
|
6602
|
+
return isTabbable(node);
|
|
6603
|
+
});
|
|
6604
|
+
var lastDomTabbableNode = focusableNodes.slice().reverse().find(function (node) {
|
|
6605
|
+
return isTabbable(node);
|
|
6606
|
+
});
|
|
6607
|
+
var posTabIndexesFound = !!tabbableNodes.find(function (node) {
|
|
6608
|
+
return getTabIndex(node) > 0;
|
|
6609
|
+
});
|
|
6477
6610
|
return {
|
|
6478
6611
|
container: container,
|
|
6479
6612
|
tabbableNodes: tabbableNodes,
|
|
6480
6613
|
focusableNodes: focusableNodes,
|
|
6481
|
-
|
|
6482
|
-
|
|
6614
|
+
/** True if at least one node with positive `tabindex` was found in this container. */
|
|
6615
|
+
posTabIndexesFound: posTabIndexesFound,
|
|
6616
|
+
/** First tabbable node in container, __tabindex__ order; `undefined` if none. */
|
|
6617
|
+
firstTabbableNode: firstTabbableNode,
|
|
6618
|
+
/** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
|
|
6619
|
+
lastTabbableNode: lastTabbableNode,
|
|
6620
|
+
// NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
|
|
6621
|
+
// would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
|
|
6622
|
+
// because that API doesn't work with Shadow DOM as well as it should (@see
|
|
6623
|
+
// https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
|
|
6624
|
+
// to address an edge case related to positive tabindex support, this seems like a much easier,
|
|
6625
|
+
// "close enough most of the time" alternative for positive tabindexes which should generally
|
|
6626
|
+
// be avoided anyway...
|
|
6627
|
+
/** First tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
6628
|
+
firstDomTabbableNode: firstDomTabbableNode,
|
|
6629
|
+
/** Last tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
6630
|
+
lastDomTabbableNode: lastDomTabbableNode,
|
|
6483
6631
|
/**
|
|
6484
6632
|
* Finds the __tabbable__ node that follows the given node in the specified direction,
|
|
6485
6633
|
* in this container, if any.
|
|
@@ -6490,30 +6638,24 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6490
6638
|
*/
|
|
6491
6639
|
nextTabbableNode: function nextTabbableNode(node) {
|
|
6492
6640
|
var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
6493
|
-
|
|
6494
|
-
// from the DOM order), this __will not work__ because the list of focusableNodes,
|
|
6495
|
-
// while it contains tabbable nodes, does not sort its nodes in any order other
|
|
6496
|
-
// than DOM order, because it can't: Where would you place focusable (but not
|
|
6497
|
-
// tabbable) nodes in that order? They have no order, because they aren't tabbale...
|
|
6498
|
-
// Support for positive tabindex is already broken and hard to manage (possibly
|
|
6499
|
-
// not supportable, TBD), so this isn't going to make things worse than they
|
|
6500
|
-
// already are, and at least makes things better for the majority of cases where
|
|
6501
|
-
// tabindex is either 0/unset or negative.
|
|
6502
|
-
// FYI, positive tabindex issue: https://github.com/focus-trap/focus-trap/issues/375
|
|
6503
|
-
var nodeIdx = focusableNodes.findIndex(function (n) {
|
|
6504
|
-
return n === node;
|
|
6505
|
-
});
|
|
6641
|
+
var nodeIdx = tabbableNodes.indexOf(node);
|
|
6506
6642
|
if (nodeIdx < 0) {
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6643
|
+
// either not tabbable nor focusable, or was focused but not tabbable (negative tabindex):
|
|
6644
|
+
// since `node` should at least have been focusable, we assume that's the case and mimic
|
|
6645
|
+
// what browsers do, which is set focus to the next node in __document position order__,
|
|
6646
|
+
// regardless of positive tabindexes, if any -- and for reasons explained in the NOTE
|
|
6647
|
+
// above related to `firstDomTabbable` and `lastDomTabbable` properties, we fall back to
|
|
6648
|
+
// basic DOM order
|
|
6649
|
+
if (forward) {
|
|
6650
|
+
return focusableNodes.slice(focusableNodes.indexOf(node) + 1).find(function (el) {
|
|
6651
|
+
return isTabbable(el);
|
|
6652
|
+
});
|
|
6653
|
+
}
|
|
6654
|
+
return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find(function (el) {
|
|
6655
|
+
return isTabbable(el);
|
|
6512
6656
|
});
|
|
6513
6657
|
}
|
|
6514
|
-
return
|
|
6515
|
-
return isTabbable(n, config.tabbableOptions);
|
|
6516
|
-
});
|
|
6658
|
+
return tabbableNodes[nodeIdx + (forward ? 1 : -1)];
|
|
6517
6659
|
}
|
|
6518
6660
|
};
|
|
6519
6661
|
});
|
|
@@ -6526,6 +6668,19 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6526
6668
|
) {
|
|
6527
6669
|
throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
|
|
6528
6670
|
}
|
|
6671
|
+
|
|
6672
|
+
// NOTE: Positive tabindexes are only properly supported in single-container traps because
|
|
6673
|
+
// doing it across multiple containers where tabindexes could be all over the place
|
|
6674
|
+
// would require Tabbable to support multiple containers, would require additional
|
|
6675
|
+
// specialized Shadow DOM support, and would require Tabbable's multi-container support
|
|
6676
|
+
// to look at those containers in document position order rather than user-provided
|
|
6677
|
+
// order (as they are treated in Focus-trap, for legacy reasons). See discussion on
|
|
6678
|
+
// https://github.com/focus-trap/focus-trap/issues/375 for more details.
|
|
6679
|
+
if (state.containerGroups.find(function (g) {
|
|
6680
|
+
return g.posTabIndexesFound;
|
|
6681
|
+
}) && state.containerGroups.length > 1) {
|
|
6682
|
+
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.");
|
|
6683
|
+
}
|
|
6529
6684
|
};
|
|
6530
6685
|
var tryFocus = function tryFocus(node) {
|
|
6531
6686
|
if (node === false) {
|
|
@@ -6541,6 +6696,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6541
6696
|
node.focus({
|
|
6542
6697
|
preventScroll: !!config.preventScroll
|
|
6543
6698
|
});
|
|
6699
|
+
// NOTE: focus() API does not trigger focusIn event so set MRU node manually
|
|
6544
6700
|
state.mostRecentlyFocusedNode = node;
|
|
6545
6701
|
if (isSelectableInput(node)) {
|
|
6546
6702
|
node.select();
|
|
@@ -6551,64 +6707,23 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6551
6707
|
return node ? node : node === false ? false : previousActiveElement;
|
|
6552
6708
|
};
|
|
6553
6709
|
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
returnFocus: config.returnFocusOnDeactivate
|
|
6572
|
-
});
|
|
6573
|
-
return;
|
|
6574
|
-
}
|
|
6575
|
-
|
|
6576
|
-
// This is needed for mobile devices.
|
|
6577
|
-
// (If we'll only let `click` events through,
|
|
6578
|
-
// then on mobile they will be blocked anyways if `touchstart` is blocked.)
|
|
6579
|
-
if (valueOrHandler(config.allowOutsideClick, e)) {
|
|
6580
|
-
// allow the click outside the trap to take place
|
|
6581
|
-
return;
|
|
6582
|
-
}
|
|
6583
|
-
|
|
6584
|
-
// otherwise, prevent the click
|
|
6585
|
-
e.preventDefault();
|
|
6586
|
-
};
|
|
6587
|
-
|
|
6588
|
-
// In case focus escapes the trap for some strange reason, pull it back in.
|
|
6589
|
-
var checkFocusIn = function checkFocusIn(e) {
|
|
6590
|
-
var target = getActualTarget(e);
|
|
6591
|
-
var targetContained = findContainerIndex(target, e) >= 0;
|
|
6592
|
-
|
|
6593
|
-
// In Firefox when you Tab out of an iframe the Document is briefly focused.
|
|
6594
|
-
if (targetContained || target instanceof Document) {
|
|
6595
|
-
if (targetContained) {
|
|
6596
|
-
state.mostRecentlyFocusedNode = target;
|
|
6597
|
-
}
|
|
6598
|
-
} else {
|
|
6599
|
-
// escaped! pull it back in to where it just left
|
|
6600
|
-
e.stopImmediatePropagation();
|
|
6601
|
-
tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
|
|
6602
|
-
}
|
|
6603
|
-
};
|
|
6604
|
-
|
|
6605
|
-
// Hijack key nav events on the first and last focusable nodes of the trap,
|
|
6606
|
-
// in order to prevent focus from escaping. If it escapes for even a
|
|
6607
|
-
// moment it can end up scrolling the page and causing confusion so we
|
|
6608
|
-
// kind of need to capture the action at the keydown phase.
|
|
6609
|
-
var checkKeyNav = function checkKeyNav(event) {
|
|
6610
|
-
var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6611
|
-
var target = getActualTarget(event);
|
|
6710
|
+
/**
|
|
6711
|
+
* Finds the next node (in either direction) where focus should move according to a
|
|
6712
|
+
* keyboard focus-in event.
|
|
6713
|
+
* @param {Object} params
|
|
6714
|
+
* @param {Node} [params.target] Known target __from which__ to navigate, if any.
|
|
6715
|
+
* @param {KeyboardEvent|FocusEvent} [params.event] Event to use if `target` isn't known (event
|
|
6716
|
+
* will be used to determine the `target`). Ignored if `target` is specified.
|
|
6717
|
+
* @param {boolean} [params.isBackward] True if focus should move backward.
|
|
6718
|
+
* @returns {Node|undefined} The next node, or `undefined` if a next node couldn't be
|
|
6719
|
+
* determined given the current state of the trap.
|
|
6720
|
+
*/
|
|
6721
|
+
var findNextNavNode = function findNextNavNode(_ref2) {
|
|
6722
|
+
var target = _ref2.target,
|
|
6723
|
+
event = _ref2.event,
|
|
6724
|
+
_ref2$isBackward = _ref2.isBackward,
|
|
6725
|
+
isBackward = _ref2$isBackward === void 0 ? false : _ref2$isBackward;
|
|
6726
|
+
target = target || getActualTarget(event);
|
|
6612
6727
|
updateTabbableNodes();
|
|
6613
6728
|
var destinationNode = null;
|
|
6614
6729
|
if (state.tabbableGroups.length > 0) {
|
|
@@ -6631,8 +6746,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6631
6746
|
// REVERSE
|
|
6632
6747
|
|
|
6633
6748
|
// is the target the first tabbable node in a group?
|
|
6634
|
-
var startOfGroupIndex = findIndex(state.tabbableGroups, function (
|
|
6635
|
-
var firstTabbableNode =
|
|
6749
|
+
var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
|
|
6750
|
+
var firstTabbableNode = _ref3.firstTabbableNode;
|
|
6636
6751
|
return target === firstTabbableNode;
|
|
6637
6752
|
});
|
|
6638
6753
|
if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
|
|
@@ -6650,7 +6765,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6650
6765
|
// the LAST group if it's the first tabbable node of the FIRST group)
|
|
6651
6766
|
var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
|
|
6652
6767
|
var destinationGroup = state.tabbableGroups[destinationGroupIndex];
|
|
6653
|
-
destinationNode = destinationGroup.lastTabbableNode;
|
|
6768
|
+
destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode;
|
|
6654
6769
|
} else if (!isTabEvent(event)) {
|
|
6655
6770
|
// user must have customized the nav keys so we have to move focus manually _within_
|
|
6656
6771
|
// the active group: do this based on the order determined by tabbable()
|
|
@@ -6660,8 +6775,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6660
6775
|
// FORWARD
|
|
6661
6776
|
|
|
6662
6777
|
// is the target the last tabbable node in a group?
|
|
6663
|
-
var lastOfGroupIndex = findIndex(state.tabbableGroups, function (
|
|
6664
|
-
var lastTabbableNode =
|
|
6778
|
+
var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref4) {
|
|
6779
|
+
var lastTabbableNode = _ref4.lastTabbableNode;
|
|
6665
6780
|
return target === lastTabbableNode;
|
|
6666
6781
|
});
|
|
6667
6782
|
if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
|
|
@@ -6679,7 +6794,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6679
6794
|
// group if it's the last tabbable node of the LAST group)
|
|
6680
6795
|
var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
|
|
6681
6796
|
var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
|
|
6682
|
-
destinationNode = _destinationGroup.firstTabbableNode;
|
|
6797
|
+
destinationNode = getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode;
|
|
6683
6798
|
} else if (!isTabEvent(event)) {
|
|
6684
6799
|
// user must have customized the nav keys so we have to move focus manually _within_
|
|
6685
6800
|
// the active group: do this based on the order determined by tabbable()
|
|
@@ -6691,6 +6806,153 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6691
6806
|
// NOTE: the fallbackFocus option does not support returning false to opt-out
|
|
6692
6807
|
destinationNode = getNodeForOption('fallbackFocus');
|
|
6693
6808
|
}
|
|
6809
|
+
return destinationNode;
|
|
6810
|
+
};
|
|
6811
|
+
|
|
6812
|
+
// This needs to be done on mousedown and touchstart instead of click
|
|
6813
|
+
// so that it precedes the focus event.
|
|
6814
|
+
var checkPointerDown = function checkPointerDown(e) {
|
|
6815
|
+
var target = getActualTarget(e);
|
|
6816
|
+
if (findContainerIndex(target, e) >= 0) {
|
|
6817
|
+
// allow the click since it ocurred inside the trap
|
|
6818
|
+
return;
|
|
6819
|
+
}
|
|
6820
|
+
if (valueOrHandler(config.clickOutsideDeactivates, e)) {
|
|
6821
|
+
// immediately deactivate the trap
|
|
6822
|
+
trap.deactivate({
|
|
6823
|
+
// NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
|
|
6824
|
+
// which will result in the outside click setting focus to the node
|
|
6825
|
+
// that was clicked (and if not focusable, to "nothing"); by setting
|
|
6826
|
+
// `returnFocus: true`, we'll attempt to re-focus the node originally-focused
|
|
6827
|
+
// on activation (or the configured `setReturnFocus` node), whether the
|
|
6828
|
+
// outside click was on a focusable node or not
|
|
6829
|
+
returnFocus: config.returnFocusOnDeactivate
|
|
6830
|
+
});
|
|
6831
|
+
return;
|
|
6832
|
+
}
|
|
6833
|
+
|
|
6834
|
+
// This is needed for mobile devices.
|
|
6835
|
+
// (If we'll only let `click` events through,
|
|
6836
|
+
// then on mobile they will be blocked anyways if `touchstart` is blocked.)
|
|
6837
|
+
if (valueOrHandler(config.allowOutsideClick, e)) {
|
|
6838
|
+
// allow the click outside the trap to take place
|
|
6839
|
+
return;
|
|
6840
|
+
}
|
|
6841
|
+
|
|
6842
|
+
// otherwise, prevent the click
|
|
6843
|
+
e.preventDefault();
|
|
6844
|
+
};
|
|
6845
|
+
|
|
6846
|
+
// In case focus escapes the trap for some strange reason, pull it back in.
|
|
6847
|
+
// NOTE: the focusIn event is NOT cancelable, so if focus escapes, it may cause unexpected
|
|
6848
|
+
// scrolling if the node that got focused was out of view; there's nothing we can do to
|
|
6849
|
+
// prevent that from happening by the time we discover that focus escaped
|
|
6850
|
+
var checkFocusIn = function checkFocusIn(event) {
|
|
6851
|
+
var target = getActualTarget(event);
|
|
6852
|
+
var targetContained = findContainerIndex(target, event) >= 0;
|
|
6853
|
+
|
|
6854
|
+
// In Firefox when you Tab out of an iframe the Document is briefly focused.
|
|
6855
|
+
if (targetContained || target instanceof Document) {
|
|
6856
|
+
if (targetContained) {
|
|
6857
|
+
state.mostRecentlyFocusedNode = target;
|
|
6858
|
+
}
|
|
6859
|
+
} else {
|
|
6860
|
+
// escaped! pull it back in to where it just left
|
|
6861
|
+
event.stopImmediatePropagation();
|
|
6862
|
+
|
|
6863
|
+
// focus will escape if the MRU node had a positive tab index and user tried to nav forward;
|
|
6864
|
+
// it will also escape if the MRU node had a 0 tab index and user tried to nav backward
|
|
6865
|
+
// toward a node with a positive tab index
|
|
6866
|
+
var nextNode; // next node to focus, if we find one
|
|
6867
|
+
var navAcrossContainers = true;
|
|
6868
|
+
if (state.mostRecentlyFocusedNode) {
|
|
6869
|
+
if (getTabIndex(state.mostRecentlyFocusedNode) > 0) {
|
|
6870
|
+
// MRU container index must be >=0 otherwise we wouldn't have it as an MRU node...
|
|
6871
|
+
var mruContainerIdx = findContainerIndex(state.mostRecentlyFocusedNode);
|
|
6872
|
+
// there MAY not be any tabbable nodes in the container if there are at least 2 containers
|
|
6873
|
+
// and the MRU node is focusable but not tabbable (focus-trap requires at least 1 container
|
|
6874
|
+
// with at least one tabbable node in order to function, so this could be the other container
|
|
6875
|
+
// with nothing tabbable in it)
|
|
6876
|
+
var tabbableNodes = state.containerGroups[mruContainerIdx].tabbableNodes;
|
|
6877
|
+
if (tabbableNodes.length > 0) {
|
|
6878
|
+
// MRU tab index MAY not be found if the MRU node is focusable but not tabbable
|
|
6879
|
+
var mruTabIdx = tabbableNodes.findIndex(function (node) {
|
|
6880
|
+
return node === state.mostRecentlyFocusedNode;
|
|
6881
|
+
});
|
|
6882
|
+
if (mruTabIdx >= 0) {
|
|
6883
|
+
if (config.isKeyForward(state.recentNavEvent)) {
|
|
6884
|
+
if (mruTabIdx + 1 < tabbableNodes.length) {
|
|
6885
|
+
nextNode = tabbableNodes[mruTabIdx + 1];
|
|
6886
|
+
navAcrossContainers = false;
|
|
6887
|
+
}
|
|
6888
|
+
// else, don't wrap within the container as focus should move to next/previous
|
|
6889
|
+
// container
|
|
6890
|
+
} else {
|
|
6891
|
+
if (mruTabIdx - 1 >= 0) {
|
|
6892
|
+
nextNode = tabbableNodes[mruTabIdx - 1];
|
|
6893
|
+
navAcrossContainers = false;
|
|
6894
|
+
}
|
|
6895
|
+
// else, don't wrap within the container as focus should move to next/previous
|
|
6896
|
+
// container
|
|
6897
|
+
}
|
|
6898
|
+
// else, don't find in container order without considering direction too
|
|
6899
|
+
}
|
|
6900
|
+
}
|
|
6901
|
+
// else, no tabbable nodes in that container (which means we must have at least one other
|
|
6902
|
+
// container with at least one tabbable node in it, otherwise focus-trap would've thrown
|
|
6903
|
+
// an error the last time updateTabbableNodes() was run): find next node among all known
|
|
6904
|
+
// containers
|
|
6905
|
+
} else {
|
|
6906
|
+
// check to see if there's at least one tabbable node with a positive tab index inside
|
|
6907
|
+
// the trap because focus seems to escape when navigating backward from a tabbable node
|
|
6908
|
+
// with tabindex=0 when this is the case (instead of wrapping to the tabbable node with
|
|
6909
|
+
// the greatest positive tab index like it should)
|
|
6910
|
+
if (!state.containerGroups.some(function (g) {
|
|
6911
|
+
return g.tabbableNodes.some(function (n) {
|
|
6912
|
+
return getTabIndex(n) > 0;
|
|
6913
|
+
});
|
|
6914
|
+
})) {
|
|
6915
|
+
// no containers with tabbable nodes with positive tab indexes which means the focus
|
|
6916
|
+
// escaped for some other reason and we should just execute the fallback to the
|
|
6917
|
+
// MRU node or initial focus node, if any
|
|
6918
|
+
navAcrossContainers = false;
|
|
6919
|
+
}
|
|
6920
|
+
}
|
|
6921
|
+
} else {
|
|
6922
|
+
// no MRU node means we're likely in some initial condition when the trap has just
|
|
6923
|
+
// been activated and initial focus hasn't been given yet, in which case we should
|
|
6924
|
+
// fall through to trying to focus the initial focus node, which is what should
|
|
6925
|
+
// happen below at this point in the logic
|
|
6926
|
+
navAcrossContainers = false;
|
|
6927
|
+
}
|
|
6928
|
+
if (navAcrossContainers) {
|
|
6929
|
+
nextNode = findNextNavNode({
|
|
6930
|
+
// move FROM the MRU node, not event-related node (which will be the node that is
|
|
6931
|
+
// outside the trap causing the focus escape we're trying to fix)
|
|
6932
|
+
target: state.mostRecentlyFocusedNode,
|
|
6933
|
+
isBackward: config.isKeyBackward(state.recentNavEvent)
|
|
6934
|
+
});
|
|
6935
|
+
}
|
|
6936
|
+
if (nextNode) {
|
|
6937
|
+
tryFocus(nextNode);
|
|
6938
|
+
} else {
|
|
6939
|
+
tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
|
|
6940
|
+
}
|
|
6941
|
+
}
|
|
6942
|
+
state.recentNavEvent = undefined; // clear
|
|
6943
|
+
};
|
|
6944
|
+
|
|
6945
|
+
// Hijack key nav events on the first and last focusable nodes of the trap,
|
|
6946
|
+
// in order to prevent focus from escaping. If it escapes for even a
|
|
6947
|
+
// moment it can end up scrolling the page and causing confusion so we
|
|
6948
|
+
// kind of need to capture the action at the keydown phase.
|
|
6949
|
+
var checkKeyNav = function checkKeyNav(event) {
|
|
6950
|
+
var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6951
|
+
state.recentNavEvent = event;
|
|
6952
|
+
var destinationNode = findNextNavNode({
|
|
6953
|
+
event: event,
|
|
6954
|
+
isBackward: isBackward
|
|
6955
|
+
});
|
|
6694
6956
|
if (destinationNode) {
|
|
6695
6957
|
if (isTabEvent(event)) {
|
|
6696
6958
|
// since tab natively moves focus, we wouldn't have a destination node unless we
|
|
@@ -6961,9 +7223,11 @@ const CatDropdown = class {
|
|
|
6961
7223
|
this.initTrigger();
|
|
6962
7224
|
this.toggle();
|
|
6963
7225
|
}
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
7226
|
+
// hide dropdown on button clicks inside the dropdown content
|
|
7227
|
+
if (!this.noAutoClose &&
|
|
7228
|
+
event.composedPath().includes(this.content) &&
|
|
7229
|
+
event.target instanceof Element &&
|
|
7230
|
+
event.target.slot !== 'trigger') {
|
|
6967
7231
|
this.close();
|
|
6968
7232
|
}
|
|
6969
7233
|
}
|
|
@@ -6998,6 +7262,9 @@ const CatDropdown = class {
|
|
|
6998
7262
|
clickOutsideDeactivates: event => {
|
|
6999
7263
|
const shouldClose = !this.noAutoClose &&
|
|
7000
7264
|
!event.composedPath().includes(this.content) &&
|
|
7265
|
+
!event
|
|
7266
|
+
.composedPath()
|
|
7267
|
+
.find(el => el instanceof HTMLElement && el.hasAttribute('data-dropdown-no-close')) &&
|
|
7001
7268
|
(!this.trigger || !event.composedPath().includes(this.trigger));
|
|
7002
7269
|
if (shouldClose) {
|
|
7003
7270
|
this.close();
|
|
@@ -7013,7 +7280,7 @@ const CatDropdown = class {
|
|
|
7013
7280
|
* Closes the dropdown.
|
|
7014
7281
|
*/
|
|
7015
7282
|
async close() {
|
|
7016
|
-
if (this.isOpen === null
|
|
7283
|
+
if (this.isOpen === null) {
|
|
7017
7284
|
return; // busy
|
|
7018
7285
|
}
|
|
7019
7286
|
this.isOpen = null;
|
|
@@ -7890,14 +8157,25 @@ const CatSelect = class {
|
|
|
7890
8157
|
}
|
|
7891
8158
|
this.hide();
|
|
7892
8159
|
// Conditionally remove selection if the option was not manually selected through click or enter key press
|
|
7893
|
-
if (!this.multiple && (!this.tags || !this.state.selection?.length)
|
|
7894
|
-
this.
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
8160
|
+
if (!this.multiple && (!this.tags || !this.state.selection?.length)) {
|
|
8161
|
+
if (this.state.tempSelection?.length) {
|
|
8162
|
+
this.patchState({
|
|
8163
|
+
activeSelectionIndex: -1,
|
|
8164
|
+
selection: this.state.tempSelection,
|
|
8165
|
+
tempSelection: [],
|
|
8166
|
+
options: [],
|
|
8167
|
+
term: this.state.tempSelection[0].render.label
|
|
8168
|
+
});
|
|
8169
|
+
}
|
|
8170
|
+
else if (!this.state.selection?.length) {
|
|
8171
|
+
this.patchState({
|
|
8172
|
+
activeSelectionIndex: -1,
|
|
8173
|
+
selection: [],
|
|
8174
|
+
tempSelection: [],
|
|
8175
|
+
options: [],
|
|
8176
|
+
term: ''
|
|
8177
|
+
});
|
|
8178
|
+
}
|
|
7901
8179
|
}
|
|
7902
8180
|
else {
|
|
7903
8181
|
this.patchState({ activeSelectionIndex: -1 });
|
|
@@ -8131,7 +8409,7 @@ const CatSelect = class {
|
|
|
8131
8409
|
newSelection = [item];
|
|
8132
8410
|
this.search(item.render.label);
|
|
8133
8411
|
}
|
|
8134
|
-
this.patchState({ selection: newSelection });
|
|
8412
|
+
this.patchState({ selection: newSelection, tempSelection: [] });
|
|
8135
8413
|
if (this.multiple && this.state.term.trim() && this.input) {
|
|
8136
8414
|
this.patchState({ term: '', activeOptionIndex: -1 });
|
|
8137
8415
|
this.term$.next('');
|
|
@@ -8157,7 +8435,7 @@ const CatSelect = class {
|
|
|
8157
8435
|
}
|
|
8158
8436
|
clear() {
|
|
8159
8437
|
if (this.input && this.state.term) {
|
|
8160
|
-
this.patchState({ selection: [],
|
|
8438
|
+
this.patchState({ selection: [], term: '', activeOptionIndex: -1, tempSelection: [] });
|
|
8161
8439
|
this.term$.next('');
|
|
8162
8440
|
this.input.value = '';
|
|
8163
8441
|
}
|
|
@@ -9855,7 +10133,7 @@ const CatTab = class {
|
|
|
9855
10133
|
};
|
|
9856
10134
|
CatTab.style = catTabCss;
|
|
9857
10135
|
|
|
9858
|
-
const catTabsCss = ":host{display:flex;flex-direction:row;box-shadow:inset 0 -1px 0 0 rgb(var(--cat-border-color
|
|
10136
|
+
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}";
|
|
9859
10137
|
|
|
9860
10138
|
const CatTabs = class {
|
|
9861
10139
|
constructor(hostRef) {
|