@prolibu-suite/cobalt-core 0.11.5 → 0.11.6
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 +65 -31
- package/dist/cjs/co-kbd_2.cjs.entry.js +10 -3
- package/dist/cjs/cobalt.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cobalt/cobalt.esm.js +1 -1
- package/dist/cobalt/p-868d1a18.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-popover/co-popover.js +1 -1
- 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 +1 -1
- package/dist/collection/components/co-toast/co-toast.js +2 -2
- package/dist/collection/components/co-tooltip/co-tooltip.css +14 -5
- package/dist/collection/components/co-tooltip/co-tooltip.js +29 -2
- 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/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-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-document-editor.js +1 -1
- package/dist/components/co-file-field.js +1 -1
- package/dist/components/co-list-item.js +1 -1
- package/dist/components/co-option-list.js +1 -1
- package/dist/components/co-ref-field.js +1 -1
- package/dist/components/co-sidebar-nav.js +1 -1
- package/dist/components/co-tooltip.js +1 -1
- package/dist/components/{p-BqFBZ1PT.js → p-BW10Sgiy.js} +1 -1
- package/dist/components/{p-VcrjNCew.js → p-BzNBPHen.js} +1 -1
- package/dist/components/p-V7HYy0VO.js +1 -0
- package/dist/esm/co-kbd_2.entry.js +10 -3
- package/dist/esm/cobalt.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/co-tooltip/co-tooltip.d.ts +6 -0
- package/dist/types/components.d.ts +11 -0
- package/package.json +3 -3
- package/dist/cobalt/p-db623519.entry.js +0 -1
- package/dist/components/p-9VoFSbIH.js +0 -1
|
@@ -5898,6 +5898,11 @@ export namespace Components {
|
|
|
5898
5898
|
* @default 80
|
|
5899
5899
|
*/
|
|
5900
5900
|
"showDelay": number;
|
|
5901
|
+
/**
|
|
5902
|
+
* Color tone of the panel (and arrow). `error` = solid `--co-semantic-status-error` surface with white text, for a record/state warning (e.g. "Inactive"). Independent of `variant`.
|
|
5903
|
+
* @default 'default'
|
|
5904
|
+
*/
|
|
5905
|
+
"tone": 'default' | 'error';
|
|
5901
5906
|
/**
|
|
5902
5907
|
* Visual variant. `label` = compact pill for a labeled trigger with an optional keyboard shortcut (radius `--co-border-radius-xs`, tighter padding, medium (500) text, `line-height: 1`, no shadow, arrow hidden). The arrow hide is CSS-only — `arrow`'s own default/behavior is unchanged.
|
|
5903
5908
|
* @default 'default'
|
|
@@ -15645,6 +15650,11 @@ declare namespace LocalJSX {
|
|
|
15645
15650
|
* @default 80
|
|
15646
15651
|
*/
|
|
15647
15652
|
"showDelay"?: number;
|
|
15653
|
+
/**
|
|
15654
|
+
* Color tone of the panel (and arrow). `error` = solid `--co-semantic-status-error` surface with white text, for a record/state warning (e.g. "Inactive"). Independent of `variant`.
|
|
15655
|
+
* @default 'default'
|
|
15656
|
+
*/
|
|
15657
|
+
"tone"?: 'default' | 'error';
|
|
15648
15658
|
/**
|
|
15649
15659
|
* Visual variant. `label` = compact pill for a labeled trigger with an optional keyboard shortcut (radius `--co-border-radius-xs`, tighter padding, medium (500) text, `line-height: 1`, no shadow, arrow hidden). The arrow hide is CSS-only — `arrow`'s own default/behavior is unchanged.
|
|
15650
15660
|
* @default 'default'
|
|
@@ -17150,6 +17160,7 @@ declare namespace LocalJSX {
|
|
|
17150
17160
|
"maxWidth": string;
|
|
17151
17161
|
"block": boolean;
|
|
17152
17162
|
"variant": 'default' | 'label';
|
|
17163
|
+
"tone": 'default' | 'error';
|
|
17153
17164
|
"shortcut": string;
|
|
17154
17165
|
}
|
|
17155
17166
|
interface CoTransferListAttributes {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prolibu-suite/cobalt-core",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.6",
|
|
4
4
|
"description": "Cobalt Design System — Framework-agnostic Web Components built with Stencil",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"@phosphor-icons/core": "^2.1.1",
|
|
51
51
|
"dompurify": "^3.2.6",
|
|
52
52
|
"overlayscrollbars": "^2.16.0",
|
|
53
|
-
"@prolibu-suite/cobalt-date-utils": "0.1.2",
|
|
54
|
-
"@prolibu-suite/cobalt-tokens": "0.6.0",
|
|
55
53
|
"@prolibu-suite/cobalt-rich-text": "0.2.1",
|
|
54
|
+
"@prolibu-suite/cobalt-tokens": "0.6.0",
|
|
55
|
+
"@prolibu-suite/cobalt-date-utils": "0.1.2",
|
|
56
56
|
"@prolibu-suite/cobalt-calendar-utils": "0.1.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
@@ -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:"d2b28cba40938051dd4488ceb0e06391e9e4b31d",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.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:"816e80ee775d782c3827fb3ba43187992e348429",class:"co-tooltip"},o("div",{key:"d4d3b56ae5502ccc4fc5c30c5191860ebef51140",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:"357ff69bca524ce8c5f3ec21936fef944733cd22"})),(this.visible||this.closing)&&this.content&&o("div",{key:"7d379c2ddafa6e84fbe5d5a4d3e9192a3ddfac87",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--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:"0898aa009807ee6d48cdb01a5db9f4ef773804b9",class:`co-tooltip__arrow co-tooltip__arrow--${t}`}),o("span",{key:"07678a78b9fdf0955c54d4dc2c491e5205e7937d",class:"co-tooltip__content"},this.content),this.shortcut&&o("co-kbd",{key:"24aa138140da114eed006f3488dc6cbc105ccee3",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;background:var(--co-color-base-negro, #1f1c1b);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-color-base-negro, #1f1c1b);border-bottom:none}.co-tooltip__arrow--bottom{top:-5px;left:50%;transform:translateX(-50%);border-bottom-color:var(--co-color-base-negro, #1f1c1b);border-top:none}.co-tooltip__arrow--left{right:-10px;top:50%;transform:translateY(-50%);border-left-color:var(--co-color-base-negro, #1f1c1b);border-right:none}.co-tooltip__arrow--right{left:-5px;top:50%;transform:translateY(-50%);border-right-color:var(--co-color-base-negro, #1f1c1b);border-left:none}.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{t,p as o,H as i,h as s}from"./index.js";import{c as e,g as a,f as n}from"./p-BtliEQAT.js";import{d as r}from"./p-KK2vAKs-.js";import{d as l}from"./p-8XzG8pzY.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.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:n}=e(t,o,{placement:this.placement,offset:this.offset,flip:this.flip});this.actualPlacement=n;let r=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();r-=t.top,l-=t.left}this.panelEl&&(this.panelEl.style.top=`${r}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=n(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:"816e80ee775d782c3827fb3ba43187992e348429",class:"co-tooltip"},s("div",{key:"d4d3b56ae5502ccc4fc5c30c5191860ebef51140",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:"357ff69bca524ce8c5f3ec21936fef944733cd22"})),(this.visible||this.closing)&&this.content&&s("div",{key:"7d379c2ddafa6e84fbe5d5a4d3e9192a3ddfac87",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--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:"0898aa009807ee6d48cdb01a5db9f4ef773804b9",class:`co-tooltip__arrow co-tooltip__arrow--${t}`}),s("span",{key:"07678a78b9fdf0955c54d4dc2c491e5205e7937d",class:"co-tooltip__content"},this.content),this.shortcut&&s("co-kbd",{key:"24aa138140da114eed006f3488dc6cbc105ccee3",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;background:var(--co-color-base-negro, #1f1c1b);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-color-base-negro, #1f1c1b);border-bottom:none}.co-tooltip__arrow--bottom{top:-5px;left:50%;transform:translateX(-50%);border-bottom-color:var(--co-color-base-negro, #1f1c1b);border-top:none}.co-tooltip__arrow--left{right:-10px;top:50%;transform:translateY(-50%);border-left-color:var(--co-color-base-negro, #1f1c1b);border-right:none}.co-tooltip__arrow--right{left:-5px;top:50%;transform:translateY(-50%);border-right-color:var(--co-color-base-negro, #1f1c1b);border-left:none}.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],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))||r();break;case"co-kbd":customElements.get(t(o))||l()}}))}h();export{c as C,h as d}
|