@prolibu-suite/cobalt-core 0.11.7 → 0.11.9
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/custom-elements.json +31 -31
- package/dist/cjs/co-calendar_3.cjs.entry.js +2 -1
- package/dist/cjs/co-kbd_2.cjs.entry.js +5 -4
- package/dist/cjs/co-lightbox.cjs.entry.js +7 -6
- package/dist/cjs/co-overlay.cjs.entry.js +4 -3
- package/dist/cjs/co-popover.cjs.entry.js +5 -4
- package/dist/cjs/co-sidebar-nav.cjs.entry.js +29 -8
- package/dist/cjs/index-bHoidDwv.js +4 -4
- package/dist/cjs/popoverApi-D1ChCCdO.js +27 -0
- package/dist/cobalt/cobalt.esm.js +1 -1
- package/dist/cobalt/p-2832ab99.entry.js +1 -0
- package/dist/cobalt/p-299c2425.entry.js +1 -0
- package/dist/cobalt/p-438cc876.entry.js +1 -0
- package/dist/cobalt/p-Dp1JT0dm.js +1 -0
- package/dist/cobalt/p-b723aa47.entry.js +1 -0
- package/dist/cobalt/p-eab59be5.entry.js +1 -0
- package/dist/cobalt/p-f562bd96.entry.js +1 -0
- package/dist/collection/components/co-autocomplete/co-autocomplete.js +1 -1
- package/dist/collection/components/co-avatar-group/co-avatar-group.js +1 -1
- package/dist/collection/components/co-checkbox-group/co-checkbox-group.js +1 -1
- package/dist/collection/components/co-color-area/co-color-area.js +2 -2
- package/dist/collection/components/co-color-slider/co-color-slider.js +1 -1
- package/dist/collection/components/co-combobox/co-combobox.js +1 -1
- package/dist/collection/components/co-command-search/co-command-search.js +1 -1
- package/dist/collection/components/co-data-table/co-data-table.js +1 -1
- package/dist/collection/components/co-date-range-picker/co-date-range-picker.js +2 -2
- package/dist/collection/components/co-document-editor/co-document-editor.js +5 -5
- package/dist/collection/components/co-drawer/co-drawer.js +2 -1
- package/dist/collection/components/co-lightbox/co-lightbox.js +7 -6
- package/dist/collection/components/co-overlay/co-overlay.js +4 -3
- package/dist/collection/components/co-popover/co-popover.js +6 -5
- package/dist/collection/components/co-radio-group/co-radio-group.js +1 -1
- package/dist/collection/components/co-ref-field/co-ref-field.js +4 -4
- package/dist/collection/components/co-segmented-bar/co-segmented-bar.js +1 -1
- package/dist/collection/components/co-select/co-select.js +1 -1
- package/dist/collection/components/co-sidebar-nav/co-sidebar-nav.js +6 -190
- package/dist/collection/components/co-sidebar-nav/sidebar-icon-map.js +205 -0
- package/dist/collection/components/co-toast/co-toast.js +2 -2
- package/dist/collection/components/co-tooltip/co-tooltip.js +5 -4
- package/dist/collection/components/co-transfer-list/co-transfer-list.js +1 -1
- package/dist/collection/components/co-tree-item/co-tree-item.js +2 -2
- package/dist/collection/utils/popoverApi.js +23 -0
- package/dist/components/co-autocomplete.js +1 -1
- package/dist/components/co-avatar-group.js +1 -1
- package/dist/components/co-avatar.js +1 -1
- package/dist/components/co-color-picker.js +1 -1
- package/dist/components/co-combobox.js +1 -1
- package/dist/components/co-command-search.js +1 -1
- package/dist/components/co-data-table.js +1 -1
- package/dist/components/co-date-picker.js +1 -1
- package/dist/components/co-date-range-picker.js +1 -1
- package/dist/components/co-date-range.js +1 -1
- package/dist/components/co-date-time-picker.js +1 -1
- package/dist/components/co-document-editor.js +1 -1
- package/dist/components/co-drawer.js +1 -1
- package/dist/components/co-file-field.js +1 -1
- package/dist/components/co-lightbox.js +1 -1
- package/dist/components/co-list-item.js +1 -1
- package/dist/components/co-menu-item.js +1 -1
- package/dist/components/co-menu.js +1 -1
- package/dist/components/co-modal.js +1 -1
- package/dist/components/co-option-list.js +1 -1
- package/dist/components/co-overlay.js +1 -1
- package/dist/components/co-popover.js +1 -1
- package/dist/components/co-ref-field.js +1 -1
- package/dist/components/co-select.js +1 -1
- package/dist/components/co-sidebar-nav.js +1 -1
- package/dist/components/co-tooltip.js +1 -1
- package/dist/components/{p-_S5htX1i.js → p-BGNXvnDr.js} +1 -1
- package/dist/components/p-BMyWdiVO.js +1 -0
- package/dist/components/{p-CaFwCFgg.js → p-BRIf9NGv.js} +1 -1
- package/dist/components/p-Bd6H9_5D.js +1 -0
- package/dist/components/{p-upZqhFKo.js → p-BkyYV32T.js} +1 -1
- package/dist/components/p-DHIa14ep.js +1 -0
- package/dist/components/p-DRL-a5hO.js +1 -0
- package/dist/components/p-Dp1JT0dm.js +1 -0
- package/dist/components/p-xA7AfoIW.js +1 -0
- package/dist/esm/co-calendar_3.entry.js +2 -1
- package/dist/esm/co-kbd_2.entry.js +5 -4
- package/dist/esm/co-lightbox.entry.js +7 -6
- package/dist/esm/co-overlay.entry.js +4 -3
- package/dist/esm/co-popover.entry.js +5 -4
- package/dist/esm/co-sidebar-nav.entry.js +29 -8
- package/dist/esm/index-DJkaRtbb.js +4 -4
- package/dist/esm/popoverApi-Dp1JT0dm.js +25 -0
- package/dist/types/components/co-sidebar-nav/sidebar-icon-map.d.ts +6 -0
- package/dist/types/utils/popoverApi.d.ts +12 -0
- package/package.json +2 -2
- package/dist/cobalt/p-60ea3d33.entry.js +0 -1
- package/dist/cobalt/p-84256bde.entry.js +0 -1
- package/dist/cobalt/p-8c22bf4b.entry.js +0 -1
- package/dist/cobalt/p-99781b0b.entry.js +0 -1
- package/dist/cobalt/p-b2c49664.entry.js +0 -1
- package/dist/cobalt/p-cf675968.entry.js +0 -1
- package/dist/components/p-B5F93Ujt.js +0 -1
- package/dist/components/p-CMMv2RcH.js +0 -1
- package/dist/components/p-CX0bNXK3.js +0 -1
- package/dist/components/p-Co0eKIiO.js +0 -1
- package/dist/components/p-xtGT3YeI.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as o,a as i}from"./p-DJkaRtbb.js";import{c as s,g as e,f as a}from"./p-BtliEQAT.js";const r={es:{ctrl:"Ctrl",shift:"Shift",alt:"Alt",win:"Win"},en:{ctrl:"Ctrl",shift:"Shift",alt:"Alt",win:"Win"},pt:{ctrl:"Ctrl",shift:"Shift",alt:"Alt",win:"Win"}},n={mod:"command",cmd:"command",shift:"arrow-fat-up",alt:"option",ctrl:"control"};function c(t){return"mod"===t||"cmd"===t||"shift"===t||"alt"===t||"ctrl"===t}function l(t,o,i){if("mac"===o)switch(t){case"mod":case"cmd":return"Cmd";case"shift":return"Shift";case"alt":return"Option";case"ctrl":return"Control"}switch(t){case"mod":case"ctrl":return i.ctrl;case"cmd":return i.win;case"shift":return i.shift;case"alt":return i.alt}}const h=class{constructor(o){t(this,o),this.keys="",this.platform="auto",this.surface="light",this.size="sm",this.chord=!1}resolvePlatform(){return"mac"===this.platform?"mac":"win"===this.platform?"win":function(){if("undefined"==typeof navigator)return!1;const t=navigator.platform||"",o=navigator.userAgent||"";return/Mac/i.test(t)||/Mac/i.test(o)}()?"mac":"win"}render(){const t=this.keys.split("+").map((t=>t.trim().toLowerCase())).filter(Boolean),i=this.resolvePlatform(),s=r[function(t){const o=(t||"").toLowerCase();return o.startsWith("es")?"es":o.startsWith("pt")?"pt":"en"}(this.locale)],e="sm"===this.size?12:10,a=t.map((t=>c(t)?l(t,i,s):t.toUpperCase())).join(" + "),h=t=>c(t)&&"mac"===i,p=(t,e)=>h(t)?o("co-icon",{name:n[t],size:e}):c(t)?l(t,i,s):t.toUpperCase(),d=[];return this.chord?d.push(o("kbd",{class:"co-kbd__key co-kbd__key--chord",part:"key",key:"chord"},t.map(((t,i)=>o("span",{class:{"co-kbd__cell":!0,"co-kbd__cell--icon":h(t),"co-kbd__cell--text":!h(t)},part:"cell",key:`cell-${i}`},p(t,12)))))):t.forEach(((t,i)=>{i>0&&d.push(o("span",{class:"co-kbd__sep",part:"sep",key:`sep-${i}`},"+")),d.push(o("kbd",{class:"co-kbd__key",part:"key",key:`key-${i}`},p(t,e)))})),o("span",{key:"539eee42201f514049f1a879f1cab901af375b79",class:{"co-kbd":!0,[`co-kbd--${this.size}`]:!0,[`co-kbd--${this.surface}`]:!0,"co-kbd--chord":this.chord},role:"group","aria-label":a,part:"group"},d)}};h.style=":host{display:inline-flex}.co-kbd{display:inline-flex;align-items:center;gap:var(--co-spacing-xxs, 2px)}.co-kbd__sep{font-family:var(--co-font-family-primary, 'Geist', sans-serif);font-size:var(--co-font-size-10, 10px);line-height:1;opacity:0.6}.co-kbd__key{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;font-family:var(--co-font-family-primary, 'Geist', sans-serif);font-style:normal;font-weight:var(--co-font-weight-medium, 500);font-size:var(--co-font-size-10, 10px);line-height:1;text-transform:uppercase;border-radius:var(--co-border-radius-xxs, 4px)}.co-kbd--sm .co-kbd__key{min-width:30px;height:18px;padding:0 3px}.co-kbd--xs .co-kbd__key{width:16px;height:16px;padding:0}.co-kbd__cell{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:12px;height:12px;flex-shrink:0;white-space:nowrap}.co-kbd__cell--icon{width:12px}.co-kbd__cell--text{width:auto;padding:0 1px}.co-kbd--xs .co-kbd__key--chord{width:auto;min-width:16px;height:16px;padding:0 2px}.co-kbd--light .co-kbd__key{background:var(--co-semantic-surface-control, #f6f6f6);color:var(--co-semantic-text-default, #1f1c1b)}.co-kbd--light .co-kbd__sep{color:var(--co-semantic-text-default, #1f1c1b)}.co-kbd--dark .co-kbd__key{background:var(--co-color-opacity-blanco-16, rgba(255, 255, 255, 0.16));color:var(--co-color-base-blanco, #fff)}.co-kbd--dark .co-kbd__sep{color:var(--co-color-base-blanco, #fff)}";const p=class{constructor(o){t(this,o),this.content="",this.placement="top",this.offset=8,this.showDelay=80,this.hideDelay=100,this.disabled=!1,this.arrow=!0,this.flip=!0,this.maxWidth="280px",this.block=!1,this.variant="default",this.tone="default",this.visible=!1,this.actualPlacement="top",this.closing=!1,this.suppressed=!1,this.scrollParents=[],this.cachedOffsetAncestor=null,this.offsetAncestorComputed=!1,this.scheduleShow=()=>{this.disabled||!this.content||this.suppressed||(this.clearHideTimeout(),this.visible||(this.showTimeout=setTimeout((()=>{this.visible=!0}),this.showDelay)))},this.scheduleHide=()=>{this.clearShowTimeout(),this.visible&&(this.hideTimeout=setTimeout((()=>{this.visible=!1}),this.hideDelay))},this.hideImmediate=()=>{this.clearTimers(),this.visible=!1},this.finishClose=()=>{clearTimeout(this.closeFallbackTimer),this.visible||(this.closing=!1,this.panelEl=void 0)},this.handlePanelTransitionEnd=t=>{!this.visible&&this.closing&&t.target===this.panelEl&&"opacity"===t.propertyName&&this.finishClose()},this.handleMouseEnter=()=>{this.scheduleShow()},this.handleMouseLeave=()=>{this.suppressed=!1,this.scheduleHide()},this.handlePointerDown=()=>{this.suppressed=!0,this.hideImmediate()},this.handleFocusIn=()=>{this.scheduleShow()},this.handleFocusOut=()=>{this.suppressed=!1,this.scheduleHide()},this.handleKeyDown=t=>{"Escape"===t.key&&this.visible&&this.hideImmediate()},this.updatePosition=()=>{if(!this.visible||!this.triggerEl||!this.panelEl)return;const t=this.triggerEl.getBoundingClientRect(),o=this.panelEl.getBoundingClientRect();if(0===o.width&&0===o.height)return;const{top:i,left:a,actualPlacement:r}=s(t,o,{placement:this.placement,offset:this.offset,flip:this.flip});this.actualPlacement=r;let n=i,c=a;if(!this.panelEl.matches(":popover-open")&&(this.offsetAncestorComputed||(this.cachedOffsetAncestor=e(this.panelEl),(this.cachedOffsetAncestor||this.panelEl.isConnected)&&(this.offsetAncestorComputed=!0)),this.cachedOffsetAncestor)){const t=this.cachedOffsetAncestor.getBoundingClientRect();n-=t.top,c-=t.left}this.panelEl&&(this.panelEl.style.top=`${n}px`,this.panelEl.style.left=`${c}px`,this.panelEl.classList.add("co-tooltip__panel--positioned"))},this.scheduleUpdate=()=>{this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(this.updatePosition)}}disconnectedCallback(){this.clearTimers(),this.cleanupListeners(),clearTimeout(this.closeFallbackTimer),this.closing=!1}onVisibleChange(t){t?(this.closing=!1,clearTimeout(this.closeFallbackTimer),this.scheduleUpdate(),requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.updatePosition()}))})),this.addScrollListeners()):(this.cleanupListeners(),this.cachedOffsetAncestor=null,this.offsetAncestorComputed=!1,this.closing=!0,clearTimeout(this.closeFallbackTimer),this.closeFallbackTimer=setTimeout((()=>this.finishClose()),250))}onDisabledChange(t){t&&this.visible&&(this.visible=!1,this.clearTimers())}clearShowTimeout(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=void 0)}clearHideTimeout(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=void 0)}clearTimers(){this.clearShowTimeout(),this.clearHideTimeout()}promotePanel(){const t=this.panelEl;if(t&&"function"==typeof t.showPopover)try{t.matches(":popover-open")||t.showPopover()}catch(t){}}addScrollListeners(){window.addEventListener("resize",this.scheduleUpdate,{passive:!0}),window.addEventListener("scroll",this.scheduleUpdate,{passive:!0,capture:!0}),this.scrollParents=a(this.el);for(const t of this.scrollParents)t.addEventListener("scroll",this.scheduleUpdate,{passive:!0})}cleanupListeners(){this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=void 0),window.removeEventListener("resize",this.scheduleUpdate),window.removeEventListener("scroll",this.scheduleUpdate,{capture:!0});for(const t of this.scrollParents)t.removeEventListener("scroll",this.scheduleUpdate);this.scrollParents=[]}render(){const t=this.actualPlacement.split("-")[0];return o("div",{key:"3764a4c115b507187115cbd30f0400deb374df09",class:"co-tooltip"},o("div",{key:"50b0c6325f1254e156f07eebe07e1abc81d8955f",class:"co-tooltip__trigger",ref:t=>this.triggerEl=t,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onPointerDown:this.handlePointerDown,onFocusin:this.handleFocusIn,onFocusout:this.handleFocusOut,onKeyDown:this.handleKeyDown,"aria-describedby":this.visible?"tooltip-panel":void 0},o("slot",{key:"d38c1723c6429912c66174a8885fa7062d2294b6"})),(this.visible||this.closing)&&this.content&&o("div",{key:"ee7495acdb7bc60c922c6dd3e2719fac3d818034",id:"tooltip-panel",class:{"co-tooltip__panel":!0,[`co-tooltip__panel--${t}`]:!0,"co-tooltip__panel--closing":this.closing,"co-tooltip__panel--label":"label"===this.variant,"co-tooltip__panel--tone-error":"error"===this.tone,"co-tooltip__panel--with-shortcut":!!this.shortcut},role:"tooltip",popover:"manual",part:"panel",onTransitionEnd:this.handlePanelTransitionEnd,ref:t=>{t&&t!==this.panelEl&&(this.panelEl=t,this.promotePanel(),this.scheduleUpdate())},style:{maxWidth:this.maxWidth}},this.arrow&&o("div",{key:"97cfb106fdc759401fefafe9990aa9388bc8aed5",class:`co-tooltip__arrow co-tooltip__arrow--${t}`}),o("span",{key:"81856efa759cfdc905ca23d7982c9469622bf89b",class:"co-tooltip__content"},this.content),this.shortcut&&o("co-kbd",{key:"2a1b2bf4728c9e085e0e198c93a4057dacf6381c",keys:this.shortcut,surface:"dark",size:"xs"})))}get el(){return i(this)}static get watchers(){return{visible:[{onVisibleChange:0}],disabled:[{onDisabledChange:0}]}}};p.style=":host{display:inline-block;position:relative}.co-tooltip{display:inline-block}.co-tooltip__trigger{display:inline-block}:host([block]){display:block;width:100%;min-width:0}:host([block]) .co-tooltip,:host([block]) .co-tooltip__trigger{display:block;width:100%;min-width:0}.co-tooltip__panel{position:fixed;inset:auto;top:0;left:0;margin:0;border:0;max-height:none;overflow:visible;z-index:10000;visibility:hidden;opacity:0;pointer-events:none;--co-tooltip-surface:var(--co-color-base-negro, #1f1c1b);background:var(--co-tooltip-surface);color:var(--co-color-base-blanco, #fff);font-family:var(--co-font-family-primary, 'Geist', sans-serif);font-size:var(--co-font-size-12, 12px);line-height:1.4;font-weight:400;text-transform:none;letter-spacing:var(--co-font-letter-spacing-body, normal);padding:var(--co-spacing-xs, 4px) var(--co-spacing-sm, 8px);border-radius:var(--co-border-radius-xxs, 4px);box-shadow:0 4px 12px rgba(31, 28, 27, 0.12);white-space:normal;word-wrap:break-word;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-out), transform var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-tooltip__panel--positioned{visibility:visible;opacity:1}.co-tooltip__panel--closing{visibility:visible;opacity:0;transition:opacity var(--co-motion-duration-instant) var(--co-motion-ease-in), transform var(--co-motion-duration-instant) var(--co-motion-ease-in)}.co-tooltip__panel--top{transform:translateY(4px)}.co-tooltip__panel--top.co-tooltip__panel--positioned{transform:translateY(0)}.co-tooltip__panel--bottom{transform:translateY(-4px)}.co-tooltip__panel--bottom.co-tooltip__panel--positioned{transform:translateY(0)}.co-tooltip__panel--left{transform:translateX(4px)}.co-tooltip__panel--left.co-tooltip__panel--positioned{transform:translateX(0)}.co-tooltip__panel--right{transform:translateX(-4px)}.co-tooltip__panel--right.co-tooltip__panel--positioned{transform:translateX(0)}.co-tooltip__arrow{position:absolute;width:0;height:0;border:5px solid transparent}.co-tooltip__arrow--top{bottom:-10px;left:50%;transform:translateX(-50%);border-top-color:var(--co-tooltip-surface);border-bottom:none}.co-tooltip__arrow--bottom{top:-5px;left:50%;transform:translateX(-50%);border-bottom-color:var(--co-tooltip-surface);border-top:none}.co-tooltip__arrow--left{right:-10px;top:50%;transform:translateY(-50%);border-left-color:var(--co-tooltip-surface);border-right:none}.co-tooltip__arrow--right{left:-5px;top:50%;transform:translateY(-50%);border-right-color:var(--co-tooltip-surface);border-left:none}.co-tooltip__panel--tone-error{--co-tooltip-surface:var(--co-semantic-status-error, #aa2e1b)}.co-tooltip__content{display:block}.co-tooltip__panel--label{padding:4px 8px;border-radius:var(--co-border-radius-xs, 8px);font-weight:var(--co-font-weight-medium, 500);line-height:1;box-shadow:none}.co-tooltip__panel--label .co-tooltip__arrow{display:none}.co-tooltip__panel--with-shortcut{display:flex;align-items:center;gap:6px}.co-tooltip__panel--with-shortcut:not(.co-tooltip__panel--label){padding-right:10px;}.co-tooltip__panel--label.co-tooltip__panel--with-shortcut{padding-right:4px}";export{h as co_kbd,p as co_tooltip}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as o,a as e}from"./p-DJkaRtbb.js";import{l as a}from"./p-jYd9gu_c.js";const s={es:{close:"Cerrar visor",prevImage:"Imagen anterior",nextImage:"Imagen siguiente",zoomIn:"Acercar",zoomOut:"Alejar",zoomReset:"Restablecer zoom",openOriginal:"Abrir original",counter:"{i} de {n}"},en:{close:"Close viewer",prevImage:"Previous image",nextImage:"Next image",zoomIn:"Zoom in",zoomOut:"Zoom out",zoomReset:"Reset zoom",openOriginal:"Open original",counter:"{i} of {n}"},pt:{close:"Fechar visualizador",prevImage:"Imagem anterior",nextImage:"Próxima imagem",zoomIn:"Aproximar",zoomOut:"Afastar",zoomReset:"Redefinir zoom",openOriginal:"Abrir original",counter:"{i} de {n}"}};function n(t,i=r){const o=(null==t?void 0:t.original)||(null==t?void 0:t.src);if(!t||!o)return!1;const e=i("","_blank");if(!e)return!1;try{e.opener=null}catch(t){}return function(t,i,o){var e;if(t.title=i.alt||"",!t.body)return;t.body.style.cssText="margin:0;min-height:100vh;display:grid;place-items:center;color-scheme:dark;background:Canvas;color:CanvasText";const a="video"===i.kind,s=t.createElement(a?"video":"img");s.style.cssText="max-width:100vw;max-height:100vh;object-fit:contain",s.setAttribute("src",o),a?(s.setAttribute("controls",""),i.poster&&s.setAttribute("poster",i.poster)):(s.setAttribute("alt",i.alt||""),i.src&&i.src!==o&&(null===(e=s.addEventListener)||void 0===e||e.call(s,"error",(()=>s.setAttribute("src",i.src)),{once:!0}))),t.body.appendChild(s)}(e.document,t,o),!0}function r(t,i){return window.open(t,i)}const c=1.15,h=class{constructor(o){t(this,o),this.coClose=i(this,"coClose",3),this.coChange=i(this,"coChange",3),this.images="[]",this.startIndex=0,this.open=!1,this.index=0,this.scale=1,this.tx=0,this.ty=0,this.dragging=!1,this.lastImagesStr="",this.lastParsed=[],this.dragStart={x:0,y:0,tx:0,ty:0},this.pendingFocus=!1,this.syncTopLayer=t=>{t&&(this.rootEl=t);const i=this.rootEl;if(i&&"function"==typeof i.showPopover)if(this.open){clearTimeout(this.demoteTimer);try{i.matches(":popover-open")||i.showPopover()}catch(t){}}else i.matches(":popover-open")&&(clearTimeout(this.demoteTimer),this.demoteTimer=setTimeout((()=>{try{i.hidePopover()}catch(t){}}),220))},this.handleKey=t=>{if(this.open){if("Escape"===t.key)return this.escapeBelongsToPlayer()||(this.requestClose(),t.preventDefault()),void t.stopPropagation();if("Tab"!==t.key){if(!this.isFocusInPlayer()){switch(t.key){case"ArrowLeft":this.goTo(-1);break;case"ArrowRight":this.goTo(1);break;case"+":case"=":if(this.isVideoSlide)return;this.zoomAt(this.scale*c,0,0);break;case"-":if(this.isVideoSlide)return;this.zoomAt(this.scale/c,0,0);break;case"0":if(this.isVideoSlide)return;this.resetView();break;default:return}t.preventDefault(),t.stopPropagation()}}else this.trapTab(t)}},this.requestClose=()=>{this.coClose.emit()},this.mountPlayer=t=>{t&&t!==this.playerEl&&(this.playerEl=t,this.tryAutoplay())},this.handlePlayerReady=t=>{var i;const{width:o,height:e}=t.detail||{};o&&e&&(null===(i=this.playerEl)||void 0===i||i.style.setProperty("--co-lb-ar",String(o/e)))},this.handleWheel=t=>{t.preventDefault();const[i,o]=this.stagePoint(t);this.zoomAt(this.scale*(t.deltaY<0?c:1/c),i,o)},this.handleDblClick=t=>{const[i,o]=this.stagePoint(t);this.zoomAt(this.scale>1?1:2.5,i,o)},this.handlePointerDown=t=>{var i;this.scale<=1||(t.preventDefault(),this.dragging=!0,this.dragStart={x:t.clientX,y:t.clientY,tx:this.tx,ty:this.ty},null===(i=this.imgEl)||void 0===i||i.setPointerCapture(t.pointerId))},this.handlePointerMove=t=>{if(!this.dragging)return;const i=this.dragStart.tx+(t.clientX-this.dragStart.x),o=this.dragStart.ty+(t.clientY-this.dragStart.y);[this.tx,this.ty]=this.clampPan(i,o,this.scale)},this.handlePointerUp=t=>{var i;this.dragging&&(this.dragging=!1,null===(i=this.imgEl)||void 0===i||i.releasePointerCapture(t.pointerId))},this.openOriginal=()=>{n(this.parsedImages[this.index])},this.stop=t=>t.stopPropagation()}get activeItem(){return this.parsedImages[this.index]}get isVideoSlide(){var t;return"video"===(null===(t=this.activeItem)||void 0===t?void 0:t.kind)}get parsedImages(){const t=this.images;if("string"!=typeof t||!t.trim())return[];if(t===this.lastImagesStr)return this.lastParsed;let i=[];try{const o=JSON.parse(t);Array.isArray(o)&&(i=o.filter((t=>t&&t.src)))}catch(t){}return this.lastImagesStr=t,this.lastParsed=i,i}componentWillLoad(){this.index=this.clampIndex(this.startIndex),this.pendingAutoplay=this.open}connectedCallback(){this.open&&this.attachKeyListener()}disconnectedCallback(){this.detachKeyListener(),this.pauseVideo(),clearTimeout(this.demoteTimer)}componentDidRender(){var t;this.pendingFocus&&(this.pendingFocus=!1,null===(t=this.closeBtnEl)||void 0===t||t.focus())}onOpenChange(t){var i,o,e;this.syncTopLayer(),t?(this.index=this.clampIndex(this.startIndex),this.resetView(),this.preloadNeighbors(),this.attachKeyListener(),this.pendingAutoplay=!0,this.tryAutoplay(),this.previouslyFocused=null!==(i=document.activeElement)&&void 0!==i?i:void 0,this.pendingFocus=!0):(this.detachKeyListener(),this.pauseVideo(),this.pendingAutoplay=!1,null===(e=null===(o=this.previouslyFocused)||void 0===o?void 0:o.focus)||void 0===e||e.call(o),this.previouslyFocused=void 0)}onStartIndexChange(t){this.open&&(this.index=this.clampIndex(t),this.resetView())}onImagesChange(){this.index=this.clampIndex(this.index)}attachKeyListener(){window.addEventListener("keydown",this.handleKey,{capture:!0})}detachKeyListener(){window.removeEventListener("keydown",this.handleKey,{capture:!0})}focusables(){var t,i;return Array.from(null!==(i=null===(t=this.el.shadowRoot)||void 0===t?void 0:t.querySelectorAll("button, co-video"))&&void 0!==i?i:[]).flatMap((t=>{var i,o;return"CO-VIDEO"===t.tagName?Array.from(null!==(o=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelectorAll('button:not([tabindex="-1"]), [tabindex="0"]'))&&void 0!==o?o:[]):[t]}))}deepActive(){var t,i,o;let e=null!==(i=null===(t=this.el.shadowRoot)||void 0===t?void 0:t.activeElement)&&void 0!==i?i:null;for(;null===(o=null==e?void 0:e.shadowRoot)||void 0===o?void 0:o.activeElement;)e=e.shadowRoot.activeElement;return e}escapeBelongsToPlayer(){var t,i;const o=document;return!(!o.fullscreenElement&&!o.webkitFullscreenElement&&!(null===(i=null===(t=this.playerEl)||void 0===t?void 0:t.shadowRoot)||void 0===i?void 0:i.querySelector(".co-video__speed-menu")))}isFocusInPlayer(){var t;const i=this.playerEl;return!!i&&(null===(t=this.el.shadowRoot)||void 0===t?void 0:t.activeElement)===i}trapTab(t){const i=this.focusables();if(0===i.length)return;t.preventDefault(),t.stopPropagation();const o=t.shiftKey?-1:1,e=i.indexOf(this.deepActive());(e<0?i[o>0?0:i.length-1]:i[(e+o+i.length)%i.length]).focus()}clampIndex(t){const i=this.parsedImages.length;return 0===i?0:Math.min(Math.max(0,t),i-1)}resetView(){this.scale=1,this.tx=0,this.ty=0,this.dragging=!1}goTo(t){const i=this.parsedImages.length;i<2||(this.pauseVideo(),this.pendingAutoplay=!1,this.index=(this.index+t+i)%i,this.resetView(),this.coChange.emit(this.index),this.preloadNeighbors())}preloadNeighbors(){const t=this.parsedImages;if(!(t.length<2))for(const i of[1,-1]){const o=t[(this.index+i+t.length)%t.length];if(!o)continue;const e="video"===o.kind?o.poster:o.src;e&&((new Image).src=e)}}tryAutoplay(){var t;if(!this.pendingAutoplay||!this.open)return;if(!this.isVideoSlide)return void(this.pendingAutoplay=!1);const i=this.playerEl;i&&(this.pendingAutoplay=!1,Promise.resolve(null===(t=i.componentOnReady)||void 0===t?void 0:t.call(i)).then((()=>{var t;if(this.open&&this.playerEl===i&&this.isVideoSlide)return null===(t=i.play)||void 0===t?void 0:t.call(i)})).catch((()=>{})))}pauseVideo(){var t,i;try{const o=null===(i=null===(t=this.playerEl)||void 0===t?void 0:t.pause)||void 0===i?void 0:i.call(t);o&&"function"==typeof o.catch&&o.catch((()=>{}))}catch(t){}}clampPan(t,i,o){const e=this.stageEl,a=this.imgEl;if(!e||!a)return[t,i];const s=Math.max(0,(a.offsetWidth*o-e.clientWidth)/2),n=Math.max(0,(a.offsetHeight*o-e.clientHeight)/2);return[Math.min(Math.max(t,-s),s),Math.min(Math.max(i,-n),n)]}zoomAt(t,i,o){const e=this.scale,a=Math.min(Math.max(t,1),8);if(a===e)return;const s=a/e;let n=i-(i-this.tx)*s,r=o-(o-this.ty)*s;1===a?(n=0,r=0):[n,r]=this.clampPan(n,r,a),this.scale=a,this.tx=n,this.ty=r}stagePoint(t){var i;const o=null===(i=this.stageEl)||void 0===i?void 0:i.getBoundingClientRect();return o?[t.clientX-o.left-o.width/2,t.clientY-o.top-o.height/2]:[0,0]}render(){const t=s[a(this.locale)],i=this.parsedImages,e=i[this.index],n=i.length>1,r="video"===(null==e?void 0:e.kind),h=t.counter.replace("{i}",String(this.index+1)).replace("{n}",String(i.length));return o("div",{key:"189314e8e6be6a3b908d2c4387e0561162a1b96e",class:{"co-lightbox":!0,"co-lightbox--open":this.open},part:"overlay",role:"dialog","aria-modal":"true","aria-label":null==e?void 0:e.alt,popover:"manual",ref:this.syncTopLayer,onClick:this.requestClose},e&&o("div",{key:"ee52518418ac4e58cd9bcece7bc3391cb0e9742f",class:"co-lightbox__toolbar",part:"toolbar",onClick:this.stop},o("span",{key:"c9e214561c3d2b7b773f82888a9147aab7d120df",class:"co-lightbox__caption",title:e.alt},e.alt),!r&&o("div",{key:"911216d5873a1462303f1ed5b59c14d72b7328c4",class:"co-lightbox__zoom"},o("button",{key:"9344807bbac6aefc47824b866a4225206b859323",class:"co-lightbox__btn",type:"button","aria-label":t.zoomOut,title:t.zoomOut,onClick:()=>this.zoomAt(this.scale/c,0,0)},o("co-icon",{key:"736c42fc97c09d76cf0aa8e0763ba56eb1ecd394",name:"minus",size:16})),o("button",{key:"e115084b8e4941bd0f476b248c3cc88f096c55f2",class:"co-lightbox__btn co-lightbox__zoom-value",type:"button","aria-label":t.zoomReset,title:t.zoomReset,onClick:()=>this.resetView()},Math.round(100*this.scale),"%"),o("button",{key:"d5955ce9dcf15f0768a1f012a11acec012805811",class:"co-lightbox__btn",type:"button","aria-label":t.zoomIn,title:t.zoomIn,onClick:()=>this.zoomAt(this.scale*c,0,0)},o("co-icon",{key:"64126b83b5ee1a510e4787c17a77b5bfb65db721",name:"plus",size:16}))),o("button",{key:"1798ea6aba9c8ce425317258b076874134de4724",class:"co-lightbox__btn",type:"button","aria-label":t.openOriginal,title:t.openOriginal,onClick:this.openOriginal},o("co-icon",{key:"a4ef44fe626c33b1b0eb11d38afe034ca5a13a8f",name:"arrow-square-out",size:16})),o("button",{key:"c68fbb1498dcfe177d8255647c39b5db83a66f7c",class:"co-lightbox__btn",part:"close",type:"button","aria-label":t.close,title:t.close,ref:t=>this.closeBtnEl=t,onClick:this.requestClose},o("co-icon",{key:"b62c1dd5fa4fba5a57b4c804e31494e5da48f0af",name:"x",size:16}))),e&&o("div",{key:"80d34170f27f6a0177747e797e10646dcfca0bed",class:"co-lightbox__stage",ref:t=>this.stageEl=t,onWheel:r?void 0:this.handleWheel},r?o("co-video",{class:"co-lightbox__video",part:"video",key:`video-${this.index}`,ref:this.mountPlayer,src:e.src,poster:e.poster||"",aspectRatio:"auto",rounded:"none",controlsAutoHide:!1,showSpeed:!0,showPip:!0,locale:a(this.locale),onCoReady:this.handlePlayerReady,onClick:this.stop}):o("img",{class:{"co-lightbox__img":!0,"co-lightbox__img--zoomed":this.scale>1,"co-lightbox__img--dragging":this.dragging},part:"image",ref:t=>this.imgEl=t,src:e.src,alt:e.alt||"",draggable:!1,style:{transform:`translate(${this.tx}px, ${this.ty}px) scale(${this.scale})`},onClick:this.stop,onDblClick:this.handleDblClick,onPointerDown:this.handlePointerDown,onPointerMove:this.handlePointerMove,onPointerUp:this.handlePointerUp,onPointerCancel:this.handlePointerUp})),e&&n&&o("button",{key:"4ef78cd047f1e8b2efb669aefbee51b73e4c5c3b",class:"co-lightbox__nav co-lightbox__nav--prev",part:"prev",type:"button","aria-label":t.prevImage,title:t.prevImage,onClick:t=>{t.stopPropagation(),this.goTo(-1)}},o("co-icon",{key:"834bd12a0dead46df44e291197f5d3b79f619932",name:"caret-left",size:24})),e&&n&&o("button",{key:"0252acb36e360dedd1fe8ac8cba74ab5895476c1",class:"co-lightbox__nav co-lightbox__nav--next",part:"next",type:"button","aria-label":t.nextImage,title:t.nextImage,onClick:t=>{t.stopPropagation(),this.goTo(1)}},o("co-icon",{key:"53521495d2bd6ac11004cedd96fd7351135115a7",name:"caret-right",size:24})),e&&n&&o("div",{key:"fae75527e79964a30745accf565b33be3b466ba6",class:"co-lightbox__counter",part:"counter",onClick:this.stop},h))}get el(){return e(this)}static get watchers(){return{open:[{onOpenChange:0}],startIndex:[{onStartIndexChange:0}],images:[{onImagesChange:0}]}}};h.style=":host{display:contents;font-family:var(--co-font-family-primary)}.co-lightbox{position:fixed;inset:0;margin:0;border:0;padding:0;width:auto;height:auto;overflow:visible;color:inherit;z-index:1100;display:flex;align-items:center;justify-content:center;background:var(--co-color-opacity-negro-80);opacity:0;pointer-events:none;transition:opacity var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-lightbox--open{opacity:1;pointer-events:auto}.co-lightbox__toolbar{position:absolute;top:0;left:0;right:0;z-index:2;display:flex;align-items:center;gap:var(--co-spacing-sm2);padding:var(--co-spacing-md) var(--co-spacing-lg);background:linear-gradient(var(--co-color-opacity-negro-50), transparent)}.co-lightbox__caption{flex:1;min-width:0;color:var(--co-color-base-blanco);font-size:var(--co-font-size-14);line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-lightbox__zoom{display:flex;align-items:center;gap:var(--co-spacing-xxs);padding:0 var(--co-spacing-xs);border-radius:var(--co-border-radius-full);background:var(--co-color-opacity-blanco-8)}.co-lightbox__btn{display:flex;align-items:center;justify-content:center;min-width:32px;height:32px;padding:0 var(--co-spacing-xs);border:none;border-radius:var(--co-border-radius-full);background:transparent;color:var(--co-color-base-blanco);font-family:inherit;font-size:var(--co-font-size-13, 13px);cursor:pointer;transition:background var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-lightbox__btn:hover{background:var(--co-color-opacity-blanco-16)}.co-lightbox__zoom-value{min-width:48px;font-variant-numeric:tabular-nums}.co-lightbox__stage{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;overflow:hidden;touch-action:none}.co-lightbox__img{max-width:calc(100vw - var(--co-spacing-5xl) * 2);max-height:calc(100vh - var(--co-spacing-5xl) * 2);border-radius:var(--co-border-radius-xs);user-select:none;transition:transform var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-lightbox__video{--co-lb-ar:1.7778;flex:0 0 auto;width:auto;aspect-ratio:var(--co-lb-ar);height:min( calc(100vh - var(--co-spacing-5xl) * 2), calc((100vw - var(--co-spacing-5xl) * 2) / var(--co-lb-ar)), calc(1200px / var(--co-lb-ar)) );border-radius:var(--co-border-radius-xs);overflow:hidden}.co-lightbox__img--zoomed{cursor:grab}.co-lightbox__img--dragging{cursor:grabbing;transition:none}.co-lightbox__nav{position:absolute;top:50%;transform:translateY(-50%);z-index:2;display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:none;border-radius:var(--co-border-radius-full);background:var(--co-color-opacity-blanco-8);color:var(--co-color-base-blanco);cursor:pointer;transition:background var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-lightbox__nav:hover{background:var(--co-color-opacity-blanco-25)}.co-lightbox__nav--prev{left:var(--co-spacing-lg)}.co-lightbox__nav--next{right:var(--co-spacing-lg)}.co-lightbox__counter{position:absolute;bottom:var(--co-spacing-lg);left:50%;transform:translateX(-50%);z-index:2;padding:var(--co-spacing-xs) var(--co-spacing-md);border-radius:var(--co-border-radius-full);background:var(--co-color-opacity-blanco-8);color:var(--co-color-base-blanco);font-size:var(--co-font-size-13, 13px);font-variant-numeric:tabular-nums}";export{h as co_lightbox}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t,p as o,H as i,h as s}from"./index.js";import{c as e,g as a,f as r}from"./p-BtliEQAT.js";import{d as n}from"./p-qMNHMnvI.js";import{d as l}from"./p-DldA2IL3.js";const c=o(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.content="",this.placement="top",this.offset=8,this.showDelay=80,this.hideDelay=100,this.disabled=!1,this.arrow=!0,this.flip=!0,this.maxWidth="280px",this.block=!1,this.variant="default",this.tone="default",this.visible=!1,this.actualPlacement="top",this.closing=!1,this.suppressed=!1,this.scrollParents=[],this.cachedOffsetAncestor=null,this.offsetAncestorComputed=!1,this.scheduleShow=()=>{this.disabled||!this.content||this.suppressed||(this.clearHideTimeout(),this.visible||(this.showTimeout=setTimeout((()=>{this.visible=!0}),this.showDelay)))},this.scheduleHide=()=>{this.clearShowTimeout(),this.visible&&(this.hideTimeout=setTimeout((()=>{this.visible=!1}),this.hideDelay))},this.hideImmediate=()=>{this.clearTimers(),this.visible=!1},this.finishClose=()=>{clearTimeout(this.closeFallbackTimer),this.visible||(this.closing=!1,this.panelEl=void 0)},this.handlePanelTransitionEnd=t=>{!this.visible&&this.closing&&t.target===this.panelEl&&"opacity"===t.propertyName&&this.finishClose()},this.handleMouseEnter=()=>{this.scheduleShow()},this.handleMouseLeave=()=>{this.suppressed=!1,this.scheduleHide()},this.handlePointerDown=()=>{this.suppressed=!0,this.hideImmediate()},this.handleFocusIn=()=>{this.scheduleShow()},this.handleFocusOut=()=>{this.suppressed=!1,this.scheduleHide()},this.handleKeyDown=t=>{"Escape"===t.key&&this.visible&&this.hideImmediate()},this.updatePosition=()=>{if(!this.visible||!this.triggerEl||!this.panelEl)return;const t=this.triggerEl.getBoundingClientRect(),o=this.panelEl.getBoundingClientRect();if(0===o.width&&0===o.height)return;const{top:i,left:s,actualPlacement:r}=e(t,o,{placement:this.placement,offset:this.offset,flip:this.flip});this.actualPlacement=r;let n=i,l=s;if(!this.panelEl.matches(":popover-open")&&(this.offsetAncestorComputed||(this.cachedOffsetAncestor=a(this.panelEl),(this.cachedOffsetAncestor||this.panelEl.isConnected)&&(this.offsetAncestorComputed=!0)),this.cachedOffsetAncestor)){const t=this.cachedOffsetAncestor.getBoundingClientRect();n-=t.top,l-=t.left}this.panelEl&&(this.panelEl.style.top=`${n}px`,this.panelEl.style.left=`${l}px`,this.panelEl.classList.add("co-tooltip__panel--positioned"))},this.scheduleUpdate=()=>{this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(this.updatePosition)}}disconnectedCallback(){this.clearTimers(),this.cleanupListeners(),clearTimeout(this.closeFallbackTimer),this.closing=!1}onVisibleChange(t){t?(this.closing=!1,clearTimeout(this.closeFallbackTimer),this.scheduleUpdate(),requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.updatePosition()}))})),this.addScrollListeners()):(this.cleanupListeners(),this.cachedOffsetAncestor=null,this.offsetAncestorComputed=!1,this.closing=!0,clearTimeout(this.closeFallbackTimer),this.closeFallbackTimer=setTimeout((()=>this.finishClose()),250))}onDisabledChange(t){t&&this.visible&&(this.visible=!1,this.clearTimers())}clearShowTimeout(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=void 0)}clearHideTimeout(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=void 0)}clearTimers(){this.clearShowTimeout(),this.clearHideTimeout()}promotePanel(){const t=this.panelEl;if(t&&"function"==typeof t.showPopover)try{t.matches(":popover-open")||t.showPopover()}catch(t){}}addScrollListeners(){window.addEventListener("resize",this.scheduleUpdate,{passive:!0}),window.addEventListener("scroll",this.scheduleUpdate,{passive:!0,capture:!0}),this.scrollParents=r(this.el);for(const t of this.scrollParents)t.addEventListener("scroll",this.scheduleUpdate,{passive:!0})}cleanupListeners(){this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=void 0),window.removeEventListener("resize",this.scheduleUpdate),window.removeEventListener("scroll",this.scheduleUpdate,{capture:!0});for(const t of this.scrollParents)t.removeEventListener("scroll",this.scheduleUpdate);this.scrollParents=[]}render(){const t=this.actualPlacement.split("-")[0];return s("div",{key:"3764a4c115b507187115cbd30f0400deb374df09",class:"co-tooltip"},s("div",{key:"50b0c6325f1254e156f07eebe07e1abc81d8955f",class:"co-tooltip__trigger",ref:t=>this.triggerEl=t,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onPointerDown:this.handlePointerDown,onFocusin:this.handleFocusIn,onFocusout:this.handleFocusOut,onKeyDown:this.handleKeyDown,"aria-describedby":this.visible?"tooltip-panel":void 0},s("slot",{key:"d38c1723c6429912c66174a8885fa7062d2294b6"})),(this.visible||this.closing)&&this.content&&s("div",{key:"ee7495acdb7bc60c922c6dd3e2719fac3d818034",id:"tooltip-panel",class:{"co-tooltip__panel":!0,[`co-tooltip__panel--${t}`]:!0,"co-tooltip__panel--closing":this.closing,"co-tooltip__panel--label":"label"===this.variant,"co-tooltip__panel--tone-error":"error"===this.tone,"co-tooltip__panel--with-shortcut":!!this.shortcut},role:"tooltip",popover:"manual",part:"panel",onTransitionEnd:this.handlePanelTransitionEnd,ref:t=>{t&&t!==this.panelEl&&(this.panelEl=t,this.promotePanel(),this.scheduleUpdate())},style:{maxWidth:this.maxWidth}},this.arrow&&s("div",{key:"97cfb106fdc759401fefafe9990aa9388bc8aed5",class:`co-tooltip__arrow co-tooltip__arrow--${t}`}),s("span",{key:"81856efa759cfdc905ca23d7982c9469622bf89b",class:"co-tooltip__content"},this.content),this.shortcut&&s("co-kbd",{key:"2a1b2bf4728c9e085e0e198c93a4057dacf6381c",keys:this.shortcut,surface:"dark",size:"xs"})))}get el(){return this}static get watchers(){return{visible:[{onVisibleChange:0}],disabled:[{onDisabledChange:0}]}}static get style(){return":host{display:inline-block;position:relative}.co-tooltip{display:inline-block}.co-tooltip__trigger{display:inline-block}:host([block]){display:block;width:100%;min-width:0}:host([block]) .co-tooltip,:host([block]) .co-tooltip__trigger{display:block;width:100%;min-width:0}.co-tooltip__panel{position:fixed;inset:auto;top:0;left:0;margin:0;border:0;max-height:none;overflow:visible;z-index:10000;visibility:hidden;opacity:0;pointer-events:none;--co-tooltip-surface:var(--co-color-base-negro, #1f1c1b);background:var(--co-tooltip-surface);color:var(--co-color-base-blanco, #fff);font-family:var(--co-font-family-primary, 'Geist', sans-serif);font-size:var(--co-font-size-12, 12px);line-height:1.4;font-weight:400;text-transform:none;letter-spacing:var(--co-font-letter-spacing-body, normal);padding:var(--co-spacing-xs, 4px) var(--co-spacing-sm, 8px);border-radius:var(--co-border-radius-xxs, 4px);box-shadow:0 4px 12px rgba(31, 28, 27, 0.12);white-space:normal;word-wrap:break-word;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-out), transform var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-tooltip__panel--positioned{visibility:visible;opacity:1}.co-tooltip__panel--closing{visibility:visible;opacity:0;transition:opacity var(--co-motion-duration-instant) var(--co-motion-ease-in), transform var(--co-motion-duration-instant) var(--co-motion-ease-in)}.co-tooltip__panel--top{transform:translateY(4px)}.co-tooltip__panel--top.co-tooltip__panel--positioned{transform:translateY(0)}.co-tooltip__panel--bottom{transform:translateY(-4px)}.co-tooltip__panel--bottom.co-tooltip__panel--positioned{transform:translateY(0)}.co-tooltip__panel--left{transform:translateX(4px)}.co-tooltip__panel--left.co-tooltip__panel--positioned{transform:translateX(0)}.co-tooltip__panel--right{transform:translateX(-4px)}.co-tooltip__panel--right.co-tooltip__panel--positioned{transform:translateX(0)}.co-tooltip__arrow{position:absolute;width:0;height:0;border:5px solid transparent}.co-tooltip__arrow--top{bottom:-10px;left:50%;transform:translateX(-50%);border-top-color:var(--co-tooltip-surface);border-bottom:none}.co-tooltip__arrow--bottom{top:-5px;left:50%;transform:translateX(-50%);border-bottom-color:var(--co-tooltip-surface);border-top:none}.co-tooltip__arrow--left{right:-10px;top:50%;transform:translateY(-50%);border-left-color:var(--co-tooltip-surface);border-right:none}.co-tooltip__arrow--right{left:-5px;top:50%;transform:translateY(-50%);border-right-color:var(--co-tooltip-surface);border-left:none}.co-tooltip__panel--tone-error{--co-tooltip-surface:var(--co-semantic-status-error, #aa2e1b)}.co-tooltip__content{display:block}.co-tooltip__panel--label{padding:4px 8px;border-radius:var(--co-border-radius-xs, 8px);font-weight:var(--co-font-weight-medium, 500);line-height:1;box-shadow:none}.co-tooltip__panel--label .co-tooltip__arrow{display:none}.co-tooltip__panel--with-shortcut{display:flex;align-items:center;gap:6px}.co-tooltip__panel--with-shortcut:not(.co-tooltip__panel--label){padding-right:10px;}.co-tooltip__panel--label.co-tooltip__panel--with-shortcut{padding-right:4px}"}},[257,"co-tooltip",{content:[1],placement:[1],offset:[2],showDelay:[2,"show-delay"],hideDelay:[2,"hide-delay"],disabled:[4],arrow:[4],flip:[4],maxWidth:[1,"max-width"],block:[516],variant:[1],tone:[1],shortcut:[1],visible:[32],actualPlacement:[32],closing:[32]},void 0,{visible:[{onVisibleChange:0}],disabled:[{onDisabledChange:0}]}]);function h(){"undefined"!=typeof customElements&&["co-tooltip","co-icon","co-kbd"].forEach((o=>{switch(o){case"co-tooltip":customElements.get(t(o))||customElements.define(t(o),c);break;case"co-icon":customElements.get(t(o))||n();break;case"co-kbd":customElements.get(t(o))||l()}}))}h();export{c as C,h as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t,p as i,H as o,c as e,h as a}from"./index.js";import{l as s}from"./p-jYd9gu_c.js";import{d as n}from"./p-qMNHMnvI.js";import{d as r}from"./p-COCcx0DN.js";const c={es:{close:"Cerrar visor",prevImage:"Imagen anterior",nextImage:"Imagen siguiente",zoomIn:"Acercar",zoomOut:"Alejar",zoomReset:"Restablecer zoom",openOriginal:"Abrir original",counter:"{i} de {n}"},en:{close:"Close viewer",prevImage:"Previous image",nextImage:"Next image",zoomIn:"Zoom in",zoomOut:"Zoom out",zoomReset:"Reset zoom",openOriginal:"Open original",counter:"{i} of {n}"},pt:{close:"Fechar visualizador",prevImage:"Imagem anterior",nextImage:"Próxima imagem",zoomIn:"Aproximar",zoomOut:"Afastar",zoomReset:"Redefinir zoom",openOriginal:"Abrir original",counter:"{i} de {n}"}};function h(t,i=l){const o=(null==t?void 0:t.original)||(null==t?void 0:t.src);if(!t||!o)return!1;const e=i("","_blank");if(!e)return!1;try{e.opener=null}catch(t){}return function(t,i,o){var e;if(t.title=i.alt||"",!t.body)return;t.body.style.cssText="margin:0;min-height:100vh;display:grid;place-items:center;color-scheme:dark;background:Canvas;color:CanvasText";const a="video"===i.kind,s=t.createElement(a?"video":"img");s.style.cssText="max-width:100vw;max-height:100vh;object-fit:contain",s.setAttribute("src",o),a?(s.setAttribute("controls",""),i.poster&&s.setAttribute("poster",i.poster)):(s.setAttribute("alt",i.alt||""),i.src&&i.src!==o&&(null===(e=s.addEventListener)||void 0===e||e.call(s,"error",(()=>s.setAttribute("src",i.src)),{once:!0}))),t.body.appendChild(s)}(e.document,t,o),!0}function l(t,i){return window.open(t,i)}const d=1.15,b=i(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.coClose=e(this,"coClose",3),this.coChange=e(this,"coChange",3),this.images="[]",this.startIndex=0,this.open=!1,this.index=0,this.scale=1,this.tx=0,this.ty=0,this.dragging=!1,this.lastImagesStr="",this.lastParsed=[],this.dragStart={x:0,y:0,tx:0,ty:0},this.pendingFocus=!1,this.syncTopLayer=t=>{t&&(this.rootEl=t);const i=this.rootEl;if(i&&"function"==typeof i.showPopover)if(this.open){clearTimeout(this.demoteTimer);try{i.matches(":popover-open")||i.showPopover()}catch(t){}}else i.matches(":popover-open")&&(clearTimeout(this.demoteTimer),this.demoteTimer=setTimeout((()=>{try{i.hidePopover()}catch(t){}}),220))},this.handleKey=t=>{if(this.open){if("Escape"===t.key)return this.escapeBelongsToPlayer()||(this.requestClose(),t.preventDefault()),void t.stopPropagation();if("Tab"!==t.key){if(!this.isFocusInPlayer()){switch(t.key){case"ArrowLeft":this.goTo(-1);break;case"ArrowRight":this.goTo(1);break;case"+":case"=":if(this.isVideoSlide)return;this.zoomAt(this.scale*d,0,0);break;case"-":if(this.isVideoSlide)return;this.zoomAt(this.scale/d,0,0);break;case"0":if(this.isVideoSlide)return;this.resetView();break;default:return}t.preventDefault(),t.stopPropagation()}}else this.trapTab(t)}},this.requestClose=()=>{this.coClose.emit()},this.mountPlayer=t=>{t&&t!==this.playerEl&&(this.playerEl=t,this.tryAutoplay())},this.handlePlayerReady=t=>{var i;const{width:o,height:e}=t.detail||{};o&&e&&(null===(i=this.playerEl)||void 0===i||i.style.setProperty("--co-lb-ar",String(o/e)))},this.handleWheel=t=>{t.preventDefault();const[i,o]=this.stagePoint(t);this.zoomAt(this.scale*(t.deltaY<0?d:1/d),i,o)},this.handleDblClick=t=>{const[i,o]=this.stagePoint(t);this.zoomAt(this.scale>1?1:2.5,i,o)},this.handlePointerDown=t=>{var i;this.scale<=1||(t.preventDefault(),this.dragging=!0,this.dragStart={x:t.clientX,y:t.clientY,tx:this.tx,ty:this.ty},null===(i=this.imgEl)||void 0===i||i.setPointerCapture(t.pointerId))},this.handlePointerMove=t=>{if(!this.dragging)return;const i=this.dragStart.tx+(t.clientX-this.dragStart.x),o=this.dragStart.ty+(t.clientY-this.dragStart.y);[this.tx,this.ty]=this.clampPan(i,o,this.scale)},this.handlePointerUp=t=>{var i;this.dragging&&(this.dragging=!1,null===(i=this.imgEl)||void 0===i||i.releasePointerCapture(t.pointerId))},this.openOriginal=()=>{h(this.parsedImages[this.index])},this.stop=t=>t.stopPropagation()}get activeItem(){return this.parsedImages[this.index]}get isVideoSlide(){var t;return"video"===(null===(t=this.activeItem)||void 0===t?void 0:t.kind)}get parsedImages(){const t=this.images;if("string"!=typeof t||!t.trim())return[];if(t===this.lastImagesStr)return this.lastParsed;let i=[];try{const o=JSON.parse(t);Array.isArray(o)&&(i=o.filter((t=>t&&t.src)))}catch(t){}return this.lastImagesStr=t,this.lastParsed=i,i}componentWillLoad(){this.index=this.clampIndex(this.startIndex),this.pendingAutoplay=this.open}connectedCallback(){this.open&&this.attachKeyListener()}disconnectedCallback(){this.detachKeyListener(),this.pauseVideo(),clearTimeout(this.demoteTimer)}componentDidRender(){var t;this.pendingFocus&&(this.pendingFocus=!1,null===(t=this.closeBtnEl)||void 0===t||t.focus())}onOpenChange(t){var i,o,e;this.syncTopLayer(),t?(this.index=this.clampIndex(this.startIndex),this.resetView(),this.preloadNeighbors(),this.attachKeyListener(),this.pendingAutoplay=!0,this.tryAutoplay(),this.previouslyFocused=null!==(i=document.activeElement)&&void 0!==i?i:void 0,this.pendingFocus=!0):(this.detachKeyListener(),this.pauseVideo(),this.pendingAutoplay=!1,null===(e=null===(o=this.previouslyFocused)||void 0===o?void 0:o.focus)||void 0===e||e.call(o),this.previouslyFocused=void 0)}onStartIndexChange(t){this.open&&(this.index=this.clampIndex(t),this.resetView())}onImagesChange(){this.index=this.clampIndex(this.index)}attachKeyListener(){window.addEventListener("keydown",this.handleKey,{capture:!0})}detachKeyListener(){window.removeEventListener("keydown",this.handleKey,{capture:!0})}focusables(){var t,i;return Array.from(null!==(i=null===(t=this.el.shadowRoot)||void 0===t?void 0:t.querySelectorAll("button, co-video"))&&void 0!==i?i:[]).flatMap((t=>{var i,o;return"CO-VIDEO"===t.tagName?Array.from(null!==(o=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelectorAll('button:not([tabindex="-1"]), [tabindex="0"]'))&&void 0!==o?o:[]):[t]}))}deepActive(){var t,i,o;let e=null!==(i=null===(t=this.el.shadowRoot)||void 0===t?void 0:t.activeElement)&&void 0!==i?i:null;for(;null===(o=null==e?void 0:e.shadowRoot)||void 0===o?void 0:o.activeElement;)e=e.shadowRoot.activeElement;return e}escapeBelongsToPlayer(){var t,i;const o=document;return!(!o.fullscreenElement&&!o.webkitFullscreenElement&&!(null===(i=null===(t=this.playerEl)||void 0===t?void 0:t.shadowRoot)||void 0===i?void 0:i.querySelector(".co-video__speed-menu")))}isFocusInPlayer(){var t;const i=this.playerEl;return!!i&&(null===(t=this.el.shadowRoot)||void 0===t?void 0:t.activeElement)===i}trapTab(t){const i=this.focusables();if(0===i.length)return;t.preventDefault(),t.stopPropagation();const o=t.shiftKey?-1:1,e=i.indexOf(this.deepActive());(e<0?i[o>0?0:i.length-1]:i[(e+o+i.length)%i.length]).focus()}clampIndex(t){const i=this.parsedImages.length;return 0===i?0:Math.min(Math.max(0,t),i-1)}resetView(){this.scale=1,this.tx=0,this.ty=0,this.dragging=!1}goTo(t){const i=this.parsedImages.length;i<2||(this.pauseVideo(),this.pendingAutoplay=!1,this.index=(this.index+t+i)%i,this.resetView(),this.coChange.emit(this.index),this.preloadNeighbors())}preloadNeighbors(){const t=this.parsedImages;if(!(t.length<2))for(const i of[1,-1]){const o=t[(this.index+i+t.length)%t.length];if(!o)continue;const e="video"===o.kind?o.poster:o.src;e&&((new Image).src=e)}}tryAutoplay(){var t;if(!this.pendingAutoplay||!this.open)return;if(!this.isVideoSlide)return void(this.pendingAutoplay=!1);const i=this.playerEl;i&&(this.pendingAutoplay=!1,Promise.resolve(null===(t=i.componentOnReady)||void 0===t?void 0:t.call(i)).then((()=>{var t;if(this.open&&this.playerEl===i&&this.isVideoSlide)return null===(t=i.play)||void 0===t?void 0:t.call(i)})).catch((()=>{})))}pauseVideo(){var t,i;try{const o=null===(i=null===(t=this.playerEl)||void 0===t?void 0:t.pause)||void 0===i?void 0:i.call(t);o&&"function"==typeof o.catch&&o.catch((()=>{}))}catch(t){}}clampPan(t,i,o){const e=this.stageEl,a=this.imgEl;if(!e||!a)return[t,i];const s=Math.max(0,(a.offsetWidth*o-e.clientWidth)/2),n=Math.max(0,(a.offsetHeight*o-e.clientHeight)/2);return[Math.min(Math.max(t,-s),s),Math.min(Math.max(i,-n),n)]}zoomAt(t,i,o){const e=this.scale,a=Math.min(Math.max(t,1),8);if(a===e)return;const s=a/e;let n=i-(i-this.tx)*s,r=o-(o-this.ty)*s;1===a?(n=0,r=0):[n,r]=this.clampPan(n,r,a),this.scale=a,this.tx=n,this.ty=r}stagePoint(t){var i;const o=null===(i=this.stageEl)||void 0===i?void 0:i.getBoundingClientRect();return o?[t.clientX-o.left-o.width/2,t.clientY-o.top-o.height/2]:[0,0]}render(){const t=c[s(this.locale)],i=this.parsedImages,o=i[this.index],e=i.length>1,n="video"===(null==o?void 0:o.kind),r=t.counter.replace("{i}",String(this.index+1)).replace("{n}",String(i.length));return a("div",{key:"189314e8e6be6a3b908d2c4387e0561162a1b96e",class:{"co-lightbox":!0,"co-lightbox--open":this.open},part:"overlay",role:"dialog","aria-modal":"true","aria-label":null==o?void 0:o.alt,popover:"manual",ref:this.syncTopLayer,onClick:this.requestClose},o&&a("div",{key:"ee52518418ac4e58cd9bcece7bc3391cb0e9742f",class:"co-lightbox__toolbar",part:"toolbar",onClick:this.stop},a("span",{key:"c9e214561c3d2b7b773f82888a9147aab7d120df",class:"co-lightbox__caption",title:o.alt},o.alt),!n&&a("div",{key:"911216d5873a1462303f1ed5b59c14d72b7328c4",class:"co-lightbox__zoom"},a("button",{key:"9344807bbac6aefc47824b866a4225206b859323",class:"co-lightbox__btn",type:"button","aria-label":t.zoomOut,title:t.zoomOut,onClick:()=>this.zoomAt(this.scale/d,0,0)},a("co-icon",{key:"736c42fc97c09d76cf0aa8e0763ba56eb1ecd394",name:"minus",size:16})),a("button",{key:"e115084b8e4941bd0f476b248c3cc88f096c55f2",class:"co-lightbox__btn co-lightbox__zoom-value",type:"button","aria-label":t.zoomReset,title:t.zoomReset,onClick:()=>this.resetView()},Math.round(100*this.scale),"%"),a("button",{key:"d5955ce9dcf15f0768a1f012a11acec012805811",class:"co-lightbox__btn",type:"button","aria-label":t.zoomIn,title:t.zoomIn,onClick:()=>this.zoomAt(this.scale*d,0,0)},a("co-icon",{key:"64126b83b5ee1a510e4787c17a77b5bfb65db721",name:"plus",size:16}))),a("button",{key:"1798ea6aba9c8ce425317258b076874134de4724",class:"co-lightbox__btn",type:"button","aria-label":t.openOriginal,title:t.openOriginal,onClick:this.openOriginal},a("co-icon",{key:"a4ef44fe626c33b1b0eb11d38afe034ca5a13a8f",name:"arrow-square-out",size:16})),a("button",{key:"c68fbb1498dcfe177d8255647c39b5db83a66f7c",class:"co-lightbox__btn",part:"close",type:"button","aria-label":t.close,title:t.close,ref:t=>this.closeBtnEl=t,onClick:this.requestClose},a("co-icon",{key:"b62c1dd5fa4fba5a57b4c804e31494e5da48f0af",name:"x",size:16}))),o&&a("div",{key:"80d34170f27f6a0177747e797e10646dcfca0bed",class:"co-lightbox__stage",ref:t=>this.stageEl=t,onWheel:n?void 0:this.handleWheel},n?a("co-video",{class:"co-lightbox__video",part:"video",key:`video-${this.index}`,ref:this.mountPlayer,src:o.src,poster:o.poster||"",aspectRatio:"auto",rounded:"none",controlsAutoHide:!1,showSpeed:!0,showPip:!0,locale:s(this.locale),onCoReady:this.handlePlayerReady,onClick:this.stop}):a("img",{class:{"co-lightbox__img":!0,"co-lightbox__img--zoomed":this.scale>1,"co-lightbox__img--dragging":this.dragging},part:"image",ref:t=>this.imgEl=t,src:o.src,alt:o.alt||"",draggable:!1,style:{transform:`translate(${this.tx}px, ${this.ty}px) scale(${this.scale})`},onClick:this.stop,onDblClick:this.handleDblClick,onPointerDown:this.handlePointerDown,onPointerMove:this.handlePointerMove,onPointerUp:this.handlePointerUp,onPointerCancel:this.handlePointerUp})),o&&e&&a("button",{key:"4ef78cd047f1e8b2efb669aefbee51b73e4c5c3b",class:"co-lightbox__nav co-lightbox__nav--prev",part:"prev",type:"button","aria-label":t.prevImage,title:t.prevImage,onClick:t=>{t.stopPropagation(),this.goTo(-1)}},a("co-icon",{key:"834bd12a0dead46df44e291197f5d3b79f619932",name:"caret-left",size:24})),o&&e&&a("button",{key:"0252acb36e360dedd1fe8ac8cba74ab5895476c1",class:"co-lightbox__nav co-lightbox__nav--next",part:"next",type:"button","aria-label":t.nextImage,title:t.nextImage,onClick:t=>{t.stopPropagation(),this.goTo(1)}},a("co-icon",{key:"53521495d2bd6ac11004cedd96fd7351135115a7",name:"caret-right",size:24})),o&&e&&a("div",{key:"fae75527e79964a30745accf565b33be3b466ba6",class:"co-lightbox__counter",part:"counter",onClick:this.stop},r))}get el(){return this}static get watchers(){return{open:[{onOpenChange:0}],startIndex:[{onStartIndexChange:0}],images:[{onImagesChange:0}]}}static get style(){return":host{display:contents;font-family:var(--co-font-family-primary)}.co-lightbox{position:fixed;inset:0;margin:0;border:0;padding:0;width:auto;height:auto;overflow:visible;color:inherit;z-index:1100;display:flex;align-items:center;justify-content:center;background:var(--co-color-opacity-negro-80);opacity:0;pointer-events:none;transition:opacity var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-lightbox--open{opacity:1;pointer-events:auto}.co-lightbox__toolbar{position:absolute;top:0;left:0;right:0;z-index:2;display:flex;align-items:center;gap:var(--co-spacing-sm2);padding:var(--co-spacing-md) var(--co-spacing-lg);background:linear-gradient(var(--co-color-opacity-negro-50), transparent)}.co-lightbox__caption{flex:1;min-width:0;color:var(--co-color-base-blanco);font-size:var(--co-font-size-14);line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-lightbox__zoom{display:flex;align-items:center;gap:var(--co-spacing-xxs);padding:0 var(--co-spacing-xs);border-radius:var(--co-border-radius-full);background:var(--co-color-opacity-blanco-8)}.co-lightbox__btn{display:flex;align-items:center;justify-content:center;min-width:32px;height:32px;padding:0 var(--co-spacing-xs);border:none;border-radius:var(--co-border-radius-full);background:transparent;color:var(--co-color-base-blanco);font-family:inherit;font-size:var(--co-font-size-13, 13px);cursor:pointer;transition:background var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-lightbox__btn:hover{background:var(--co-color-opacity-blanco-16)}.co-lightbox__zoom-value{min-width:48px;font-variant-numeric:tabular-nums}.co-lightbox__stage{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;overflow:hidden;touch-action:none}.co-lightbox__img{max-width:calc(100vw - var(--co-spacing-5xl) * 2);max-height:calc(100vh - var(--co-spacing-5xl) * 2);border-radius:var(--co-border-radius-xs);user-select:none;transition:transform var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-lightbox__video{--co-lb-ar:1.7778;flex:0 0 auto;width:auto;aspect-ratio:var(--co-lb-ar);height:min( calc(100vh - var(--co-spacing-5xl) * 2), calc((100vw - var(--co-spacing-5xl) * 2) / var(--co-lb-ar)), calc(1200px / var(--co-lb-ar)) );border-radius:var(--co-border-radius-xs);overflow:hidden}.co-lightbox__img--zoomed{cursor:grab}.co-lightbox__img--dragging{cursor:grabbing;transition:none}.co-lightbox__nav{position:absolute;top:50%;transform:translateY(-50%);z-index:2;display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:none;border-radius:var(--co-border-radius-full);background:var(--co-color-opacity-blanco-8);color:var(--co-color-base-blanco);cursor:pointer;transition:background var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-lightbox__nav:hover{background:var(--co-color-opacity-blanco-25)}.co-lightbox__nav--prev{left:var(--co-spacing-lg)}.co-lightbox__nav--next{right:var(--co-spacing-lg)}.co-lightbox__counter{position:absolute;bottom:var(--co-spacing-lg);left:50%;transform:translateX(-50%);z-index:2;padding:var(--co-spacing-xs) var(--co-spacing-md);border-radius:var(--co-border-radius-full);background:var(--co-color-opacity-blanco-8);color:var(--co-color-base-blanco);font-size:var(--co-font-size-13, 13px);font-variant-numeric:tabular-nums}"}},[1,"co-lightbox",{images:[1],startIndex:[2,"start-index"],open:[1540],locale:[1],index:[32],scale:[32],tx:[32],ty:[32],dragging:[32]},void 0,{open:[{onOpenChange:0}],startIndex:[{onStartIndexChange:0}],images:[{onImagesChange:0}]}]);function u(){"undefined"!=typeof customElements&&["co-lightbox","co-icon","co-video"].forEach((i=>{switch(i){case"co-lightbox":customElements.get(t(i))||customElements.define(t(i),b);break;case"co-icon":customElements.get(t(i))||n();break;case"co-video":customElements.get(t(i))||r()}}))}u();export{b as C,u as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t,p as n,H as e,c as o,h as i}from"./index.js";function s(t,n,e){return t!==e?null:n?"after-open":"after-close"}const r=["a[href]","area[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","iframe","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])','[tabindex]:not([tabindex="-1"])'].join(",");function a(t){if(t.shadowRoot)return Array.from(t.shadowRoot.children);if("SLOT"===t.tagName){const n=t.assignedElements({flatten:!0});return n.length?n:Array.from(t.children)}return Array.from(t.children)}function c(t){var n,e;if(!(null===(n=t.matches)||void 0===n?void 0:n.call(t,r))||t.hasAttribute("disabled"))return!1;const o=t.getAttribute("tabindex");return!(null!==o&&Number(o)<0||null===t.offsetParent&&0===t.getClientRects().length||!1===(null===(e=t.checkVisibility)||void 0===e?void 0:e.call(t,{visibilityProperty:!0})))}function h(t,n){const e=t=>{return"true"!==(o=t).getAttribute("aria-hidden")&&!o.hasAttribute("inert")&&(!!n(t)||a(t).some(e));var o};a(t).some(e)}function l(t,n){let e=null;return h(t,(t=>!!n(t)&&(e=t,!0))),e}function u(t){const n=[];return h(t,(t=>(c(t)&&n.push(t),!1))),n}function d(t,n){return t.length>0&&t[t.length-1]===n}let f=0,p="";const v=[];let y=0;const b="co-overlay--refront";function m(t){"function"==typeof requestAnimationFrame?requestAnimationFrame(t):t()}const g=n(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.coClose=o(this,"coClose",7),this.coAfterClose=o(this,"coAfterClose",3),this.coAfterOpen=o(this,"coAfterOpen",3),this.open=!1,this.trapFocus=!1,this.closeOnEscape=!1,this.hasLock=!1,this.trapId="co-overlay-trap-"+ ++y,this.trapping=!1,this.pressDownTarget=null,this.pressUpTarget=null,this.handlePointerDown=t=>{var n;this.pressDownTarget=null!==(n=t.composedPath()[0])&&void 0!==n?n:null,this.pressUpTarget=null},this.handlePointerUp=t=>{var n;this.pressUpTarget=null!==(n=t.composedPath()[0])&&void 0!==n?n:null},this.handleClick=t=>{var n;const e=null!==(n=t.composedPath()[0])&&void 0!==n?n:null,o=e===this.overlayEl&&function(t,n,e){return null!==t&&t===n&&n===e}(this.pressDownTarget,this.pressUpTarget,e);this.pressDownTarget=null,this.pressUpTarget=null,o&&this.coClose.emit()},this.handleTransitionEnd=t=>{if(t.target!==this.overlayEl)return;const n=s(t.propertyName,this.open,"opacity");"after-open"===n?this.coAfterOpen.emit():"after-close"===n&&this.coAfterClose.emit()}}onOpenChange(t){t?this.acquireLock():this.releaseLock(),this.syncPopover(),this.syncTrap()}onTrapFocusChange(){this.syncTrap()}componentDidLoad(){this.open&&this.acquireLock(),this.syncPopover(),this.syncTrap()}disconnectedCallback(){this.releaseLock(),this.releaseTrap()}async bringToFront(){const t=this.overlayEl;if(!this.open||!t||"function"!=typeof t.showPopover)return;if(!t.matches(":popover-open"))return;const n=this.deepActiveElement();t.classList.add(b);try{t.hidePopover(),t.showPopover()}catch(t){}n&&n.isConnected&&this.deepActiveElement()!==n&&n.focus({preventScroll:!0}),m((()=>t.classList.remove(b)))}acquireLock(){this.hasLock||(this.hasLock=!0,"undefined"!=typeof document&&(0===f&&(p=document.body.style.overflow,document.body.style.overflow="hidden"),f++))}releaseLock(){this.hasLock&&(this.hasLock=!1,"undefined"!=typeof document&&0!==f&&(f--,0===f&&(document.body.style.overflow=p)))}syncPopover(){const t=this.overlayEl;if(t&&"function"==typeof t.showPopover)try{const n=t.matches(":popover-open");this.open&&!n?t.showPopover():!this.open&&n&&t.hidePopover()}catch(t){}}syncTrap(){this.open&&this.trapFocus?this.engageTrap():this.releaseTrap()}engageTrap(){this.trapping||(this.trapping=!0,v.push(this.trapId),this.captureAndFocus())}releaseTrap(){if(!this.trapping)return;this.trapping=!1;const t=v.indexOf(this.trapId);t>=0&&v.splice(t,1),this.restoreFocus()}captureAndFocus(){this.returnFocusEl=this.deepActiveElement(),m((()=>{var t;if(!this.open||!this.trapping||!d(v,this.trapId))return;const n=function(t){const n=l(t,(t=>t.hasAttribute("autofocus")));if(n){if(c(n))return n;const t=n.shadowRoot?u(n)[0]:void 0;if(t)return t}return l(t,c)}(this.el);n?n.focus():null===(t=this.overlayEl)||void 0===t||t.focus()}))}restoreFocus(){const t=this.returnFocusEl;this.returnFocusEl=null,t&&t.isConnected&&"function"==typeof t.focus&&t.focus({preventScroll:!0})}deepActiveElement(){if("undefined"==typeof document)return null;let t=document.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}handleKeydown(t){this.open&&(this.closeOnEscape&&"Escape"===t.key?this.coClose.emit():this.trapping&&"Tab"===t.key&&d(v,this.trapId)&&this.trapTab(t))}trapTab(t){var n;if(t.defaultPrevented)return;const e=u(this.el);if(0===e.length)return t.preventDefault(),void(null===(n=this.overlayEl)||void 0===n||n.focus());const o=e.indexOf(this.deepActiveElement()),i=function(t,n,e){return t<=0?-1:e?n<=0?t-1:n-1:-1===n||n>=t-1?0:n+1}(e.length,o,t.shiftKey);i<0||(t.preventDefault(),e[i].focus())}render(){return i("div",{key:"9d6cec0764074a33489f79fb4a554e7aa7374785",class:{"co-overlay":!0,"co-overlay--open":this.open},part:"overlay",popover:"manual",tabindex:this.trapFocus?-1:void 0,ref:t=>this.overlayEl=t,onPointerDown:this.handlePointerDown,onPointerUp:this.handlePointerUp,onClick:this.handleClick,onTransitionEnd:this.handleTransitionEnd},i("slot",{key:"2f8ad7b23e72ce2f5c74b3cb67ba9ab80e88cf26"}))}get el(){return this}static get watchers(){return{open:[{onOpenChange:0}],trapFocus:[{onTrapFocusChange:0}]}}static get style(){return":host{display:contents}.co-overlay{position:fixed;inset:0;z-index:1000;margin:0;border:0;padding:0;width:auto;height:auto;max-width:none;max-height:none;overflow:visible;color:inherit;display:flex;align-items:center;justify-content:center;background:var(--co-overlay-bg, rgba(0, 0, 0, 0.4));-webkit-backdrop-filter:blur(var(--co-overlay-blur, 2px));backdrop-filter:blur(var(--co-overlay-blur, 2px));opacity:0;pointer-events:none;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-in)}.co-overlay--open{opacity:1;pointer-events:auto;transition:opacity var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-overlay--refront{transition:none !important}"}},[257,"co-overlay",{open:[1540],trapFocus:[516,"trap-focus"],closeOnEscape:[516,"close-on-escape"],bringToFront:[64]},[[4,"keydown","handleKeydown"]],{open:[{onOpenChange:0}],trapFocus:[{onTrapFocusChange:0}]}]);function x(){"undefined"!=typeof customElements&&["co-overlay"].forEach((n=>{"co-overlay"===n&&(customElements.get(t(n))||customElements.define(t(n),g))}))}x();export{g as C,s as a,x as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as r,p as o,H as e,c as a,h as t}from"./index.js";import{d as s,a as c}from"./p-CX0bNXK3.js";import{i,p as d,r as n}from"./p-hXbDUT3I.js";import{s as l}from"./p-CBX_oabB.js";import{d as h}from"./p-qMNHMnvI.js";import{d as p}from"./p-BH184F0X.js";const w=o(class extends e{constructor(r){super(),!1!==r&&this.__registerHost(),this.__attachShadow(),this.coClose=a(this,"coClose",7),this.coOpen=a(this,"coOpen",7),this.coAfterOpen=a(this,"coAfterOpen",7),this.coAfterClose=a(this,"coAfterClose",7),this.open=!1,this.position="right",this.size="md",this.heading="",this.description="",this.icon="",this.closable=!0,this.closeOnOverlay=!0,this.closeOnEscape=!0,this.modeless=!1,this.loading=!1,this.hasFooter=!1,this.hasTabs=!1,this.hasHeaderSlot=!1,this.handleFooterSlotChange=r=>{this.hasFooter=l(r)},this.handleTabsSlotChange=r=>{this.hasTabs=l(r)},this.handleHeaderSlotChange=r=>{this.hasHeaderSlot=l(r)},this.handleOverlayClose=()=>{this.closeOnOverlay&&this.coClose.emit()},this.handleCloseClick=()=>{this.coClose.emit()},this.stopPropagation=r=>{r.stopPropagation()},this.handleTransitionEnd=r=>{if(r.target!==this.asideEl)return;const o=c(r.propertyName,this.open,"transform");"after-open"===o?this.coAfterOpen.emit():"after-close"===o&&this.coAfterClose.emit()},this.promoteModeless=r=>{r&&(this.asideEl=r);const o=this.asideEl;if(this.modeless&&o&&"function"==typeof o.showPopover)try{o.matches(":popover-open")||o.showPopover()}catch(r){}}}get labelledBy(){return this.hasHeaderSlot?"co-drawer-header-content":this.heading?"co-drawer-heading":void 0}onOpenChange(r,o){r?d(this):n(this),r&&!o&&this.coOpen.emit()}connectedCallback(){this.open&&d(this)}disconnectedCallback(){n(this)}handleKey(r){this.open&&this.closeOnEscape&&"Escape"===r.key&&(this.modeless&&document.querySelector("co-drawer[open]:not([modeless]), co-modal[open]")||i(this)&&this.coClose.emit())}componentDidLoad(){this.promoteModeless()}render(){const r=t("aside",{class:{"co-drawer":!0,"co-sq-elevation":!0,"co-sq-elevation-fallback":!0,"co-drawer--open":this.open,"co-drawer--modeless":this.modeless,[`co-drawer--${this.position}`]:!0,[`co-drawer--${this.size}`]:!0},popover:this.modeless?"manual":void 0,ref:this.promoteModeless,part:"drawer",role:"dialog","aria-modal":this.modeless?"false":"true","aria-labelledby":this.labelledBy,onClick:this.stopPropagation,onTransitionEnd:this.handleTransitionEnd},t("div",{class:"co-drawer__card co-sq-clip",part:"card"},t("header",{class:"co-drawer__header",part:"header"},t("div",{class:"co-drawer__header-content",id:"co-drawer-header-content"},t("slot",{name:"header",onSlotchange:this.handleHeaderSlotChange},t("div",{class:"co-drawer__heading-row"},this.icon&&t("co-icon",{name:this.icon,size:20,class:"co-drawer__icon"}),t("h2",{class:"co-drawer__heading",id:"co-drawer-heading"},this.heading)),this.description&&t("p",{class:"co-drawer__description"},this.description))),this.closable&&t("button",{class:"co-drawer__close",type:"button","aria-label":"Close",onClick:this.handleCloseClick},t("co-icon",{name:"x",size:20}))),t("div",{class:{"co-drawer__tabs":!0,"co-drawer__tabs--empty":!this.hasTabs},part:"tabs"},t("slot",{name:"tabs",onSlotchange:this.handleTabsSlotChange})),t("div",{class:"co-drawer__body",part:"body"},t("slot",null),t("co-loader",{overlay:!0,visible:this.loading,part:"loader"})),t("footer",{class:{"co-drawer__footer":!0,"co-drawer__footer--empty":!this.hasFooter},part:"footer"},t("slot",{name:"footer",onSlotchange:this.handleFooterSlotChange}))));return this.modeless?r:t("co-overlay",{open:this.open,onCoClose:this.handleOverlayClose},r)}get el(){return this}static get watchers(){return{open:[{onOpenChange:0}]}}static get style(){return'.co-sq-elevation{border-radius:var(--co-sq-r);corner-shape:squircle;box-shadow:var(--co-sq-shadow)}.co-sq-clip{overflow:hidden;border-radius:var(--co-sq-r);corner-shape:squircle}@supports not (corner-shape: squircle){.co-sq-elevation{box-shadow:none}.co-sq-elevation-fallback{filter:var(--co-sq-drop-shadow)}.co-sq-clip{border-radius:0;--co-sq-tl:url("data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 100 100%27 preserveAspectRatio=%27none%27><path d=%27M100 0L97.5 0L95 0L92.5 0L90 0L87.5 0.01L85 0.01L82.5 0.02L80 0.04L77.5 0.06L75 0.1L72.5 0.14L70 0.2L67.5 0.28L65 0.38L62.5 0.5L60 0.65L57.5 0.83L55 1.04L52.5 1.3L50 1.6L47.5 1.96L45 2.37L42.5 2.85L40 3.41L37.5 4.05L35 4.8L32.5 5.65L30 6.63L27.5 7.77L25 9.07L22.5 10.58L20 12.34L17.5 14.41L15 16.85L12.5 19.79L10 23.42L7.5 28.06L5 34.37L2.5 44.29L0 100L100 100Z%27 fill=%27%23fff%27/></svg>");--co-sq-tr:url("data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 100 100%27 preserveAspectRatio=%27none%27><path d=%27M0 0L2.5 0L5 0L7.5 0L10 0L12.5 0.01L15 0.01L17.5 0.02L20 0.04L22.5 0.06L25 0.1L27.5 0.14L30 0.2L32.5 0.28L35 0.38L37.5 0.5L40 0.65L42.5 0.83L45 1.04L47.5 1.3L50 1.6L52.5 1.96L55 2.37L57.5 2.85L60 3.41L62.5 4.05L65 4.8L67.5 5.65L70 6.63L72.5 7.77L75 9.07L77.5 10.58L80 12.34L82.5 14.41L85 16.85L87.5 19.79L90 23.42L92.5 28.06L95 34.37L97.5 44.29L100 100L0 100Z%27 fill=%27%23fff%27/></svg>");--co-sq-bl:url("data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 100 100%27 preserveAspectRatio=%27none%27><path d=%27M0 0L2.5 55.71L5 65.63L7.5 71.94L10 76.58L12.5 80.21L15 83.15L17.5 85.59L20 87.66L22.5 89.42L25 90.93L27.5 92.23L30 93.37L32.5 94.35L35 95.2L37.5 95.95L40 96.59L42.5 97.15L45 97.63L47.5 98.04L50 98.4L52.5 98.7L55 98.96L57.5 99.17L60 99.35L62.5 99.5L65 99.62L67.5 99.72L70 99.8L72.5 99.86L75 99.9L77.5 99.94L80 99.96L82.5 99.98L85 99.99L87.5 99.99L90 100L92.5 100L95 100L97.5 100L100 100L100 0Z%27 fill=%27%23fff%27/></svg>");--co-sq-br:url("data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 100 100%27 preserveAspectRatio=%27none%27><path d=%27M100 0L97.5 55.71L95 65.63L92.5 71.94L90 76.58L87.5 80.21L85 83.15L82.5 85.59L80 87.66L77.5 89.42L75 90.93L72.5 92.23L70 93.37L67.5 94.35L65 95.2L62.5 95.95L60 96.59L57.5 97.15L55 97.63L52.5 98.04L50 98.4L47.5 98.7L45 98.96L42.5 99.17L40 99.35L37.5 99.5L35 99.62L32.5 99.72L30 99.8L27.5 99.86L25 99.9L22.5 99.94L20 99.96L17.5 99.98L15 99.99L12.5 99.99L10 100L7.5 100L5 100L2.5 100L0 100L0 0Z%27 fill=%27%23fff%27/></svg>");-webkit-mask:var(--co-sq-tl) top left / var(--co-sq-r) var(--co-sq-r) no-repeat, var(--co-sq-tr) top right / var(--co-sq-r) var(--co-sq-r) no-repeat, var(--co-sq-bl) bottom left / var(--co-sq-r) var(--co-sq-r) no-repeat, var(--co-sq-br) bottom right / var(--co-sq-r) var(--co-sq-r) no-repeat, linear-gradient(#fff 0 0) center / 100% calc(100% - 2 * var(--co-sq-r) + 2px) no-repeat, linear-gradient(#fff 0 0) center / calc(100% - 2 * var(--co-sq-r) + 2px) 100% no-repeat;mask:var(--co-sq-tl) top left / var(--co-sq-r) var(--co-sq-r) no-repeat, var(--co-sq-tr) top right / var(--co-sq-r) var(--co-sq-r) no-repeat, var(--co-sq-bl) bottom left / var(--co-sq-r) var(--co-sq-r) no-repeat, var(--co-sq-br) bottom right / var(--co-sq-r) var(--co-sq-r) no-repeat, linear-gradient(#fff 0 0) center / 100% calc(100% - 2 * var(--co-sq-r) + 2px) no-repeat, linear-gradient(#fff 0 0) center / calc(100% - 2 * var(--co-sq-r) + 2px) 100% no-repeat}}:host{display:contents}.co-drawer{position:fixed;display:flex;flex-direction:column;font-family:var(--co-font-family-primary);color:inherit;transition:transform var(--co-motion-duration-slow) var(--co-motion-ease-in-out);will-change:transform;z-index:1;contain:layout;--co-drawer-r:var(--co-shell-r, var(--co-border-radius-md));--co-sq-r:var(--co-drawer-r);--co-sq-shadow:0 1px 4px rgba(31, 28, 27, 0.06), 0 10px 56px rgba(31, 28, 27, 0.12);--co-sq-drop-shadow:drop-shadow(0 1px 2px rgba(31, 28, 27, 0.06)) drop-shadow(0 10px 28px rgba(31, 28, 27, 0.12))}.co-drawer--right{top:0;right:0;margin:6px;height:100vh;height:-webkit-fill-available;transform:translateX(calc(100% + 12px))}.co-drawer--right.co-drawer--open{transform:translateX(0)}.co-drawer--left{top:0;left:0;margin:6px;height:100vh;height:-webkit-fill-available;transform:translateX(calc(-100% - 12px))}.co-drawer--left.co-drawer--open{transform:translateX(0)}.co-drawer--bottom{bottom:0;left:0;right:0;margin:6px;width:auto;transform:translateY(calc(100% + 12px))}.co-drawer--bottom.co-drawer--open{transform:translateY(0)}.co-drawer--right.co-drawer--sm,.co-drawer--left.co-drawer--sm{width:400px;max-width:100vw}.co-drawer--right.co-drawer--md,.co-drawer--left.co-drawer--md{width:520px;max-width:100vw}.co-drawer--right.co-drawer--lg,.co-drawer--left.co-drawer--lg{width:672px;max-width:100vw}.co-drawer--right.co-drawer--xl,.co-drawer--left.co-drawer--xl{width:960px;max-width:100vw}.co-drawer--right.co-drawer--full,.co-drawer--left.co-drawer--full{width:100vw}.co-drawer--bottom.co-drawer--sm{height:40vh}.co-drawer--bottom.co-drawer--md{height:60vh}.co-drawer--bottom.co-drawer--lg{height:80vh}.co-drawer--bottom.co-drawer--xl{height:95vh}.co-drawer--bottom.co-drawer--full{height:100vh}.co-drawer__card{flex:1;min-height:0;display:flex;flex-direction:column;background:var(--co-semantic-surface-page);color:var(--co-semantic-text-default)}.co-drawer__header{display:flex;align-items:center;gap:var(--co-spacing-md);padding:var(--co-spacing-lg) var(--co-spacing-xl);border-bottom:1px solid var(--co-semantic-border-default);flex-shrink:0}.co-drawer__header-content{flex:1;min-width:0}.co-drawer__heading-row{display:flex;align-items:center;gap:var(--co-spacing-sm, 8px)}.co-drawer__icon{flex-shrink:0;color:var(--co-semantic-text-secondary)}.co-drawer__heading{margin:0;font-size:var(--co-font-size-18);font-weight:600;color:var(--co-semantic-text-default);line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.co-drawer__description{margin:var(--co-spacing-xs) 0 0;font-size:var(--co-font-size-13, 13px);font-weight:400;color:var(--co-semantic-text-muted);line-height:1.4}.co-drawer__close{display:flex;align-items:center;justify-content:center;padding:var(--co-spacing-xs);margin:0;border:none;background:transparent;cursor:pointer;color:var(--co-semantic-text-muted);border-radius:var(--co-border-radius-sm);transition:background var(--co-motion-duration-fast) var(--co-motion-ease-out);flex-shrink:0}.co-drawer__close:hover{background:var(--co-semantic-surface-hover)}.co-drawer__close:focus-visible{outline:2px solid var(--co-color-primary-azul);outline-offset:2px}.co-drawer__tabs{flex-shrink:0;border-bottom:1px solid var(--co-semantic-border-default)}.co-drawer__tabs--empty{display:none}.co-drawer__body{flex:1;overflow-y:auto;overscroll-behavior:contain;padding:var(--co-spacing-xl);position:relative}.co-drawer__body{scrollbar-width:thin;scrollbar-color:transparent transparent}.co-drawer__body:hover{scrollbar-color:var(--co-semantic-border-default) transparent}.co-drawer__body::-webkit-scrollbar{width:6px}.co-drawer__body::-webkit-scrollbar-track{background:transparent}.co-drawer__body::-webkit-scrollbar-thumb{background:transparent;border-radius:9999px}.co-drawer__body:hover::-webkit-scrollbar-thumb{background:var(--co-semantic-border-default)}.co-drawer__body:hover::-webkit-scrollbar-thumb:hover{background:var(--co-semantic-border-field)}.co-drawer__body:hover::-webkit-scrollbar-thumb:active{background:var(--co-semantic-border-strong)}.co-drawer__footer{display:flex;justify-content:flex-end;align-items:center;gap:var(--co-spacing-md);padding:var(--co-spacing-lg) var(--co-spacing-xl);border-top:1px solid var(--co-semantic-border-default);flex-shrink:0}.co-drawer__footer--empty{display:none}@media (max-width: 600px){.co-drawer--right,.co-drawer--left{width:100vw !important}}.co-drawer--modeless{z-index:1000;border:0;padding:0;background:transparent}.co-drawer--modeless.co-drawer--right{left:auto;bottom:auto}.co-drawer--modeless.co-drawer--left{right:auto;bottom:auto}.co-drawer--modeless.co-drawer--bottom{top:auto}'}},[257,"co-drawer",{open:[1540],position:[513],size:[513],heading:[1],description:[1],icon:[1],closable:[4],closeOnOverlay:[4,"close-on-overlay"],closeOnEscape:[4,"close-on-escape"],modeless:[516],loading:[4],hasFooter:[32],hasTabs:[32],hasHeaderSlot:[32]},[[4,"keydown","handleKey"]],{open:[{onOpenChange:0}]}]);function L(){"undefined"!=typeof customElements&&["co-drawer","co-icon","co-loader","co-overlay"].forEach((o=>{switch(o){case"co-drawer":customElements.get(r(o))||customElements.define(r(o),w);break;case"co-icon":customElements.get(r(o))||h();break;case"co-loader":customElements.get(r(o))||p();break;case"co-overlay":customElements.get(r(o))||s()}}))}L();export{w as C,L as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t,p as i,H as s,c as o,h as e}from"./index.js";import{i as h,c as n,g as r,f as a}from"./p-BtliEQAT.js";const c=[];function p(t){const i=c.indexOf(t);-1!==i&&c.splice(i,1)}function l(t){return c.length>0&&c[c.length-1]===t}const d=["top","bottom","left","right"].map((t=>`co-popover__panel--${t}`)),f=i(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.coOpen=o(this,"coOpen",3),this.coClose=o(this,"coClose",3),this.coPlacement=o(this,"coPlacement",3),this.open=!1,this.placement="bottom-start",this.matchWidth=!1,this.offset=4,this.closeOnClickOutside=!0,this.closeOnEscape=!0,this.flip=!0,this.bare=!1,this.shift=0,this.closing=!1,this.anchorSeenVisible=!1,this.keepSide=!1,this.scrollParents=[],this.cachedOffsetAncestor=null,this.offsetAncestorComputed=!1,this.docListenersBound=!1,this.finishClose=()=>{clearTimeout(this.closeFallbackTimer),this.open||(this.closing=!1,this.panelEl=void 0)},this.handlePanelTransitionEnd=t=>{!this.open&&this.closing&&t.target===this.panelEl&&"transform"===t.propertyName&&this.finishClose()},this.pressStartedInside=!1,this.handleDocumentPointerDownManual=t=>{this.pressStartedInside=t.composedPath().includes(this.el)},this.handleDocumentClickManual=t=>{const i=this.pressStartedInside;this.pressStartedInside=!1,this.open&&this.closeOnClickOutside&&(i||l(this.el)&&(t.composedPath().includes(this.el)||(this.open=!1)))},this.handleDocumentKeydownManual=t=>{this.open&&this.closeOnEscape&&l(this.el)&&"Escape"===t.key&&(t.stopPropagation(),this.open=!1)},this.updatePosition=()=>{if(!this.open||!this.triggerEl||!this.panelEl)return;const t=this.triggerEl.getBoundingClientRect(),i=this.scrollParents.map((t=>t.getBoundingClientRect()));if(h(t,i))this.anchorSeenVisible=!0;else if(this.anchorSeenVisible&&this.closeOnClickOutside)return void(this.open=!1);const s=DOMRect.fromRect({width:this.panelEl.offsetWidth,height:this.panelEl.offsetHeight}),o=this.resolveAnchor(),e=null==o?void 0:o.getBoundingClientRect(),a=this.keepSide&&this.lastPlacement?this.lastPlacement:this.placement;this.keepSide=!1,this.observePanel();const{top:c,left:p,actualPlacement:l}=n(t,s,{placement:a,offset:this.offset,flip:this.flip,anchorRect:e,shift:this.shift});this.lastPlacement=l;let f=c,m=p;if(!this.panelEl.matches(":popover-open")&&(this.offsetAncestorComputed||(this.cachedOffsetAncestor=r(this.panelEl),this.offsetAncestorComputed=!0),this.cachedOffsetAncestor)){const t=this.cachedOffsetAncestor.getBoundingClientRect();f-=t.top,m-=t.left}const v={top:`${f}px`,left:`${m}px`};if(this.matchWidth&&(v.width=`${(null!=e?e:t).width}px`),this.panelEl){Object.assign(this.panelEl.style,v);const t=`co-popover__panel--${l.split("-")[0]}`;this.panelEl.classList.contains(t)||(this.panelEl.classList.remove(...d),this.panelEl.classList.add(t),this.coPlacement.emit({placement:l})),this.panelEl.classList.add("co-popover__panel--positioned")}},this.handlePanelResize=()=>{this.open&&(this.keepSide=!0,this.scheduleUpdate())},this.scheduleUpdate=()=>{this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(this.updatePosition)},this.handleTriggerClick=()=>{this.open=!this.open}}componentDidLoad(){this.open&&this.onOpenChange(!0)}disconnectedCallback(){p(this.el),this.unbindDocListeners(),this.cleanupListeners(),clearTimeout(this.closeFallbackTimer),this.closing=!1}onOpenChange(t){var i;this.anchorSeenVisible=!1,t?(this.closing=!1,clearTimeout(this.closeFallbackTimer),p(i=this.el),c.push(i),this.coOpen.emit(),this.bindDocListeners(),this.scheduleUpdate(),requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.updatePosition()}))})),this.addScrollListeners()):(p(this.el),this.coClose.emit(),this.cleanupListeners(),this.unbindDocListeners(),this.cachedOffsetAncestor=null,this.offsetAncestorComputed=!1,this.closing=!0,clearTimeout(this.closeFallbackTimer),this.closeFallbackTimer=setTimeout((()=>this.finishClose()),400))}bindDocListeners(){this.docListenersBound||(document.addEventListener("pointerdown",this.handleDocumentPointerDownManual,!0),document.addEventListener("click",this.handleDocumentClickManual,!0),document.addEventListener("keydown",this.handleDocumentKeydownManual,!0),this.docListenersBound=!0)}unbindDocListeners(){this.docListenersBound&&(document.removeEventListener("pointerdown",this.handleDocumentPointerDownManual,!0),document.removeEventListener("click",this.handleDocumentClickManual,!0),document.removeEventListener("keydown",this.handleDocumentKeydownManual,!0),this.docListenersBound=!1,this.pressStartedInside=!1)}async toggle(){this.open=!this.open}async show(){this.open=!0}async hide(){this.open=!1}resolveAnchor(){return this.anchor?"string"==typeof this.anchor?document.querySelector(this.anchor):this.anchor:null}promotePanel(){const t=this.panelEl;if(t&&"function"==typeof t.showPopover)try{t.matches(":popover-open")||t.showPopover()}catch(t){}}observePanel(){var t;"undefined"!=typeof ResizeObserver&&this.panelEl&&this.observedPanel!==this.panelEl&&(null!==(t=this.resizeObserver)&&void 0!==t||(this.resizeObserver=new ResizeObserver(this.handlePanelResize)),this.observedPanel&&this.resizeObserver.unobserve(this.observedPanel),this.observedPanel=this.panelEl,this.resizeObserver.observe(this.panelEl))}addScrollListeners(){window.addEventListener("resize",this.scheduleUpdate,{passive:!0}),window.addEventListener("scroll",this.scheduleUpdate,{passive:!0,capture:!0}),this.scrollParents=a(this.el);for(const t of this.scrollParents)t.addEventListener("scroll",this.scheduleUpdate,{passive:!0})}cleanupListeners(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect(),this.observedPanel=void 0,this.lastPlacement=void 0,this.keepSide=!1,this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=void 0),window.removeEventListener("resize",this.scheduleUpdate),window.removeEventListener("scroll",this.scheduleUpdate,{capture:!0});for(const t of this.scrollParents)t.removeEventListener("scroll",this.scheduleUpdate);this.scrollParents=[]}render(){return e("div",{key:"a85df32be71c08c86bd19a31224b51b899d1f468",class:"co-popover"},e("div",{key:"accafae8513bad7bfbf32b7e98f0dc6ec0968efa",class:"co-popover__trigger",ref:t=>this.triggerEl=t,onClick:this.handleTriggerClick},e("slot",{key:"f12247af31066f6d4cbdd45671146b3ea5c996bc",name:"trigger"})),(this.open||this.closing)&&e("div",{key:"64dbc77cae4a913bbe3ec4174f6b18c4982520ae",class:{"co-popover__panel":!0,"co-popover__panel--closing":this.closing},part:"panel",popover:"manual",onTransitionEnd:this.handlePanelTransitionEnd,ref:t=>{t&&t!==this.panelEl&&(this.panelEl=t,this.promotePanel(),this.scheduleUpdate())}},e("slot",{key:"858df49b45b1bd72f215f5e408e835227633d41f"})))}get el(){return this}static get watchers(){return{open:[{onOpenChange:0}]}}static get style(){return":host{display:inline-block;position:relative}:host([match-width]){display:block;width:100%}.co-popover{display:block;width:100%}.co-popover__trigger{display:block;width:100%;cursor:pointer}.co-popover__panel{position:fixed;inset:auto;top:0;left:0;margin:0;padding:0;width:auto;height:auto;max-width:none;max-height:none;z-index:10000;visibility:hidden;opacity:0;transform:scale(0.97);background:var(--co-semantic-surface-page, #fff);color:var(--co-semantic-text-default);border:1px solid var(--co-popover-border-color, var(--co-semantic-border-subtle));border-radius:var(--co-border-radius-sm, 12px);box-shadow:var(--co-popover-shadow, 0 4px 16px rgba(31, 28, 27, 0.08));overflow:visible}:host([bare]) .co-popover__panel{background:transparent;border:0;box-shadow:none}.co-popover__panel--positioned{visibility:visible;opacity:1;transform:scale(1);transition:opacity var(--co-motion-duration-base) var(--co-motion-ease-out), transform var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-popover__panel--closing{visibility:visible;opacity:0;transform:scale(0.99);pointer-events:none;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-in), transform var(--co-motion-duration-fast) var(--co-motion-ease-in)}.co-popover__panel--bottom{transform-origin:top center}.co-popover__panel--top{transform-origin:bottom center}.co-popover__panel--right{transform-origin:center left}.co-popover__panel--left{transform-origin:center right}"}},[257,"co-popover",{open:[1540],placement:[1],matchWidth:[516,"match-width"],offset:[2],closeOnClickOutside:[4,"close-on-click-outside"],closeOnEscape:[4,"close-on-escape"],flip:[4],bare:[516],anchor:[1],shift:[2],closing:[32],toggle:[64],show:[64],hide:[64]},void 0,{open:[{onOpenChange:0}]}]);function m(){"undefined"!=typeof customElements&&["co-popover"].forEach((i=>{"co-popover"===i&&(customElements.get(t(i))||customElements.define(t(i),f))}))}m();export{f as C,m as d}
|