@haiilo/catalyst 6.3.1 → 6.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +513 -240
- 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 +30 -0
- package/dist/collection/components/cat-datepicker/cat-datepicker.js.map +1 -1
- package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.js +17 -0
- 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 +4 -1
- package/dist/components/cat-datepicker-inline.js.map +1 -1
- package/dist/components/cat-datepicker.js +16 -0
- 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 +513 -240
- 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 +7 -0
- package/dist/types/components/cat-datepicker-inline/cat-datepicker-inline.d.ts +6 -0
- package/dist/types/components.d.ts +16 -0
- package/package.json +11 -11
- package/dist/catalyst/p-dfc7c716.entry.js +0 -10
- package/dist/catalyst/p-dfc7c716.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;
|
|
@@ -4184,6 +4191,9 @@ const CatDatepickerFlat = class {
|
|
|
4184
4191
|
if (this.disabled || this.readonly || !input) {
|
|
4185
4192
|
return;
|
|
4186
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': '' } : {};
|
|
4187
4197
|
return flatpickr(input, getConfig({
|
|
4188
4198
|
locale: getLocale(catI18nRegistry.getLocale()),
|
|
4189
4199
|
format: getFormat(catI18nRegistry.getLocale(), this.mode),
|
|
@@ -4193,9 +4203,20 @@ const CatDatepickerFlat = class {
|
|
|
4193
4203
|
step: this.step,
|
|
4194
4204
|
disabled: this.disabled,
|
|
4195
4205
|
readonly: this.readonly,
|
|
4206
|
+
nativePickerAttributes: { ...nativePickerAttributes, ...this.nativePickerAttributes },
|
|
4196
4207
|
applyChange: value => (this.value = value)
|
|
4197
4208
|
}));
|
|
4198
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
|
+
}
|
|
4199
4220
|
static get watchers() { return {
|
|
4200
4221
|
"value": ["onValueChanged"],
|
|
4201
4222
|
"disabled": ["onDisabledChanged"],
|
|
@@ -4217,6 +4238,7 @@ const CatDatepickerInline = class {
|
|
|
4217
4238
|
this.readonly = false;
|
|
4218
4239
|
this.step = 5;
|
|
4219
4240
|
this.value = undefined;
|
|
4241
|
+
this.nativePickerAttributes = undefined;
|
|
4220
4242
|
}
|
|
4221
4243
|
onValueChanged(value) {
|
|
4222
4244
|
if (value) {
|
|
@@ -4259,6 +4281,7 @@ const CatDatepickerInline = class {
|
|
|
4259
4281
|
step: this.step,
|
|
4260
4282
|
disabled: this.disabled,
|
|
4261
4283
|
readonly: this.readonly,
|
|
4284
|
+
nativePickerAttributes: this.nativePickerAttributes ?? {},
|
|
4262
4285
|
applyChange: value => (this.value = value)
|
|
4263
4286
|
}, {
|
|
4264
4287
|
...(this.disabled ? { enable: [] } : {}),
|
|
@@ -4951,7 +4974,7 @@ const size = function (options) {
|
|
|
4951
4974
|
|
|
4952
4975
|
function getWindow(node) {
|
|
4953
4976
|
var _node$ownerDocument;
|
|
4954
|
-
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;
|
|
4955
4978
|
}
|
|
4956
4979
|
|
|
4957
4980
|
function getComputedStyle$1(element) {
|
|
@@ -4962,22 +4985,24 @@ function isNode(value) {
|
|
|
4962
4985
|
return value instanceof getWindow(value).Node;
|
|
4963
4986
|
}
|
|
4964
4987
|
function getNodeName(node) {
|
|
4965
|
-
|
|
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';
|
|
4966
4995
|
}
|
|
4967
4996
|
|
|
4968
4997
|
function isHTMLElement(value) {
|
|
4969
|
-
return value instanceof getWindow(value).HTMLElement;
|
|
4970
|
-
}
|
|
4971
|
-
function isElement(value) {
|
|
4972
|
-
return value instanceof getWindow(value).Element;
|
|
4998
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
4973
4999
|
}
|
|
4974
5000
|
function isShadowRoot(node) {
|
|
4975
5001
|
// Browsers without `ShadowRoot` support.
|
|
4976
5002
|
if (typeof ShadowRoot === 'undefined') {
|
|
4977
5003
|
return false;
|
|
4978
5004
|
}
|
|
4979
|
-
|
|
4980
|
-
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
5005
|
+
return node instanceof getWindow(node).ShadowRoot || node instanceof ShadowRoot;
|
|
4981
5006
|
}
|
|
4982
5007
|
function isOverflowElement(element) {
|
|
4983
5008
|
const {
|
|
@@ -4996,7 +5021,7 @@ function isContainingBlock(element) {
|
|
|
4996
5021
|
const css = getComputedStyle$1(element);
|
|
4997
5022
|
|
|
4998
5023
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
4999
|
-
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));
|
|
5000
5025
|
}
|
|
5001
5026
|
function isSafari() {
|
|
5002
5027
|
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
@@ -5009,6 +5034,11 @@ function isLastTraversableNode(node) {
|
|
|
5009
5034
|
const min = Math.min;
|
|
5010
5035
|
const max = Math.max;
|
|
5011
5036
|
const round = Math.round;
|
|
5037
|
+
const floor = Math.floor;
|
|
5038
|
+
const createCoords = v => ({
|
|
5039
|
+
x: v,
|
|
5040
|
+
y: v
|
|
5041
|
+
});
|
|
5012
5042
|
|
|
5013
5043
|
function getCssDimensions(element) {
|
|
5014
5044
|
const css = getComputedStyle$1(element);
|
|
@@ -5027,31 +5057,31 @@ function getCssDimensions(element) {
|
|
|
5027
5057
|
return {
|
|
5028
5058
|
width,
|
|
5029
5059
|
height,
|
|
5030
|
-
|
|
5060
|
+
$: shouldFallback
|
|
5031
5061
|
};
|
|
5032
5062
|
}
|
|
5033
5063
|
|
|
5064
|
+
function isElement(value) {
|
|
5065
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
5066
|
+
}
|
|
5067
|
+
|
|
5034
5068
|
function unwrapElement(element) {
|
|
5035
5069
|
return !isElement(element) ? element.contextElement : element;
|
|
5036
5070
|
}
|
|
5037
5071
|
|
|
5038
|
-
const FALLBACK_SCALE = {
|
|
5039
|
-
x: 1,
|
|
5040
|
-
y: 1
|
|
5041
|
-
};
|
|
5042
5072
|
function getScale(element) {
|
|
5043
5073
|
const domElement = unwrapElement(element);
|
|
5044
5074
|
if (!isHTMLElement(domElement)) {
|
|
5045
|
-
return
|
|
5075
|
+
return createCoords(1);
|
|
5046
5076
|
}
|
|
5047
5077
|
const rect = domElement.getBoundingClientRect();
|
|
5048
5078
|
const {
|
|
5049
5079
|
width,
|
|
5050
5080
|
height,
|
|
5051
|
-
|
|
5081
|
+
$
|
|
5052
5082
|
} = getCssDimensions(domElement);
|
|
5053
|
-
let x = (
|
|
5054
|
-
let y = (
|
|
5083
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
5084
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
5055
5085
|
|
|
5056
5086
|
// 0, NaN, or Infinity should always fallback to 1.
|
|
5057
5087
|
|
|
@@ -5067,27 +5097,26 @@ function getScale(element) {
|
|
|
5067
5097
|
};
|
|
5068
5098
|
}
|
|
5069
5099
|
|
|
5070
|
-
const noOffsets =
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
function getVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
5075
|
-
var _win$visualViewport, _win$visualViewport2;
|
|
5076
|
-
if (isFixed === void 0) {
|
|
5077
|
-
isFixed = true;
|
|
5078
|
-
}
|
|
5079
|
-
if (!isSafari()) {
|
|
5080
|
-
return noOffsets;
|
|
5081
|
-
}
|
|
5082
|
-
const win = element ? getWindow(element) : window;
|
|
5083
|
-
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) {
|
|
5084
5104
|
return noOffsets;
|
|
5085
5105
|
}
|
|
5086
5106
|
return {
|
|
5087
|
-
x:
|
|
5088
|
-
y:
|
|
5107
|
+
x: win.visualViewport.offsetLeft,
|
|
5108
|
+
y: win.visualViewport.offsetTop
|
|
5089
5109
|
};
|
|
5090
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
|
+
}
|
|
5091
5120
|
|
|
5092
5121
|
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
5093
5122
|
if (includeScale === void 0) {
|
|
@@ -5098,7 +5127,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
5098
5127
|
}
|
|
5099
5128
|
const clientRect = element.getBoundingClientRect();
|
|
5100
5129
|
const domElement = unwrapElement(element);
|
|
5101
|
-
let scale =
|
|
5130
|
+
let scale = createCoords(1);
|
|
5102
5131
|
if (includeScale) {
|
|
5103
5132
|
if (offsetParent) {
|
|
5104
5133
|
if (isElement(offsetParent)) {
|
|
@@ -5108,7 +5137,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
5108
5137
|
scale = getScale(element);
|
|
5109
5138
|
}
|
|
5110
5139
|
}
|
|
5111
|
-
const visualOffsets =
|
|
5140
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
5112
5141
|
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
5113
5142
|
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
5114
5143
|
let width = clientRect.width / scale.x;
|
|
@@ -5121,14 +5150,14 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
5121
5150
|
const iframeScale = getScale(currentIFrame);
|
|
5122
5151
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
5123
5152
|
const css = getComputedStyle(currentIFrame);
|
|
5124
|
-
iframeRect.
|
|
5125
|
-
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;
|
|
5126
5155
|
x *= iframeScale.x;
|
|
5127
5156
|
y *= iframeScale.y;
|
|
5128
5157
|
width *= iframeScale.x;
|
|
5129
5158
|
height *= iframeScale.y;
|
|
5130
|
-
x +=
|
|
5131
|
-
y +=
|
|
5159
|
+
x += left;
|
|
5160
|
+
y += top;
|
|
5132
5161
|
currentIFrame = getWindow(currentIFrame).frameElement;
|
|
5133
5162
|
}
|
|
5134
5163
|
}
|
|
@@ -5140,10 +5169,6 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
5140
5169
|
});
|
|
5141
5170
|
}
|
|
5142
5171
|
|
|
5143
|
-
function getDocumentElement(node) {
|
|
5144
|
-
return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
|
|
5145
|
-
}
|
|
5146
|
-
|
|
5147
5172
|
function getNodeScroll(element) {
|
|
5148
5173
|
if (isElement(element)) {
|
|
5149
5174
|
return {
|
|
@@ -5157,6 +5182,11 @@ function getNodeScroll(element) {
|
|
|
5157
5182
|
};
|
|
5158
5183
|
}
|
|
5159
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
|
+
|
|
5160
5190
|
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
5161
5191
|
let {
|
|
5162
5192
|
rect,
|
|
@@ -5172,14 +5202,8 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
5172
5202
|
scrollLeft: 0,
|
|
5173
5203
|
scrollTop: 0
|
|
5174
5204
|
};
|
|
5175
|
-
let scale =
|
|
5176
|
-
|
|
5177
|
-
y: 1
|
|
5178
|
-
};
|
|
5179
|
-
const offsets = {
|
|
5180
|
-
x: 0,
|
|
5181
|
-
y: 0
|
|
5182
|
-
};
|
|
5205
|
+
let scale = createCoords(1);
|
|
5206
|
+
const offsets = createCoords(0);
|
|
5183
5207
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
|
|
5184
5208
|
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
5185
5209
|
scroll = getNodeScroll(offsetParent);
|
|
@@ -5199,6 +5223,10 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
5199
5223
|
};
|
|
5200
5224
|
}
|
|
5201
5225
|
|
|
5226
|
+
function getClientRects(element) {
|
|
5227
|
+
return Array.from(element.getClientRects());
|
|
5228
|
+
}
|
|
5229
|
+
|
|
5202
5230
|
function getWindowScrollBarX(element) {
|
|
5203
5231
|
// If <html> has a CSS width greater than the viewport, then this will be
|
|
5204
5232
|
// incorrect for RTL.
|
|
@@ -5245,9 +5273,7 @@ function getParentNode(node) {
|
|
|
5245
5273
|
function getNearestOverflowAncestor(node) {
|
|
5246
5274
|
const parentNode = getParentNode(node);
|
|
5247
5275
|
if (isLastTraversableNode(parentNode)) {
|
|
5248
|
-
|
|
5249
|
-
// check, so it's either the <html> or <body> element.
|
|
5250
|
-
return parentNode.ownerDocument.body;
|
|
5276
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
5251
5277
|
}
|
|
5252
5278
|
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
5253
5279
|
return parentNode;
|
|
@@ -5299,10 +5325,7 @@ function getInnerBoundingClientRect(element, strategy) {
|
|
|
5299
5325
|
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
5300
5326
|
const top = clientRect.top + element.clientTop;
|
|
5301
5327
|
const left = clientRect.left + element.clientLeft;
|
|
5302
|
-
const scale = isHTMLElement(element) ? getScale(element) :
|
|
5303
|
-
x: 1,
|
|
5304
|
-
y: 1
|
|
5305
|
-
};
|
|
5328
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
5306
5329
|
const width = element.clientWidth * scale.x;
|
|
5307
5330
|
const height = element.clientHeight * scale.y;
|
|
5308
5331
|
const x = left * scale.x;
|
|
@@ -5406,6 +5429,36 @@ function getDimensions(element) {
|
|
|
5406
5429
|
return getCssDimensions(element);
|
|
5407
5430
|
}
|
|
5408
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
|
+
|
|
5409
5462
|
function getTrueOffsetParent(element, polyfill) {
|
|
5410
5463
|
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
5411
5464
|
return null;
|
|
@@ -5444,68 +5497,115 @@ function getOffsetParent(element, polyfill) {
|
|
|
5444
5497
|
return offsetParent || getContainingBlock(element) || window;
|
|
5445
5498
|
}
|
|
5446
5499
|
|
|
5447
|
-
function
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
};
|
|
5456
|
-
const offsets = {
|
|
5457
|
-
x: 0,
|
|
5458
|
-
y: 0
|
|
5459
|
-
};
|
|
5460
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
5461
|
-
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
5462
|
-
scroll = getNodeScroll(offsetParent);
|
|
5463
|
-
}
|
|
5464
|
-
if (isHTMLElement(offsetParent)) {
|
|
5465
|
-
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
5466
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
5467
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
5468
|
-
} else if (documentElement) {
|
|
5469
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
5470
|
-
}
|
|
5471
|
-
}
|
|
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;
|
|
5472
5508
|
return {
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5509
|
+
reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
|
|
5510
|
+
floating: {
|
|
5511
|
+
x: 0,
|
|
5512
|
+
y: 0,
|
|
5513
|
+
...(await getDimensionsFn(floating))
|
|
5514
|
+
}
|
|
5477
5515
|
};
|
|
5516
|
+
};
|
|
5517
|
+
|
|
5518
|
+
function isRTL(element) {
|
|
5519
|
+
return getComputedStyle(element).direction === 'rtl';
|
|
5478
5520
|
}
|
|
5479
5521
|
|
|
5480
5522
|
const platform = {
|
|
5481
|
-
getClippingRect,
|
|
5482
5523
|
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
5483
|
-
isElement,
|
|
5484
|
-
getDimensions,
|
|
5485
|
-
getOffsetParent,
|
|
5486
5524
|
getDocumentElement,
|
|
5525
|
+
getClippingRect,
|
|
5526
|
+
getOffsetParent,
|
|
5527
|
+
getElementRects,
|
|
5528
|
+
getClientRects,
|
|
5529
|
+
getDimensions,
|
|
5487
5530
|
getScale,
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
reference,
|
|
5491
|
-
floating,
|
|
5492
|
-
strategy
|
|
5493
|
-
} = _ref;
|
|
5494
|
-
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
5495
|
-
const getDimensionsFn = this.getDimensions;
|
|
5496
|
-
return {
|
|
5497
|
-
reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
|
|
5498
|
-
floating: {
|
|
5499
|
-
x: 0,
|
|
5500
|
-
y: 0,
|
|
5501
|
-
...(await getDimensionsFn(floating))
|
|
5502
|
-
}
|
|
5503
|
-
};
|
|
5504
|
-
},
|
|
5505
|
-
getClientRects: element => Array.from(element.getClientRects()),
|
|
5506
|
-
isRTL: element => getComputedStyle$1(element).direction === 'rtl'
|
|
5531
|
+
isElement,
|
|
5532
|
+
isRTL
|
|
5507
5533
|
};
|
|
5508
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
|
+
|
|
5509
5609
|
/**
|
|
5510
5610
|
* Automatically updates the position of the floating element when necessary.
|
|
5511
5611
|
* Should only be called when the floating element is mounted on the DOM or
|
|
@@ -5521,30 +5621,39 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
5521
5621
|
const {
|
|
5522
5622
|
ancestorScroll = true,
|
|
5523
5623
|
ancestorResize = true,
|
|
5524
|
-
elementResize =
|
|
5624
|
+
elementResize = typeof ResizeObserver === 'function',
|
|
5625
|
+
layoutShift = typeof IntersectionObserver === 'function',
|
|
5525
5626
|
animationFrame = false
|
|
5526
5627
|
} = options;
|
|
5527
|
-
const
|
|
5628
|
+
const referenceEl = unwrapElement(reference);
|
|
5629
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
|
|
5528
5630
|
ancestors.forEach(ancestor => {
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
ancestor.addEventListener('scroll', update, {
|
|
5533
|
-
passive: true
|
|
5534
|
-
});
|
|
5535
|
-
}
|
|
5631
|
+
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
5632
|
+
passive: true
|
|
5633
|
+
});
|
|
5536
5634
|
ancestorResize && ancestor.addEventListener('resize', update);
|
|
5537
5635
|
});
|
|
5538
|
-
|
|
5636
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
5637
|
+
let reobserveFrame = -1;
|
|
5638
|
+
let resizeObserver = null;
|
|
5539
5639
|
if (elementResize) {
|
|
5540
|
-
|
|
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
|
+
}
|
|
5541
5651
|
update();
|
|
5542
5652
|
});
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
observer.observe(reference.contextElement);
|
|
5653
|
+
if (referenceEl && !animationFrame) {
|
|
5654
|
+
resizeObserver.observe(referenceEl);
|
|
5546
5655
|
}
|
|
5547
|
-
|
|
5656
|
+
resizeObserver.observe(floating);
|
|
5548
5657
|
}
|
|
5549
5658
|
let frameId;
|
|
5550
5659
|
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
@@ -5561,13 +5670,13 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
5561
5670
|
}
|
|
5562
5671
|
update();
|
|
5563
5672
|
return () => {
|
|
5564
|
-
var _observer;
|
|
5565
5673
|
ancestors.forEach(ancestor => {
|
|
5566
5674
|
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
5567
5675
|
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
5568
5676
|
});
|
|
5569
|
-
|
|
5570
|
-
|
|
5677
|
+
cleanupIo && cleanupIo();
|
|
5678
|
+
resizeObserver && resizeObserver.disconnect();
|
|
5679
|
+
resizeObserver = null;
|
|
5571
5680
|
if (animationFrame) {
|
|
5572
5681
|
cancelAnimationFrame(frameId);
|
|
5573
5682
|
}
|
|
@@ -6173,7 +6282,7 @@ var isFocusable = function isFocusable(node, options) {
|
|
|
6173
6282
|
};
|
|
6174
6283
|
|
|
6175
6284
|
/*!
|
|
6176
|
-
* focus-trap 7.
|
|
6285
|
+
* focus-trap 7.5.2
|
|
6177
6286
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
6178
6287
|
*/
|
|
6179
6288
|
|
|
@@ -6258,10 +6367,10 @@ var isSelectableInput = function isSelectableInput(node) {
|
|
|
6258
6367
|
return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
|
|
6259
6368
|
};
|
|
6260
6369
|
var isEscapeEvent = function isEscapeEvent(e) {
|
|
6261
|
-
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;
|
|
6262
6371
|
};
|
|
6263
6372
|
var isTabEvent = function isTabEvent(e) {
|
|
6264
|
-
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;
|
|
6265
6374
|
};
|
|
6266
6375
|
|
|
6267
6376
|
// checks for TAB by default
|
|
@@ -6345,8 +6454,11 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6345
6454
|
// container: HTMLElement,
|
|
6346
6455
|
// tabbableNodes: Array<HTMLElement>, // empty if none
|
|
6347
6456
|
// focusableNodes: Array<HTMLElement>, // empty if none
|
|
6348
|
-
//
|
|
6349
|
-
//
|
|
6457
|
+
// posTabIndexesFound: boolean,
|
|
6458
|
+
// firstTabbableNode: HTMLElement|undefined,
|
|
6459
|
+
// lastTabbableNode: HTMLElement|undefined,
|
|
6460
|
+
// firstDomTabbableNode: HTMLElement|undefined,
|
|
6461
|
+
// lastDomTabbableNode: HTMLElement|undefined,
|
|
6350
6462
|
// nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
|
|
6351
6463
|
// }>}
|
|
6352
6464
|
containerGroups: [],
|
|
@@ -6363,7 +6475,9 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6363
6475
|
paused: false,
|
|
6364
6476
|
// timer ID for when delayInitialFocus is true and initial focus in this trap
|
|
6365
6477
|
// has been delayed during activation
|
|
6366
|
-
delayInitialFocusTimer: undefined
|
|
6478
|
+
delayInitialFocusTimer: undefined,
|
|
6479
|
+
// the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
|
|
6480
|
+
recentNavEvent: undefined
|
|
6367
6481
|
};
|
|
6368
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
|
|
6369
6483
|
|
|
@@ -6382,7 +6496,9 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6382
6496
|
/**
|
|
6383
6497
|
* Finds the index of the container that contains the element.
|
|
6384
6498
|
* @param {HTMLElement} element
|
|
6385
|
-
* @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.
|
|
6386
6502
|
* @returns {number} Index of the container in either `state.containers` or
|
|
6387
6503
|
* `state.containerGroups` (the order/length of these lists are the same); -1
|
|
6388
6504
|
* if the element isn't found.
|
|
@@ -6477,14 +6593,41 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6477
6593
|
var tabbableNodes = tabbable(container, config.tabbableOptions);
|
|
6478
6594
|
|
|
6479
6595
|
// NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
|
|
6480
|
-
// 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
|
|
6481
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
|
+
});
|
|
6482
6610
|
return {
|
|
6483
6611
|
container: container,
|
|
6484
6612
|
tabbableNodes: tabbableNodes,
|
|
6485
6613
|
focusableNodes: focusableNodes,
|
|
6486
|
-
|
|
6487
|
-
|
|
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,
|
|
6488
6631
|
/**
|
|
6489
6632
|
* Finds the __tabbable__ node that follows the given node in the specified direction,
|
|
6490
6633
|
* in this container, if any.
|
|
@@ -6495,30 +6638,24 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6495
6638
|
*/
|
|
6496
6639
|
nextTabbableNode: function nextTabbableNode(node) {
|
|
6497
6640
|
var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
6498
|
-
|
|
6499
|
-
// from the DOM order), this __will not work__ because the list of focusableNodes,
|
|
6500
|
-
// while it contains tabbable nodes, does not sort its nodes in any order other
|
|
6501
|
-
// than DOM order, because it can't: Where would you place focusable (but not
|
|
6502
|
-
// tabbable) nodes in that order? They have no order, because they aren't tabbale...
|
|
6503
|
-
// Support for positive tabindex is already broken and hard to manage (possibly
|
|
6504
|
-
// not supportable, TBD), so this isn't going to make things worse than they
|
|
6505
|
-
// already are, and at least makes things better for the majority of cases where
|
|
6506
|
-
// tabindex is either 0/unset or negative.
|
|
6507
|
-
// FYI, positive tabindex issue: https://github.com/focus-trap/focus-trap/issues/375
|
|
6508
|
-
var nodeIdx = focusableNodes.findIndex(function (n) {
|
|
6509
|
-
return n === node;
|
|
6510
|
-
});
|
|
6641
|
+
var nodeIdx = tabbableNodes.indexOf(node);
|
|
6511
6642
|
if (nodeIdx < 0) {
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
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);
|
|
6517
6656
|
});
|
|
6518
6657
|
}
|
|
6519
|
-
return
|
|
6520
|
-
return isTabbable(n, config.tabbableOptions);
|
|
6521
|
-
});
|
|
6658
|
+
return tabbableNodes[nodeIdx + (forward ? 1 : -1)];
|
|
6522
6659
|
}
|
|
6523
6660
|
};
|
|
6524
6661
|
});
|
|
@@ -6531,6 +6668,19 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6531
6668
|
) {
|
|
6532
6669
|
throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
|
|
6533
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
|
+
}
|
|
6534
6684
|
};
|
|
6535
6685
|
var tryFocus = function tryFocus(node) {
|
|
6536
6686
|
if (node === false) {
|
|
@@ -6546,6 +6696,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6546
6696
|
node.focus({
|
|
6547
6697
|
preventScroll: !!config.preventScroll
|
|
6548
6698
|
});
|
|
6699
|
+
// NOTE: focus() API does not trigger focusIn event so set MRU node manually
|
|
6549
6700
|
state.mostRecentlyFocusedNode = node;
|
|
6550
6701
|
if (isSelectableInput(node)) {
|
|
6551
6702
|
node.select();
|
|
@@ -6556,64 +6707,23 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6556
6707
|
return node ? node : node === false ? false : previousActiveElement;
|
|
6557
6708
|
};
|
|
6558
6709
|
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
returnFocus: config.returnFocusOnDeactivate
|
|
6577
|
-
});
|
|
6578
|
-
return;
|
|
6579
|
-
}
|
|
6580
|
-
|
|
6581
|
-
// This is needed for mobile devices.
|
|
6582
|
-
// (If we'll only let `click` events through,
|
|
6583
|
-
// then on mobile they will be blocked anyways if `touchstart` is blocked.)
|
|
6584
|
-
if (valueOrHandler(config.allowOutsideClick, e)) {
|
|
6585
|
-
// allow the click outside the trap to take place
|
|
6586
|
-
return;
|
|
6587
|
-
}
|
|
6588
|
-
|
|
6589
|
-
// otherwise, prevent the click
|
|
6590
|
-
e.preventDefault();
|
|
6591
|
-
};
|
|
6592
|
-
|
|
6593
|
-
// In case focus escapes the trap for some strange reason, pull it back in.
|
|
6594
|
-
var checkFocusIn = function checkFocusIn(e) {
|
|
6595
|
-
var target = getActualTarget(e);
|
|
6596
|
-
var targetContained = findContainerIndex(target, e) >= 0;
|
|
6597
|
-
|
|
6598
|
-
// In Firefox when you Tab out of an iframe the Document is briefly focused.
|
|
6599
|
-
if (targetContained || target instanceof Document) {
|
|
6600
|
-
if (targetContained) {
|
|
6601
|
-
state.mostRecentlyFocusedNode = target;
|
|
6602
|
-
}
|
|
6603
|
-
} else {
|
|
6604
|
-
// escaped! pull it back in to where it just left
|
|
6605
|
-
e.stopImmediatePropagation();
|
|
6606
|
-
tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
|
|
6607
|
-
}
|
|
6608
|
-
};
|
|
6609
|
-
|
|
6610
|
-
// Hijack key nav events on the first and last focusable nodes of the trap,
|
|
6611
|
-
// in order to prevent focus from escaping. If it escapes for even a
|
|
6612
|
-
// moment it can end up scrolling the page and causing confusion so we
|
|
6613
|
-
// kind of need to capture the action at the keydown phase.
|
|
6614
|
-
var checkKeyNav = function checkKeyNav(event) {
|
|
6615
|
-
var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6616
|
-
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);
|
|
6617
6727
|
updateTabbableNodes();
|
|
6618
6728
|
var destinationNode = null;
|
|
6619
6729
|
if (state.tabbableGroups.length > 0) {
|
|
@@ -6636,8 +6746,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6636
6746
|
// REVERSE
|
|
6637
6747
|
|
|
6638
6748
|
// is the target the first tabbable node in a group?
|
|
6639
|
-
var startOfGroupIndex = findIndex(state.tabbableGroups, function (
|
|
6640
|
-
var firstTabbableNode =
|
|
6749
|
+
var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
|
|
6750
|
+
var firstTabbableNode = _ref3.firstTabbableNode;
|
|
6641
6751
|
return target === firstTabbableNode;
|
|
6642
6752
|
});
|
|
6643
6753
|
if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
|
|
@@ -6655,7 +6765,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6655
6765
|
// the LAST group if it's the first tabbable node of the FIRST group)
|
|
6656
6766
|
var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
|
|
6657
6767
|
var destinationGroup = state.tabbableGroups[destinationGroupIndex];
|
|
6658
|
-
destinationNode = destinationGroup.lastTabbableNode;
|
|
6768
|
+
destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode;
|
|
6659
6769
|
} else if (!isTabEvent(event)) {
|
|
6660
6770
|
// user must have customized the nav keys so we have to move focus manually _within_
|
|
6661
6771
|
// the active group: do this based on the order determined by tabbable()
|
|
@@ -6665,8 +6775,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6665
6775
|
// FORWARD
|
|
6666
6776
|
|
|
6667
6777
|
// is the target the last tabbable node in a group?
|
|
6668
|
-
var lastOfGroupIndex = findIndex(state.tabbableGroups, function (
|
|
6669
|
-
var lastTabbableNode =
|
|
6778
|
+
var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref4) {
|
|
6779
|
+
var lastTabbableNode = _ref4.lastTabbableNode;
|
|
6670
6780
|
return target === lastTabbableNode;
|
|
6671
6781
|
});
|
|
6672
6782
|
if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
|
|
@@ -6684,7 +6794,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6684
6794
|
// group if it's the last tabbable node of the LAST group)
|
|
6685
6795
|
var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
|
|
6686
6796
|
var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
|
|
6687
|
-
destinationNode = _destinationGroup.firstTabbableNode;
|
|
6797
|
+
destinationNode = getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode;
|
|
6688
6798
|
} else if (!isTabEvent(event)) {
|
|
6689
6799
|
// user must have customized the nav keys so we have to move focus manually _within_
|
|
6690
6800
|
// the active group: do this based on the order determined by tabbable()
|
|
@@ -6696,6 +6806,153 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
6696
6806
|
// NOTE: the fallbackFocus option does not support returning false to opt-out
|
|
6697
6807
|
destinationNode = getNodeForOption('fallbackFocus');
|
|
6698
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
|
+
});
|
|
6699
6956
|
if (destinationNode) {
|
|
6700
6957
|
if (isTabEvent(event)) {
|
|
6701
6958
|
// since tab natively moves focus, we wouldn't have a destination node unless we
|
|
@@ -6966,9 +7223,11 @@ const CatDropdown = class {
|
|
|
6966
7223
|
this.initTrigger();
|
|
6967
7224
|
this.toggle();
|
|
6968
7225
|
}
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
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') {
|
|
6972
7231
|
this.close();
|
|
6973
7232
|
}
|
|
6974
7233
|
}
|
|
@@ -7003,6 +7262,9 @@ const CatDropdown = class {
|
|
|
7003
7262
|
clickOutsideDeactivates: event => {
|
|
7004
7263
|
const shouldClose = !this.noAutoClose &&
|
|
7005
7264
|
!event.composedPath().includes(this.content) &&
|
|
7265
|
+
!event
|
|
7266
|
+
.composedPath()
|
|
7267
|
+
.find(el => el instanceof HTMLElement && el.hasAttribute('data-dropdown-no-close')) &&
|
|
7006
7268
|
(!this.trigger || !event.composedPath().includes(this.trigger));
|
|
7007
7269
|
if (shouldClose) {
|
|
7008
7270
|
this.close();
|
|
@@ -7018,7 +7280,7 @@ const CatDropdown = class {
|
|
|
7018
7280
|
* Closes the dropdown.
|
|
7019
7281
|
*/
|
|
7020
7282
|
async close() {
|
|
7021
|
-
if (this.isOpen === null
|
|
7283
|
+
if (this.isOpen === null) {
|
|
7022
7284
|
return; // busy
|
|
7023
7285
|
}
|
|
7024
7286
|
this.isOpen = null;
|
|
@@ -7895,14 +8157,25 @@ const CatSelect = class {
|
|
|
7895
8157
|
}
|
|
7896
8158
|
this.hide();
|
|
7897
8159
|
// Conditionally remove selection if the option was not manually selected through click or enter key press
|
|
7898
|
-
if (!this.multiple && (!this.tags || !this.state.selection?.length)
|
|
7899
|
-
this.
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
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
|
+
}
|
|
7906
8179
|
}
|
|
7907
8180
|
else {
|
|
7908
8181
|
this.patchState({ activeSelectionIndex: -1 });
|
|
@@ -8136,7 +8409,7 @@ const CatSelect = class {
|
|
|
8136
8409
|
newSelection = [item];
|
|
8137
8410
|
this.search(item.render.label);
|
|
8138
8411
|
}
|
|
8139
|
-
this.patchState({ selection: newSelection });
|
|
8412
|
+
this.patchState({ selection: newSelection, tempSelection: [] });
|
|
8140
8413
|
if (this.multiple && this.state.term.trim() && this.input) {
|
|
8141
8414
|
this.patchState({ term: '', activeOptionIndex: -1 });
|
|
8142
8415
|
this.term$.next('');
|
|
@@ -8162,7 +8435,7 @@ const CatSelect = class {
|
|
|
8162
8435
|
}
|
|
8163
8436
|
clear() {
|
|
8164
8437
|
if (this.input && this.state.term) {
|
|
8165
|
-
this.patchState({ selection: [],
|
|
8438
|
+
this.patchState({ selection: [], term: '', activeOptionIndex: -1, tempSelection: [] });
|
|
8166
8439
|
this.term$.next('');
|
|
8167
8440
|
this.input.value = '';
|
|
8168
8441
|
}
|
|
@@ -9860,7 +10133,7 @@ const CatTab = class {
|
|
|
9860
10133
|
};
|
|
9861
10134
|
CatTab.style = catTabCss;
|
|
9862
10135
|
|
|
9863
|
-
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}";
|
|
9864
10137
|
|
|
9865
10138
|
const CatTabs = class {
|
|
9866
10139
|
constructor(hostRef) {
|