@ds-mo/ui 14.22.0 → 14.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.package-ready.json +1 -1
- package/dist/agent-patterns.json +1 -1
- package/dist/agent.json +1 -1
- package/dist/components/ds-agent-questionnaire.js +1 -1
- package/dist/components/ds-agent-response.js +1 -1
- package/dist/components/ds-banner.js +1 -1
- package/dist/components/ds-bar-nav.js +1 -1
- package/dist/components/ds-bar-title.js +1 -1
- package/dist/components/ds-bar-workflow.js +1 -1
- package/dist/components/ds-button-unfilled.js +1 -1
- package/dist/components/ds-card-chart.js +1 -1
- package/dist/components/ds-card-overview.js +1 -1
- package/dist/components/ds-card-overview.js.map +1 -1
- package/dist/components/ds-card-setting.js +1 -1
- package/dist/components/ds-code-block.js +1 -1
- package/dist/components/ds-filter-menu.js +1 -1
- package/dist/components/ds-input.js +1 -1
- package/dist/components/ds-markdown.js +1 -1
- package/dist/components/ds-menu.js +1 -1
- package/dist/components/ds-message-actions.js +1 -1
- package/dist/components/ds-message-composer.js +1 -1
- package/dist/components/ds-message-scroller.js +1 -1
- package/dist/components/ds-mobile-header.js +1 -1
- package/dist/components/ds-mobile-section-switcher.js +1 -1
- package/dist/components/ds-mobile-sheet-nav.js +1 -1
- package/dist/components/ds-modal.js +1 -1
- package/dist/components/ds-pagination.js +1 -1
- package/dist/components/ds-panel-nav.js +1 -1
- package/dist/components/ds-panel-tool-header.js +1 -1
- package/dist/components/ds-panel-tool-search.js +1 -1
- package/dist/components/ds-panel-tools.js +1 -1
- package/dist/components/ds-select.js +1 -1
- package/dist/components/ds-shell-app.js +1 -1
- package/dist/components/ds-shell-tools.js +1 -1
- package/dist/components/ds-table-filter.js +1 -1
- package/dist/components/ds-table-group.js +1 -1
- package/dist/components/ds-table-saved-views.js +1 -1
- package/dist/components/ds-table-search.js +1 -1
- package/dist/components/ds-table-sort.js +1 -1
- package/dist/components/ds-table.js +1 -1
- package/dist/components/ds-table.js.map +1 -1
- package/dist/components/ds-toast.js +1 -1
- package/dist/components/ds-tooltip.js +1 -1
- package/dist/components/{p-DnZ7DNaz.js → p--68f7nIx.js} +2 -2
- package/dist/components/{p-CZ144LS5.js → p-0X-4KGQf.js} +2 -2
- package/dist/components/{p-DSy1oOnd.js → p-7MWaWl8w.js} +2 -2
- package/dist/components/{p-hYjmOPCI.js → p-9M0ak2q_.js} +2 -2
- package/dist/components/{p-pnO8tAYB.js → p-9X_p0bHr.js} +2 -2
- package/dist/components/{p-BFit8o0r.js → p-BIaHDBfP.js} +2 -2
- package/dist/components/{p-9ykZwPlI.js → p-CL0tECXf.js} +2 -2
- package/dist/components/{p-9ykZwPlI.js.map → p-CL0tECXf.js.map} +1 -1
- package/dist/components/{p-Bd8I2oXN.js → p-COFw_fcj.js} +2 -2
- package/dist/components/{p-D36EmETH.js → p-CilwchJH.js} +2 -2
- package/dist/components/{p-Cnsvgx1M.js → p-CrYJnDev.js} +2 -2
- package/dist/components/{p-_C-XRpCB.js → p-CvHrCyuz.js} +2 -2
- package/dist/components/{p-De0qjzPu.js → p-DAFR4U9P.js} +2 -2
- package/dist/components/{p-CeKa4VbU.js → p-DXbryJHz.js} +2 -2
- package/dist/components/{p-CFkZSDwI.js → p-DeK_6Uym.js} +2 -2
- package/dist/components/{p-Dit6JmAK.js → p-DiyO47xX.js} +2 -2
- package/dist/components/{p-DCbKsABt.js → p-DjF2m7bf.js} +2 -2
- package/dist/components/{p-DCbKsABt.js.map → p-DjF2m7bf.js.map} +1 -1
- package/dist/components/{p-CB3fv_Oh.js → p-DrVA5L25.js} +2 -2
- package/dist/components/{p-BbG7nOcz.js → p-DzVYGJJv.js} +2 -2
- package/dist/components/{p-B1wMpt1z.js → p-FitB53eM.js} +2 -2
- package/dist/components/{p-6rB0eAda.js → p-FxtgCvhA.js} +2 -2
- package/dist/components/{p-pxN8JGEh.js → p-nVv71P3f.js} +2 -2
- package/dist/docs/components.json +1 -1
- package/dist/mcp-data/registry/card-overview.json +1 -1
- package/dist/mcp-data/registry/modal.json +1 -1
- package/dist/mcp-data/registry/table.json +1 -1
- package/dist/types/components/CardOverview/CardOverview.d.ts +1 -0
- package/dist/types/components/Table/Table.d.ts +3 -0
- package/package.json +1 -1
- /package/dist/components/{p-DnZ7DNaz.js.map → p--68f7nIx.js.map} +0 -0
- /package/dist/components/{p-CZ144LS5.js.map → p-0X-4KGQf.js.map} +0 -0
- /package/dist/components/{p-DSy1oOnd.js.map → p-7MWaWl8w.js.map} +0 -0
- /package/dist/components/{p-hYjmOPCI.js.map → p-9M0ak2q_.js.map} +0 -0
- /package/dist/components/{p-pnO8tAYB.js.map → p-9X_p0bHr.js.map} +0 -0
- /package/dist/components/{p-BFit8o0r.js.map → p-BIaHDBfP.js.map} +0 -0
- /package/dist/components/{p-Bd8I2oXN.js.map → p-COFw_fcj.js.map} +0 -0
- /package/dist/components/{p-D36EmETH.js.map → p-CilwchJH.js.map} +0 -0
- /package/dist/components/{p-Cnsvgx1M.js.map → p-CrYJnDev.js.map} +0 -0
- /package/dist/components/{p-_C-XRpCB.js.map → p-CvHrCyuz.js.map} +0 -0
- /package/dist/components/{p-De0qjzPu.js.map → p-DAFR4U9P.js.map} +0 -0
- /package/dist/components/{p-CeKa4VbU.js.map → p-DXbryJHz.js.map} +0 -0
- /package/dist/components/{p-CFkZSDwI.js.map → p-DeK_6Uym.js.map} +0 -0
- /package/dist/components/{p-Dit6JmAK.js.map → p-DiyO47xX.js.map} +0 -0
- /package/dist/components/{p-CB3fv_Oh.js.map → p-DrVA5L25.js.map} +0 -0
- /package/dist/components/{p-BbG7nOcz.js.map → p-DzVYGJJv.js.map} +0 -0
- /package/dist/components/{p-B1wMpt1z.js.map → p-FitB53eM.js.map} +0 -0
- /package/dist/components/{p-6rB0eAda.js.map → p-FxtgCvhA.js.map} +0 -0
- /package/dist/components/{p-pxN8JGEh.js.map → p-nVv71P3f.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,H as s,c as t,h as o,a as i,t as n}from"./index.js";import{p as r}from"./p-CUL5_8JM.js";import{d as a}from"./p-DzPtYdXy.js";import{d as l}from"./p-DSy1oOnd.js";import{d}from"./p-Cea7rROU.js";import{d as c}from"./p-0XTyQNRG.js";import{d as h}from"./p-BbG7nOcz.js";import{d as f}from"./p-Cd1JnnVK.js";import{d as u}from"./p-pnO8tAYB.js";const p=["agents","messages","activity","search","stacks","help"];const m="agents";const g={search:"Search",messages:"Messages",stacks:"Stacks",activity:"Activity",agents:"Agents",help:"Help & Support"};const v={search:"K",agents:"A",messages:"M",stacks:"S",activity:"N",help:"/"};const b=[{id:"agents",icon:"AI",label:g.agents,railPlacement:"header",order:0,shortcutKey:v.agents,mobileDestination:"agents"},{id:"messages",icon:"MessageBubbleStack",label:g.messages,order:0,shortcutKey:v.messages,mobileDestination:"messages"},{id:"activity",icon:"Bell",label:g.activity,order:1,shortcutKey:v.activity,mobileDestination:"activity"},{id:"search",icon:"MagnifyingGlass",label:g.search,order:2,shortcutKey:v.search,mobileDestination:"search"},{id:"help",icon:"CircleQuestion",label:g.help,railPlacement:"footer",order:0,shortcutKey:v.help,mobileDestination:"help"}];function w(e){const s=new Map;for(const t of e){if(t.id.trim()&&!s.has(t.id))s.set(t.id,t)}const t={header:0,body:1,footer:2};return Array.from(s.values()).sort(((e,s)=>{const o=_(e);const i=_(s);const n=t[o]-t[i];if(n!==0)return n;const r=p.findIndex((s=>s===e.id));const a=p.findIndex((e=>e===s.id));const l=e.order??(r<0?Number.MAX_SAFE_INTEGER:r);const d=s.order??(a<0?Number.MAX_SAFE_INTEGER:a);return l-d}))}function y(e){return typeof e==="string"&&e.trim().length>0}function _(e){if(e.railPlacement)return e.railPlacement;if(e.id===m)return"header";if(e.id==="help")return"footer";return"body"}function x(e,s,t){if(!t||e.some((e=>e.id===t))){return{open:s,activeTool:t,removedTool:""}}return{open:false,activeTool:"",removedTool:t}}function k(e){const s=e.transitionProperty.split(",").map((e=>e.trim()));const t=e.transitionDuration.split(",").map((e=>r(e.trim(),0)));const o=e.transitionDelay.split(",").map((e=>r(e.trim(),0)));return s.reduce(((e,s,i)=>{if(s!=="all"&&s!=="max-width")return e;const n=t[i%t.length]??0;const r=o[i%o.length]??0;return Math.max(e,n+r,0)}),0)}function T(e,s){return!e&&s==="idle"}function C(e,s,t){if(t==="closing")return e<=.5;if(t==="opening")return s>0&&e>=s-.5;return true}function A(e,s,t){if(e&&s===t){return{open:false,activeTool:t,selected:false}}return{open:true,activeTool:t,selected:true}}const z=()=>`.ds-control--lg,:host(.ds-control--lg),:host(.ds-control--md),.ds-control--md,:host(.ds-control--sm),.ds-control--sm,:host(.ds-control--xs),.ds-control--xs{--ds-control-radius:var(--dimension-radius-025)}:host(.ds-control--lg),.ds-control--lg{--ds-control-height:var(--dimension-size-500);--ds-control-icon:var(--dimension-iconography-lg);--ds-control-padding-inline:var(--dimension-space-100);--ds-control-label-inset:var(--dimension-space-050);--ds-control-gap:var(--dimension-space-050)}:host(.ds-control--md),.ds-control--md{--ds-control-height:var(--dimension-size-400);--ds-control-icon:var(--dimension-iconography-md);--ds-control-padding-inline:var(--dimension-space-075);--ds-control-label-inset:var(--dimension-space-025);--ds-control-gap:var(--dimension-space-050)}:host(.ds-control--sm),.ds-control--sm{--ds-control-height:var(--dimension-size-300);--ds-control-icon:var(--dimension-iconography-sm);--ds-control-padding-inline:var(--dimension-space-050);--ds-control-label-inset:var(--dimension-space-025);--ds-control-gap:var(--dimension-space-025)}:host(.ds-control--xs),.ds-control--xs{--ds-control-height:var(--dimension-size-200);--ds-control-icon:var(--dimension-iconography-xs);--ds-control-padding-inline:var(--dimension-space-025);--ds-control-label-inset:var(--dimension-space-025);--ds-control-gap:0}:host(.ds-chrome-space--sm),.ds-chrome-space--sm{--ds-chrome-padding:var(--dimension-space-050);--ds-chrome-gap:var(--dimension-space-050)}:host(.ds-chrome-space--md),.ds-chrome-space--md{--ds-chrome-padding:var(--dimension-space-100);--ds-chrome-gap:var(--dimension-space-100)}:host(.ds-chrome-space--lg),.ds-chrome-space--lg{--ds-chrome-padding:var(--dimension-space-200);--ds-chrome-gap:var(--dimension-space-200)}:host(.ds-chrome-row),.ds-chrome-row,:host(.ds-chrome-column),.ds-chrome-column,:host(.ds-chrome-grid),.ds-chrome-grid{display:flex;box-sizing:border-box;gap:var(--ds-chrome-gap, var(--dimension-space-100));padding:var(--ds-chrome-padding, var(--dimension-space-100))}:host(.ds-chrome-row),.ds-chrome-row{flex-direction:row;align-items:center}:host(.ds-chrome-column),.ds-chrome-column{flex-direction:column}:host(.ds-chrome-grid),.ds-chrome-grid{display:grid;align-items:center}@media (forced-colors: active){:root,:host,.ds-forced-colors-scope{--ds-forced-color-surface:Canvas;--ds-forced-color-content:CanvasText;--ds-forced-color-control-boundary:ButtonText;--ds-forced-color-selected:Highlight;--ds-forced-color-on-selected:HighlightText;--ds-forced-color-disabled:GrayText}}:host{--ds-focus-ring-width:var(--dimension-stroke-width-025, 2px);--ds-focus-ring-offset:var(--dimension-space-025, 2px);--ds-focus-ring-color:var(--color-interaction-focus)}:host(.ds-focus-ring),.ds-focus-ring,:host(.ds-focus-ring-inset),.ds-focus-ring-inset{outline:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation}:host(.ds-focus-ring:focus-visible),.ds-focus-ring:focus-visible{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:var(--ds-focus-ring-offset)}:host(.ds-focus-ring.ds-focus-ring--visible),.ds-focus-ring.ds-focus-ring--visible{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:var(--ds-focus-ring-offset)}:host(.ds-focus-ring-inset:focus-visible),.ds-focus-ring-inset:focus-visible{outline:none}:host(.ds-focus-ring-inset:focus-visible)::after,.ds-focus-ring-inset:focus-visible::after{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:calc(-1 * var(--ds-focus-ring-width))}:host(.ds-focus-ring-inset.ds-focus-ring--visible),.ds-focus-ring-inset.ds-focus-ring--visible{outline:none}:host(.ds-focus-ring-inset.ds-focus-ring--visible)::after,.ds-focus-ring-inset.ds-focus-ring--visible::after{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:calc(-1 * var(--ds-focus-ring-width))}@media (forced-colors: active){:host{--ds-focus-ring-color:var(--ds-forced-color-selected)}}:host(.ds-scrollbar-hidden),.ds-scrollbar-hidden{scrollbar-width:none}:host(.ds-scrollbar-hidden)::-webkit-scrollbar,.ds-scrollbar-hidden::-webkit-scrollbar{display:none}:host{display:block;flex:0 0 auto;box-sizing:border-box;height:100%;min-height:0;overflow:hidden;--_panel-tools-rail-width:var(--dimension-size-600);--_panel-tools-drawer-width:var(--ds-shell-panel-tools-width, var(--dimension-panel-width-xs));--_panel-tools-border:var(--dimension-stroke-width-012, 1px) solid var(--color-border-tertiary);--_panel-tools-expand-dur:var(--effect-animation-duration-medium-1, 300ms)}.panel-tools__layout{display:flex;flex-direction:row-reverse;align-items:stretch;height:100%;min-height:0;box-sizing:border-box}.panel-tools__drawer{flex:0 0 auto;max-width:0;min-width:0;height:100%;min-height:0;overflow:hidden;box-sizing:border-box;transition:none}:host(.panel-tools--ready) .panel-tools__drawer{transition:max-width var(--_panel-tools-expand-dur) var(--effect-animation-easing-ease-in-out, ease)}:host(.panel-tools--ready.panel-tools--motion-opening) .panel-tools__drawer{transition:max-width var(--_panel-tools-expand-dur) var(--effect-animation-easing-ease-out, ease-out)}:host(.panel-tools--ready.panel-tools--motion-closing) .panel-tools__drawer{transition:max-width var(--_panel-tools-expand-dur) var(--effect-animation-easing-ease-in, ease-in)}:host(.panel-tools--open) .panel-tools__drawer{max-width:var(--_panel-tools-drawer-width)}.panel-tools__drawer--visible{border-left:var(--_panel-tools-border)}.panel-tools__drawer-surface{display:flex;flex-direction:column;width:var(--_panel-tools-drawer-width);height:100%;min-height:0;box-sizing:border-box;background-color:transparent}.panel-tools__full-views,.panel-tools__full-view{flex:1 1 auto;min-height:0;overflow:hidden}.panel-tools__full-view{height:100%}.panel-tools__full-view{display:none}.panel-tools__full-view--active{display:block}:host([presentation='fullscreen']){height:100vh;inset:0;position:fixed;width:100vw;z-index:var(--dimension-z-index-modal)}:host([presentation='fullscreen']) .panel-tools__rail{display:none}:host([presentation='fullscreen']) .panel-tools__drawer{max-width:100vw;transition:none;width:100vw}:host([presentation='fullscreen']) .panel-tools__drawer--visible{border-left:none}:host([presentation='fullscreen']) .panel-tools__drawer-surface{background-color:transparent;width:100vw}:host([presentation='fullscreen']:not(.panel-tools--fullscreen)) .panel-tools__drawer-surface,:host(.panel-tools--fullscreen:not([presentation='fullscreen'])) .panel-tools__drawer-surface{visibility:hidden}:host(.panel-tools--presentation-snap) .panel-tools__drawer{transition:none}.panel-tools__body{flex:1 1 auto;min-height:0;overflow:auto;position:relative}:host(.panel-tools--drawer-resting) .panel-tools__body{content-visibility:auto;contain-intrinsic-size:auto 200px}.panel-tools__view{display:none;height:100%;min-height:0;box-sizing:border-box;padding:var(--dimension-space-200);color:var(--color-foreground-secondary);font-family:var(--typography-font-family-ui);font-size:var(--typography-fontsize-md);line-height:var(--typography-lineheight-md);font-weight:var(--typography-weight-regular);letter-spacing:var(--typography-letterspacing-negative-half)}.panel-tools__view ::slotted(*){margin:0;color:var(--color-foreground-secondary);font-family:var(--typography-font-family-ui);font-size:var(--typography-fontsize-md);line-height:var(--typography-lineheight-md);font-weight:var(--typography-weight-regular);letter-spacing:var(--typography-letterspacing-negative-half)}.panel-tools__view--active{display:block}.panel-tools__rail{flex:0 0 var(--_panel-tools-rail-width);width:var(--_panel-tools-rail-width);min-width:var(--_panel-tools-rail-width);display:flex;flex-direction:column;box-sizing:border-box;height:100%;min-height:0;border-left:var(--_panel-tools-border);background-color:transparent}.panel-tools__rail-header{justify-content:center;height:var(--dimension-size-600);flex-shrink:0;border-bottom:var(--_panel-tools-border)}.panel-tools__rail-body{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden}.panel-tools__rail-actions{display:flex;flex-direction:column;gap:var(--dimension-space-050);width:100%}.panel-tools__rail-footer{justify-content:center;flex-shrink:0;margin-top:auto}.panel-tools__rail-action{display:flex;align-items:center;justify-content:center;width:100%;height:var(--ds-control-height);flex-shrink:0}@media (prefers-reduced-motion: reduce){:host(.panel-tools--ready.panel-tools--motion-opening) .panel-tools__drawer,:host(.panel-tools--ready.panel-tools--motion-closing) .panel-tools__drawer{transition:none}}`;const S=e(class e extends s{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.dsToolChange=t(this,"dsToolChange",7);this.dsPresentationChange=t(this,"dsPresentationChange",7);this.dsHeaderBack=t(this,"dsHeaderBack",7);this.dsHeaderAction=t(this,"dsHeaderAction",7);this.dsChromeTransitionStart=t(this,"dsChromeTransitionStart",7);this.dsChromeTransitionEnd=t(this,"dsChromeTransitionEnd",7);this.open=false;this.presentation="drawer";this.fullscreenHeaderMode="shared";this.activeTool="";this.items=[];this.toolsLabel="Tools";this.toolShortcutsLabel="Tool shortcuts";this.headers={};this.storageKey="";this.motion="idle";this.drawerSurfaceRetained=false;this.readyForMotion=false;this.presentationMotionSuppressed=false;this.rovingIndex=0;this.fullViewToolIds=[];this.railBodyScrollable=false;this.motionEnableGeneration=0;this.presentationMotionGeneration=0;this.transitionGeneration=0;this.transitionFallbackTimer=null;this.ignoreReplacementTerminal=false;this.focusBeforeFullscreen=null;this.fullViewObserver=null;this.handleComposedHeaderAction=e=>{const s=e.detail;if(!this.activeTool||!s?.id)return;e.stopPropagation();this.dsHeaderAction.emit({tool:this.activeTool,id:s.id,anchor:s.anchor})};this.handleTransitionEnd=e=>{const s=this.renderRoot.querySelector(".panel-tools__drawer");if(e.target!==s)return;if(e.propertyName!=="max-width")return;if(this.ignoreReplacementTerminal){this.ignoreReplacementTerminal=false;return}if(e.type==="transitioncancel")return;if(s&&!this.drawerTransitionAtTerminal(s,this.motion))return;this.finishDrawerTransition()};this.handleToolChange=e=>{const s=A(this.open,this.activeTool,e);this.open=s.open;this.activeTool=s.activeTool;this.dsToolChange.emit({id:e,selected:s.selected})};this.handleRailKeyDown=(e,s)=>{const t=this.orderedRailItems;if(!t.length)return;if(e.key==="Enter"||e.key===" "){e.preventDefault();this.handleToolChange(t[s].id);return}if(e.key==="ArrowDown"){if(s>=t.length-1)return;e.preventDefault();this.focusRailAt(s+1);return}if(e.key==="ArrowUp"){if(s<=0)return;e.preventDefault();this.focusRailAt(s-1)}}}get railItems(){return this.items??[]}get orderedRailItems(){return w(this.railItems)}disconnectedCallback(){this.el.removeEventListener("transitionend",this.handleTransitionEnd);this.el.removeEventListener("transitioncancel",this.handleTransitionEnd);this.el.removeEventListener("dsAction",this.handleComposedHeaderAction);this.clearTransitionCompletion();this.motionEnableGeneration+=1;this.fullViewObserver?.disconnect();this.fullViewObserver=null;this.disconnectRailBodyObserver()}presentationChanged(e,t){if(e===t)return;if(this.el.getAttribute("presentation")!==e){this.el.setAttribute("presentation",e)}const o=++this.presentationMotionGeneration;this.presentationMotionSuppressed=true;requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(o!==this.presentationMotionGeneration)return;this.presentationMotionSuppressed=false}))}));if(e==="fullscreen"){this.focusBeforeFullscreen=document.activeElement instanceof s?document.activeElement:null;this.open=true}else if(t==="fullscreen"){const e=this.focusBeforeFullscreen;const s=this.activeHeader().actions?.[0]?.id;requestAnimationFrame((async()=>{if(e?.isConnected){e.focus({preventScroll:true})}const t=e?document.activeElement===e||e.contains(document.activeElement):false;if(!t&&s)await this.focusHeaderAction(s);this.focusBeforeFullscreen=null}))}this.dsPresentationChange.emit({presentation:e})}handleFullscreenEscape(e){if(this.presentation!=="fullscreen"||e.key!=="Escape")return;e.preventDefault();e.stopPropagation();this.presentation="drawer"}deferMotionEnable(){if(this.readyForMotion)return;const e=++this.motionEnableGeneration;requestAnimationFrame((()=>{if(e!==this.motionEnableGeneration)return;requestAnimationFrame((()=>{if(e!==this.motionEnableGeneration)return;this.readyForMotion=true}))}))}connectedCallback(){this.el.addEventListener("transitionend",this.handleTransitionEnd);this.el.addEventListener("transitioncancel",this.handleTransitionEnd);this.el.addEventListener("dsAction",this.handleComposedHeaderAction)}componentWillLoad(){this.restoreLastActiveTool();this.drawerSurfaceRetained=this.open}openChanged(e,s){if(e)this.drawerSurfaceRetained=true;if(this.readyForMotion&&s!==undefined&&s!==e){this.startDrawerTransition(e?"opening":"closing")}else if(!e){this.drawerSurfaceRetained=false}this.deferMotionEnable()}activeToolChanged(){this.persistLastActiveTool();this.deferMotionEnable()}storageKeyChanged(){this.restoreLastActiveTool()}componentDidLoad(){this.deferMotionEnable();this.connectRailBodyObserver();this.updateRailBodyScrollable();this.syncFullViewTools();this.fullViewObserver=new MutationObserver((()=>this.syncFullViewTools()));this.fullViewObserver.observe(this.el,{childList:true,attributes:true,attributeFilter:["slot"]})}componentDidRender(){this.updateRailBodyScrollable()}connectRailBodyObserver(){this.disconnectRailBodyObserver();if(!this.railBodyEl||typeof ResizeObserver==="undefined")return;this.railBodyObserver=new ResizeObserver((()=>this.updateRailBodyScrollable()));this.railBodyObserver.observe(this.railBodyEl)}disconnectRailBodyObserver(){this.railBodyObserver?.disconnect();this.railBodyObserver=undefined}updateRailBodyScrollable(){const e=Boolean(this.railBodyEl&&this.railBodyEl.scrollHeight>this.railBodyEl.clientHeight+1);if(e!==this.railBodyScrollable)this.railBodyScrollable=e}itemsChanged(){this.rovingIndex=0;this.reconcileActiveTool();this.deferMotionEnable()}restoreLastActiveTool(){if(!this.storageKey||this.activeTool)return;try{const e=localStorage.getItem(this.storageKey);if(y(e))this.activeTool=e}catch{}}persistLastActiveTool(){if(!this.storageKey||!this.activeTool)return;try{localStorage.setItem(this.storageKey,this.activeTool)}catch{}}clearPersistedTool(){if(!this.storageKey)return;try{localStorage.removeItem(this.storageKey)}catch{}}reconcileActiveTool(){const e=x(this.railItems,this.open,this.activeTool);if(!e.removedTool)return;this.clearPersistedTool();this.open=e.open;this.activeTool=e.activeTool;this.dsToolChange.emit({id:e.removedTool,selected:false})}startDrawerTransition(e){const s=this.renderRoot.querySelector(".panel-tools__drawer");if(this.motion!=="idle"){this.finishDrawerTransition();this.ignoreReplacementTerminal=true}this.motion=e;this.dsChromeTransitionStart.emit({source:"panel-tools",phase:e});const t=++this.transitionGeneration;requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(t!==this.transitionGeneration||this.motion!==e)return;if(!s){this.finishDrawerTransition();return}if(this.drawerTransitionAtTerminal(s,e)){this.finishDrawerTransition();return}const o=k(getComputedStyle(s));if(o<=0){this.finishDrawerTransition();return}this.transitionFallbackTimer=window.setTimeout((()=>{this.finishDrawerTransition()}),o)}))}))}drawerTransitionAtTerminal(e,s){const t=e.getBoundingClientRect().width;const o=e.querySelector(".panel-tools__drawer-surface");const i=o?.getBoundingClientRect().width??0;return C(t,i,s)}finishDrawerTransition(){const e=this.motion;const s=e!=="idle";this.clearTransitionCompletion();if(!s)return;this.ignoreReplacementTerminal=false;this.motion="idle";if(e==="closing"&&!this.open){this.drawerSurfaceRetained=false}this.dsChromeTransitionEnd.emit({source:"panel-tools"})}clearTransitionCompletion(){this.transitionGeneration+=1;if(this.transitionFallbackTimer!==null){window.clearTimeout(this.transitionFallbackTimer);this.transitionFallbackTimer=null}}isRailSelected(e){return this.open&&this.activeTool===e}isDrawerPresent(){return this.open||this.drawerSurfaceRetained}isViewActive(e){return this.isDrawerPresent()&&this.activeTool===e}hasFullView(e){return this.fullViewToolIds.includes(e)}syncFullViewTools(){const e=this.orderedRailItems.map((e=>e.id));const s=e.filter((e=>Boolean(this.el.querySelector(`[slot="${e}-view"]`))));if(s.join("|")!==this.fullViewToolIds.join("|"))this.fullViewToolIds=s}get renderRoot(){return this.el.shadowRoot??this.el}headerLabel(){if(!this.isDrawerPresent()||!this.activeTool)return"";const e=this.railItems.find((e=>e.id===this.activeTool));return e?.label??g[this.activeTool]??this.activeTool}resolvedHeaders(){return this.headers??{}}activeHeader(){if(!this.activeTool)return{};return this.resolvedHeaders()[this.activeTool]??{}}async activateTool(e){const s=this.railItems.find((s=>s.id===e));if(!s||s.isInactive)return;this.handleToolChange(e)}async closeDrawer(){if(!this.open)return;const e=this.activeTool;this.open=false;if(e){this.dsToolChange.emit({id:e,selected:false})}}async focusHeaderAction(e){const s=this.renderRoot.querySelector(`[data-header-action-id="${CSS.escape(e)}"]`);await(s?.setFocus?.())}focusRailAt(e){const s=this.orderedRailItems;if(!s.length)return;const t=Math.max(0,Math.min(e,s.length-1));if(t===this.rovingIndex)return;this.rovingIndex=t;const o=Array.from(this.renderRoot.querySelectorAll(".panel-tools__rail-action .button-icon"));o[t]?.focus({preventScroll:true})}renderRailAction(e,s){const t=e.ariaLabel??e.label??g[e.id]??e.id;return o("ds-tooltip",{key:e.id,label:t,shortcutKey:e.shortcutKey??v[e.id],side:"left",size:"sm",boundary:"viewport"},o("ds-button-unfilled",{variant:"icon",class:"panel-tools__rail-action",icon:e.icon,isActive:this.isRailSelected(e.id),activeFill:false,hasBorder:false,pressScale:false,dot:e.dot??false,isInactive:e.isInactive,focusTabIndex:s===this.rovingIndex?0:-1,"aria-label":t,pressed:this.isRailSelected(e.id),onFocusin:()=>{this.rovingIndex=s},onKeyDown:e=>this.handleRailKeyDown(e,s),onDsClick:()=>this.handleToolChange(e.id)}))}render(){const e=this.headerLabel();const s=this.activeHeader();const t=s.title?.trim()||e;const n=s.actions??[];const r=this.orderedRailItems;const a=r.filter((e=>_(e)==="header"));const l=r.filter((e=>_(e)==="body"));const d=r.filter((e=>_(e)==="footer"));const c=a.length;const h=c+l.length;const f=this.isDrawerPresent();const u=T(this.open,this.motion);const p=Boolean(f&&this.activeTool&&this.hasFullView(this.activeTool));const m=r.map((e=>e.id));return o(i,{key:"f0b68f1eba06350ea0e6e9cd49ac8af501e3d119",class:{"panel-tools":true,"panel-tools--open":this.open,"panel-tools--ready":this.readyForMotion,"panel-tools--motion-opening":this.motion==="opening","panel-tools--motion-closing":this.motion==="closing","panel-tools--drawer-resting":u,"panel-tools--fullscreen":this.presentation==="fullscreen","panel-tools--presentation-snap":this.presentationMotionSuppressed},role:this.presentation==="fullscreen"?"dialog":"complementary","aria-modal":this.presentation==="fullscreen"?"true":undefined,"aria-label":this.toolsLabel},o("div",{key:"39d87b56af32d1b0c9df28ae753418b031bce592",class:"panel-tools__layout"},o("nav",{key:"49386a819594b99d83fad67035ba9b61dffef7b8",class:"panel-tools__rail","aria-label":this.toolShortcutsLabel},a.length?o("div",{class:"panel-tools__rail-header ds-chrome-row ds-chrome-space--md"},a.map(((e,s)=>this.renderRailAction(e,s)))):null,o("div",{key:"03b7594635006a2bd0dcd01328b67a470477fe22",class:{"panel-tools__rail-body":true,"ds-chrome-column":true,"ds-chrome-space--md":true,"ds-scrollbar-hidden":true,"ds-focus-ring":this.railBodyScrollable},ref:e=>{const s=e??undefined;if(s===this.railBodyEl)return;this.railBodyEl=s;this.connectRailBodyObserver()},role:this.railBodyScrollable?"region":undefined,"aria-label":this.railBodyScrollable?this.toolShortcutsLabel:undefined,tabIndex:this.railBodyScrollable?0:undefined},o("div",{key:"fdbd54e7590e79decf8650a402f97655accde47a",class:"panel-tools__rail-actions"},l.map(((e,s)=>this.renderRailAction(e,c+s))))),d.length?o("div",{class:"panel-tools__rail-footer ds-chrome-row ds-chrome-space--md"},d.map(((e,s)=>this.renderRailAction(e,h+s)))):null),o("div",{key:"b52eb269ee5503602f7449cbcc98d3d8a79ac24e",class:{"panel-tools__drawer":true,"panel-tools__drawer--visible":f},"aria-hidden":f?null:"true",inert:f?undefined:true},o("div",{key:"8ae718b1e9e1cea92011c4f098fb2baf4f3088e6",class:"panel-tools__drawer-surface"},this.presentation!=="fullscreen"||this.fullscreenHeaderMode==="shared"?o("ds-panel-tool-header",{class:"panel-tools__header",heading:t,showBack:s.showBack??false,backIcon:s.backIcon||"ChevronLeft",backAriaLabel:s.backAriaLabel||"Back",showMenu:false,ref:e=>{const s=e;if(s)s.actions=n},onDsBack:()=>{if(this.activeTool)this.dsHeaderBack.emit({tool:this.activeTool})}}):null,o("div",{key:"b0ed560e468602805bc95ef3d30de2b7874f1ccf",class:"panel-tools__body",hidden:p},m.map((e=>{const s=this.isViewActive(e);return o("div",{class:{"panel-tools__view":true,"panel-tools__view--active":s},hidden:!s},o("slot",{name:e}))}))),o("div",{key:"20e0ba3227e0b5fa1ca193e73660e73a0f84e986",class:"panel-tools__full-views",hidden:!p},m.map((e=>o("div",{class:{"panel-tools__full-view":true,"panel-tools__full-view--active":this.isViewActive(e)&&this.hasFullView(e)},hidden:!(this.isViewActive(e)&&this.hasFullView(e))},o("slot",{name:`${e}-view`})))))))))}get el(){return this}static get watchers(){return{presentation:[{presentationChanged:0}],open:[{openChanged:0}],activeTool:[{activeToolChanged:0}],storageKey:[{storageKeyChanged:0}],items:[{itemsChanged:0}]}}static get style(){return z()}},[257,"ds-panel-tools",{open:[1540],presentation:[1537],fullscreenHeaderMode:[513,"fullscreen-header-mode"],activeTool:[1537,"active-tool"],items:[16],toolsLabel:[1,"tools-label"],toolShortcutsLabel:[1,"tool-shortcuts-label"],headers:[16],storageKey:[1,"storage-key"],motion:[32],drawerSurfaceRetained:[32],readyForMotion:[32],presentationMotionSuppressed:[32],rovingIndex:[32],fullViewToolIds:[32],railBodyScrollable:[32],activateTool:[64],closeDrawer:[64],focusHeaderAction:[64]},[[10,"keydown","handleFullscreenEscape"]],{presentation:[{presentationChanged:0}],open:[{openChanged:0}],activeTool:[{activeToolChanged:0}],storageKey:[{storageKeyChanged:0}],items:[{itemsChanged:0}]}]);function D(){if(typeof customElements==="undefined"){return}const e=["ds-panel-tools","ds-badge","ds-button-unfilled","ds-icon","ds-loader","ds-panel-tool-header","ds-text","ds-tooltip"];e.forEach((e=>{switch(e){case"ds-panel-tools":if(!customElements.get(n(e))){customElements.define(n(e),S)}break;case"ds-badge":if(!customElements.get(n(e))){a()}break;case"ds-button-unfilled":if(!customElements.get(n(e))){l()}break;case"ds-icon":if(!customElements.get(n(e))){d()}break;case"ds-loader":if(!customElements.get(n(e))){c()}break;case"ds-panel-tool-header":if(!customElements.get(n(e))){h()}break;case"ds-text":if(!customElements.get(n(e))){f()}break;case"ds-tooltip":if(!customElements.get(n(e))){u()}break}}))}D();export{S as P,g as a,A as b,b as c,D as d,w as o,x as r};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{p as e,H as s,c as t,h as o,a as i,t as n}from"./index.js";import{p as r}from"./p-CUL5_8JM.js";import{d as a}from"./p-DzPtYdXy.js";import{d as l}from"./p-7MWaWl8w.js";import{d}from"./p-Cea7rROU.js";import{d as c}from"./p-0XTyQNRG.js";import{d as h}from"./p-DzVYGJJv.js";import{d as f}from"./p-Cd1JnnVK.js";import{d as u}from"./p-9X_p0bHr.js";const p=["agents","messages","activity","search","stacks","help"];const m="agents";const g={search:"Search",messages:"Messages",stacks:"Stacks",activity:"Activity",agents:"Agents",help:"Help & Support"};const v={search:"K",agents:"A",messages:"M",stacks:"S",activity:"N",help:"/"};const b=[{id:"agents",icon:"AI",label:g.agents,railPlacement:"header",order:0,shortcutKey:v.agents,mobileDestination:"agents"},{id:"messages",icon:"MessageBubbleStack",label:g.messages,order:0,shortcutKey:v.messages,mobileDestination:"messages"},{id:"activity",icon:"Bell",label:g.activity,order:1,shortcutKey:v.activity,mobileDestination:"activity"},{id:"search",icon:"MagnifyingGlass",label:g.search,order:2,shortcutKey:v.search,mobileDestination:"search"},{id:"help",icon:"CircleQuestion",label:g.help,railPlacement:"footer",order:0,shortcutKey:v.help,mobileDestination:"help"}];function w(e){const s=new Map;for(const t of e){if(t.id.trim()&&!s.has(t.id))s.set(t.id,t)}const t={header:0,body:1,footer:2};return Array.from(s.values()).sort(((e,s)=>{const o=_(e);const i=_(s);const n=t[o]-t[i];if(n!==0)return n;const r=p.findIndex((s=>s===e.id));const a=p.findIndex((e=>e===s.id));const l=e.order??(r<0?Number.MAX_SAFE_INTEGER:r);const d=s.order??(a<0?Number.MAX_SAFE_INTEGER:a);return l-d}))}function y(e){return typeof e==="string"&&e.trim().length>0}function _(e){if(e.railPlacement)return e.railPlacement;if(e.id===m)return"header";if(e.id==="help")return"footer";return"body"}function x(e,s,t){if(!t||e.some((e=>e.id===t))){return{open:s,activeTool:t,removedTool:""}}return{open:false,activeTool:"",removedTool:t}}function k(e){const s=e.transitionProperty.split(",").map((e=>e.trim()));const t=e.transitionDuration.split(",").map((e=>r(e.trim(),0)));const o=e.transitionDelay.split(",").map((e=>r(e.trim(),0)));return s.reduce(((e,s,i)=>{if(s!=="all"&&s!=="max-width")return e;const n=t[i%t.length]??0;const r=o[i%o.length]??0;return Math.max(e,n+r,0)}),0)}function T(e,s){return!e&&s==="idle"}function C(e,s,t){if(t==="closing")return e<=.5;if(t==="opening")return s>0&&e>=s-.5;return true}function A(e,s,t){if(e&&s===t){return{open:false,activeTool:t,selected:false}}return{open:true,activeTool:t,selected:true}}const z=()=>`.ds-control--lg,:host(.ds-control--lg),:host(.ds-control--md),.ds-control--md,:host(.ds-control--sm),.ds-control--sm,:host(.ds-control--xs),.ds-control--xs{--ds-control-radius:var(--dimension-radius-025)}:host(.ds-control--lg),.ds-control--lg{--ds-control-height:var(--dimension-size-500);--ds-control-icon:var(--dimension-iconography-lg);--ds-control-padding-inline:var(--dimension-space-100);--ds-control-label-inset:var(--dimension-space-050);--ds-control-gap:var(--dimension-space-050)}:host(.ds-control--md),.ds-control--md{--ds-control-height:var(--dimension-size-400);--ds-control-icon:var(--dimension-iconography-md);--ds-control-padding-inline:var(--dimension-space-075);--ds-control-label-inset:var(--dimension-space-025);--ds-control-gap:var(--dimension-space-050)}:host(.ds-control--sm),.ds-control--sm{--ds-control-height:var(--dimension-size-300);--ds-control-icon:var(--dimension-iconography-sm);--ds-control-padding-inline:var(--dimension-space-050);--ds-control-label-inset:var(--dimension-space-025);--ds-control-gap:var(--dimension-space-025)}:host(.ds-control--xs),.ds-control--xs{--ds-control-height:var(--dimension-size-200);--ds-control-icon:var(--dimension-iconography-xs);--ds-control-padding-inline:var(--dimension-space-025);--ds-control-label-inset:var(--dimension-space-025);--ds-control-gap:0}:host(.ds-chrome-space--sm),.ds-chrome-space--sm{--ds-chrome-padding:var(--dimension-space-050);--ds-chrome-gap:var(--dimension-space-050)}:host(.ds-chrome-space--md),.ds-chrome-space--md{--ds-chrome-padding:var(--dimension-space-100);--ds-chrome-gap:var(--dimension-space-100)}:host(.ds-chrome-space--lg),.ds-chrome-space--lg{--ds-chrome-padding:var(--dimension-space-200);--ds-chrome-gap:var(--dimension-space-200)}:host(.ds-chrome-row),.ds-chrome-row,:host(.ds-chrome-column),.ds-chrome-column,:host(.ds-chrome-grid),.ds-chrome-grid{display:flex;box-sizing:border-box;gap:var(--ds-chrome-gap, var(--dimension-space-100));padding:var(--ds-chrome-padding, var(--dimension-space-100))}:host(.ds-chrome-row),.ds-chrome-row{flex-direction:row;align-items:center}:host(.ds-chrome-column),.ds-chrome-column{flex-direction:column}:host(.ds-chrome-grid),.ds-chrome-grid{display:grid;align-items:center}@media (forced-colors: active){:root,:host,.ds-forced-colors-scope{--ds-forced-color-surface:Canvas;--ds-forced-color-content:CanvasText;--ds-forced-color-control-boundary:ButtonText;--ds-forced-color-selected:Highlight;--ds-forced-color-on-selected:HighlightText;--ds-forced-color-disabled:GrayText}}:host{--ds-focus-ring-width:var(--dimension-stroke-width-025, 2px);--ds-focus-ring-offset:var(--dimension-space-025, 2px);--ds-focus-ring-color:var(--color-interaction-focus)}:host(.ds-focus-ring),.ds-focus-ring,:host(.ds-focus-ring-inset),.ds-focus-ring-inset{outline:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation}:host(.ds-focus-ring:focus-visible),.ds-focus-ring:focus-visible{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:var(--ds-focus-ring-offset)}:host(.ds-focus-ring.ds-focus-ring--visible),.ds-focus-ring.ds-focus-ring--visible{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:var(--ds-focus-ring-offset)}:host(.ds-focus-ring-inset:focus-visible),.ds-focus-ring-inset:focus-visible{outline:none}:host(.ds-focus-ring-inset:focus-visible)::after,.ds-focus-ring-inset:focus-visible::after{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:calc(-1 * var(--ds-focus-ring-width))}:host(.ds-focus-ring-inset.ds-focus-ring--visible),.ds-focus-ring-inset.ds-focus-ring--visible{outline:none}:host(.ds-focus-ring-inset.ds-focus-ring--visible)::after,.ds-focus-ring-inset.ds-focus-ring--visible::after{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:calc(-1 * var(--ds-focus-ring-width))}@media (forced-colors: active){:host{--ds-focus-ring-color:var(--ds-forced-color-selected)}}:host(.ds-scrollbar-hidden),.ds-scrollbar-hidden{scrollbar-width:none}:host(.ds-scrollbar-hidden)::-webkit-scrollbar,.ds-scrollbar-hidden::-webkit-scrollbar{display:none}:host{display:block;flex:0 0 auto;box-sizing:border-box;height:100%;min-height:0;overflow:hidden;--_panel-tools-rail-width:var(--dimension-size-600);--_panel-tools-drawer-width:var(--ds-shell-panel-tools-width, var(--dimension-panel-width-xs));--_panel-tools-border:var(--dimension-stroke-width-012, 1px) solid var(--color-border-tertiary);--_panel-tools-expand-dur:var(--effect-animation-duration-medium-1, 300ms)}.panel-tools__layout{display:flex;flex-direction:row-reverse;align-items:stretch;height:100%;min-height:0;box-sizing:border-box}.panel-tools__drawer{flex:0 0 auto;max-width:0;min-width:0;height:100%;min-height:0;overflow:hidden;box-sizing:border-box;transition:none}:host(.panel-tools--ready) .panel-tools__drawer{transition:max-width var(--_panel-tools-expand-dur) var(--effect-animation-easing-ease-in-out, ease)}:host(.panel-tools--ready.panel-tools--motion-opening) .panel-tools__drawer{transition:max-width var(--_panel-tools-expand-dur) var(--effect-animation-easing-ease-out, ease-out)}:host(.panel-tools--ready.panel-tools--motion-closing) .panel-tools__drawer{transition:max-width var(--_panel-tools-expand-dur) var(--effect-animation-easing-ease-in, ease-in)}:host(.panel-tools--open) .panel-tools__drawer{max-width:var(--_panel-tools-drawer-width)}.panel-tools__drawer--visible{border-left:var(--_panel-tools-border)}.panel-tools__drawer-surface{display:flex;flex-direction:column;width:var(--_panel-tools-drawer-width);height:100%;min-height:0;box-sizing:border-box;background-color:transparent}.panel-tools__full-views,.panel-tools__full-view{flex:1 1 auto;min-height:0;overflow:hidden}.panel-tools__full-view{height:100%}.panel-tools__full-view{display:none}.panel-tools__full-view--active{display:block}:host([presentation='fullscreen']){height:100vh;inset:0;position:fixed;width:100vw;z-index:var(--dimension-z-index-modal)}:host([presentation='fullscreen']) .panel-tools__rail{display:none}:host([presentation='fullscreen']) .panel-tools__drawer{max-width:100vw;transition:none;width:100vw}:host([presentation='fullscreen']) .panel-tools__drawer--visible{border-left:none}:host([presentation='fullscreen']) .panel-tools__drawer-surface{background-color:transparent;width:100vw}:host([presentation='fullscreen']:not(.panel-tools--fullscreen)) .panel-tools__drawer-surface,:host(.panel-tools--fullscreen:not([presentation='fullscreen'])) .panel-tools__drawer-surface{visibility:hidden}:host(.panel-tools--presentation-snap) .panel-tools__drawer{transition:none}.panel-tools__body{flex:1 1 auto;min-height:0;overflow:auto;position:relative}:host(.panel-tools--drawer-resting) .panel-tools__body{content-visibility:auto;contain-intrinsic-size:auto 200px}.panel-tools__view{display:none;height:100%;min-height:0;box-sizing:border-box;padding:var(--dimension-space-200);color:var(--color-foreground-secondary);font-family:var(--typography-font-family-ui);font-size:var(--typography-fontsize-md);line-height:var(--typography-lineheight-md);font-weight:var(--typography-weight-regular);letter-spacing:var(--typography-letterspacing-negative-half)}.panel-tools__view ::slotted(*){margin:0;color:var(--color-foreground-secondary);font-family:var(--typography-font-family-ui);font-size:var(--typography-fontsize-md);line-height:var(--typography-lineheight-md);font-weight:var(--typography-weight-regular);letter-spacing:var(--typography-letterspacing-negative-half)}.panel-tools__view--active{display:block}.panel-tools__rail{flex:0 0 var(--_panel-tools-rail-width);width:var(--_panel-tools-rail-width);min-width:var(--_panel-tools-rail-width);display:flex;flex-direction:column;box-sizing:border-box;height:100%;min-height:0;border-left:var(--_panel-tools-border);background-color:transparent}.panel-tools__rail-header{justify-content:center;height:var(--dimension-size-600);flex-shrink:0;border-bottom:var(--_panel-tools-border)}.panel-tools__rail-body{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden}.panel-tools__rail-actions{display:flex;flex-direction:column;gap:var(--dimension-space-050);width:100%}.panel-tools__rail-footer{justify-content:center;flex-shrink:0;margin-top:auto}.panel-tools__rail-action{display:flex;align-items:center;justify-content:center;width:100%;height:var(--ds-control-height);flex-shrink:0}@media (prefers-reduced-motion: reduce){:host(.panel-tools--ready.panel-tools--motion-opening) .panel-tools__drawer,:host(.panel-tools--ready.panel-tools--motion-closing) .panel-tools__drawer{transition:none}}`;const S=e(class e extends s{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.dsToolChange=t(this,"dsToolChange",7);this.dsPresentationChange=t(this,"dsPresentationChange",7);this.dsHeaderBack=t(this,"dsHeaderBack",7);this.dsHeaderAction=t(this,"dsHeaderAction",7);this.dsChromeTransitionStart=t(this,"dsChromeTransitionStart",7);this.dsChromeTransitionEnd=t(this,"dsChromeTransitionEnd",7);this.open=false;this.presentation="drawer";this.fullscreenHeaderMode="shared";this.activeTool="";this.items=[];this.toolsLabel="Tools";this.toolShortcutsLabel="Tool shortcuts";this.headers={};this.storageKey="";this.motion="idle";this.drawerSurfaceRetained=false;this.readyForMotion=false;this.presentationMotionSuppressed=false;this.rovingIndex=0;this.fullViewToolIds=[];this.railBodyScrollable=false;this.motionEnableGeneration=0;this.presentationMotionGeneration=0;this.transitionGeneration=0;this.transitionFallbackTimer=null;this.ignoreReplacementTerminal=false;this.focusBeforeFullscreen=null;this.fullViewObserver=null;this.handleComposedHeaderAction=e=>{const s=e.detail;if(!this.activeTool||!s?.id)return;e.stopPropagation();this.dsHeaderAction.emit({tool:this.activeTool,id:s.id,anchor:s.anchor})};this.handleTransitionEnd=e=>{const s=this.renderRoot.querySelector(".panel-tools__drawer");if(e.target!==s)return;if(e.propertyName!=="max-width")return;if(this.ignoreReplacementTerminal){this.ignoreReplacementTerminal=false;return}if(e.type==="transitioncancel")return;if(s&&!this.drawerTransitionAtTerminal(s,this.motion))return;this.finishDrawerTransition()};this.handleToolChange=e=>{const s=A(this.open,this.activeTool,e);this.open=s.open;this.activeTool=s.activeTool;this.dsToolChange.emit({id:e,selected:s.selected})};this.handleRailKeyDown=(e,s)=>{const t=this.orderedRailItems;if(!t.length)return;if(e.key==="Enter"||e.key===" "){e.preventDefault();this.handleToolChange(t[s].id);return}if(e.key==="ArrowDown"){if(s>=t.length-1)return;e.preventDefault();this.focusRailAt(s+1);return}if(e.key==="ArrowUp"){if(s<=0)return;e.preventDefault();this.focusRailAt(s-1)}}}get railItems(){return this.items??[]}get orderedRailItems(){return w(this.railItems)}disconnectedCallback(){this.el.removeEventListener("transitionend",this.handleTransitionEnd);this.el.removeEventListener("transitioncancel",this.handleTransitionEnd);this.el.removeEventListener("dsAction",this.handleComposedHeaderAction);this.clearTransitionCompletion();this.motionEnableGeneration+=1;this.fullViewObserver?.disconnect();this.fullViewObserver=null;this.disconnectRailBodyObserver()}presentationChanged(e,t){if(e===t)return;if(this.el.getAttribute("presentation")!==e){this.el.setAttribute("presentation",e)}const o=++this.presentationMotionGeneration;this.presentationMotionSuppressed=true;requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(o!==this.presentationMotionGeneration)return;this.presentationMotionSuppressed=false}))}));if(e==="fullscreen"){this.focusBeforeFullscreen=document.activeElement instanceof s?document.activeElement:null;this.open=true}else if(t==="fullscreen"){const e=this.focusBeforeFullscreen;const s=this.activeHeader().actions?.[0]?.id;requestAnimationFrame((async()=>{if(e?.isConnected){e.focus({preventScroll:true})}const t=e?document.activeElement===e||e.contains(document.activeElement):false;if(!t&&s)await this.focusHeaderAction(s);this.focusBeforeFullscreen=null}))}this.dsPresentationChange.emit({presentation:e})}handleFullscreenEscape(e){if(this.presentation!=="fullscreen"||e.key!=="Escape")return;e.preventDefault();e.stopPropagation();this.presentation="drawer"}deferMotionEnable(){if(this.readyForMotion)return;const e=++this.motionEnableGeneration;requestAnimationFrame((()=>{if(e!==this.motionEnableGeneration)return;requestAnimationFrame((()=>{if(e!==this.motionEnableGeneration)return;this.readyForMotion=true}))}))}connectedCallback(){this.el.addEventListener("transitionend",this.handleTransitionEnd);this.el.addEventListener("transitioncancel",this.handleTransitionEnd);this.el.addEventListener("dsAction",this.handleComposedHeaderAction)}componentWillLoad(){this.restoreLastActiveTool();this.drawerSurfaceRetained=this.open}openChanged(e,s){if(e)this.drawerSurfaceRetained=true;if(this.readyForMotion&&s!==undefined&&s!==e){this.startDrawerTransition(e?"opening":"closing")}else if(!e){this.drawerSurfaceRetained=false}this.deferMotionEnable()}activeToolChanged(){this.persistLastActiveTool();this.deferMotionEnable()}storageKeyChanged(){this.restoreLastActiveTool()}componentDidLoad(){this.deferMotionEnable();this.connectRailBodyObserver();this.updateRailBodyScrollable();this.syncFullViewTools();this.fullViewObserver=new MutationObserver((()=>this.syncFullViewTools()));this.fullViewObserver.observe(this.el,{childList:true,attributes:true,attributeFilter:["slot"]})}componentDidRender(){this.updateRailBodyScrollable()}connectRailBodyObserver(){this.disconnectRailBodyObserver();if(!this.railBodyEl||typeof ResizeObserver==="undefined")return;this.railBodyObserver=new ResizeObserver((()=>this.updateRailBodyScrollable()));this.railBodyObserver.observe(this.railBodyEl)}disconnectRailBodyObserver(){this.railBodyObserver?.disconnect();this.railBodyObserver=undefined}updateRailBodyScrollable(){const e=Boolean(this.railBodyEl&&this.railBodyEl.scrollHeight>this.railBodyEl.clientHeight+1);if(e!==this.railBodyScrollable)this.railBodyScrollable=e}itemsChanged(){this.rovingIndex=0;this.reconcileActiveTool();this.deferMotionEnable()}restoreLastActiveTool(){if(!this.storageKey||this.activeTool)return;try{const e=localStorage.getItem(this.storageKey);if(y(e))this.activeTool=e}catch{}}persistLastActiveTool(){if(!this.storageKey||!this.activeTool)return;try{localStorage.setItem(this.storageKey,this.activeTool)}catch{}}clearPersistedTool(){if(!this.storageKey)return;try{localStorage.removeItem(this.storageKey)}catch{}}reconcileActiveTool(){const e=x(this.railItems,this.open,this.activeTool);if(!e.removedTool)return;this.clearPersistedTool();this.open=e.open;this.activeTool=e.activeTool;this.dsToolChange.emit({id:e.removedTool,selected:false})}startDrawerTransition(e){const s=this.renderRoot.querySelector(".panel-tools__drawer");if(this.motion!=="idle"){this.finishDrawerTransition();this.ignoreReplacementTerminal=true}this.motion=e;this.dsChromeTransitionStart.emit({source:"panel-tools",phase:e});const t=++this.transitionGeneration;requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(t!==this.transitionGeneration||this.motion!==e)return;if(!s){this.finishDrawerTransition();return}if(this.drawerTransitionAtTerminal(s,e)){this.finishDrawerTransition();return}const o=k(getComputedStyle(s));if(o<=0){this.finishDrawerTransition();return}this.transitionFallbackTimer=window.setTimeout((()=>{this.finishDrawerTransition()}),o)}))}))}drawerTransitionAtTerminal(e,s){const t=e.getBoundingClientRect().width;const o=e.querySelector(".panel-tools__drawer-surface");const i=o?.getBoundingClientRect().width??0;return C(t,i,s)}finishDrawerTransition(){const e=this.motion;const s=e!=="idle";this.clearTransitionCompletion();if(!s)return;this.ignoreReplacementTerminal=false;this.motion="idle";if(e==="closing"&&!this.open){this.drawerSurfaceRetained=false}this.dsChromeTransitionEnd.emit({source:"panel-tools"})}clearTransitionCompletion(){this.transitionGeneration+=1;if(this.transitionFallbackTimer!==null){window.clearTimeout(this.transitionFallbackTimer);this.transitionFallbackTimer=null}}isRailSelected(e){return this.open&&this.activeTool===e}isDrawerPresent(){return this.open||this.drawerSurfaceRetained}isViewActive(e){return this.isDrawerPresent()&&this.activeTool===e}hasFullView(e){return this.fullViewToolIds.includes(e)}syncFullViewTools(){const e=this.orderedRailItems.map((e=>e.id));const s=e.filter((e=>Boolean(this.el.querySelector(`[slot="${e}-view"]`))));if(s.join("|")!==this.fullViewToolIds.join("|"))this.fullViewToolIds=s}get renderRoot(){return this.el.shadowRoot??this.el}headerLabel(){if(!this.isDrawerPresent()||!this.activeTool)return"";const e=this.railItems.find((e=>e.id===this.activeTool));return e?.label??g[this.activeTool]??this.activeTool}resolvedHeaders(){return this.headers??{}}activeHeader(){if(!this.activeTool)return{};return this.resolvedHeaders()[this.activeTool]??{}}async activateTool(e){const s=this.railItems.find((s=>s.id===e));if(!s||s.isInactive)return;this.handleToolChange(e)}async closeDrawer(){if(!this.open)return;const e=this.activeTool;this.open=false;if(e){this.dsToolChange.emit({id:e,selected:false})}}async focusHeaderAction(e){const s=this.renderRoot.querySelector(`[data-header-action-id="${CSS.escape(e)}"]`);await(s?.setFocus?.())}focusRailAt(e){const s=this.orderedRailItems;if(!s.length)return;const t=Math.max(0,Math.min(e,s.length-1));if(t===this.rovingIndex)return;this.rovingIndex=t;const o=Array.from(this.renderRoot.querySelectorAll(".panel-tools__rail-action .button-icon"));o[t]?.focus({preventScroll:true})}renderRailAction(e,s){const t=e.ariaLabel??e.label??g[e.id]??e.id;return o("ds-tooltip",{key:e.id,label:t,shortcutKey:e.shortcutKey??v[e.id],side:"left",size:"sm",boundary:"viewport"},o("ds-button-unfilled",{variant:"icon",class:"panel-tools__rail-action",icon:e.icon,isActive:this.isRailSelected(e.id),activeFill:false,hasBorder:false,pressScale:false,dot:e.dot??false,isInactive:e.isInactive,focusTabIndex:s===this.rovingIndex?0:-1,"aria-label":t,pressed:this.isRailSelected(e.id),onFocusin:()=>{this.rovingIndex=s},onKeyDown:e=>this.handleRailKeyDown(e,s),onDsClick:()=>this.handleToolChange(e.id)}))}render(){const e=this.headerLabel();const s=this.activeHeader();const t=s.title?.trim()||e;const n=s.actions??[];const r=this.orderedRailItems;const a=r.filter((e=>_(e)==="header"));const l=r.filter((e=>_(e)==="body"));const d=r.filter((e=>_(e)==="footer"));const c=a.length;const h=c+l.length;const f=this.isDrawerPresent();const u=T(this.open,this.motion);const p=Boolean(f&&this.activeTool&&this.hasFullView(this.activeTool));const m=r.map((e=>e.id));return o(i,{key:"f0b68f1eba06350ea0e6e9cd49ac8af501e3d119",class:{"panel-tools":true,"panel-tools--open":this.open,"panel-tools--ready":this.readyForMotion,"panel-tools--motion-opening":this.motion==="opening","panel-tools--motion-closing":this.motion==="closing","panel-tools--drawer-resting":u,"panel-tools--fullscreen":this.presentation==="fullscreen","panel-tools--presentation-snap":this.presentationMotionSuppressed},role:this.presentation==="fullscreen"?"dialog":"complementary","aria-modal":this.presentation==="fullscreen"?"true":undefined,"aria-label":this.toolsLabel},o("div",{key:"39d87b56af32d1b0c9df28ae753418b031bce592",class:"panel-tools__layout"},o("nav",{key:"49386a819594b99d83fad67035ba9b61dffef7b8",class:"panel-tools__rail","aria-label":this.toolShortcutsLabel},a.length?o("div",{class:"panel-tools__rail-header ds-chrome-row ds-chrome-space--md"},a.map(((e,s)=>this.renderRailAction(e,s)))):null,o("div",{key:"03b7594635006a2bd0dcd01328b67a470477fe22",class:{"panel-tools__rail-body":true,"ds-chrome-column":true,"ds-chrome-space--md":true,"ds-scrollbar-hidden":true,"ds-focus-ring":this.railBodyScrollable},ref:e=>{const s=e??undefined;if(s===this.railBodyEl)return;this.railBodyEl=s;this.connectRailBodyObserver()},role:this.railBodyScrollable?"region":undefined,"aria-label":this.railBodyScrollable?this.toolShortcutsLabel:undefined,tabIndex:this.railBodyScrollable?0:undefined},o("div",{key:"fdbd54e7590e79decf8650a402f97655accde47a",class:"panel-tools__rail-actions"},l.map(((e,s)=>this.renderRailAction(e,c+s))))),d.length?o("div",{class:"panel-tools__rail-footer ds-chrome-row ds-chrome-space--md"},d.map(((e,s)=>this.renderRailAction(e,h+s)))):null),o("div",{key:"b52eb269ee5503602f7449cbcc98d3d8a79ac24e",class:{"panel-tools__drawer":true,"panel-tools__drawer--visible":f},"aria-hidden":f?null:"true",inert:f?undefined:true},o("div",{key:"8ae718b1e9e1cea92011c4f098fb2baf4f3088e6",class:"panel-tools__drawer-surface"},this.presentation!=="fullscreen"||this.fullscreenHeaderMode==="shared"?o("ds-panel-tool-header",{class:"panel-tools__header",heading:t,showBack:s.showBack??false,backIcon:s.backIcon||"ChevronLeft",backAriaLabel:s.backAriaLabel||"Back",showMenu:false,ref:e=>{const s=e;if(s)s.actions=n},onDsBack:()=>{if(this.activeTool)this.dsHeaderBack.emit({tool:this.activeTool})}}):null,o("div",{key:"b0ed560e468602805bc95ef3d30de2b7874f1ccf",class:"panel-tools__body",hidden:p},m.map((e=>{const s=this.isViewActive(e);return o("div",{class:{"panel-tools__view":true,"panel-tools__view--active":s},hidden:!s},o("slot",{name:e}))}))),o("div",{key:"20e0ba3227e0b5fa1ca193e73660e73a0f84e986",class:"panel-tools__full-views",hidden:!p},m.map((e=>o("div",{class:{"panel-tools__full-view":true,"panel-tools__full-view--active":this.isViewActive(e)&&this.hasFullView(e)},hidden:!(this.isViewActive(e)&&this.hasFullView(e))},o("slot",{name:`${e}-view`})))))))))}get el(){return this}static get watchers(){return{presentation:[{presentationChanged:0}],open:[{openChanged:0}],activeTool:[{activeToolChanged:0}],storageKey:[{storageKeyChanged:0}],items:[{itemsChanged:0}]}}static get style(){return z()}},[257,"ds-panel-tools",{open:[1540],presentation:[1537],fullscreenHeaderMode:[513,"fullscreen-header-mode"],activeTool:[1537,"active-tool"],items:[16],toolsLabel:[1,"tools-label"],toolShortcutsLabel:[1,"tool-shortcuts-label"],headers:[16],storageKey:[1,"storage-key"],motion:[32],drawerSurfaceRetained:[32],readyForMotion:[32],presentationMotionSuppressed:[32],rovingIndex:[32],fullViewToolIds:[32],railBodyScrollable:[32],activateTool:[64],closeDrawer:[64],focusHeaderAction:[64]},[[10,"keydown","handleFullscreenEscape"]],{presentation:[{presentationChanged:0}],open:[{openChanged:0}],activeTool:[{activeToolChanged:0}],storageKey:[{storageKeyChanged:0}],items:[{itemsChanged:0}]}]);function D(){if(typeof customElements==="undefined"){return}const e=["ds-panel-tools","ds-badge","ds-button-unfilled","ds-icon","ds-loader","ds-panel-tool-header","ds-text","ds-tooltip"];e.forEach((e=>{switch(e){case"ds-panel-tools":if(!customElements.get(n(e))){customElements.define(n(e),S)}break;case"ds-badge":if(!customElements.get(n(e))){a()}break;case"ds-button-unfilled":if(!customElements.get(n(e))){l()}break;case"ds-icon":if(!customElements.get(n(e))){d()}break;case"ds-loader":if(!customElements.get(n(e))){c()}break;case"ds-panel-tool-header":if(!customElements.get(n(e))){h()}break;case"ds-text":if(!customElements.get(n(e))){f()}break;case"ds-tooltip":if(!customElements.get(n(e))){u()}break}}))}D();export{S as P,g as a,A as b,b as c,D as d,w as o,x as r};
|
|
2
|
+
//# sourceMappingURL=p-COFw_fcj.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,H as s,h as r,a as o,t as a}from"./index.js";import{d}from"./p-DzPtYdXy.js";import{d as n}from"./p-DSy1oOnd.js";import{d as t}from"./p-Dit6JmAK.js";import{d as i}from"./p-Cea7rROU.js";import{d as c}from"./p-0XTyQNRG.js";import{d as h}from"./p-Cd1JnnVK.js";import{d as m}from"./p-pnO8tAYB.js";import{r as l}from"./p-rCeztgVn.js";const w=()=>`.sc-ds-markdown:where(.ds-prose){display:block;box-sizing:border-box;max-inline-size:100%;min-inline-size:0;color:inherit;overflow-wrap:anywhere}.sc-ds-markdown:where(.ds-prose)>:where(h1,h2.sc-ds-markdown,h3.sc-ds-markdown,h4.sc-ds-markdown,h5.sc-ds-markdown,h6.sc-ds-markdown,p.sc-ds-markdown,ul.sc-ds-markdown,ol.sc-ds-markdown,dl.sc-ds-markdown,blockquote).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{max-inline-size:var(--ds-prose-text-max-inline-size, 100%)}.sc-ds-markdown:where(.ds-prose) :where(p,ul.sc-ds-markdown,ol.sc-ds-markdown,dl.sc-ds-markdown,blockquote.sc-ds-markdown,figure.sc-ds-markdown,figcaption.sc-ds-markdown,table).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin:0;color:inherit;font-family:var(--typography-font-family-ui);font-size:var(--typography-fontsize-md);font-weight:var(--typography-weight-regular);line-height:var(--typography-lineheight-md);letter-spacing:var(--typography-letterspacing-negative-half)}.sc-ds-markdown:where(.ds-prose) :where(h1,h2.sc-ds-markdown,h3.sc-ds-markdown,h4.sc-ds-markdown,h5.sc-ds-markdown,h6).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin:0;color:var(--color-foreground-primary);font-family:var(--typography-font-family-ui);font-weight:var(--typography-weight-semibold)}.sc-ds-markdown:where(.ds-prose) :where(h1,h2).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{font-size:var(--typography-fontsize-xl);line-height:var(--typography-lineheight-xl);letter-spacing:var(--typography-letterspacing-negative-double)}.sc-ds-markdown:where(.ds-prose) :where(h3,h4).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{font-size:var(--typography-fontsize-lg);line-height:var(--typography-lineheight-lg);letter-spacing:var(--typography-letterspacing-negative)}.sc-ds-markdown:where(.ds-prose) :where(h5,h6).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{font-size:var(--typography-fontsize-md);line-height:var(--typography-lineheight-md);letter-spacing:var(--typography-letterspacing-negative)}.sc-ds-markdown:where(.ds-prose)>.sc-ds-markdown:where(*+*){margin-block-start:var(--dimension-space-150)}.sc-ds-markdown:where(.ds-prose)>:where(*)+:where(h1,h2.sc-ds-markdown,h3.sc-ds-markdown,h4.sc-ds-markdown,h5.sc-ds-markdown,h6).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin-block-start:var(--dimension-space-200)}.sc-ds-markdown:where(.ds-prose)>:where(h1,h2.sc-ds-markdown,h3.sc-ds-markdown,h4.sc-ds-markdown,h5.sc-ds-markdown,h6).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown+.sc-ds-markdown:where(*){margin-block-start:var(--dimension-space-100)}.sc-ds-markdown:where(.ds-prose) :where(blockquote,li.sc-ds-markdown,dd)>.sc-ds-markdown:where(*+*):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin-block-start:var(--dimension-space-050)}.sc-ds-markdown:where(.ds-prose) :where(li+li.sc-ds-markdown,dt+dd).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin-block-start:var(--dimension-space-050)}.sc-ds-markdown:where(.ds-prose) :where(ul,ol).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{padding-inline-start:var(--dimension-space-300)}.sc-ds-markdown:where(.ds-prose) :where(li>ul.sc-ds-markdown,li>ol).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin-block-start:var(--dimension-space-050)}.sc-ds-markdown:where(.ds-prose) :where(li>input[type='checkbox']):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin-inline-end:var(--dimension-space-050)}.sc-ds-markdown:where(.ds-prose) :where(blockquote):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{padding-inline-start:var(--dimension-space-150);border-inline-start:var(--dimension-stroke-width-025) solid var(--color-border-secondary);color:var(--color-foreground-secondary)}.sc-ds-markdown:where(.ds-prose) :where(strong,b).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{font-weight:var(--typography-weight-medium)}.sc-ds-markdown:where(.ds-prose) :where(h1,h2.sc-ds-markdown,h3.sc-ds-markdown,h4.sc-ds-markdown,h5.sc-ds-markdown,h6) .sc-ds-markdown:where(strong,b).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{font-weight:inherit}.sc-ds-markdown:where(.ds-prose) :where(a):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{color:var(--color-foreground-bold-brand);text-decoration-line:none;text-decoration-color:currentcolor;text-decoration-thickness:var(--ds-text-decoration-thickness, var(--dimension-stroke-width-012));text-underline-offset:var(--ds-text-decoration-offset, var(--dimension-space-025))}@media (hover: hover) and (pointer: fine){.sc-ds-markdown:where(.ds-prose) :where(a):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown:hover{text-decoration-line:underline}}@media (forced-colors: active){.sc-ds-markdown:where(.ds-prose) :where(a):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{text-decoration-line:underline}}.sc-ds-markdown:where(.ds-prose) :where(code):not(:where(pre code.sc-ds-markdown,[data-ds-prose='off'].sc-ds-markdown,[data-ds-prose='off'] *)).sc-ds-markdown{padding:var(--dimension-space-012) var(--dimension-space-025);border-radius:var(--dimension-radius-025);background:var(--color-background-secondary);font-family:var( --typography-font-family-code, 'Fira Code', ui-monospace, 'SFMono-Regular', 'Cascadia Code', 'Roboto Mono', Menlo, Monaco, Consolas, 'Liberation Mono', monospace );font-size:var(--typography-fontsize-sm);font-variant-ligatures:var(--ds-code-font-variant-ligatures, normal);font-weight:var(--typography-weight-regular);line-height:var(--typography-lineheight-sm);letter-spacing:var(--typography-letterspacing-none)}.sc-ds-markdown:where(.ds-prose) :where(pre):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{box-sizing:border-box;max-inline-size:100%;min-inline-size:0;margin:0;padding:var(--dimension-space-150);overflow:auto;border-radius:var(--dimension-radius-050);background:var(--color-background-strong-neutral);color:var(--color-foreground-faint-neutral);font-family:var( --typography-font-family-code, 'Fira Code', ui-monospace, 'SFMono-Regular', 'Cascadia Code', 'Roboto Mono', Menlo, Monaco, Consolas, 'Liberation Mono', monospace );font-size:var(--typography-fontsize-sm);font-variant-ligatures:var(--ds-code-font-variant-ligatures, normal);font-weight:var(--typography-weight-regular);line-height:var(--typography-lineheight-sm);letter-spacing:var(--typography-letterspacing-none);tab-size:2}.sc-ds-markdown:where(.ds-prose) :where(pre code):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{padding:0;background:transparent;color:inherit;font:inherit;letter-spacing:inherit;white-space:pre}.sc-ds-markdown:where(.ds-prose) :where(hr):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin:0;border:0;border-block-start:var(--dimension-stroke-width-012) solid var(--color-border-tertiary)}.sc-ds-markdown:where(.ds-prose__table-scroll){box-sizing:border-box;max-inline-size:100%;min-inline-size:0;overflow-x:auto}.sc-ds-markdown:where(.ds-prose) :where(table):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{inline-size:100%;border-collapse:collapse}.sc-ds-markdown:where(.ds-prose) :where(th,td).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{padding:var(--dimension-space-075);border:var(--dimension-stroke-width-012) solid var(--color-border-tertiary);text-align:start;vertical-align:top;overflow-wrap:anywhere}.sc-ds-markdown:where(.ds-prose) :where(th):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{color:var(--color-foreground-primary);font-weight:var(--typography-weight-medium)}.sc-ds-markdown:where(.ds-prose) :where(img,video.sc-ds-markdown,svg).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{max-inline-size:100%;block-size:auto}.sc-ds-markdown:where(.ds-prose) :where(figcaption):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin-block-start:var(--dimension-space-050);color:var(--color-foreground-secondary);font-size:var(--typography-fontsize-sm);line-height:var(--typography-lineheight-sm);letter-spacing:var(--typography-letterspacing-none)}.sc-ds-markdown-h{display:block;min-width:0;color:inherit;box-sizing:border-box;-webkit-user-select:text;user-select:text}`;let p;function f(){p??(p=Promise.all([import("./p-BjtXYFhw.js"),import("./p-DVsje4AY.js"),import("./p-gidVv1FX.js")]).then((([e,s,r])=>({fromMarkdown:e.fromMarkdown,gfmFromMarkdown:s.gfmFromMarkdown,gfm:r.gfm}))));return p}const k=e(class e extends s{constructor(e){super();if(e!==false){this.__registerHost()}this.content="";this.streaming=false;this.tree=null;this.parseRevision=0}componentWillLoad(){if(typeof document!=="undefined")return this.parse()}disconnectedCallback(){this.parseRevision+=1;if(this.parseFrame&&typeof cancelAnimationFrame==="function"){cancelAnimationFrame(this.parseFrame)}}scheduleParse(){if(typeof requestAnimationFrame!=="function")return;if(this.parseFrame)cancelAnimationFrame(this.parseFrame);this.parseFrame=requestAnimationFrame((()=>{this.parseFrame=undefined;void this.parse()}))}async parse(){const e=++this.parseRevision;try{const{fromMarkdown:s,gfmFromMarkdown:r,gfm:o}=await f();const a=s(this.content,{extensions:[o()],mdastExtensions:[r()]});if(e===this.parseRevision)this.tree=a}catch{if(e===this.parseRevision)this.tree=null}}children(e){if(!("children"in e))return[];return e.children.map((e=>this.renderNode(e)))}renderNode(e){switch(e.type){case"root":return this.children(e);case"text":return r("span",{class:"markdown__text"},e.value);case"paragraph":return r("p",{class:"markdown__paragraph"},this.children(e));case"heading":{const s=`h${e.depth}`;return r(s,{class:"markdown__heading"},this.children(e))}case"strong":return r("strong",{class:"markdown__strong"},this.children(e));case"emphasis":return r("em",{class:"markdown__emphasis"},this.children(e));case"delete":return r("del",{class:"markdown__delete"},this.children(e));case"blockquote":return r("blockquote",{class:"markdown__blockquote"},this.children(e));case"break":return r("br",{class:"markdown__break"});case"thematicBreak":return r("hr",{class:"markdown__thematic-break"});case"inlineCode":return r("code",{class:"markdown__inline-code"},e.value);case"code":return r("ds-code-block",{class:"markdown__code-block","data-ds-prose":"off",code:e.value,language:e.lang??"",filename:e.meta??""});case"link":{const s=l(e.url,{protocols:["http:","https:","mailto:"]});return s?r("a",{class:"markdown__link",href:s,target:"_blank",rel:"noopener noreferrer"},this.children(e)):this.children(e)}case"list":{const s=e.ordered?"ol":"ul";return r(s,{class:"markdown__list",start:e.ordered&&e.start?e.start:undefined},this.children(e))}case"listItem":return r("li",{class:"markdown__list-item"},typeof e.checked==="boolean"?r("input",{class:"markdown__task-indicator",type:"checkbox",checked:e.checked,disabled:true,"aria-hidden":"true",tabIndex:-1}):null,this.children(e));case"table":{const[s,...o]=e.children;return r("div",{class:"markdown__table-wrap ds-prose__table-scroll",tabIndex:0},r("table",{class:"markdown__table"},s?r("thead",{class:"markdown__table-head"},r("tr",{class:"markdown__table-row"},s.children.map((e=>r("th",{class:"markdown__table-heading",scope:"col"},this.children(e)))))):null,r("tbody",{class:"markdown__table-body"},o.map((e=>this.renderNode(e))))))}case"tableRow":return r("tr",{class:"markdown__table-row"},this.children(e));case"tableCell":return r("td",{class:"markdown__table-cell"},this.children(e));case"image":{const s=l(e.url,{protocols:["http:","https:","mailto:"]});return s?r("a",{class:"markdown__image-link",href:s,target:"_blank",rel:"noopener noreferrer"},e.alt||"View image"):e.alt||null}case"html":case"definition":case"footnoteDefinition":return null;case"footnoteReference":return r("sup",{class:"markdown__footnote"},e.label);default:return this.children(e)}}render(){return r(o,{key:"0f678f68ac5dc6c429e8069e106ff540ef1f526b","aria-busy":this.streaming?"true":undefined},r("div",{key:"66369e1db84c906d27582f19df6a3acdc2d3c11a",class:"markdown ds-prose"},this.tree?this.renderNode(this.tree):r("p",{class:"markdown__paragraph"},r("span",{class:"markdown__text"},this.content))))}static get watchers(){return{content:[{scheduleParse:0}]}}static get style(){return w()}},[2,"ds-markdown",{content:[1],streaming:[4],tree:[32]},undefined,{content:[{scheduleParse:0}]}]);function g(){if(typeof customElements==="undefined"){return}const e=["ds-markdown","ds-badge","ds-button-unfilled","ds-code-block","ds-icon","ds-loader","ds-text","ds-tooltip"];e.forEach((e=>{switch(e){case"ds-markdown":if(!customElements.get(a(e))){customElements.define(a(e),k)}break;case"ds-badge":if(!customElements.get(a(e))){d()}break;case"ds-button-unfilled":if(!customElements.get(a(e))){n()}break;case"ds-code-block":if(!customElements.get(a(e))){t()}break;case"ds-icon":if(!customElements.get(a(e))){i()}break;case"ds-loader":if(!customElements.get(a(e))){c()}break;case"ds-text":if(!customElements.get(a(e))){h()}break;case"ds-tooltip":if(!customElements.get(a(e))){m()}break}}))}g();export{k as M,g as d};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{p as e,H as s,h as r,a as o,t as a}from"./index.js";import{d}from"./p-DzPtYdXy.js";import{d as n}from"./p-7MWaWl8w.js";import{d as t}from"./p-DiyO47xX.js";import{d as i}from"./p-Cea7rROU.js";import{d as c}from"./p-0XTyQNRG.js";import{d as h}from"./p-Cd1JnnVK.js";import{d as m}from"./p-9X_p0bHr.js";import{r as l}from"./p-rCeztgVn.js";const w=()=>`.sc-ds-markdown:where(.ds-prose){display:block;box-sizing:border-box;max-inline-size:100%;min-inline-size:0;color:inherit;overflow-wrap:anywhere}.sc-ds-markdown:where(.ds-prose)>:where(h1,h2.sc-ds-markdown,h3.sc-ds-markdown,h4.sc-ds-markdown,h5.sc-ds-markdown,h6.sc-ds-markdown,p.sc-ds-markdown,ul.sc-ds-markdown,ol.sc-ds-markdown,dl.sc-ds-markdown,blockquote).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{max-inline-size:var(--ds-prose-text-max-inline-size, 100%)}.sc-ds-markdown:where(.ds-prose) :where(p,ul.sc-ds-markdown,ol.sc-ds-markdown,dl.sc-ds-markdown,blockquote.sc-ds-markdown,figure.sc-ds-markdown,figcaption.sc-ds-markdown,table).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin:0;color:inherit;font-family:var(--typography-font-family-ui);font-size:var(--typography-fontsize-md);font-weight:var(--typography-weight-regular);line-height:var(--typography-lineheight-md);letter-spacing:var(--typography-letterspacing-negative-half)}.sc-ds-markdown:where(.ds-prose) :where(h1,h2.sc-ds-markdown,h3.sc-ds-markdown,h4.sc-ds-markdown,h5.sc-ds-markdown,h6).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin:0;color:var(--color-foreground-primary);font-family:var(--typography-font-family-ui);font-weight:var(--typography-weight-semibold)}.sc-ds-markdown:where(.ds-prose) :where(h1,h2).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{font-size:var(--typography-fontsize-xl);line-height:var(--typography-lineheight-xl);letter-spacing:var(--typography-letterspacing-negative-double)}.sc-ds-markdown:where(.ds-prose) :where(h3,h4).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{font-size:var(--typography-fontsize-lg);line-height:var(--typography-lineheight-lg);letter-spacing:var(--typography-letterspacing-negative)}.sc-ds-markdown:where(.ds-prose) :where(h5,h6).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{font-size:var(--typography-fontsize-md);line-height:var(--typography-lineheight-md);letter-spacing:var(--typography-letterspacing-negative)}.sc-ds-markdown:where(.ds-prose)>.sc-ds-markdown:where(*+*){margin-block-start:var(--dimension-space-150)}.sc-ds-markdown:where(.ds-prose)>:where(*)+:where(h1,h2.sc-ds-markdown,h3.sc-ds-markdown,h4.sc-ds-markdown,h5.sc-ds-markdown,h6).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin-block-start:var(--dimension-space-200)}.sc-ds-markdown:where(.ds-prose)>:where(h1,h2.sc-ds-markdown,h3.sc-ds-markdown,h4.sc-ds-markdown,h5.sc-ds-markdown,h6).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown+.sc-ds-markdown:where(*){margin-block-start:var(--dimension-space-100)}.sc-ds-markdown:where(.ds-prose) :where(blockquote,li.sc-ds-markdown,dd)>.sc-ds-markdown:where(*+*):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin-block-start:var(--dimension-space-050)}.sc-ds-markdown:where(.ds-prose) :where(li+li.sc-ds-markdown,dt+dd).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin-block-start:var(--dimension-space-050)}.sc-ds-markdown:where(.ds-prose) :where(ul,ol).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{padding-inline-start:var(--dimension-space-300)}.sc-ds-markdown:where(.ds-prose) :where(li>ul.sc-ds-markdown,li>ol).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin-block-start:var(--dimension-space-050)}.sc-ds-markdown:where(.ds-prose) :where(li>input[type='checkbox']):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin-inline-end:var(--dimension-space-050)}.sc-ds-markdown:where(.ds-prose) :where(blockquote):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{padding-inline-start:var(--dimension-space-150);border-inline-start:var(--dimension-stroke-width-025) solid var(--color-border-secondary);color:var(--color-foreground-secondary)}.sc-ds-markdown:where(.ds-prose) :where(strong,b).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{font-weight:var(--typography-weight-medium)}.sc-ds-markdown:where(.ds-prose) :where(h1,h2.sc-ds-markdown,h3.sc-ds-markdown,h4.sc-ds-markdown,h5.sc-ds-markdown,h6) .sc-ds-markdown:where(strong,b).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{font-weight:inherit}.sc-ds-markdown:where(.ds-prose) :where(a):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{color:var(--color-foreground-bold-brand);text-decoration-line:none;text-decoration-color:currentcolor;text-decoration-thickness:var(--ds-text-decoration-thickness, var(--dimension-stroke-width-012));text-underline-offset:var(--ds-text-decoration-offset, var(--dimension-space-025))}@media (hover: hover) and (pointer: fine){.sc-ds-markdown:where(.ds-prose) :where(a):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown:hover{text-decoration-line:underline}}@media (forced-colors: active){.sc-ds-markdown:where(.ds-prose) :where(a):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{text-decoration-line:underline}}.sc-ds-markdown:where(.ds-prose) :where(code):not(:where(pre code.sc-ds-markdown,[data-ds-prose='off'].sc-ds-markdown,[data-ds-prose='off'] *)).sc-ds-markdown{padding:var(--dimension-space-012) var(--dimension-space-025);border-radius:var(--dimension-radius-025);background:var(--color-background-secondary);font-family:var( --typography-font-family-code, 'Fira Code', ui-monospace, 'SFMono-Regular', 'Cascadia Code', 'Roboto Mono', Menlo, Monaco, Consolas, 'Liberation Mono', monospace );font-size:var(--typography-fontsize-sm);font-variant-ligatures:var(--ds-code-font-variant-ligatures, normal);font-weight:var(--typography-weight-regular);line-height:var(--typography-lineheight-sm);letter-spacing:var(--typography-letterspacing-none)}.sc-ds-markdown:where(.ds-prose) :where(pre):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{box-sizing:border-box;max-inline-size:100%;min-inline-size:0;margin:0;padding:var(--dimension-space-150);overflow:auto;border-radius:var(--dimension-radius-050);background:var(--color-background-strong-neutral);color:var(--color-foreground-faint-neutral);font-family:var( --typography-font-family-code, 'Fira Code', ui-monospace, 'SFMono-Regular', 'Cascadia Code', 'Roboto Mono', Menlo, Monaco, Consolas, 'Liberation Mono', monospace );font-size:var(--typography-fontsize-sm);font-variant-ligatures:var(--ds-code-font-variant-ligatures, normal);font-weight:var(--typography-weight-regular);line-height:var(--typography-lineheight-sm);letter-spacing:var(--typography-letterspacing-none);tab-size:2}.sc-ds-markdown:where(.ds-prose) :where(pre code):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{padding:0;background:transparent;color:inherit;font:inherit;letter-spacing:inherit;white-space:pre}.sc-ds-markdown:where(.ds-prose) :where(hr):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin:0;border:0;border-block-start:var(--dimension-stroke-width-012) solid var(--color-border-tertiary)}.sc-ds-markdown:where(.ds-prose__table-scroll){box-sizing:border-box;max-inline-size:100%;min-inline-size:0;overflow-x:auto}.sc-ds-markdown:where(.ds-prose) :where(table):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{inline-size:100%;border-collapse:collapse}.sc-ds-markdown:where(.ds-prose) :where(th,td).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{padding:var(--dimension-space-075);border:var(--dimension-stroke-width-012) solid var(--color-border-tertiary);text-align:start;vertical-align:top;overflow-wrap:anywhere}.sc-ds-markdown:where(.ds-prose) :where(th):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{color:var(--color-foreground-primary);font-weight:var(--typography-weight-medium)}.sc-ds-markdown:where(.ds-prose) :where(img,video.sc-ds-markdown,svg).sc-ds-markdown:not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{max-inline-size:100%;block-size:auto}.sc-ds-markdown:where(.ds-prose) :where(figcaption):not(:where([data-ds-prose='off'],[data-ds-prose='off'] *)).sc-ds-markdown{margin-block-start:var(--dimension-space-050);color:var(--color-foreground-secondary);font-size:var(--typography-fontsize-sm);line-height:var(--typography-lineheight-sm);letter-spacing:var(--typography-letterspacing-none)}.sc-ds-markdown-h{display:block;min-width:0;color:inherit;box-sizing:border-box;-webkit-user-select:text;user-select:text}`;let p;function f(){p??(p=Promise.all([import("./p-BjtXYFhw.js"),import("./p-DVsje4AY.js"),import("./p-gidVv1FX.js")]).then((([e,s,r])=>({fromMarkdown:e.fromMarkdown,gfmFromMarkdown:s.gfmFromMarkdown,gfm:r.gfm}))));return p}const k=e(class e extends s{constructor(e){super();if(e!==false){this.__registerHost()}this.content="";this.streaming=false;this.tree=null;this.parseRevision=0}componentWillLoad(){if(typeof document!=="undefined")return this.parse()}disconnectedCallback(){this.parseRevision+=1;if(this.parseFrame&&typeof cancelAnimationFrame==="function"){cancelAnimationFrame(this.parseFrame)}}scheduleParse(){if(typeof requestAnimationFrame!=="function")return;if(this.parseFrame)cancelAnimationFrame(this.parseFrame);this.parseFrame=requestAnimationFrame((()=>{this.parseFrame=undefined;void this.parse()}))}async parse(){const e=++this.parseRevision;try{const{fromMarkdown:s,gfmFromMarkdown:r,gfm:o}=await f();const a=s(this.content,{extensions:[o()],mdastExtensions:[r()]});if(e===this.parseRevision)this.tree=a}catch{if(e===this.parseRevision)this.tree=null}}children(e){if(!("children"in e))return[];return e.children.map((e=>this.renderNode(e)))}renderNode(e){switch(e.type){case"root":return this.children(e);case"text":return r("span",{class:"markdown__text"},e.value);case"paragraph":return r("p",{class:"markdown__paragraph"},this.children(e));case"heading":{const s=`h${e.depth}`;return r(s,{class:"markdown__heading"},this.children(e))}case"strong":return r("strong",{class:"markdown__strong"},this.children(e));case"emphasis":return r("em",{class:"markdown__emphasis"},this.children(e));case"delete":return r("del",{class:"markdown__delete"},this.children(e));case"blockquote":return r("blockquote",{class:"markdown__blockquote"},this.children(e));case"break":return r("br",{class:"markdown__break"});case"thematicBreak":return r("hr",{class:"markdown__thematic-break"});case"inlineCode":return r("code",{class:"markdown__inline-code"},e.value);case"code":return r("ds-code-block",{class:"markdown__code-block","data-ds-prose":"off",code:e.value,language:e.lang??"",filename:e.meta??""});case"link":{const s=l(e.url,{protocols:["http:","https:","mailto:"]});return s?r("a",{class:"markdown__link",href:s,target:"_blank",rel:"noopener noreferrer"},this.children(e)):this.children(e)}case"list":{const s=e.ordered?"ol":"ul";return r(s,{class:"markdown__list",start:e.ordered&&e.start?e.start:undefined},this.children(e))}case"listItem":return r("li",{class:"markdown__list-item"},typeof e.checked==="boolean"?r("input",{class:"markdown__task-indicator",type:"checkbox",checked:e.checked,disabled:true,"aria-hidden":"true",tabIndex:-1}):null,this.children(e));case"table":{const[s,...o]=e.children;return r("div",{class:"markdown__table-wrap ds-prose__table-scroll",tabIndex:0},r("table",{class:"markdown__table"},s?r("thead",{class:"markdown__table-head"},r("tr",{class:"markdown__table-row"},s.children.map((e=>r("th",{class:"markdown__table-heading",scope:"col"},this.children(e)))))):null,r("tbody",{class:"markdown__table-body"},o.map((e=>this.renderNode(e))))))}case"tableRow":return r("tr",{class:"markdown__table-row"},this.children(e));case"tableCell":return r("td",{class:"markdown__table-cell"},this.children(e));case"image":{const s=l(e.url,{protocols:["http:","https:","mailto:"]});return s?r("a",{class:"markdown__image-link",href:s,target:"_blank",rel:"noopener noreferrer"},e.alt||"View image"):e.alt||null}case"html":case"definition":case"footnoteDefinition":return null;case"footnoteReference":return r("sup",{class:"markdown__footnote"},e.label);default:return this.children(e)}}render(){return r(o,{key:"0f678f68ac5dc6c429e8069e106ff540ef1f526b","aria-busy":this.streaming?"true":undefined},r("div",{key:"66369e1db84c906d27582f19df6a3acdc2d3c11a",class:"markdown ds-prose"},this.tree?this.renderNode(this.tree):r("p",{class:"markdown__paragraph"},r("span",{class:"markdown__text"},this.content))))}static get watchers(){return{content:[{scheduleParse:0}]}}static get style(){return w()}},[2,"ds-markdown",{content:[1],streaming:[4],tree:[32]},undefined,{content:[{scheduleParse:0}]}]);function g(){if(typeof customElements==="undefined"){return}const e=["ds-markdown","ds-badge","ds-button-unfilled","ds-code-block","ds-icon","ds-loader","ds-text","ds-tooltip"];e.forEach((e=>{switch(e){case"ds-markdown":if(!customElements.get(a(e))){customElements.define(a(e),k)}break;case"ds-badge":if(!customElements.get(a(e))){d()}break;case"ds-button-unfilled":if(!customElements.get(a(e))){n()}break;case"ds-code-block":if(!customElements.get(a(e))){t()}break;case"ds-icon":if(!customElements.get(a(e))){i()}break;case"ds-loader":if(!customElements.get(a(e))){c()}break;case"ds-text":if(!customElements.get(a(e))){h()}break;case"ds-tooltip":if(!customElements.get(a(e))){m()}break}}))}g();export{k as M,g as d};
|
|
2
|
+
//# sourceMappingURL=p-CilwchJH.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,H as t,c as i,h as s,a as n,t as a}from"./index.js";import{d as r}from"./p-DzPtYdXy.js";import{d as o}from"./p-BnTPuV3x.js";import{d}from"./p-DSy1oOnd.js";import{d as u}from"./p-CBymzuOO.js";import{d as c}from"./p-Cea7rROU.js";import{d as l}from"./p-0XTyQNRG.js";import{d as h}from"./p-DI8DUozc.js";import{d as g}from"./p-Cd1JnnVK.js";import{d as q}from"./p-pnO8tAYB.js";function p(e,t){return e.find((e=>e.questionId===t))}function m(e,t){return Object.fromEntries(e.map((e=>{const i=p(t,e.id);const s=new Set(e.choices?.map((e=>e.value))??[]);if(e.type==="multiple"){const t=Array.isArray(i?.value)?i.value:[];const n=t.filter((e=>s.has(e)));const a=t.find((e=>!s.has(e)))??"";return[e.id,{value:n,otherSelected:Boolean(e.allowOther&&a),otherText:e.allowOther?a:"",skipped:i?.value===null}]}const n=typeof i?.value==="string"?i.value:"";const a=e.type==="single"&&s.has(n);return[e.id,{value:e.type==="single"&&!a?"":n,otherSelected:Boolean(e.type==="single"&&e.allowOther&&n&&!a),otherText:e.type==="single"&&e.allowOther&&n&&!a?n:"",skipped:i?.value===null}]})))}function f(e,t){if(t.skipped)return{questionId:e.id,value:null};if(e.type==="multiple"){const i=Array.isArray(t.value)?[...t.value]:[];if(t.otherSelected&&t.otherText.trim())i.push(t.otherText.trim());return{questionId:e.id,value:i.length||e.required?i:null}}if(t.otherSelected){const i=t.otherText.trim();return{questionId:e.id,value:i||null}}const i=typeof t.value==="string"?t.value.trim():"";return{questionId:e.id,value:i||null}}function b(e,t){if((e.type==="single"||e.type==="multiple")&&!e.choices?.length){return"This question has no available choices."}if(t.otherSelected&&!t.otherText.trim()){return"Enter a response for Other."}if(!e.required||t.skipped)return undefined;const i=f(e,t).value;const s=i===null||Array.isArray(i)&&i.length===0;if(!s)return undefined;return e.type==="text"?"Enter an answer before continuing.":"Choose an answer before continuing."}function _(e,t){if(!t||t.value===null)return"Skipped";const i=Array.isArray(t.value)?t.value:[t.value];const s=new Map(e.choices?.map((e=>[e.value,e.label]))??[]);return i.map((e=>s.get(e)??e)).join(", ")}const v=()=>`@media (forced-colors: active){.sc-ds-agent-questionnaire:root,.sc-ds-agent-questionnaire-h,.ds-forced-colors-scope.sc-ds-agent-questionnaire{--ds-forced-color-surface:Canvas;--ds-forced-color-content:CanvasText;--ds-forced-color-control-boundary:ButtonText;--ds-forced-color-selected:Highlight;--ds-forced-color-on-selected:HighlightText;--ds-forced-color-disabled:GrayText}}.ds-visually-hidden.sc-ds-agent-questionnaire-h,.ds-visually-hidden.sc-ds-agent-questionnaire{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}.sc-ds-agent-questionnaire-h{display:block;width:100%;min-width:0;box-sizing:border-box;-webkit-user-select:none;user-select:none}.questionnaire.sc-ds-agent-questionnaire{display:grid;gap:var(--dimension-space-150);width:100%;padding:var(--dimension-space-200);border-radius:var(--dimension-radius-125);background:var(--color-background-primary);box-shadow:var(--effect-elevation-elevated-md);box-sizing:border-box}.questionnaire--answered.sc-ds-agent-questionnaire{gap:var(--dimension-space-100);padding:var(--dimension-space-150);background:var(--color-background-secondary);box-shadow:none}.questionnaire--preparing.sc-ds-agent-questionnaire{align-items:center;grid-template-columns:auto minmax(0, 1fr)}.questionnaire__header.sc-ds-agent-questionnaire,.questionnaire__actions.sc-ds-agent-questionnaire,.questionnaire__actions-leading.sc-ds-agent-questionnaire,.questionnaire__error.sc-ds-agent-questionnaire,.questionnaire__submission-error.sc-ds-agent-questionnaire{display:flex;align-items:center}.questionnaire__header.sc-ds-agent-questionnaire,.questionnaire__actions.sc-ds-agent-questionnaire{justify-content:space-between;gap:var(--dimension-space-100)}.questionnaire__body.sc-ds-agent-questionnaire,.questionnaire__prompt.sc-ds-agent-questionnaire,.questionnaire__choices.sc-ds-agent-questionnaire,.questionnaire__single-choice.sc-ds-agent-questionnaire,.questionnaire__multiple-choice.sc-ds-agent-questionnaire,.questionnaire__other-choice.sc-ds-agent-questionnaire,.questionnaire__summary.sc-ds-agent-questionnaire,.questionnaire__summary.sc-ds-agent-questionnaire li.sc-ds-agent-questionnaire{display:grid}.questionnaire__body.sc-ds-agent-questionnaire,.questionnaire__prompt.sc-ds-agent-questionnaire,.questionnaire__choices.sc-ds-agent-questionnaire,.questionnaire__single-choice.sc-ds-agent-questionnaire,.questionnaire__multiple-choice.sc-ds-agent-questionnaire,.questionnaire__other-choice.sc-ds-agent-questionnaire{gap:var(--dimension-space-100)}.questionnaire__choices.sc-ds-agent-questionnaire{min-width:0;margin:0;padding:0;border:0}ds-radio.sc-ds-agent-questionnaire,ds-checkbox.sc-ds-agent-questionnaire{width:100%;min-width:0}.questionnaire__other-input.sc-ds-agent-questionnaire,.questionnaire__text-input.sc-ds-agent-questionnaire{width:100%;padding:var(--dimension-space-100);border:var(--dimension-stroke-width-012) solid var(--color-border-secondary);border-radius:var(--dimension-radius-050);outline:none;background:var(--color-background-primary);color:var(--color-foreground-primary);font-family:var(--typography-font-family-ui);font-size:var(--typography-fontsize-md);font-weight:var(--typography-weight-regular);line-height:var(--typography-lineheight-md);letter-spacing:var(--typography-letterspacing-negative-half);box-sizing:border-box;-webkit-user-select:text;user-select:text}.questionnaire__other-input.sc-ds-agent-questionnaire{width:calc(100% - var(--dimension-size-500));margin-inline-start:var(--dimension-size-500)}.questionnaire__text-input.sc-ds-agent-questionnaire{min-height:calc(var(--typography-lineheight-md) * 4 + var(--dimension-space-200));resize:vertical}.questionnaire__other-input.sc-ds-agent-questionnaire:focus,.questionnaire__text-input.sc-ds-agent-questionnaire:focus{border-color:var(--color-border-bold-brand);box-shadow:inset 0 0 0 var(--dimension-stroke-width-018) var(--color-border-bold-brand)}.questionnaire__other-input[aria-invalid='true'].sc-ds-agent-questionnaire,.questionnaire__text-input[aria-invalid='true'].sc-ds-agent-questionnaire{border-color:var(--color-border-bold-negative)}.questionnaire__error.sc-ds-agent-questionnaire,.questionnaire__submission-error.sc-ds-agent-questionnaire{gap:var(--dimension-space-050);color:var(--color-foreground-bold-negative)}.questionnaire__submission-error.sc-ds-agent-questionnaire{padding:var(--dimension-space-075);border-radius:var(--dimension-radius-050);background:var(--color-background-faint-negative)}.questionnaire__actions-leading.sc-ds-agent-questionnaire{flex-wrap:wrap;gap:var(--dimension-space-075)}.questionnaire__action-item.sc-ds-agent-questionnaire{width:fit-content;max-width:100%}.questionnaire.sc-ds-agent-questionnaire textarea.sc-ds-agent-questionnaire:disabled{color:var(--color-foreground-tertiary);cursor:default;opacity:1}.questionnaire__summary.sc-ds-agent-questionnaire{gap:var(--dimension-space-100);margin:0;padding:0;list-style:none}.questionnaire__summary.sc-ds-agent-questionnaire li.sc-ds-agent-questionnaire{gap:var(--dimension-space-025)}@media (max-width: 480px){.questionnaire.sc-ds-agent-questionnaire{padding:var(--dimension-space-150)}.questionnaire__actions.sc-ds-agent-questionnaire{align-items:stretch;flex-direction:column}.questionnaire__actions-leading.sc-ds-agent-questionnaire{display:grid;grid-template-columns:minmax(0, 1fr);width:100%}.questionnaire__action-item.sc-ds-agent-questionnaire,.questionnaire__action-item--primary.sc-ds-agent-questionnaire{width:100%}}@media (forced-colors: active){.questionnaire.sc-ds-agent-questionnaire{border:var(--dimension-stroke-width-012) solid var(--ds-forced-color-content);box-shadow:none}.questionnaire__other-input[aria-invalid='true'].sc-ds-agent-questionnaire,.questionnaire__text-input[aria-invalid='true'].sc-ds-agent-questionnaire{outline:var(--dimension-stroke-width-025) dashed var(--ds-forced-color-content)}.questionnaire__submission-error.sc-ds-agent-questionnaire{border:var(--dimension-stroke-width-012) solid var(--ds-forced-color-content);background:var(--ds-forced-color-surface)}.questionnaire.sc-ds-agent-questionnaire input.sc-ds-agent-questionnaire:disabled,.questionnaire.sc-ds-agent-questionnaire textarea.sc-ds-agent-questionnaire:disabled{color:var(--ds-forced-color-disabled)}}`;const y={progress:"Question {current} of {total}",previous:"Previous",next:"Next",answer:"Answer",skip:"Skip",cancel:"Cancel",other:"Other",otherPlaceholder:"Enter another answer",preparing:"Preparing questions…"};let x=0;const w=e(class e extends t{constructor(e){super();if(e!==false){this.__registerHost()}this.dsAnswer=i(this,"dsAnswer",7);this.dsCancel=i(this,"dsCancel",7);this.answers=[];this.status="ready";this.allowCancel=false;this.currentStep=0;this.drafts={};this.validation={};this.instanceId=++x;this.otherValue=`__ds-agent-questionnaire-other-${this.instanceId}`;this.answerPending=false;this.resetScheduled=false;this.answersSnapshot=[];this.waitingForRequestAnswers=false}componentWillLoad(){this.draftRequestId=this.requestId;this.answersSnapshot=this.answers;this.resetDraft()}handleQuestionnaireInputChange(){this.scheduleDraftReset()}handleStatusChange(e){if(e!=="submitting")this.answerPending=false}async setFocus(){this.focusCurrentControl()}get copy(){return{...y,...this.labels}}get disabled(){return this.status==="submitting"}resetDraft(e=this.answers){this.currentStep=0;this.drafts=m(this.questions??[],e??[]);this.validation={};this.answerPending=false}scheduleDraftReset(){if(this.resetScheduled)return;this.resetScheduled=true;queueMicrotask((()=>{this.resetScheduled=false;const e=this.requestId!==this.draftRequestId;const t=this.answers!==this.answersSnapshot;if(e&&!t){this.waitingForRequestAnswers=true}else if(t){this.waitingForRequestAnswers=false}this.resetDraft(this.waitingForRequestAnswers?[]:this.answers);this.draftRequestId=this.requestId;this.answersSnapshot=this.answers}))}focusCurrentControl(e=false){const t=()=>{const t=e?this.el.querySelector('[data-question-control][aria-invalid="true"]:not([disabled])'):null;const i=t??this.el.querySelector("[data-question-control]:not([disabled]):not([is-inactive])");const s=this.el.querySelector("[data-question-action]:not([is-inactive]):not([is-loading])");const n=i??s;if(n?.setFocus)void n.setFocus();else n?.focus()};t();requestAnimationFrame(t);setTimeout(t,0)}updateDraft(e,t){const i=this.drafts[e]??{value:"",otherSelected:false,otherText:"",skipped:false};this.drafts={...this.drafts,[e]:{...i,...t,skipped:false}};if(this.validation[e]){const{[e]:t,...i}=this.validation;this.validation=i}}validate(e){const t=b(e,this.drafts[e.id]);if(!t)return true;this.validation={...this.validation,[e.id]:t};this.focusCurrentControl(true);return false}move(e){this.currentStep=Math.min(Math.max(e,0),this.questions.length-1);this.focusCurrentControl()}next(e){if(!this.validate(e))return;this.move(this.currentStep+1)}skip(e){if(e.required)return;this.drafts={...this.drafts,[e.id]:{...this.drafts[e.id]??{value:"",otherSelected:false,otherText:""},skipped:true}};if(this.currentStep<this.questions.length-1)this.move(this.currentStep+1);else this.submit()}submit(){if(this.disabled||this.answerPending)return;const e=this.questions.findIndex((e=>!this.validateWithoutFocus(e)));if(e>=0){this.currentStep=e;this.focusCurrentControl(true);return}this.answerPending=true;this.dsAnswer.emit({requestId:this.requestId,answers:this.questions.map((e=>f(e,this.drafts[e.id])))})}validateWithoutFocus(e){const t=b(e,this.drafts[e.id]);if(!t)return true;this.validation={...this.validation,[e.id]:t};return false}progressLabel(){return this.copy.progress.split("{current}").join(String(this.currentStep+1)).split("{total}").join(String(this.questions.length))}selectSingle(e,t){const i=t===this.otherValue;this.updateDraft(e.id,{value:i?"":t,otherSelected:i});if(i){requestAnimationFrame((()=>this.el.querySelector("[data-question-other-input]")?.focus()))}}renderSingleChoice(e,t,i){const n=this.drafts[e.id];const a=n.otherSelected?this.otherValue:typeof n.value==="string"?n.value:"";const r=[...e.choices??[],...e.allowOther?[{value:this.otherValue,label:this.copy.other}]:[]];return s("div",{class:"questionnaire__single-choice"},s("ds-radio",{"data-question-control":true,size:"lg",options:r,value:a,disabled:this.disabled,form:`ds-agent-questionnaire-detached-${this.instanceId}`,ariaLabelledby:t,"aria-describedby":this.validation[e.id]?i:undefined,onDsChange:t=>this.selectSingle(e,t.detail)}),n.otherSelected?this.renderOtherInput(e,i):null)}renderMultipleChoice(e,t){const i=this.drafts[e.id];const n=Array.isArray(i.value)?i.value:[];const a=`ds-agent-questionnaire-detached-${this.instanceId}`;return s("div",{class:"questionnaire__multiple-choice"},e.choices?.map((t=>s("ds-checkbox",{key:t.value,"data-question-control":true,size:"lg",label:t.label,description:t.description,value:t.value,checked:n.includes(t.value),disabled:this.disabled,form:a,onDsChange:i=>{this.updateDraft(e.id,{value:i.detail?[...n,t.value]:n.filter((e=>e!==t.value))})}}))),e.allowOther?s("div",{class:"questionnaire__other-choice"},s("ds-checkbox",{"data-question-control":true,size:"lg",label:this.copy.other,checked:i.otherSelected,disabled:this.disabled,form:a,onDsChange:t=>{this.updateDraft(e.id,{otherSelected:t.detail});if(t.detail){requestAnimationFrame((()=>this.el.querySelector("[data-question-other-input]")?.focus()))}}}),i.otherSelected?this.renderOtherInput(e,t):null):null)}renderOtherInput(e,t){const i=this.drafts[e.id];return s("input",{class:"questionnaire__other-input","data-question-control":true,"data-question-other-input":true,type:"text",form:`ds-agent-questionnaire-detached-${this.instanceId}`,value:i.otherText,placeholder:this.copy.otherPlaceholder,"aria-label":this.copy.other,"aria-invalid":this.validation[e.id]?"true":undefined,"aria-describedby":this.validation[e.id]?t:undefined,disabled:this.disabled,onInput:t=>this.updateDraft(e.id,{otherText:t.target.value})})}renderQuestion(e){const t=this.drafts[e.id];const i=`ds-agent-questionnaire-${this.instanceId}-${this.currentStep}-error`;const n=`ds-agent-questionnaire-${this.instanceId}-${this.currentStep}-prompt`;return s("div",{class:"questionnaire__body"},s("div",{class:"questionnaire__prompt"},s("ds-text",{as:"h2",variant:"text-title-small",textId:n},e.question),e.description?s("ds-text",{variant:"text-body-small",color:"secondary"},e.description):null),e.type==="text"?s("textarea",{class:"questionnaire__text-input","data-question-control":true,value:typeof t.value==="string"?t.value:"",form:`ds-agent-questionnaire-detached-${this.instanceId}`,placeholder:e.placeholder,"aria-label":e.question,"aria-invalid":this.validation[e.id]?"true":undefined,"aria-describedby":this.validation[e.id]?i:undefined,disabled:this.disabled,rows:4,onInput:t=>this.updateDraft(e.id,{value:t.target.value})}):s("fieldset",{class:"questionnaire__choices","aria-describedby":this.validation[e.id]?i:undefined},s("legend",{class:"ds-visually-hidden"},e.question),e.type==="single"?this.renderSingleChoice(e,n,i):this.renderMultipleChoice(e,i)),this.validation[e.id]?s("div",{id:i,class:"questionnaire__error",role:"alert"},s("ds-icon",{name:"ErrorTriangle",size:"xs",color:"inherit"}),s("ds-text",{variant:"text-body-small",color:"negative"},this.validation[e.id])):null)}renderAnswered(){return s("div",{class:"questionnaire questionnaire--answered"},s("ol",{class:"questionnaire__summary"},this.questions.map((e=>s("li",null,s("ds-text",{variant:"text-body-small",emphasis:true},e.question),s("ds-text",{variant:"text-body-small",color:"secondary"},_(e,this.answers.find((t=>t.questionId===e.id)))))))))}render(){if(this.status==="preparing"){return s(n,null,s("div",{class:"questionnaire questionnaire--preparing",role:"status"},s("ds-loader",{size:"sm"}),s("ds-text",{variant:"text-body-medium"},this.copy.preparing)))}if(!this.questions?.length)return null;if(this.status==="answered")return s(n,null,this.renderAnswered());const e=this.questions[this.currentStep];const t=this.currentStep===this.questions.length-1;const i=Boolean(e.skippable&&!e.required);return s(n,null,s("section",{class:{questionnaire:true,"questionnaire--submitting":this.disabled,"questionnaire--error":this.status==="error"},"aria-busy":this.disabled?"true":undefined,"aria-label":e.question},s("header",{class:"questionnaire__header"},s("ds-text",{variant:"text-caption",color:"secondary"},this.progressLabel()),this.allowCancel?s("ds-tooltip",{label:this.copy.cancel,side:"top",size:"sm"},s("ds-button-unfilled",{"data-question-action":true,variant:"icon",icon:"Cross",size:"sm","aria-label":this.copy.cancel,hasBorder:false,isInactive:this.disabled,onDsClick:()=>this.dsCancel.emit({requestId:this.requestId})})):null),this.renderQuestion(e),this.status==="error"&&this.errorMessage?s("div",{class:"questionnaire__submission-error",role:"alert"},s("ds-icon",{name:"ErrorTriangle",size:"xs",color:"inherit"}),s("ds-text",{variant:"text-body-small",color:"negative"},this.errorMessage)):null,s("footer",{class:"questionnaire__actions"},s("div",{class:"questionnaire__actions-leading"},this.currentStep>0?s("div",{class:"questionnaire__action-item"},s("ds-button-unfilled",{"data-question-action":true,label:this.copy.previous,size:"sm",width:"fill",isInactive:this.disabled,onDsClick:()=>this.move(this.currentStep-1)})):null,i?s("div",{class:"questionnaire__action-item"},s("ds-button-unfilled",{"data-question-action":true,label:this.copy.skip,size:"sm",width:"fill",hasBorder:false,isInactive:this.disabled,onDsClick:()=>this.skip(e)})):null),s("div",{class:"questionnaire__action-item questionnaire__action-item--primary"},s("ds-button-filled",{"data-question-action":true,label:t?this.copy.answer:this.copy.next,size:"sm",width:"fill",isLoading:this.disabled,onDsClick:()=>t?this.submit():this.next(e)})))))}get el(){return this}static get watchers(){return{requestId:[{handleQuestionnaireInputChange:0}],questions:[{handleQuestionnaireInputChange:0}],answers:[{handleQuestionnaireInputChange:0}],status:[{handleStatusChange:0}]}}static get style(){return v()}},[2,"ds-agent-questionnaire",{requestId:[1,"request-id"],questions:[16],answers:[16],status:[1],errorMessage:[1,"error-message"],allowCancel:[4,"allow-cancel"],labels:[16],currentStep:[32],drafts:[32],validation:[32],setFocus:[64]},undefined,{requestId:[{handleQuestionnaireInputChange:0}],questions:[{handleQuestionnaireInputChange:0}],answers:[{handleQuestionnaireInputChange:0}],status:[{handleStatusChange:0}]}]);function k(){if(typeof customElements==="undefined"){return}const e=["ds-agent-questionnaire","ds-badge","ds-button-filled","ds-button-unfilled","ds-checkbox","ds-icon","ds-loader","ds-radio","ds-text","ds-tooltip"];e.forEach((e=>{switch(e){case"ds-agent-questionnaire":if(!customElements.get(a(e))){customElements.define(a(e),w)}break;case"ds-badge":if(!customElements.get(a(e))){r()}break;case"ds-button-filled":if(!customElements.get(a(e))){o()}break;case"ds-button-unfilled":if(!customElements.get(a(e))){d()}break;case"ds-checkbox":if(!customElements.get(a(e))){u()}break;case"ds-icon":if(!customElements.get(a(e))){c()}break;case"ds-loader":if(!customElements.get(a(e))){l()}break;case"ds-radio":if(!customElements.get(a(e))){h()}break;case"ds-text":if(!customElements.get(a(e))){g()}break;case"ds-tooltip":if(!customElements.get(a(e))){q()}break}}))}k();export{w as A,k as d};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{p as e,H as t,c as i,h as s,a as n,t as a}from"./index.js";import{d as r}from"./p-DzPtYdXy.js";import{d as o}from"./p-BnTPuV3x.js";import{d}from"./p-7MWaWl8w.js";import{d as u}from"./p-CBymzuOO.js";import{d as c}from"./p-Cea7rROU.js";import{d as l}from"./p-0XTyQNRG.js";import{d as h}from"./p-DI8DUozc.js";import{d as g}from"./p-Cd1JnnVK.js";import{d as q}from"./p-9X_p0bHr.js";function p(e,t){return e.find((e=>e.questionId===t))}function m(e,t){return Object.fromEntries(e.map((e=>{const i=p(t,e.id);const s=new Set(e.choices?.map((e=>e.value))??[]);if(e.type==="multiple"){const t=Array.isArray(i?.value)?i.value:[];const n=t.filter((e=>s.has(e)));const a=t.find((e=>!s.has(e)))??"";return[e.id,{value:n,otherSelected:Boolean(e.allowOther&&a),otherText:e.allowOther?a:"",skipped:i?.value===null}]}const n=typeof i?.value==="string"?i.value:"";const a=e.type==="single"&&s.has(n);return[e.id,{value:e.type==="single"&&!a?"":n,otherSelected:Boolean(e.type==="single"&&e.allowOther&&n&&!a),otherText:e.type==="single"&&e.allowOther&&n&&!a?n:"",skipped:i?.value===null}]})))}function f(e,t){if(t.skipped)return{questionId:e.id,value:null};if(e.type==="multiple"){const i=Array.isArray(t.value)?[...t.value]:[];if(t.otherSelected&&t.otherText.trim())i.push(t.otherText.trim());return{questionId:e.id,value:i.length||e.required?i:null}}if(t.otherSelected){const i=t.otherText.trim();return{questionId:e.id,value:i||null}}const i=typeof t.value==="string"?t.value.trim():"";return{questionId:e.id,value:i||null}}function b(e,t){if((e.type==="single"||e.type==="multiple")&&!e.choices?.length){return"This question has no available choices."}if(t.otherSelected&&!t.otherText.trim()){return"Enter a response for Other."}if(!e.required||t.skipped)return undefined;const i=f(e,t).value;const s=i===null||Array.isArray(i)&&i.length===0;if(!s)return undefined;return e.type==="text"?"Enter an answer before continuing.":"Choose an answer before continuing."}function _(e,t){if(!t||t.value===null)return"Skipped";const i=Array.isArray(t.value)?t.value:[t.value];const s=new Map(e.choices?.map((e=>[e.value,e.label]))??[]);return i.map((e=>s.get(e)??e)).join(", ")}const v=()=>`@media (forced-colors: active){.sc-ds-agent-questionnaire:root,.sc-ds-agent-questionnaire-h,.ds-forced-colors-scope.sc-ds-agent-questionnaire{--ds-forced-color-surface:Canvas;--ds-forced-color-content:CanvasText;--ds-forced-color-control-boundary:ButtonText;--ds-forced-color-selected:Highlight;--ds-forced-color-on-selected:HighlightText;--ds-forced-color-disabled:GrayText}}.ds-visually-hidden.sc-ds-agent-questionnaire-h,.ds-visually-hidden.sc-ds-agent-questionnaire{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}.sc-ds-agent-questionnaire-h{display:block;width:100%;min-width:0;box-sizing:border-box;-webkit-user-select:none;user-select:none}.questionnaire.sc-ds-agent-questionnaire{display:grid;gap:var(--dimension-space-150);width:100%;padding:var(--dimension-space-200);border-radius:var(--dimension-radius-125);background:var(--color-background-primary);box-shadow:var(--effect-elevation-elevated-md);box-sizing:border-box}.questionnaire--answered.sc-ds-agent-questionnaire{gap:var(--dimension-space-100);padding:var(--dimension-space-150);background:var(--color-background-secondary);box-shadow:none}.questionnaire--preparing.sc-ds-agent-questionnaire{align-items:center;grid-template-columns:auto minmax(0, 1fr)}.questionnaire__header.sc-ds-agent-questionnaire,.questionnaire__actions.sc-ds-agent-questionnaire,.questionnaire__actions-leading.sc-ds-agent-questionnaire,.questionnaire__error.sc-ds-agent-questionnaire,.questionnaire__submission-error.sc-ds-agent-questionnaire{display:flex;align-items:center}.questionnaire__header.sc-ds-agent-questionnaire,.questionnaire__actions.sc-ds-agent-questionnaire{justify-content:space-between;gap:var(--dimension-space-100)}.questionnaire__body.sc-ds-agent-questionnaire,.questionnaire__prompt.sc-ds-agent-questionnaire,.questionnaire__choices.sc-ds-agent-questionnaire,.questionnaire__single-choice.sc-ds-agent-questionnaire,.questionnaire__multiple-choice.sc-ds-agent-questionnaire,.questionnaire__other-choice.sc-ds-agent-questionnaire,.questionnaire__summary.sc-ds-agent-questionnaire,.questionnaire__summary.sc-ds-agent-questionnaire li.sc-ds-agent-questionnaire{display:grid}.questionnaire__body.sc-ds-agent-questionnaire,.questionnaire__prompt.sc-ds-agent-questionnaire,.questionnaire__choices.sc-ds-agent-questionnaire,.questionnaire__single-choice.sc-ds-agent-questionnaire,.questionnaire__multiple-choice.sc-ds-agent-questionnaire,.questionnaire__other-choice.sc-ds-agent-questionnaire{gap:var(--dimension-space-100)}.questionnaire__choices.sc-ds-agent-questionnaire{min-width:0;margin:0;padding:0;border:0}ds-radio.sc-ds-agent-questionnaire,ds-checkbox.sc-ds-agent-questionnaire{width:100%;min-width:0}.questionnaire__other-input.sc-ds-agent-questionnaire,.questionnaire__text-input.sc-ds-agent-questionnaire{width:100%;padding:var(--dimension-space-100);border:var(--dimension-stroke-width-012) solid var(--color-border-secondary);border-radius:var(--dimension-radius-050);outline:none;background:var(--color-background-primary);color:var(--color-foreground-primary);font-family:var(--typography-font-family-ui);font-size:var(--typography-fontsize-md);font-weight:var(--typography-weight-regular);line-height:var(--typography-lineheight-md);letter-spacing:var(--typography-letterspacing-negative-half);box-sizing:border-box;-webkit-user-select:text;user-select:text}.questionnaire__other-input.sc-ds-agent-questionnaire{width:calc(100% - var(--dimension-size-500));margin-inline-start:var(--dimension-size-500)}.questionnaire__text-input.sc-ds-agent-questionnaire{min-height:calc(var(--typography-lineheight-md) * 4 + var(--dimension-space-200));resize:vertical}.questionnaire__other-input.sc-ds-agent-questionnaire:focus,.questionnaire__text-input.sc-ds-agent-questionnaire:focus{border-color:var(--color-border-bold-brand);box-shadow:inset 0 0 0 var(--dimension-stroke-width-018) var(--color-border-bold-brand)}.questionnaire__other-input[aria-invalid='true'].sc-ds-agent-questionnaire,.questionnaire__text-input[aria-invalid='true'].sc-ds-agent-questionnaire{border-color:var(--color-border-bold-negative)}.questionnaire__error.sc-ds-agent-questionnaire,.questionnaire__submission-error.sc-ds-agent-questionnaire{gap:var(--dimension-space-050);color:var(--color-foreground-bold-negative)}.questionnaire__submission-error.sc-ds-agent-questionnaire{padding:var(--dimension-space-075);border-radius:var(--dimension-radius-050);background:var(--color-background-faint-negative)}.questionnaire__actions-leading.sc-ds-agent-questionnaire{flex-wrap:wrap;gap:var(--dimension-space-075)}.questionnaire__action-item.sc-ds-agent-questionnaire{width:fit-content;max-width:100%}.questionnaire.sc-ds-agent-questionnaire textarea.sc-ds-agent-questionnaire:disabled{color:var(--color-foreground-tertiary);cursor:default;opacity:1}.questionnaire__summary.sc-ds-agent-questionnaire{gap:var(--dimension-space-100);margin:0;padding:0;list-style:none}.questionnaire__summary.sc-ds-agent-questionnaire li.sc-ds-agent-questionnaire{gap:var(--dimension-space-025)}@media (max-width: 480px){.questionnaire.sc-ds-agent-questionnaire{padding:var(--dimension-space-150)}.questionnaire__actions.sc-ds-agent-questionnaire{align-items:stretch;flex-direction:column}.questionnaire__actions-leading.sc-ds-agent-questionnaire{display:grid;grid-template-columns:minmax(0, 1fr);width:100%}.questionnaire__action-item.sc-ds-agent-questionnaire,.questionnaire__action-item--primary.sc-ds-agent-questionnaire{width:100%}}@media (forced-colors: active){.questionnaire.sc-ds-agent-questionnaire{border:var(--dimension-stroke-width-012) solid var(--ds-forced-color-content);box-shadow:none}.questionnaire__other-input[aria-invalid='true'].sc-ds-agent-questionnaire,.questionnaire__text-input[aria-invalid='true'].sc-ds-agent-questionnaire{outline:var(--dimension-stroke-width-025) dashed var(--ds-forced-color-content)}.questionnaire__submission-error.sc-ds-agent-questionnaire{border:var(--dimension-stroke-width-012) solid var(--ds-forced-color-content);background:var(--ds-forced-color-surface)}.questionnaire.sc-ds-agent-questionnaire input.sc-ds-agent-questionnaire:disabled,.questionnaire.sc-ds-agent-questionnaire textarea.sc-ds-agent-questionnaire:disabled{color:var(--ds-forced-color-disabled)}}`;const x={progress:"Question {current} of {total}",previous:"Previous",next:"Next",answer:"Answer",skip:"Skip",cancel:"Cancel",other:"Other",otherPlaceholder:"Enter another answer",preparing:"Preparing questions…"};let y=0;const w=e(class e extends t{constructor(e){super();if(e!==false){this.__registerHost()}this.dsAnswer=i(this,"dsAnswer",7);this.dsCancel=i(this,"dsCancel",7);this.answers=[];this.status="ready";this.allowCancel=false;this.currentStep=0;this.drafts={};this.validation={};this.instanceId=++y;this.otherValue=`__ds-agent-questionnaire-other-${this.instanceId}`;this.answerPending=false;this.resetScheduled=false;this.answersSnapshot=[];this.waitingForRequestAnswers=false}componentWillLoad(){this.draftRequestId=this.requestId;this.answersSnapshot=this.answers;this.resetDraft()}handleQuestionnaireInputChange(){this.scheduleDraftReset()}handleStatusChange(e){if(e!=="submitting")this.answerPending=false}async setFocus(){this.focusCurrentControl()}get copy(){return{...x,...this.labels}}get disabled(){return this.status==="submitting"}resetDraft(e=this.answers){this.currentStep=0;this.drafts=m(this.questions??[],e??[]);this.validation={};this.answerPending=false}scheduleDraftReset(){if(this.resetScheduled)return;this.resetScheduled=true;queueMicrotask((()=>{this.resetScheduled=false;const e=this.requestId!==this.draftRequestId;const t=this.answers!==this.answersSnapshot;if(e&&!t){this.waitingForRequestAnswers=true}else if(t){this.waitingForRequestAnswers=false}this.resetDraft(this.waitingForRequestAnswers?[]:this.answers);this.draftRequestId=this.requestId;this.answersSnapshot=this.answers}))}focusCurrentControl(e=false){const t=()=>{const t=e?this.el.querySelector('[data-question-control][aria-invalid="true"]:not([disabled])'):null;const i=t??this.el.querySelector("[data-question-control]:not([disabled]):not([is-inactive])");const s=this.el.querySelector("[data-question-action]:not([is-inactive]):not([is-loading])");const n=i??s;if(n?.setFocus)void n.setFocus();else n?.focus()};t();requestAnimationFrame(t);setTimeout(t,0)}updateDraft(e,t){const i=this.drafts[e]??{value:"",otherSelected:false,otherText:"",skipped:false};this.drafts={...this.drafts,[e]:{...i,...t,skipped:false}};if(this.validation[e]){const{[e]:t,...i}=this.validation;this.validation=i}}validate(e){const t=b(e,this.drafts[e.id]);if(!t)return true;this.validation={...this.validation,[e.id]:t};this.focusCurrentControl(true);return false}move(e){this.currentStep=Math.min(Math.max(e,0),this.questions.length-1);this.focusCurrentControl()}next(e){if(!this.validate(e))return;this.move(this.currentStep+1)}skip(e){if(e.required)return;this.drafts={...this.drafts,[e.id]:{...this.drafts[e.id]??{value:"",otherSelected:false,otherText:""},skipped:true}};if(this.currentStep<this.questions.length-1)this.move(this.currentStep+1);else this.submit()}submit(){if(this.disabled||this.answerPending)return;const e=this.questions.findIndex((e=>!this.validateWithoutFocus(e)));if(e>=0){this.currentStep=e;this.focusCurrentControl(true);return}this.answerPending=true;this.dsAnswer.emit({requestId:this.requestId,answers:this.questions.map((e=>f(e,this.drafts[e.id])))})}validateWithoutFocus(e){const t=b(e,this.drafts[e.id]);if(!t)return true;this.validation={...this.validation,[e.id]:t};return false}progressLabel(){return this.copy.progress.split("{current}").join(String(this.currentStep+1)).split("{total}").join(String(this.questions.length))}selectSingle(e,t){const i=t===this.otherValue;this.updateDraft(e.id,{value:i?"":t,otherSelected:i});if(i){requestAnimationFrame((()=>this.el.querySelector("[data-question-other-input]")?.focus()))}}renderSingleChoice(e,t,i){const n=this.drafts[e.id];const a=n.otherSelected?this.otherValue:typeof n.value==="string"?n.value:"";const r=[...e.choices??[],...e.allowOther?[{value:this.otherValue,label:this.copy.other}]:[]];return s("div",{class:"questionnaire__single-choice"},s("ds-radio",{"data-question-control":true,size:"lg",options:r,value:a,disabled:this.disabled,form:`ds-agent-questionnaire-detached-${this.instanceId}`,ariaLabelledby:t,"aria-describedby":this.validation[e.id]?i:undefined,onDsChange:t=>this.selectSingle(e,t.detail)}),n.otherSelected?this.renderOtherInput(e,i):null)}renderMultipleChoice(e,t){const i=this.drafts[e.id];const n=Array.isArray(i.value)?i.value:[];const a=`ds-agent-questionnaire-detached-${this.instanceId}`;return s("div",{class:"questionnaire__multiple-choice"},e.choices?.map((t=>s("ds-checkbox",{key:t.value,"data-question-control":true,size:"lg",label:t.label,description:t.description,value:t.value,checked:n.includes(t.value),disabled:this.disabled,form:a,onDsChange:i=>{this.updateDraft(e.id,{value:i.detail?[...n,t.value]:n.filter((e=>e!==t.value))})}}))),e.allowOther?s("div",{class:"questionnaire__other-choice"},s("ds-checkbox",{"data-question-control":true,size:"lg",label:this.copy.other,checked:i.otherSelected,disabled:this.disabled,form:a,onDsChange:t=>{this.updateDraft(e.id,{otherSelected:t.detail});if(t.detail){requestAnimationFrame((()=>this.el.querySelector("[data-question-other-input]")?.focus()))}}}),i.otherSelected?this.renderOtherInput(e,t):null):null)}renderOtherInput(e,t){const i=this.drafts[e.id];return s("input",{class:"questionnaire__other-input","data-question-control":true,"data-question-other-input":true,type:"text",form:`ds-agent-questionnaire-detached-${this.instanceId}`,value:i.otherText,placeholder:this.copy.otherPlaceholder,"aria-label":this.copy.other,"aria-invalid":this.validation[e.id]?"true":undefined,"aria-describedby":this.validation[e.id]?t:undefined,disabled:this.disabled,onInput:t=>this.updateDraft(e.id,{otherText:t.target.value})})}renderQuestion(e){const t=this.drafts[e.id];const i=`ds-agent-questionnaire-${this.instanceId}-${this.currentStep}-error`;const n=`ds-agent-questionnaire-${this.instanceId}-${this.currentStep}-prompt`;return s("div",{class:"questionnaire__body"},s("div",{class:"questionnaire__prompt"},s("ds-text",{as:"h2",variant:"text-title-small",textId:n},e.question),e.description?s("ds-text",{variant:"text-body-small",color:"secondary"},e.description):null),e.type==="text"?s("textarea",{class:"questionnaire__text-input","data-question-control":true,value:typeof t.value==="string"?t.value:"",form:`ds-agent-questionnaire-detached-${this.instanceId}`,placeholder:e.placeholder,"aria-label":e.question,"aria-invalid":this.validation[e.id]?"true":undefined,"aria-describedby":this.validation[e.id]?i:undefined,disabled:this.disabled,rows:4,onInput:t=>this.updateDraft(e.id,{value:t.target.value})}):s("fieldset",{class:"questionnaire__choices","aria-describedby":this.validation[e.id]?i:undefined},s("legend",{class:"ds-visually-hidden"},e.question),e.type==="single"?this.renderSingleChoice(e,n,i):this.renderMultipleChoice(e,i)),this.validation[e.id]?s("div",{id:i,class:"questionnaire__error",role:"alert"},s("ds-icon",{name:"ErrorTriangle",size:"xs",color:"inherit"}),s("ds-text",{variant:"text-body-small",color:"negative"},this.validation[e.id])):null)}renderAnswered(){return s("div",{class:"questionnaire questionnaire--answered"},s("ol",{class:"questionnaire__summary"},this.questions.map((e=>s("li",null,s("ds-text",{variant:"text-body-small",emphasis:true},e.question),s("ds-text",{variant:"text-body-small",color:"secondary"},_(e,this.answers.find((t=>t.questionId===e.id)))))))))}render(){if(this.status==="preparing"){return s(n,null,s("div",{class:"questionnaire questionnaire--preparing",role:"status"},s("ds-loader",{size:"sm"}),s("ds-text",{variant:"text-body-medium"},this.copy.preparing)))}if(!this.questions?.length)return null;if(this.status==="answered")return s(n,null,this.renderAnswered());const e=this.questions[this.currentStep];const t=this.currentStep===this.questions.length-1;const i=Boolean(e.skippable&&!e.required);return s(n,null,s("section",{class:{questionnaire:true,"questionnaire--submitting":this.disabled,"questionnaire--error":this.status==="error"},"aria-busy":this.disabled?"true":undefined,"aria-label":e.question},s("header",{class:"questionnaire__header"},s("ds-text",{variant:"text-caption",color:"secondary"},this.progressLabel()),this.allowCancel?s("ds-tooltip",{label:this.copy.cancel,side:"top",size:"sm"},s("ds-button-unfilled",{"data-question-action":true,variant:"icon",icon:"Cross",size:"sm","aria-label":this.copy.cancel,hasBorder:false,isInactive:this.disabled,onDsClick:()=>this.dsCancel.emit({requestId:this.requestId})})):null),this.renderQuestion(e),this.status==="error"&&this.errorMessage?s("div",{class:"questionnaire__submission-error",role:"alert"},s("ds-icon",{name:"ErrorTriangle",size:"xs",color:"inherit"}),s("ds-text",{variant:"text-body-small",color:"negative"},this.errorMessage)):null,s("footer",{class:"questionnaire__actions"},s("div",{class:"questionnaire__actions-leading"},this.currentStep>0?s("div",{class:"questionnaire__action-item"},s("ds-button-unfilled",{"data-question-action":true,label:this.copy.previous,size:"sm",width:"fill",isInactive:this.disabled,onDsClick:()=>this.move(this.currentStep-1)})):null,i?s("div",{class:"questionnaire__action-item"},s("ds-button-unfilled",{"data-question-action":true,label:this.copy.skip,size:"sm",width:"fill",hasBorder:false,isInactive:this.disabled,onDsClick:()=>this.skip(e)})):null),s("div",{class:"questionnaire__action-item questionnaire__action-item--primary"},s("ds-button-filled",{"data-question-action":true,label:t?this.copy.answer:this.copy.next,size:"sm",width:"fill",isLoading:this.disabled,onDsClick:()=>t?this.submit():this.next(e)})))))}get el(){return this}static get watchers(){return{requestId:[{handleQuestionnaireInputChange:0}],questions:[{handleQuestionnaireInputChange:0}],answers:[{handleQuestionnaireInputChange:0}],status:[{handleStatusChange:0}]}}static get style(){return v()}},[2,"ds-agent-questionnaire",{requestId:[1,"request-id"],questions:[16],answers:[16],status:[1],errorMessage:[1,"error-message"],allowCancel:[4,"allow-cancel"],labels:[16],currentStep:[32],drafts:[32],validation:[32],setFocus:[64]},undefined,{requestId:[{handleQuestionnaireInputChange:0}],questions:[{handleQuestionnaireInputChange:0}],answers:[{handleQuestionnaireInputChange:0}],status:[{handleStatusChange:0}]}]);function k(){if(typeof customElements==="undefined"){return}const e=["ds-agent-questionnaire","ds-badge","ds-button-filled","ds-button-unfilled","ds-checkbox","ds-icon","ds-loader","ds-radio","ds-text","ds-tooltip"];e.forEach((e=>{switch(e){case"ds-agent-questionnaire":if(!customElements.get(a(e))){customElements.define(a(e),w)}break;case"ds-badge":if(!customElements.get(a(e))){r()}break;case"ds-button-filled":if(!customElements.get(a(e))){o()}break;case"ds-button-unfilled":if(!customElements.get(a(e))){d()}break;case"ds-checkbox":if(!customElements.get(a(e))){u()}break;case"ds-icon":if(!customElements.get(a(e))){c()}break;case"ds-loader":if(!customElements.get(a(e))){l()}break;case"ds-radio":if(!customElements.get(a(e))){h()}break;case"ds-text":if(!customElements.get(a(e))){g()}break;case"ds-tooltip":if(!customElements.get(a(e))){q()}break}}))}k();export{w as A,k as d};
|
|
2
|
+
//# sourceMappingURL=p-CrYJnDev.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,H as s,c as t,h as i,a as o,t as l}from"./index.js";import{o as a,a as
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{p as e,H as s,c as t,h as i,a as o,t as l}from"./index.js";import{o as a,a as r,r as n,b as h,d}from"./p-COFw_fcj.js";import{i as c,r as m,a as u}from"./p-CgGcgMjs.js";import{d as b}from"./p-DzPtYdXy.js";import{d as p}from"./p-7MWaWl8w.js";import{d as f}from"./p-Cea7rROU.js";import{d as g}from"./p-0XTyQNRG.js";import{d as v}from"./p-DeK_6Uym.js";import{d as k}from"./p-FxtgCvhA.js";import{d as _}from"./p-0X-4KGQf.js";import{d as w}from"./p-DzVYGJJv.js";import{d as y}from"./p-XaCYqck3.js";import{d as C}from"./p-DGkn8FwV.js";import{d as j}from"./p-Bjq1KP_Y.js";import{d as x}from"./p-DbLLH3hr.js";import{d as E}from"./p-Cd1JnnVK.js";import{d as D}from"./p-9X_p0bHr.js";const L=()=>`:host{display:block;min-width:0;min-height:0;height:100%;background:transparent}:host([responsive-mode='mobile']){width:100%;background:var(--color-background-primary)}.shell-tools__desktop,.shell-tools__desktop ds-panel-tools,.shell-tools__mobile{display:block;min-width:0;min-height:0;height:100%}.shell-tools__slot-proxy{display:block;width:100%;height:100%;min-width:0;min-height:0}.shell-tools__mobile{display:grid;grid-template-rows:auto minmax(0, 1fr);background:var(--color-background-primary)}.shell-tools__mobile-header{grid-row:1}.shell-tools__mobile-body,.shell-tools__view{min-width:0;min-height:0;height:100%}.shell-tools__mobile-body{grid-row:2;overflow:hidden}.shell-tools__view{overflow:auto;overscroll-behavior:contain}.shell-tools__view[hidden]{display:none}.shell-tools__view ::slotted(*){min-height:0}`;const T=e(class e extends s{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.dsToolChange=t(this,"dsToolChange",7);this.dsPresentationChange=t(this,"dsPresentationChange",7);this.dsHeaderBack=t(this,"dsHeaderBack",7);this.dsHeaderAction=t(this,"dsHeaderAction",7);this.responsiveMode="desktop";this.open=false;this.activeTool="";this.presentation="drawer";this.fullscreenHeaderMode="shared";this.items=[];this.headers={};this.storageKey="";this.toolsLabel="Tools";this.toolShortcutsLabel="Tool shortcuts";this.inboxLabel="Inbox";this.inboxNavigationLabel="Inbox sections";this.panelToolsEl=null;this.selectInboxTool=e=>{const s=e.detail;if(!this.availableInboxTools.includes(s)||s===this.mobileActiveTool)return;this.open=true;this.activeTool=s;this.dsToolChange.emit({id:s,selected:true})};this.handlePanelToolChange=e=>{this.activeTool=e.detail.id;this.open=e.detail.selected};this.handlePanelPresentationChange=e=>{this.presentation=e.detail.presentation};this.handleMobileHeaderAction=(e,s,t)=>{t.stopPropagation();this.dsHeaderAction.emit({tool:e,id:s})}}presentationChanged(e,s){if(e===s)return;if(this.panelToolsEl&&this.panelToolsEl.getAttribute("presentation")!==e){this.panelToolsEl.setAttribute("presentation",e)}}get resolvedItems(){return this.items??[]}get availableInboxTools(){return this.resolvedItems.filter((e=>!e.isInactive&&c(e))).map((e=>e.id))}get mobileViewOrder(){return a(this.resolvedItems).map((e=>e.id))}toolLabel(e){const s=this.resolvedItems.find((s=>s.id===e));return s?.label??s?.ariaLabel??r[e]??e}get mobileActiveTool(){const e=this.resolvedItems.find((e=>e.id===this.activeTool));const s=e?c(e):u(this.activeTool);if(!s)return this.activeTool;return m(this.activeTool,this.availableInboxTools)}componentWillLoad(){this.reconcileAvailability()}handleItemsChange(){this.reconcileAvailability()}reconcileAvailability(){const e=n(this.resolvedItems,this.open,this.activeTool);this.open=e.open;this.activeTool=e.activeTool}resolvedHeaders(){return this.headers??{}}activeHeader(e){return this.resolvedHeaders()[e]??{}}activateMobileTool(e){const s=this.resolvedItems.find((s=>s.id===e));if(!s||s.isInactive)return;const t=h(this.open,this.activeTool,e);this.open=t.open;this.activeTool=t.activeTool;this.dsToolChange.emit({id:e,selected:t.selected})}async activateTool(e){if(this.responsiveMode!=="mobile"){await(this.panelToolsEl?.activateTool(e));return}this.activateMobileTool(e)}async closeDrawer(){if(this.responsiveMode!=="mobile"){await(this.panelToolsEl?.closeDrawer());return}if(!this.open)return;const e=this.activeTool;this.open=false;if(e)this.dsToolChange.emit({id:e,selected:false})}async focusHeaderAction(e){if(this.responsiveMode!=="mobile"){await(this.panelToolsEl?.focusHeaderAction(e));return}const s=(this.el.shadowRoot??this.el).querySelector(`[data-header-action-id="${CSS.escape(e)}"]`);await(s?.setFocus?.())}renderForwardedSlots(){return this.mobileViewOrder.flatMap((e=>[i("div",{key:`tool:${e}`,class:"shell-tools__slot-proxy",slot:e},i("slot",{name:e})),i("div",{key:`tool-view:${e}`,class:"shell-tools__slot-proxy",slot:`${e}-view`},i("slot",{name:`${e}-view`}))]))}renderDesktop(){return i("div",{class:"shell-tools__desktop"},i("ds-panel-tools",{open:this.open,activeTool:this.activeTool,presentation:this.presentation,fullscreenHeaderMode:this.fullscreenHeaderMode,items:this.resolvedItems,headers:this.resolvedHeaders(),storageKey:this.storageKey,toolsLabel:this.toolsLabel,toolShortcutsLabel:this.toolShortcutsLabel,ref:e=>{this.panelToolsEl=e},onDsToolChange:this.handlePanelToolChange,onDsPresentationChange:this.handlePanelPresentationChange},this.renderForwardedSlots()))}renderMobileHeader(e){const s=this.activeHeader(e);const t=s.title?.trim();const o=t||this.toolLabel(e);const l=(s.actions??[]).filter((e=>e.id!=="fullscreen"));const a=this.resolvedItems.find((s=>s.id===e));const r=Boolean(a&&c(a)&&!s.showBack);const n=r?this.availableInboxTools.map((e=>{const s=this.resolvedItems.find((s=>s.id===e));return{id:e,label:this.toolLabel(e),variant:"label",dot:s?.dot}})):[];return i("ds-mobile-header",{class:"shell-tools__mobile-header",heading:o,headingLevel:"h2",sections:n,value:e,sectionsAriaLabel:this.inboxNavigationLabel,sectionsPresentation:r?"segmented":"switcher",sectionsSize:"lg",onDsSectionChange:this.selectInboxTool},s.showBack?i("ds-tooltip",{slot:"leading",label:s.backAriaLabel||"Back",side:"bottom",size:"sm"},i("ds-button-unfilled",{variant:"icon",icon:s.backIcon||"ChevronLeft",size:"md","aria-label":s.backAriaLabel||"Back",activeFill:false,hasBorder:false,onDsClick:()=>this.dsHeaderBack.emit({tool:e})})):null,l.map((s=>i("ds-tooltip",{slot:"trailing",key:s.id,label:s.ariaLabel,side:"bottom",size:"sm"},i("ds-button-unfilled",{id:s.triggerId||undefined,"data-header-action-id":s.id,variant:"icon",icon:s.icon,size:"md","aria-label":s.ariaLabel,haspopup:s.haspopup,controls:s.controls,expanded:s.expanded,pressed:s.pressed,isInactive:s.isInactive,activeFill:false,hasBorder:false,onDsClick:t=>this.handleMobileHeaderAction(e,s.id,t)})))))}renderMobile(){const e=this.mobileActiveTool;return i("div",{class:"shell-tools__mobile","aria-hidden":this.open&&e?undefined:"true",inert:this.open&&e?undefined:true},e?this.renderMobileHeader(e):null,i("div",{class:"shell-tools__mobile-body"},this.mobileViewOrder.map((s=>{const t=this.open&&s===e;return i("div",{key:`mobile-tool-view:${s}`,class:{"shell-tools__view":true,"shell-tools__view--active":t},hidden:!t,"aria-hidden":t?undefined:"true",inert:t?undefined:true},i("slot",{name:`${s}-view`},i("slot",{name:s})))}))))}render(){const e=this.responsiveMode==="mobile";return i(o,{key:"64d96a6b6bc0e30991c6c2578eb67fded642d104",role:e?this.presentation==="fullscreen"?"dialog":"complementary":undefined,"aria-modal":e&&this.presentation==="fullscreen"?"true":undefined,"aria-label":e?this.toolsLabel:undefined},e?this.renderMobile():this.renderDesktop())}get el(){return this}static get watchers(){return{presentation:[{presentationChanged:0}],items:[{handleItemsChange:0}]}}static get style(){return L()}},[257,"ds-shell-tools",{responsiveMode:[513,"responsive-mode"],open:[1540],activeTool:[1537,"active-tool"],presentation:[1537],fullscreenHeaderMode:[513,"fullscreen-header-mode"],items:[16],headers:[16],storageKey:[1,"storage-key"],toolsLabel:[1,"tools-label"],toolShortcutsLabel:[1,"tool-shortcuts-label"],inboxLabel:[1,"inbox-label"],inboxNavigationLabel:[1,"inbox-navigation-label"],activateTool:[64],closeDrawer:[64],focusHeaderAction:[64]},undefined,{presentation:[{presentationChanged:0}],items:[{handleItemsChange:0}]}]);function H(){if(typeof customElements==="undefined"){return}const e=["ds-shell-tools","ds-badge","ds-button-unfilled","ds-icon","ds-loader","ds-menu","ds-mobile-header","ds-mobile-section-switcher","ds-panel-tool-header","ds-panel-tools","ds-swatch-picker","ds-switch","ds-tab-group","ds-tag","ds-text","ds-tooltip"];e.forEach((e=>{switch(e){case"ds-shell-tools":if(!customElements.get(l(e))){customElements.define(l(e),T)}break;case"ds-badge":if(!customElements.get(l(e))){b()}break;case"ds-button-unfilled":if(!customElements.get(l(e))){p()}break;case"ds-icon":if(!customElements.get(l(e))){f()}break;case"ds-loader":if(!customElements.get(l(e))){g()}break;case"ds-menu":if(!customElements.get(l(e))){v()}break;case"ds-mobile-header":if(!customElements.get(l(e))){k()}break;case"ds-mobile-section-switcher":if(!customElements.get(l(e))){_()}break;case"ds-panel-tool-header":if(!customElements.get(l(e))){w()}break;case"ds-panel-tools":if(!customElements.get(l(e))){d()}break;case"ds-swatch-picker":if(!customElements.get(l(e))){y()}break;case"ds-switch":if(!customElements.get(l(e))){C()}break;case"ds-tab-group":if(!customElements.get(l(e))){j()}break;case"ds-tag":if(!customElements.get(l(e))){x()}break;case"ds-text":if(!customElements.get(l(e))){E()}break;case"ds-tooltip":if(!customElements.get(l(e))){D()}break}}))}H();export{T as S,H as d};
|
|
2
|
+
//# sourceMappingURL=p-CvHrCyuz.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,H as i,c as s,h as o,a as n,t}from"./index.js";import{d as r}from"./p-D9wZlB_N.js";import{d as a}from"./p-DzPtYdXy.js";import{d}from"./p-DSy1oOnd.js";import{d as c}from"./p-Cea7rROU.js";import{d as l}from"./p-0XTyQNRG.js";import{d as h}from"./p-Bjq1KP_Y.js";import{d as v}from"./p-Cd1JnnVK.js";import{d as m}from"./p-pnO8tAYB.js";const b=()=>`.ds-control--lg.sc-ds-mobile-sheet-nav,.ds-control--lg.sc-ds-mobile-sheet-nav-h,.ds-control--md.sc-ds-mobile-sheet-nav-h,.ds-control--md.sc-ds-mobile-sheet-nav,.ds-control--sm.sc-ds-mobile-sheet-nav-h,.ds-control--sm.sc-ds-mobile-sheet-nav,.ds-control--xs.sc-ds-mobile-sheet-nav-h,.ds-control--xs.sc-ds-mobile-sheet-nav{--ds-control-radius:var(--dimension-radius-025)}.ds-control--lg.sc-ds-mobile-sheet-nav-h,.ds-control--lg.sc-ds-mobile-sheet-nav{--ds-control-height:var(--dimension-size-500);--ds-control-icon:var(--dimension-iconography-lg);--ds-control-padding-inline:var(--dimension-space-100);--ds-control-label-inset:var(--dimension-space-050);--ds-control-gap:var(--dimension-space-050)}.ds-control--md.sc-ds-mobile-sheet-nav-h,.ds-control--md.sc-ds-mobile-sheet-nav{--ds-control-height:var(--dimension-size-400);--ds-control-icon:var(--dimension-iconography-md);--ds-control-padding-inline:var(--dimension-space-075);--ds-control-label-inset:var(--dimension-space-025);--ds-control-gap:var(--dimension-space-050)}.ds-control--sm.sc-ds-mobile-sheet-nav-h,.ds-control--sm.sc-ds-mobile-sheet-nav{--ds-control-height:var(--dimension-size-300);--ds-control-icon:var(--dimension-iconography-sm);--ds-control-padding-inline:var(--dimension-space-050);--ds-control-label-inset:var(--dimension-space-025);--ds-control-gap:var(--dimension-space-025)}.ds-control--xs.sc-ds-mobile-sheet-nav-h,.ds-control--xs.sc-ds-mobile-sheet-nav{--ds-control-height:var(--dimension-size-200);--ds-control-icon:var(--dimension-iconography-xs);--ds-control-padding-inline:var(--dimension-space-025);--ds-control-label-inset:var(--dimension-space-025);--ds-control-gap:0}.ds-chrome-space--sm.sc-ds-mobile-sheet-nav-h,.ds-chrome-space--sm.sc-ds-mobile-sheet-nav{--ds-chrome-padding:var(--dimension-space-050);--ds-chrome-gap:var(--dimension-space-050)}.ds-chrome-space--md.sc-ds-mobile-sheet-nav-h,.ds-chrome-space--md.sc-ds-mobile-sheet-nav{--ds-chrome-padding:var(--dimension-space-100);--ds-chrome-gap:var(--dimension-space-100)}.ds-chrome-space--lg.sc-ds-mobile-sheet-nav-h,.ds-chrome-space--lg.sc-ds-mobile-sheet-nav{--ds-chrome-padding:var(--dimension-space-200);--ds-chrome-gap:var(--dimension-space-200)}.ds-chrome-row.sc-ds-mobile-sheet-nav-h,.ds-chrome-row.sc-ds-mobile-sheet-nav,.ds-chrome-column.sc-ds-mobile-sheet-nav-h,.ds-chrome-column.sc-ds-mobile-sheet-nav,.ds-chrome-grid.sc-ds-mobile-sheet-nav-h,.ds-chrome-grid.sc-ds-mobile-sheet-nav{display:flex;box-sizing:border-box;gap:var(--ds-chrome-gap, var(--dimension-space-100));padding:var(--ds-chrome-padding, var(--dimension-space-100))}.ds-chrome-row.sc-ds-mobile-sheet-nav-h,.ds-chrome-row.sc-ds-mobile-sheet-nav{flex-direction:row;align-items:center}.ds-chrome-column.sc-ds-mobile-sheet-nav-h,.ds-chrome-column.sc-ds-mobile-sheet-nav{flex-direction:column}.ds-chrome-grid.sc-ds-mobile-sheet-nav-h,.ds-chrome-grid.sc-ds-mobile-sheet-nav{display:grid;align-items:center}@media (forced-colors: active){.sc-ds-mobile-sheet-nav:root,.sc-ds-mobile-sheet-nav-h,.ds-forced-colors-scope.sc-ds-mobile-sheet-nav{--ds-forced-color-surface:Canvas;--ds-forced-color-content:CanvasText;--ds-forced-color-control-boundary:ButtonText;--ds-forced-color-selected:Highlight;--ds-forced-color-on-selected:HighlightText;--ds-forced-color-disabled:GrayText}}.sc-ds-mobile-sheet-nav-h{--ds-focus-ring-width:var(--dimension-stroke-width-025, 2px);--ds-focus-ring-offset:var(--dimension-space-025, 2px);--ds-focus-ring-color:var(--color-interaction-focus)}.ds-focus-ring.sc-ds-mobile-sheet-nav-h,.ds-focus-ring.sc-ds-mobile-sheet-nav,.ds-focus-ring-inset.sc-ds-mobile-sheet-nav-h,.ds-focus-ring-inset.sc-ds-mobile-sheet-nav{outline:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation}.ds-focus-ring.sc-ds-mobile-sheet-nav-h:focus-visible,.ds-focus-ring.sc-ds-mobile-sheet-nav:focus-visible{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:var(--ds-focus-ring-offset)}.ds-focus-ring.ds-focus-ring--visible.sc-ds-mobile-sheet-nav-h,.ds-focus-ring.ds-focus-ring--visible.sc-ds-mobile-sheet-nav{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:var(--ds-focus-ring-offset)}.ds-focus-ring-inset.sc-ds-mobile-sheet-nav-h:focus-visible,.ds-focus-ring-inset.sc-ds-mobile-sheet-nav:focus-visible{outline:none}.ds-focus-ring-inset.sc-ds-mobile-sheet-nav-h:focus-visible::after,.ds-focus-ring-inset.sc-ds-mobile-sheet-nav:focus-visible::after{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:calc(-1 * var(--ds-focus-ring-width))}.ds-focus-ring-inset.ds-focus-ring--visible.sc-ds-mobile-sheet-nav-h,.ds-focus-ring-inset.ds-focus-ring--visible.sc-ds-mobile-sheet-nav{outline:none}.ds-focus-ring-inset.ds-focus-ring--visible.sc-ds-mobile-sheet-nav-h::after,.ds-focus-ring-inset.ds-focus-ring--visible.sc-ds-mobile-sheet-nav::after{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:calc(-1 * var(--ds-focus-ring-width))}@media (forced-colors: active){.sc-ds-mobile-sheet-nav-h{--ds-focus-ring-color:var(--ds-forced-color-selected)}}@media (forced-colors: active){.sc-ds-mobile-sheet-nav:root,.sc-ds-mobile-sheet-nav-h,.ds-forced-colors-scope.sc-ds-mobile-sheet-nav{--ds-forced-color-surface:Canvas;--ds-forced-color-content:CanvasText;--ds-forced-color-control-boundary:ButtonText;--ds-forced-color-selected:Highlight;--ds-forced-color-on-selected:HighlightText;--ds-forced-color-disabled:GrayText}}.ds-interaction-fill.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill.sc-ds-mobile-sheet-nav{position:var(--ds-interaction-position, relative);z-index:var(--ds-interaction-z-index, 0);cursor:default;--ds-interaction-hover:var(--color-interaction-hover);--ds-interaction-pressed:var(--color-interaction-pressed);--ds-interaction-active:var(--color-interaction-active-brand);--ds-interaction-border-width:0px;--ds-interaction-border-color:transparent;--ds-interaction-divider-width:0px;--ds-interaction-divider-color:transparent;--ds-interaction-divider-inline-start-width:0px;--ds-interaction-divider-inline-start-color:transparent;--ds-interaction-divider-inline-end-width:0px;--ds-interaction-divider-inline-end-color:transparent}.ds-interaction-fill.sc-ds-mobile-sheet-nav-h::before,.ds-interaction-fill.sc-ds-mobile-sheet-nav::before,.ds-interaction-fill.sc-ds-mobile-sheet-nav-h::after,.ds-interaction-fill.sc-ds-mobile-sheet-nav::after{content:'';position:absolute;inset:0;border-radius:inherit;background:transparent;pointer-events:none;cursor:inherit;transition:none}.ds-interaction-fill.sc-ds-mobile-sheet-nav-h::before,.ds-interaction-fill.sc-ds-mobile-sheet-nav::before{z-index:1}.ds-interaction-fill.sc-ds-mobile-sheet-nav-h::after,.ds-interaction-fill.sc-ds-mobile-sheet-nav::after{z-index:3;box-shadow:inset 0 calc(-1 * var(--ds-interaction-divider-width)) 0 var(--ds-interaction-divider-color), inset var(--ds-interaction-divider-inline-start-width) 0 0 var(--ds-interaction-divider-inline-start-color), inset calc(-1 * var(--ds-interaction-divider-inline-end-width)) 0 0 var(--ds-interaction-divider-inline-end-color), inset 0 0 0 var(--ds-interaction-border-width) var(--ds-interaction-border-color)}.ds-interaction-fill--bordered.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--bordered.sc-ds-mobile-sheet-nav{--ds-interaction-border-width:var(--dimension-stroke-width-012);--ds-interaction-border-color:var(--color-border-secondary)}.ds-interaction-fill--selected.sc-ds-mobile-sheet-nav-h::before,.ds-interaction-fill--selected.sc-ds-mobile-sheet-nav::before{background:var(--ds-interaction-active)}.ds-interaction-fill--selected.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--selected.sc-ds-mobile-sheet-nav{--ds-interaction-dot-ring:var(--ds-interaction-active)}@media (hover: hover) and (pointer: fine){.ds-interaction-fill.sc-ds-mobile-sheet-nav-h:hover:not(:disabled)::after,.ds-interaction-fill.sc-ds-mobile-sheet-nav:hover:not(:disabled)::after{background:var(--ds-interaction-hover)}}.ds-interaction-fill.sc-ds-mobile-sheet-nav-h:active:not(:disabled)::after,.ds-interaction-fill.sc-ds-mobile-sheet-nav:active:not(:disabled)::after{background:var(--ds-interaction-pressed)}.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav-h::after,.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav::after,.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav-h:active:not(:disabled)::after,.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav:active:not(:disabled)::after{background:var(--ds-interaction-group-fill, transparent)}@media (hover: hover) and (pointer: fine){.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav-h:hover:not(:disabled)::after,.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav:hover:not(:disabled)::after{background:var(--ds-interaction-group-fill, transparent)}}.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav{--ds-interaction-divider-width:var(--ds-interaction-group-divider-width, 0px);--ds-interaction-divider-color:var(--ds-interaction-group-divider-color, transparent);--ds-interaction-divider-inline-start-width:var( --ds-interaction-group-divider-inline-start-width, 0px );--ds-interaction-divider-inline-start-color:var( --ds-interaction-group-divider-inline-start-color, transparent );--ds-interaction-divider-inline-end-width:var( --ds-interaction-group-divider-inline-end-width, 0px );--ds-interaction-divider-inline-end-color:var( --ds-interaction-group-divider-inline-end-color, transparent )}.ds-interaction-fill.sc-ds-mobile-sheet-nav-h>.ds-interaction-fill__content.sc-ds-mobile-sheet-nav,.ds-interaction-fill.sc-ds-mobile-sheet-nav>.ds-interaction-fill__content.sc-ds-mobile-sheet-nav,.ds-interaction-fill__content.sc-ds-mobile-sheet-nav{position:relative;z-index:2;cursor:inherit}.ds-interaction-fill--on-faint.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-faint.sc-ds-mobile-sheet-nav{--ds-interaction-active:var(--color-interaction-active)}.ds-interaction-fill--on-medium.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-medium.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-interaction-on-medium-background-hover);--ds-interaction-pressed:var(--color-interaction-on-medium-background-pressed);--ds-interaction-active:var(--color-interaction-on-medium-background-active);--ds-focus-ring-color:var(--color-interaction-on-medium-background-focus)}.ds-interaction-fill--on-bold.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-bold.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-interaction-on-bold-background-hover);--ds-interaction-pressed:var(--color-interaction-on-bold-background-pressed);--ds-interaction-active:var(--color-interaction-on-bold-background-active);--ds-focus-ring-color:var(--color-interaction-on-bold-background-focus)}.ds-interaction-fill--on-strong.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-strong.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-interaction-on-strong-background-hover);--ds-interaction-pressed:var(--color-interaction-on-strong-background-pressed);--ds-interaction-active:var(--color-interaction-on-strong-background-active);--ds-focus-ring-color:var(--color-interaction-on-strong-background-focus)}.ds-interaction-fill--on-translucent.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-translucent.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-translucent-interaction-hover);--ds-interaction-pressed:var(--color-translucent-interaction-pressed);--ds-interaction-active:var(--color-translucent-interaction-active-brand);--ds-focus-ring-color:var(--color-translucent-interaction-focus)}.ds-interaction-fill--on-inverted.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-inverted.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-inverted-interaction-hover);--ds-interaction-pressed:var(--color-inverted-interaction-pressed);--ds-interaction-active:var(--color-inverted-interaction-active-brand);--ds-focus-ring-color:var(--color-inverted-interaction-focus)}.ds-interaction-fill--on-media.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-media.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-media-interaction-hover);--ds-interaction-pressed:var(--color-media-interaction-pressed);--ds-interaction-active:var(--color-media-interaction-active);--ds-focus-ring-color:var(--color-media-interaction-focus)}.ds-interaction-fill--on-always-dark.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-always-dark.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-always-dark-interaction-hover);--ds-interaction-pressed:var(--color-always-dark-interaction-pressed);--ds-interaction-active:var(--color-always-dark-interaction-active-brand);--ds-focus-ring-color:var(--color-always-dark-interaction-focus)}.ds-interaction-fill--on-navigation.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-navigation.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-navigation-interaction-hover);--ds-interaction-pressed:var(--color-navigation-interaction-pressed);--ds-interaction-active:var(--color-navigation-interaction-active);--ds-focus-ring-color:var(--color-navigation-interaction-focus)}@media (forced-colors: active){.ds-interaction-fill.sc-ds-mobile-sheet-nav-h::after,.ds-interaction-fill.sc-ds-mobile-sheet-nav::after{box-shadow:none;outline:var(--ds-interaction-border-width) solid var(--ds-forced-color-control-boundary);outline-offset:calc(-1 * var(--ds-interaction-border-width))}.ds-interaction-fill--selected.sc-ds-mobile-sheet-nav-h::before,.ds-interaction-fill--selected.sc-ds-mobile-sheet-nav::before{background:transparent;outline:var(--dimension-stroke-width-025) solid var(--ds-forced-color-selected);outline-offset:calc(-1 * var(--dimension-stroke-width-025))}}@media (forced-colors: active) and (hover: hover) and (pointer: fine){.ds-interaction-fill.sc-ds-mobile-sheet-nav-h:hover:not(:disabled):not(:focus-visible):not(:focus-within):not(.ds-focus-ring--visible)::after,.ds-interaction-fill.sc-ds-mobile-sheet-nav:hover:not(:disabled):not(:focus-visible):not(:focus-within):not(.ds-focus-ring--visible)::after{outline-color:var(--ds-forced-color-selected);outline-width:var(--dimension-stroke-width-012)}}.sc-ds-mobile-sheet-nav-h{display:block;min-width:0;min-height:0;height:100%;background:var(--color-background-primary)}.sc-ds-mobile-sheet-nav-h:not([open]){display:none}.mobile-sheet-nav.sc-ds-mobile-sheet-nav{display:grid;grid-template-rows:auto minmax(0, 1fr);height:100%;min-height:0;background:var(--color-background-primary)}.mobile-sheet-nav__header.sc-ds-mobile-sheet-nav{position:relative;grid-template-columns:minmax(0, 1fr) auto minmax(0, 1fr)}.mobile-sheet-nav__header--expanded-context.sc-ds-mobile-sheet-nav{grid-template-columns:minmax(var(--dimension-size-500), 1fr) minmax(0, 4fr) minmax(var(--dimension-size-500), 1fr)}.mobile-sheet-nav__header--expanded-context.sc-ds-mobile-sheet-nav .mobile-sheet-nav__context.sc-ds-mobile-sheet-nav{width:100%}.mobile-sheet-nav__header.sc-ds-mobile-sheet-nav::after{content:'';position:absolute;inset-inline:0;inset-block-end:0;height:var(--dimension-stroke-width-012);background:var(--color-border-tertiary);pointer-events:none}.mobile-sheet-nav__brand.sc-ds-mobile-sheet-nav{display:flex;align-items:center;justify-content:flex-start;min-width:0}.mobile-sheet-nav__logo.sc-ds-mobile-sheet-nav{display:inline-flex;align-items:center;justify-content:center;width:var(--dimension-size-500);height:var(--dimension-size-500);padding:var(--dimension-space-100);box-sizing:border-box;color:var(--color-foreground-primary)}.mobile-sheet-nav__logo-mark.sc-ds-mobile-sheet-nav{width:var(--dimension-iconography-lg);height:var(--dimension-iconography-lg);flex:0 0 auto}.mobile-sheet-nav__context.sc-ds-mobile-sheet-nav{justify-self:center}.mobile-sheet-nav__actions.sc-ds-mobile-sheet-nav{display:flex;align-items:center;justify-content:flex-end;gap:var(--dimension-space-050);min-width:0}.mobile-sheet-nav__body.sc-ds-mobile-sheet-nav{min-height:0;overflow:auto;overscroll-behavior:contain}.mobile-sheet-nav__sections.sc-ds-mobile-sheet-nav{display:grid;gap:var(--dimension-space-400)}.mobile-sheet-nav__items.sc-ds-mobile-sheet-nav{display:grid;gap:var(--dimension-space-100)}.mobile-sheet-nav__item.sc-ds-mobile-sheet-nav{appearance:none;width:100%;height:var(--ds-control-height);min-height:var(--ds-control-height);padding-inline:var(--ds-control-padding-inline);border:0;border-radius:var(--ds-control-radius);background:transparent;color:var(--color-foreground-secondary);display:flex;align-items:center;justify-content:flex-start;gap:var(--ds-control-gap);cursor:default;text-align:start;box-sizing:border-box}.mobile-sheet-nav__item--selected.sc-ds-mobile-sheet-nav{color:var(--color-foreground-primary)}.mobile-sheet-nav__item-label.sc-ds-mobile-sheet-nav{min-width:0;padding-inline:var(--ds-control-label-inset)}.mobile-sheet-nav__dot.sc-ds-mobile-sheet-nav{margin-inline-start:auto}`;const f=[{id:"dashboard",label:"Dashboard",icon:"Dashboard",variant:"icon"},{id:"settings",label:"Settings",icon:"Gear",variant:"icon"}];const u=e(class e extends i{constructor(e){super();if(e!==false){this.__registerHost()}this.dsAreaSelect=s(this,"dsAreaSelect",7);this.dsBrowseContextChange=s(this,"dsBrowseContextChange",7);this.dsClose=s(this,"dsClose",7);this.open=false;this.browseContext="dashboard";this.dashboardGroups=[];this.settingsGroups=[];this.currentUrl="";this.routeSelectionActive=true;this.navigationLabel="Application navigation";this.dashboardLabel="Dashboard";this.settingsLabel="Settings";this.accountLabel="Account";this.helpLabel="Help & Support";this.showAccount=true;this.handleContextChange=e=>{const i=e.detail==="settings"?"settings":"dashboard";if(i===this.browseContext)return;this.dsBrowseContextChange.emit(i)}}get groups(){return this.browseContext==="settings"?this.settingsGroups:this.dashboardGroups}get activeId(){if(!this.routeSelectionActive)return"";return r(this.currentUrl,[...this.dashboardGroups.flatMap((e=>e.items)),...this.settingsGroups.flatMap((e=>e.items))])}handleOpenChange(e){if(!e)return;requestAnimationFrame((()=>{const e=this.el.querySelector('[aria-current="page"]');const i=this.el.querySelector(".mobile-sheet-nav__item");(e??i)?.focus({preventScroll:true})}))}handleKeyDown(e){if(!this.open||e.key!=="Escape")return;e.preventDefault();this.dsClose.emit()}renderItem(e){const i=e.id===this.activeId;return o("button",{type:"button",class:{"mobile-sheet-nav__item":true,"mobile-sheet-nav__item--selected":i,"ds-control--lg":true,"ds-focus-ring-inset":true,"ds-interaction-fill":true},"aria-current":i?"page":undefined,onClick:()=>this.dsAreaSelect.emit(e.id)},o("ds-icon",{class:"ds-interaction-fill__content",name:e.icon,size:"lg",color:"inherit"}),o("ds-text",{class:"mobile-sheet-nav__item-label ds-interaction-fill__content",as:"span",variant:"text-body-large",emphasis:i,color:"inherit"},e.label),e.dot&&o("ds-badge",{class:"mobile-sheet-nav__dot ds-interaction-fill__content",variant:"dot",hasRing:false,label:"","aria-hidden":"true"}))}renderLogo(){return o("span",{class:"mobile-sheet-nav__logo","aria-hidden":"true"},o("svg",{class:"mobile-sheet-nav__logo-mark",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",focusable:"false","aria-hidden":"true"},o("path",{d:"M11.1159 4.31537H7.67021L2.53401 13.0703H0V15.6875H4.02716L8.24319 8.49978V15.6846H11.6342L15.8289 8.47829V15.6846H18.7122V4.3125H15.2559L11.1159 11.3648V4.31537Z",fill:"currentColor"})))}renderHeaderDestination(e,i,s){return o("ds-tooltip",{label:s,side:"bottom",size:"sm"},o("ds-button-unfilled",{variant:"icon",size:"lg",icon:i,"aria-label":s,activeFill:false,hasBorder:false,onDsClick:()=>this.dsAreaSelect.emit(e)}))}render(){const e=[{...f[0],label:this.dashboardLabel},{...f[1],label:this.settingsLabel}];return o(n,{key:"c43f525774bb3a6634a06e4e2d1e96d20c1e6fc1","aria-hidden":this.open?undefined:"true",inert:this.open?undefined:true},o("section",{key:"96c113be515e98317cfaf8e3c6c2eebd8e9858ed",id:"ds-mobile-sheet-nav",class:"mobile-sheet-nav"},o("header",{key:"3584495f66a4fee16beacbfd5423723d0e21d6f5",class:{"mobile-sheet-nav__header":true,"mobile-sheet-nav__header--expanded-context":!this.showAccount,"ds-chrome-grid":true,"ds-chrome-space--md":true}},o("div",{key:"fa20dd38aa965083a14d42c1e7e41932eb204c3d",class:"mobile-sheet-nav__brand"},this.renderLogo()),o("ds-tab-group",{key:"a443ad3cf6138734e545c4a404e9f5f9a618d175",class:"mobile-sheet-nav__context",tabs:e,value:this.browseContext,size:"lg",width:this.showAccount?"hug":"fill","aria-label":"Browse context",onDsChange:this.handleContextChange}),o("div",{key:"0f855c0208114ae28e64119a5ce455f264299ddb",class:"mobile-sheet-nav__actions"},this.renderHeaderDestination("help","CircleQuestion",this.helpLabel),this.showAccount?this.renderHeaderDestination("account","Avatar",this.accountLabel):null)),o("nav",{key:"6b059aed59ba67a8c6e6b704a03b12bc90b1436f",class:"mobile-sheet-nav__body ds-chrome-column ds-chrome-space--md","aria-label":this.navigationLabel},o("div",{key:"bad8c7a37e95e767aef5d01af91e81f2f8894375",class:"mobile-sheet-nav__sections"},this.groups.filter((e=>e.items.length>0)).map((e=>o("div",{class:"mobile-sheet-nav__items"},e.items.map((e=>this.renderItem(e))))))))))}get el(){return this}static get watchers(){return{open:[{handleOpenChange:0}]}}static get style(){return b()}},[2,"ds-mobile-sheet-nav",{open:[516],browseContext:[1,"browse-context"],dashboardGroups:[16],settingsGroups:[16],currentUrl:[1,"current-url"],routeSelectionActive:[4,"route-selection-active"],navigationLabel:[1,"navigation-label"],dashboardLabel:[1,"dashboard-label"],settingsLabel:[1,"settings-label"],accountLabel:[1,"account-label"],helpLabel:[1,"help-label"],showAccount:[4,"show-account"]},[[0,"keydown","handleKeyDown"]],{open:[{handleOpenChange:0}]}]);function g(){if(typeof customElements==="undefined"){return}const e=["ds-mobile-sheet-nav","ds-badge","ds-button-unfilled","ds-icon","ds-loader","ds-tab-group","ds-text","ds-tooltip"];e.forEach((e=>{switch(e){case"ds-mobile-sheet-nav":if(!customElements.get(t(e))){customElements.define(t(e),u)}break;case"ds-badge":if(!customElements.get(t(e))){a()}break;case"ds-button-unfilled":if(!customElements.get(t(e))){d()}break;case"ds-icon":if(!customElements.get(t(e))){c()}break;case"ds-loader":if(!customElements.get(t(e))){l()}break;case"ds-tab-group":if(!customElements.get(t(e))){h()}break;case"ds-text":if(!customElements.get(t(e))){v()}break;case"ds-tooltip":if(!customElements.get(t(e))){m()}break}}))}g();export{u as M,g as d};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{p as e,H as i,c as s,h as o,a as n,t}from"./index.js";import{d as r}from"./p-D9wZlB_N.js";import{d as a}from"./p-DzPtYdXy.js";import{d}from"./p-7MWaWl8w.js";import{d as c}from"./p-Cea7rROU.js";import{d as l}from"./p-0XTyQNRG.js";import{d as h}from"./p-Bjq1KP_Y.js";import{d as v}from"./p-Cd1JnnVK.js";import{d as m}from"./p-9X_p0bHr.js";const b=()=>`.ds-control--lg.sc-ds-mobile-sheet-nav,.ds-control--lg.sc-ds-mobile-sheet-nav-h,.ds-control--md.sc-ds-mobile-sheet-nav-h,.ds-control--md.sc-ds-mobile-sheet-nav,.ds-control--sm.sc-ds-mobile-sheet-nav-h,.ds-control--sm.sc-ds-mobile-sheet-nav,.ds-control--xs.sc-ds-mobile-sheet-nav-h,.ds-control--xs.sc-ds-mobile-sheet-nav{--ds-control-radius:var(--dimension-radius-025)}.ds-control--lg.sc-ds-mobile-sheet-nav-h,.ds-control--lg.sc-ds-mobile-sheet-nav{--ds-control-height:var(--dimension-size-500);--ds-control-icon:var(--dimension-iconography-lg);--ds-control-padding-inline:var(--dimension-space-100);--ds-control-label-inset:var(--dimension-space-050);--ds-control-gap:var(--dimension-space-050)}.ds-control--md.sc-ds-mobile-sheet-nav-h,.ds-control--md.sc-ds-mobile-sheet-nav{--ds-control-height:var(--dimension-size-400);--ds-control-icon:var(--dimension-iconography-md);--ds-control-padding-inline:var(--dimension-space-075);--ds-control-label-inset:var(--dimension-space-025);--ds-control-gap:var(--dimension-space-050)}.ds-control--sm.sc-ds-mobile-sheet-nav-h,.ds-control--sm.sc-ds-mobile-sheet-nav{--ds-control-height:var(--dimension-size-300);--ds-control-icon:var(--dimension-iconography-sm);--ds-control-padding-inline:var(--dimension-space-050);--ds-control-label-inset:var(--dimension-space-025);--ds-control-gap:var(--dimension-space-025)}.ds-control--xs.sc-ds-mobile-sheet-nav-h,.ds-control--xs.sc-ds-mobile-sheet-nav{--ds-control-height:var(--dimension-size-200);--ds-control-icon:var(--dimension-iconography-xs);--ds-control-padding-inline:var(--dimension-space-025);--ds-control-label-inset:var(--dimension-space-025);--ds-control-gap:0}.ds-chrome-space--sm.sc-ds-mobile-sheet-nav-h,.ds-chrome-space--sm.sc-ds-mobile-sheet-nav{--ds-chrome-padding:var(--dimension-space-050);--ds-chrome-gap:var(--dimension-space-050)}.ds-chrome-space--md.sc-ds-mobile-sheet-nav-h,.ds-chrome-space--md.sc-ds-mobile-sheet-nav{--ds-chrome-padding:var(--dimension-space-100);--ds-chrome-gap:var(--dimension-space-100)}.ds-chrome-space--lg.sc-ds-mobile-sheet-nav-h,.ds-chrome-space--lg.sc-ds-mobile-sheet-nav{--ds-chrome-padding:var(--dimension-space-200);--ds-chrome-gap:var(--dimension-space-200)}.ds-chrome-row.sc-ds-mobile-sheet-nav-h,.ds-chrome-row.sc-ds-mobile-sheet-nav,.ds-chrome-column.sc-ds-mobile-sheet-nav-h,.ds-chrome-column.sc-ds-mobile-sheet-nav,.ds-chrome-grid.sc-ds-mobile-sheet-nav-h,.ds-chrome-grid.sc-ds-mobile-sheet-nav{display:flex;box-sizing:border-box;gap:var(--ds-chrome-gap, var(--dimension-space-100));padding:var(--ds-chrome-padding, var(--dimension-space-100))}.ds-chrome-row.sc-ds-mobile-sheet-nav-h,.ds-chrome-row.sc-ds-mobile-sheet-nav{flex-direction:row;align-items:center}.ds-chrome-column.sc-ds-mobile-sheet-nav-h,.ds-chrome-column.sc-ds-mobile-sheet-nav{flex-direction:column}.ds-chrome-grid.sc-ds-mobile-sheet-nav-h,.ds-chrome-grid.sc-ds-mobile-sheet-nav{display:grid;align-items:center}@media (forced-colors: active){.sc-ds-mobile-sheet-nav:root,.sc-ds-mobile-sheet-nav-h,.ds-forced-colors-scope.sc-ds-mobile-sheet-nav{--ds-forced-color-surface:Canvas;--ds-forced-color-content:CanvasText;--ds-forced-color-control-boundary:ButtonText;--ds-forced-color-selected:Highlight;--ds-forced-color-on-selected:HighlightText;--ds-forced-color-disabled:GrayText}}.sc-ds-mobile-sheet-nav-h{--ds-focus-ring-width:var(--dimension-stroke-width-025, 2px);--ds-focus-ring-offset:var(--dimension-space-025, 2px);--ds-focus-ring-color:var(--color-interaction-focus)}.ds-focus-ring.sc-ds-mobile-sheet-nav-h,.ds-focus-ring.sc-ds-mobile-sheet-nav,.ds-focus-ring-inset.sc-ds-mobile-sheet-nav-h,.ds-focus-ring-inset.sc-ds-mobile-sheet-nav{outline:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation}.ds-focus-ring.sc-ds-mobile-sheet-nav-h:focus-visible,.ds-focus-ring.sc-ds-mobile-sheet-nav:focus-visible{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:var(--ds-focus-ring-offset)}.ds-focus-ring.ds-focus-ring--visible.sc-ds-mobile-sheet-nav-h,.ds-focus-ring.ds-focus-ring--visible.sc-ds-mobile-sheet-nav{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:var(--ds-focus-ring-offset)}.ds-focus-ring-inset.sc-ds-mobile-sheet-nav-h:focus-visible,.ds-focus-ring-inset.sc-ds-mobile-sheet-nav:focus-visible{outline:none}.ds-focus-ring-inset.sc-ds-mobile-sheet-nav-h:focus-visible::after,.ds-focus-ring-inset.sc-ds-mobile-sheet-nav:focus-visible::after{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:calc(-1 * var(--ds-focus-ring-width))}.ds-focus-ring-inset.ds-focus-ring--visible.sc-ds-mobile-sheet-nav-h,.ds-focus-ring-inset.ds-focus-ring--visible.sc-ds-mobile-sheet-nav{outline:none}.ds-focus-ring-inset.ds-focus-ring--visible.sc-ds-mobile-sheet-nav-h::after,.ds-focus-ring-inset.ds-focus-ring--visible.sc-ds-mobile-sheet-nav::after{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:calc(-1 * var(--ds-focus-ring-width))}@media (forced-colors: active){.sc-ds-mobile-sheet-nav-h{--ds-focus-ring-color:var(--ds-forced-color-selected)}}@media (forced-colors: active){.sc-ds-mobile-sheet-nav:root,.sc-ds-mobile-sheet-nav-h,.ds-forced-colors-scope.sc-ds-mobile-sheet-nav{--ds-forced-color-surface:Canvas;--ds-forced-color-content:CanvasText;--ds-forced-color-control-boundary:ButtonText;--ds-forced-color-selected:Highlight;--ds-forced-color-on-selected:HighlightText;--ds-forced-color-disabled:GrayText}}.ds-interaction-fill.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill.sc-ds-mobile-sheet-nav{position:var(--ds-interaction-position, relative);z-index:var(--ds-interaction-z-index, 0);cursor:default;--ds-interaction-hover:var(--color-interaction-hover);--ds-interaction-pressed:var(--color-interaction-pressed);--ds-interaction-active:var(--color-interaction-active-brand);--ds-interaction-border-width:0px;--ds-interaction-border-color:transparent;--ds-interaction-divider-width:0px;--ds-interaction-divider-color:transparent;--ds-interaction-divider-inline-start-width:0px;--ds-interaction-divider-inline-start-color:transparent;--ds-interaction-divider-inline-end-width:0px;--ds-interaction-divider-inline-end-color:transparent}.ds-interaction-fill.sc-ds-mobile-sheet-nav-h::before,.ds-interaction-fill.sc-ds-mobile-sheet-nav::before,.ds-interaction-fill.sc-ds-mobile-sheet-nav-h::after,.ds-interaction-fill.sc-ds-mobile-sheet-nav::after{content:'';position:absolute;inset:0;border-radius:inherit;background:transparent;pointer-events:none;cursor:inherit;transition:none}.ds-interaction-fill.sc-ds-mobile-sheet-nav-h::before,.ds-interaction-fill.sc-ds-mobile-sheet-nav::before{z-index:1}.ds-interaction-fill.sc-ds-mobile-sheet-nav-h::after,.ds-interaction-fill.sc-ds-mobile-sheet-nav::after{z-index:3;box-shadow:inset 0 calc(-1 * var(--ds-interaction-divider-width)) 0 var(--ds-interaction-divider-color), inset var(--ds-interaction-divider-inline-start-width) 0 0 var(--ds-interaction-divider-inline-start-color), inset calc(-1 * var(--ds-interaction-divider-inline-end-width)) 0 0 var(--ds-interaction-divider-inline-end-color), inset 0 0 0 var(--ds-interaction-border-width) var(--ds-interaction-border-color)}.ds-interaction-fill--bordered.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--bordered.sc-ds-mobile-sheet-nav{--ds-interaction-border-width:var(--dimension-stroke-width-012);--ds-interaction-border-color:var(--color-border-secondary)}.ds-interaction-fill--selected.sc-ds-mobile-sheet-nav-h::before,.ds-interaction-fill--selected.sc-ds-mobile-sheet-nav::before{background:var(--ds-interaction-active)}.ds-interaction-fill--selected.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--selected.sc-ds-mobile-sheet-nav{--ds-interaction-dot-ring:var(--ds-interaction-active)}@media (hover: hover) and (pointer: fine){.ds-interaction-fill.sc-ds-mobile-sheet-nav-h:hover:not(:disabled)::after,.ds-interaction-fill.sc-ds-mobile-sheet-nav:hover:not(:disabled)::after{background:var(--ds-interaction-hover)}}.ds-interaction-fill.sc-ds-mobile-sheet-nav-h:active:not(:disabled)::after,.ds-interaction-fill.sc-ds-mobile-sheet-nav:active:not(:disabled)::after{background:var(--ds-interaction-pressed)}.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav-h::after,.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav::after,.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav-h:active:not(:disabled)::after,.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav:active:not(:disabled)::after{background:var(--ds-interaction-group-fill, transparent)}@media (hover: hover) and (pointer: fine){.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav-h:hover:not(:disabled)::after,.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav:hover:not(:disabled)::after{background:var(--ds-interaction-group-fill, transparent)}}.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--grouped.sc-ds-mobile-sheet-nav{--ds-interaction-divider-width:var(--ds-interaction-group-divider-width, 0px);--ds-interaction-divider-color:var(--ds-interaction-group-divider-color, transparent);--ds-interaction-divider-inline-start-width:var( --ds-interaction-group-divider-inline-start-width, 0px );--ds-interaction-divider-inline-start-color:var( --ds-interaction-group-divider-inline-start-color, transparent );--ds-interaction-divider-inline-end-width:var( --ds-interaction-group-divider-inline-end-width, 0px );--ds-interaction-divider-inline-end-color:var( --ds-interaction-group-divider-inline-end-color, transparent )}.ds-interaction-fill.sc-ds-mobile-sheet-nav-h>.ds-interaction-fill__content.sc-ds-mobile-sheet-nav,.ds-interaction-fill.sc-ds-mobile-sheet-nav>.ds-interaction-fill__content.sc-ds-mobile-sheet-nav,.ds-interaction-fill__content.sc-ds-mobile-sheet-nav{position:relative;z-index:2;cursor:inherit}.ds-interaction-fill--on-faint.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-faint.sc-ds-mobile-sheet-nav{--ds-interaction-active:var(--color-interaction-active)}.ds-interaction-fill--on-medium.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-medium.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-interaction-on-medium-background-hover);--ds-interaction-pressed:var(--color-interaction-on-medium-background-pressed);--ds-interaction-active:var(--color-interaction-on-medium-background-active);--ds-focus-ring-color:var(--color-interaction-on-medium-background-focus)}.ds-interaction-fill--on-bold.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-bold.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-interaction-on-bold-background-hover);--ds-interaction-pressed:var(--color-interaction-on-bold-background-pressed);--ds-interaction-active:var(--color-interaction-on-bold-background-active);--ds-focus-ring-color:var(--color-interaction-on-bold-background-focus)}.ds-interaction-fill--on-strong.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-strong.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-interaction-on-strong-background-hover);--ds-interaction-pressed:var(--color-interaction-on-strong-background-pressed);--ds-interaction-active:var(--color-interaction-on-strong-background-active);--ds-focus-ring-color:var(--color-interaction-on-strong-background-focus)}.ds-interaction-fill--on-translucent.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-translucent.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-translucent-interaction-hover);--ds-interaction-pressed:var(--color-translucent-interaction-pressed);--ds-interaction-active:var(--color-translucent-interaction-active-brand);--ds-focus-ring-color:var(--color-translucent-interaction-focus)}.ds-interaction-fill--on-inverted.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-inverted.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-inverted-interaction-hover);--ds-interaction-pressed:var(--color-inverted-interaction-pressed);--ds-interaction-active:var(--color-inverted-interaction-active-brand);--ds-focus-ring-color:var(--color-inverted-interaction-focus)}.ds-interaction-fill--on-media.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-media.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-media-interaction-hover);--ds-interaction-pressed:var(--color-media-interaction-pressed);--ds-interaction-active:var(--color-media-interaction-active);--ds-focus-ring-color:var(--color-media-interaction-focus)}.ds-interaction-fill--on-always-dark.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-always-dark.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-always-dark-interaction-hover);--ds-interaction-pressed:var(--color-always-dark-interaction-pressed);--ds-interaction-active:var(--color-always-dark-interaction-active-brand);--ds-focus-ring-color:var(--color-always-dark-interaction-focus)}.ds-interaction-fill--on-navigation.sc-ds-mobile-sheet-nav-h,.ds-interaction-fill--on-navigation.sc-ds-mobile-sheet-nav{--ds-interaction-hover:var(--color-navigation-interaction-hover);--ds-interaction-pressed:var(--color-navigation-interaction-pressed);--ds-interaction-active:var(--color-navigation-interaction-active);--ds-focus-ring-color:var(--color-navigation-interaction-focus)}@media (forced-colors: active){.ds-interaction-fill.sc-ds-mobile-sheet-nav-h::after,.ds-interaction-fill.sc-ds-mobile-sheet-nav::after{box-shadow:none;outline:var(--ds-interaction-border-width) solid var(--ds-forced-color-control-boundary);outline-offset:calc(-1 * var(--ds-interaction-border-width))}.ds-interaction-fill--selected.sc-ds-mobile-sheet-nav-h::before,.ds-interaction-fill--selected.sc-ds-mobile-sheet-nav::before{background:transparent;outline:var(--dimension-stroke-width-025) solid var(--ds-forced-color-selected);outline-offset:calc(-1 * var(--dimension-stroke-width-025))}}@media (forced-colors: active) and (hover: hover) and (pointer: fine){.ds-interaction-fill.sc-ds-mobile-sheet-nav-h:hover:not(:disabled):not(:focus-visible):not(:focus-within):not(.ds-focus-ring--visible)::after,.ds-interaction-fill.sc-ds-mobile-sheet-nav:hover:not(:disabled):not(:focus-visible):not(:focus-within):not(.ds-focus-ring--visible)::after{outline-color:var(--ds-forced-color-selected);outline-width:var(--dimension-stroke-width-012)}}.sc-ds-mobile-sheet-nav-h{display:block;min-width:0;min-height:0;height:100%;background:var(--color-background-primary)}.sc-ds-mobile-sheet-nav-h:not([open]){display:none}.mobile-sheet-nav.sc-ds-mobile-sheet-nav{display:grid;grid-template-rows:auto minmax(0, 1fr);height:100%;min-height:0;background:var(--color-background-primary)}.mobile-sheet-nav__header.sc-ds-mobile-sheet-nav{position:relative;grid-template-columns:minmax(0, 1fr) auto minmax(0, 1fr)}.mobile-sheet-nav__header--expanded-context.sc-ds-mobile-sheet-nav{grid-template-columns:minmax(var(--dimension-size-500), 1fr) minmax(0, 4fr) minmax(var(--dimension-size-500), 1fr)}.mobile-sheet-nav__header--expanded-context.sc-ds-mobile-sheet-nav .mobile-sheet-nav__context.sc-ds-mobile-sheet-nav{width:100%}.mobile-sheet-nav__header.sc-ds-mobile-sheet-nav::after{content:'';position:absolute;inset-inline:0;inset-block-end:0;height:var(--dimension-stroke-width-012);background:var(--color-border-tertiary);pointer-events:none}.mobile-sheet-nav__brand.sc-ds-mobile-sheet-nav{display:flex;align-items:center;justify-content:flex-start;min-width:0}.mobile-sheet-nav__logo.sc-ds-mobile-sheet-nav{display:inline-flex;align-items:center;justify-content:center;width:var(--dimension-size-500);height:var(--dimension-size-500);padding:var(--dimension-space-100);box-sizing:border-box;color:var(--color-foreground-primary)}.mobile-sheet-nav__logo-mark.sc-ds-mobile-sheet-nav{width:var(--dimension-iconography-lg);height:var(--dimension-iconography-lg);flex:0 0 auto}.mobile-sheet-nav__context.sc-ds-mobile-sheet-nav{justify-self:center}.mobile-sheet-nav__actions.sc-ds-mobile-sheet-nav{display:flex;align-items:center;justify-content:flex-end;gap:var(--dimension-space-050);min-width:0}.mobile-sheet-nav__body.sc-ds-mobile-sheet-nav{min-height:0;overflow:auto;overscroll-behavior:contain}.mobile-sheet-nav__sections.sc-ds-mobile-sheet-nav{display:grid;gap:var(--dimension-space-400)}.mobile-sheet-nav__items.sc-ds-mobile-sheet-nav{display:grid;gap:var(--dimension-space-100)}.mobile-sheet-nav__item.sc-ds-mobile-sheet-nav{appearance:none;width:100%;height:var(--ds-control-height);min-height:var(--ds-control-height);padding-inline:var(--ds-control-padding-inline);border:0;border-radius:var(--ds-control-radius);background:transparent;color:var(--color-foreground-secondary);display:flex;align-items:center;justify-content:flex-start;gap:var(--ds-control-gap);cursor:default;text-align:start;box-sizing:border-box}.mobile-sheet-nav__item--selected.sc-ds-mobile-sheet-nav{color:var(--color-foreground-primary)}.mobile-sheet-nav__item-label.sc-ds-mobile-sheet-nav{min-width:0;padding-inline:var(--ds-control-label-inset)}.mobile-sheet-nav__dot.sc-ds-mobile-sheet-nav{margin-inline-start:auto}`;const f=[{id:"dashboard",label:"Dashboard",icon:"Dashboard",variant:"icon"},{id:"settings",label:"Settings",icon:"Gear",variant:"icon"}];const u=e(class e extends i{constructor(e){super();if(e!==false){this.__registerHost()}this.dsAreaSelect=s(this,"dsAreaSelect",7);this.dsBrowseContextChange=s(this,"dsBrowseContextChange",7);this.dsClose=s(this,"dsClose",7);this.open=false;this.browseContext="dashboard";this.dashboardGroups=[];this.settingsGroups=[];this.currentUrl="";this.routeSelectionActive=true;this.navigationLabel="Application navigation";this.dashboardLabel="Dashboard";this.settingsLabel="Settings";this.accountLabel="Account";this.helpLabel="Help & Support";this.showAccount=true;this.handleContextChange=e=>{const i=e.detail==="settings"?"settings":"dashboard";if(i===this.browseContext)return;this.dsBrowseContextChange.emit(i)}}get groups(){return this.browseContext==="settings"?this.settingsGroups:this.dashboardGroups}get activeId(){if(!this.routeSelectionActive)return"";return r(this.currentUrl,[...this.dashboardGroups.flatMap((e=>e.items)),...this.settingsGroups.flatMap((e=>e.items))])}handleOpenChange(e){if(!e)return;requestAnimationFrame((()=>{const e=this.el.querySelector('[aria-current="page"]');const i=this.el.querySelector(".mobile-sheet-nav__item");(e??i)?.focus({preventScroll:true})}))}handleKeyDown(e){if(!this.open||e.key!=="Escape")return;e.preventDefault();this.dsClose.emit()}renderItem(e){const i=e.id===this.activeId;return o("button",{type:"button",class:{"mobile-sheet-nav__item":true,"mobile-sheet-nav__item--selected":i,"ds-control--lg":true,"ds-focus-ring-inset":true,"ds-interaction-fill":true},"aria-current":i?"page":undefined,onClick:()=>this.dsAreaSelect.emit(e.id)},o("ds-icon",{class:"ds-interaction-fill__content",name:e.icon,size:"lg",color:"inherit"}),o("ds-text",{class:"mobile-sheet-nav__item-label ds-interaction-fill__content",as:"span",variant:"text-body-large",emphasis:i,color:"inherit"},e.label),e.dot&&o("ds-badge",{class:"mobile-sheet-nav__dot ds-interaction-fill__content",variant:"dot",hasRing:false,label:"","aria-hidden":"true"}))}renderLogo(){return o("span",{class:"mobile-sheet-nav__logo","aria-hidden":"true"},o("svg",{class:"mobile-sheet-nav__logo-mark",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",focusable:"false","aria-hidden":"true"},o("path",{d:"M11.1159 4.31537H7.67021L2.53401 13.0703H0V15.6875H4.02716L8.24319 8.49978V15.6846H11.6342L15.8289 8.47829V15.6846H18.7122V4.3125H15.2559L11.1159 11.3648V4.31537Z",fill:"currentColor"})))}renderHeaderDestination(e,i,s){return o("ds-tooltip",{label:s,side:"bottom",size:"sm"},o("ds-button-unfilled",{variant:"icon",size:"lg",icon:i,"aria-label":s,activeFill:false,hasBorder:false,onDsClick:()=>this.dsAreaSelect.emit(e)}))}render(){const e=[{...f[0],label:this.dashboardLabel},{...f[1],label:this.settingsLabel}];return o(n,{key:"c43f525774bb3a6634a06e4e2d1e96d20c1e6fc1","aria-hidden":this.open?undefined:"true",inert:this.open?undefined:true},o("section",{key:"96c113be515e98317cfaf8e3c6c2eebd8e9858ed",id:"ds-mobile-sheet-nav",class:"mobile-sheet-nav"},o("header",{key:"3584495f66a4fee16beacbfd5423723d0e21d6f5",class:{"mobile-sheet-nav__header":true,"mobile-sheet-nav__header--expanded-context":!this.showAccount,"ds-chrome-grid":true,"ds-chrome-space--md":true}},o("div",{key:"fa20dd38aa965083a14d42c1e7e41932eb204c3d",class:"mobile-sheet-nav__brand"},this.renderLogo()),o("ds-tab-group",{key:"a443ad3cf6138734e545c4a404e9f5f9a618d175",class:"mobile-sheet-nav__context",tabs:e,value:this.browseContext,size:"lg",width:this.showAccount?"hug":"fill","aria-label":"Browse context",onDsChange:this.handleContextChange}),o("div",{key:"0f855c0208114ae28e64119a5ce455f264299ddb",class:"mobile-sheet-nav__actions"},this.renderHeaderDestination("help","CircleQuestion",this.helpLabel),this.showAccount?this.renderHeaderDestination("account","Avatar",this.accountLabel):null)),o("nav",{key:"6b059aed59ba67a8c6e6b704a03b12bc90b1436f",class:"mobile-sheet-nav__body ds-chrome-column ds-chrome-space--md","aria-label":this.navigationLabel},o("div",{key:"bad8c7a37e95e767aef5d01af91e81f2f8894375",class:"mobile-sheet-nav__sections"},this.groups.filter((e=>e.items.length>0)).map((e=>o("div",{class:"mobile-sheet-nav__items"},e.items.map((e=>this.renderItem(e))))))))))}get el(){return this}static get watchers(){return{open:[{handleOpenChange:0}]}}static get style(){return b()}},[2,"ds-mobile-sheet-nav",{open:[516],browseContext:[1,"browse-context"],dashboardGroups:[16],settingsGroups:[16],currentUrl:[1,"current-url"],routeSelectionActive:[4,"route-selection-active"],navigationLabel:[1,"navigation-label"],dashboardLabel:[1,"dashboard-label"],settingsLabel:[1,"settings-label"],accountLabel:[1,"account-label"],helpLabel:[1,"help-label"],showAccount:[4,"show-account"]},[[0,"keydown","handleKeyDown"]],{open:[{handleOpenChange:0}]}]);function g(){if(typeof customElements==="undefined"){return}const e=["ds-mobile-sheet-nav","ds-badge","ds-button-unfilled","ds-icon","ds-loader","ds-tab-group","ds-text","ds-tooltip"];e.forEach((e=>{switch(e){case"ds-mobile-sheet-nav":if(!customElements.get(t(e))){customElements.define(t(e),u)}break;case"ds-badge":if(!customElements.get(t(e))){a()}break;case"ds-button-unfilled":if(!customElements.get(t(e))){d()}break;case"ds-icon":if(!customElements.get(t(e))){c()}break;case"ds-loader":if(!customElements.get(t(e))){l()}break;case"ds-tab-group":if(!customElements.get(t(e))){h()}break;case"ds-text":if(!customElements.get(t(e))){v()}break;case"ds-tooltip":if(!customElements.get(t(e))){m()}break}}))}g();export{u as M,g as d};
|
|
2
|
+
//# sourceMappingURL=p-DAFR4U9P.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as i,H as e,c as a,h as t,a as s,t as n}from"./index.js";import{o,d}from"./p-DSy1oOnd.js";import{d as c}from"./p-DzPtYdXy.js";import{d as r}from"./p-CBymzuOO.js";import{d as p}from"./p-Bv6FSDPR.js";import{d as l}from"./p-CpeJMKJ5.js";import{d as g}from"./p-Cea7rROU.js";import{d as f}from"./p-pxN8JGEh.js";import{d as h}from"./p-0XTyQNRG.js";import{d as b}from"./p-BFit8o0r.js";import{d as m}from"./p-Cd1JnnVK.js";import{d as u}from"./p-pnO8tAYB.js";const v=[25,50,100,200];function z(i){return Number.isFinite(i)?Math.max(0,Math.trunc(i)):0}function _(i,e){return Number.isFinite(i)&&i>0?Math.trunc(i):e}function y(i){const e=_(i.pageSize,v[0]);const a=i.pageSizeMode==="fit"?"fit":"fixed";const t=z(i.totalItems);const s=Math.max(1,Math.ceil(t/e));const n=Math.min(z(i.pageIndex),s-1);const o=(i.pageSizeOptions?.length?i.pageSizeOptions:v).map((i=>_(i,0))).filter((i=>i>0));const d=[...new Set(a==="fixed"?[...o,e]:o)].sort(((i,e)=>i-e));const c=t===0?0:n*e+1;const r=t===0?0:Math.min(t,c+e-1);return{pageIndex:n,pageSize:e,pageSizeMode:a,totalItems:t,totalPages:s,firstItem:c,lastItem:r,pageSizeOptions:d}}const S=()=>`.ds-visually-hidden.sc-ds-pagination-h,.ds-visually-hidden.sc-ds-pagination{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}.sc-ds-pagination-h{display:block;box-sizing:border-box;min-width:0;max-width:100%;overflow-x:auto;scrollbar-width:none}.sc-ds-pagination-h::-webkit-scrollbar{display:none}.pagination.sc-ds-pagination,.pagination__page-size.sc-ds-pagination,.pagination__navigation.sc-ds-pagination{display:flex;align-items:center;box-sizing:border-box}.pagination.sc-ds-pagination{width:max-content;min-width:100%;gap:var(--dimension-space-200)}.pagination__page-size.sc-ds-pagination,.pagination__navigation.sc-ds-pagination{flex:0 0 auto}.pagination__page-size.sc-ds-pagination{gap:0;padding-inline-end:var(--dimension-space-100)}.pagination__navigation.sc-ds-pagination{gap:var(--dimension-space-050)}.pagination__total.sc-ds-pagination,.pagination__page.sc-ds-pagination,.pagination__label.sc-ds-pagination{display:inline-flex;align-items:center;flex:0 0 auto;white-space:nowrap}.pagination__total.sc-ds-pagination{margin-inline-start:var(--dimension-space-100)}.pagination.sc-ds-pagination .pagination__page-size-select.sc-ds-pagination{--ds-select-fg-active:var(--color-foreground-secondary)}.pagination__page.sc-ds-pagination{justify-content:center;min-inline-size:0;padding-inline:var(--dimension-space-100)}.pagination--table-compact.sc-ds-pagination .pagination__total.sc-ds-pagination,.pagination--table-compact.sc-ds-pagination .pagination__boundary.sc-ds-pagination{display:none}.pagination--table-compact.sc-ds-pagination{gap:var(--dimension-space-100)}.pagination--table-compact.sc-ds-pagination .pagination__page-size.sc-ds-pagination{padding-inline-end:0}`;let x=0;const k=i(class i extends e{constructor(i){super();if(i!==false){this.__registerHost()}this.dsChange=a(this,"dsChange",7);this.pageIndex=0;this.pageSize=25;this.pageSizeMode="fixed";this.totalItems=0;this.pageSizeOptions=[25,50,100,200];this.fitToPage=false;this.fitToPageInactive=false;this.fitPageSizeLabel="Fit to page";this.fitPageSizeTriggerLabel="Fit";this.itemLabel="items";this.pageSizeLabel="Items";this.label="Pagination";this.showFirstLastButtons=false;this.loading=false;this.tableCompact=false;this.pageSizeControlId=`ds-pagination-${++x}-page-size`;this.hasLoaded=false}componentDidLoad(){this.hasLoaded=true;this.syncTableCompactObserver()}connectedCallback(){if(this.hasLoaded)this.syncTableCompactObserver()}disconnectedCallback(){this.tableCompactDisconnect?.();this.tableCompactDisconnect=undefined}syncTableCompactObserver(){this.tableCompactDisconnect?.();this.tableCompactDisconnect=o(this.el,(i=>{if(this.tableCompact!==i)this.tableCompact=i}))}requestPage(i){const e=this.resolvedState;if(this.loading||i===e.pageIndex||i<0||i>=e.totalPages){return}this.dsChange.emit({pageIndex:i,pageSize:e.pageSize,pageSizeMode:e.pageSizeMode,totalItems:e.totalItems,pageSizeOptions:e.pageSizeOptions,fitToPage:this.fitToPage,fitToPageInactive:this.fitToPageInactive,fitPageSize:this.resolvedFitPageSize,fitPageSizeLabel:this.fitPageSizeLabel,fitPageSizeTriggerLabel:this.fitPageSizeTriggerLabel,itemLabel:this.itemLabel,pageSizeLabel:this.pageSizeLabel,ariaLabel:this.label,showFirstLastButtons:this.showFirstLastButtons,previousPageIndex:e.pageIndex,previousPageSize:e.pageSize,previousPageSizeMode:e.pageSizeMode,reason:"page"})}requestPageSize(i){if(this.loading||typeof i!=="string"||i==="fit"&&this.fitToPageInactive)return;const e=this.resolvedState;const a=i==="fit"?"fit":"fixed";const t=a==="fit"?this.resolvedFitPageSize:Number(i);if(!t||t===e.pageSize&&a===e.pageSizeMode)return;this.dsChange.emit({pageIndex:0,pageSize:Math.trunc(t),pageSizeMode:a,totalItems:e.totalItems,pageSizeOptions:e.pageSizeOptions,fitToPage:this.fitToPage,fitToPageInactive:this.fitToPageInactive,fitPageSize:this.resolvedFitPageSize,fitPageSizeLabel:this.fitPageSizeLabel,fitPageSizeTriggerLabel:this.fitPageSizeTriggerLabel,itemLabel:this.itemLabel,pageSizeLabel:this.pageSizeLabel,ariaLabel:this.label,showFirstLastButtons:this.showFirstLastButtons,previousPageIndex:e.pageIndex,previousPageSize:e.pageSize,previousPageSizeMode:e.pageSizeMode,reason:"page-size"})}handleKeyDown(i){if(i.defaultPrevented||i.altKey||i.ctrlKey||i.metaKey||i.shiftKey){return}const a=i.composedPath().some((i=>i instanceof e&&(i.tagName==="DS-SELECT"||["INPUT","SELECT","TEXTAREA"].includes(i.tagName))));if(a||i.key!=="ArrowLeft"&&i.key!=="ArrowRight")return;const t=this.resolvedState;const s=i.key==="ArrowLeft"?t.pageIndex-1:t.pageIndex+1;if(this.loading||s<0||s>=t.totalPages)return;i.preventDefault();this.requestPage(s)}get resolvedFitPageSize(){return Number.isFinite(this.fitPageSize)&&Number(this.fitPageSize)>0?Math.trunc(Number(this.fitPageSize)):undefined}get resolvedState(){return y({pageIndex:this.pageIndex,pageSize:this.pageSize,pageSizeMode:this.pageSizeMode,totalItems:this.totalItems,pageSizeOptions:this.pageSizeOptions})}render(){const i=this.resolvedState;const e=i.pageIndex===0;const a=i.pageIndex===i.totalPages-1;const n=i.totalItems===0?0:i.lastItem-i.firstItem+1;const o=`${n} of ${i.totalItems}`;const d=`${i.pageIndex+1} of ${i.totalPages}`;const c=`${i.firstItem}–${i.lastItem} of ${i.totalItems}`;const r=`Page ${i.pageIndex+1} of ${i.totalPages}`;const p=this.pageSizeAriaLabel??`${this.pageSizeLabel} per page`;const l=i.pageSizeOptions.map((i=>({label:String(i),value:String(i)})));if(this.fitToPage){l.push({label:this.fitPageSizeLabel,value:"fit",isInactive:this.fitToPageInactive||this.resolvedFitPageSize===undefined})}return t(s,{key:"a7f12780491861b6c63426c9570e232b2265a87b"},t("nav",{key:"26959c9f4f720828f9d41fb5e4c73ae043691e63",class:{pagination:true,"pagination--table-compact":this.tableCompact},"aria-label":this.label,"aria-busy":this.loading?"true":undefined,onKeyDown:i=>this.handleKeyDown(i)},t("div",{key:"b7af5a25d018f22bd306fa63d5cb5ae258aac439",class:"pagination__page-size"},t("ds-text",{key:"35199807e7a6af3cab32863bba5f4dc94f2a8eec",class:"pagination__label",as:"span",variant:"text-body-medium",color:"secondary","aria-hidden":"true"},this.pageSizeLabel,":"),t("span",{key:"2b267918462c9c10be6cbaa9569e30ae1095bd6f",id:`${this.pageSizeControlId}-label`,class:"ds-visually-hidden"},p),t("ds-select",{key:"c633d7bfd3b0b0df1b9e0d046a0296559b6ea037",class:"pagination__page-size-select",size:"md",inputId:this.pageSizeControlId,ariaLabelledby:`${this.pageSizeControlId}-label`,options:l,value:i.pageSizeMode==="fit"?"fit":String(i.pageSize),triggerLabel:i.pageSizeMode==="fit"?this.fitPageSizeTriggerLabel:undefined,indicator:"up-down",allowClear:false,activeFill:false,hasBorder:false,isInactive:this.loading,onDsChange:i=>{i.stopPropagation();this.requestPageSize(i.detail)}}),t("ds-text",{key:"a67485350c9aa8cff8ff40eff6af4ac5b42ff1a7",class:"pagination__total",as:"span",variant:"text-body-medium",color:"secondary",fontFeature:"tabular-nums"},o)),t("ds-divider",{key:"b9edc0487574b04ebe274d267f51060e2d07c6dc",class:"pagination__divider",orientation:"vertical",length:"var(--dimension-size-250)"}),t("div",{key:"c8ec4a80ecf71835f599227952acc0d7c4c42491",class:"pagination__navigation"},this.showFirstLastButtons?t("ds-button-unfilled",{class:"pagination__boundary",variant:"icon",size:"md",icon:"ChevronLeftDouble",ariaLabel:"First page",hasBorder:false,isInactive:this.loading||e,onDsClick:()=>this.requestPage(0)}):null,t("ds-button-unfilled",{key:"6b6b76db6860232dfd1677915afb5431a18db14e",variant:"icon",size:"md",icon:"ChevronLeft",ariaLabel:"Previous page",hasBorder:false,isInactive:this.loading||e,onDsClick:()=>this.requestPage(i.pageIndex-1)}),t("ds-text",{key:"de237a0653102086be7b2ae52730a0f35a25cd9b",class:"pagination__page",as:"span",variant:"text-body-medium",color:"secondary",fontFeature:"tabular-nums"},d),t("ds-button-unfilled",{key:"d62972dcc872a447e05fa3cc3d5400492195f41d",variant:"icon",size:"md",icon:"ChevronRight",ariaLabel:"Next page",hasBorder:false,isInactive:this.loading||a,onDsClick:()=>this.requestPage(i.pageIndex+1)}),this.showFirstLastButtons?t("ds-button-unfilled",{class:"pagination__boundary",variant:"icon",size:"md",icon:"ChevronRightDouble",ariaLabel:"Last page",hasBorder:false,isInactive:this.loading||a,onDsClick:()=>this.requestPage(i.totalPages-1)}):null),t("span",{key:"cd9c7a39fe4b0bc815a4b313b067fbfbb3f854c8",class:"ds-visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true"},c," ",this.itemLabel,". ",r,".")))}get el(){return this}static get style(){return S()}},[2,"ds-pagination",{pageIndex:[2,"page-index"],pageSize:[2,"page-size"],pageSizeMode:[1,"page-size-mode"],totalItems:[2,"total-items"],pageSizeOptions:[16],fitToPage:[4,"fit-to-page"],fitToPageInactive:[4,"fit-to-page-inactive"],fitPageSize:[2,"fit-page-size"],fitPageSizeLabel:[1,"fit-page-size-label"],fitPageSizeTriggerLabel:[1,"fit-page-size-trigger-label"],itemLabel:[1,"item-label"],pageSizeLabel:[1,"page-size-label"],pageSizeAriaLabel:[1,"page-size-aria-label"],label:[1],showFirstLastButtons:[4,"show-first-last-buttons"],loading:[4],tableCompact:[32]}]);function L(){if(typeof customElements==="undefined"){return}const i=["ds-pagination","ds-badge","ds-button-unfilled","ds-checkbox","ds-divider","ds-empty-state","ds-icon","ds-input","ds-loader","ds-select","ds-text","ds-tooltip"];i.forEach((i=>{switch(i){case"ds-pagination":if(!customElements.get(n(i))){customElements.define(n(i),k)}break;case"ds-badge":if(!customElements.get(n(i))){c()}break;case"ds-button-unfilled":if(!customElements.get(n(i))){d()}break;case"ds-checkbox":if(!customElements.get(n(i))){r()}break;case"ds-divider":if(!customElements.get(n(i))){p()}break;case"ds-empty-state":if(!customElements.get(n(i))){l()}break;case"ds-icon":if(!customElements.get(n(i))){g()}break;case"ds-input":if(!customElements.get(n(i))){f()}break;case"ds-loader":if(!customElements.get(n(i))){h()}break;case"ds-select":if(!customElements.get(n(i))){b()}break;case"ds-text":if(!customElements.get(n(i))){m()}break;case"ds-tooltip":if(!customElements.get(n(i))){u()}break}}))}L();export{k as P,L as d,y as r};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{p as i,H as e,c as a,h as t,a as s,t as n}from"./index.js";import{o,d}from"./p-7MWaWl8w.js";import{d as c}from"./p-DzPtYdXy.js";import{d as r}from"./p-CBymzuOO.js";import{d as p}from"./p-Bv6FSDPR.js";import{d as l}from"./p-CpeJMKJ5.js";import{d as g}from"./p-Cea7rROU.js";import{d as f}from"./p-nVv71P3f.js";import{d as h}from"./p-0XTyQNRG.js";import{d as b}from"./p-BIaHDBfP.js";import{d as m}from"./p-Cd1JnnVK.js";import{d as u}from"./p-9X_p0bHr.js";const v=[25,50,100,200];function z(i){return Number.isFinite(i)?Math.max(0,Math.trunc(i)):0}function _(i,e){return Number.isFinite(i)&&i>0?Math.trunc(i):e}function y(i){const e=_(i.pageSize,v[0]);const a=i.pageSizeMode==="fit"?"fit":"fixed";const t=z(i.totalItems);const s=Math.max(1,Math.ceil(t/e));const n=Math.min(z(i.pageIndex),s-1);const o=(i.pageSizeOptions?.length?i.pageSizeOptions:v).map((i=>_(i,0))).filter((i=>i>0));const d=[...new Set(a==="fixed"?[...o,e]:o)].sort(((i,e)=>i-e));const c=t===0?0:n*e+1;const r=t===0?0:Math.min(t,c+e-1);return{pageIndex:n,pageSize:e,pageSizeMode:a,totalItems:t,totalPages:s,firstItem:c,lastItem:r,pageSizeOptions:d}}const S=()=>`.ds-visually-hidden.sc-ds-pagination-h,.ds-visually-hidden.sc-ds-pagination{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}.sc-ds-pagination-h{display:block;box-sizing:border-box;min-width:0;max-width:100%;overflow-x:auto;scrollbar-width:none}.sc-ds-pagination-h::-webkit-scrollbar{display:none}.pagination.sc-ds-pagination,.pagination__page-size.sc-ds-pagination,.pagination__navigation.sc-ds-pagination{display:flex;align-items:center;box-sizing:border-box}.pagination.sc-ds-pagination{width:max-content;min-width:100%;gap:var(--dimension-space-200)}.pagination__page-size.sc-ds-pagination,.pagination__navigation.sc-ds-pagination{flex:0 0 auto}.pagination__page-size.sc-ds-pagination{gap:0;padding-inline-end:var(--dimension-space-100)}.pagination__navigation.sc-ds-pagination{gap:var(--dimension-space-050)}.pagination__total.sc-ds-pagination,.pagination__page.sc-ds-pagination,.pagination__label.sc-ds-pagination{display:inline-flex;align-items:center;flex:0 0 auto;white-space:nowrap}.pagination__total.sc-ds-pagination{margin-inline-start:var(--dimension-space-100)}.pagination.sc-ds-pagination .pagination__page-size-select.sc-ds-pagination{--ds-select-fg-active:var(--color-foreground-secondary)}.pagination__page.sc-ds-pagination{justify-content:center;min-inline-size:0;padding-inline:var(--dimension-space-100)}.pagination--table-compact.sc-ds-pagination .pagination__total.sc-ds-pagination,.pagination--table-compact.sc-ds-pagination .pagination__boundary.sc-ds-pagination{display:none}.pagination--table-compact.sc-ds-pagination{gap:var(--dimension-space-100)}.pagination--table-compact.sc-ds-pagination .pagination__page-size.sc-ds-pagination{padding-inline-end:0}`;let x=0;const k=i(class i extends e{constructor(i){super();if(i!==false){this.__registerHost()}this.dsChange=a(this,"dsChange",7);this.pageIndex=0;this.pageSize=25;this.pageSizeMode="fixed";this.totalItems=0;this.pageSizeOptions=[25,50,100,200];this.fitToPage=false;this.fitToPageInactive=false;this.fitPageSizeLabel="Fit to page";this.fitPageSizeTriggerLabel="Fit";this.itemLabel="items";this.pageSizeLabel="Items";this.label="Pagination";this.showFirstLastButtons=false;this.loading=false;this.tableCompact=false;this.pageSizeControlId=`ds-pagination-${++x}-page-size`;this.hasLoaded=false}componentDidLoad(){this.hasLoaded=true;this.syncTableCompactObserver()}connectedCallback(){if(this.hasLoaded)this.syncTableCompactObserver()}disconnectedCallback(){this.tableCompactDisconnect?.();this.tableCompactDisconnect=undefined}syncTableCompactObserver(){this.tableCompactDisconnect?.();this.tableCompactDisconnect=o(this.el,(i=>{if(this.tableCompact!==i)this.tableCompact=i}))}requestPage(i){const e=this.resolvedState;if(this.loading||i===e.pageIndex||i<0||i>=e.totalPages){return}this.dsChange.emit({pageIndex:i,pageSize:e.pageSize,pageSizeMode:e.pageSizeMode,totalItems:e.totalItems,pageSizeOptions:e.pageSizeOptions,fitToPage:this.fitToPage,fitToPageInactive:this.fitToPageInactive,fitPageSize:this.resolvedFitPageSize,fitPageSizeLabel:this.fitPageSizeLabel,fitPageSizeTriggerLabel:this.fitPageSizeTriggerLabel,itemLabel:this.itemLabel,pageSizeLabel:this.pageSizeLabel,ariaLabel:this.label,showFirstLastButtons:this.showFirstLastButtons,previousPageIndex:e.pageIndex,previousPageSize:e.pageSize,previousPageSizeMode:e.pageSizeMode,reason:"page"})}requestPageSize(i){if(this.loading||typeof i!=="string"||i==="fit"&&this.fitToPageInactive)return;const e=this.resolvedState;const a=i==="fit"?"fit":"fixed";const t=a==="fit"?this.resolvedFitPageSize:Number(i);if(!t||t===e.pageSize&&a===e.pageSizeMode)return;this.dsChange.emit({pageIndex:0,pageSize:Math.trunc(t),pageSizeMode:a,totalItems:e.totalItems,pageSizeOptions:e.pageSizeOptions,fitToPage:this.fitToPage,fitToPageInactive:this.fitToPageInactive,fitPageSize:this.resolvedFitPageSize,fitPageSizeLabel:this.fitPageSizeLabel,fitPageSizeTriggerLabel:this.fitPageSizeTriggerLabel,itemLabel:this.itemLabel,pageSizeLabel:this.pageSizeLabel,ariaLabel:this.label,showFirstLastButtons:this.showFirstLastButtons,previousPageIndex:e.pageIndex,previousPageSize:e.pageSize,previousPageSizeMode:e.pageSizeMode,reason:"page-size"})}handleKeyDown(i){if(i.defaultPrevented||i.altKey||i.ctrlKey||i.metaKey||i.shiftKey){return}const a=i.composedPath().some((i=>i instanceof e&&(i.tagName==="DS-SELECT"||["INPUT","SELECT","TEXTAREA"].includes(i.tagName))));if(a||i.key!=="ArrowLeft"&&i.key!=="ArrowRight")return;const t=this.resolvedState;const s=i.key==="ArrowLeft"?t.pageIndex-1:t.pageIndex+1;if(this.loading||s<0||s>=t.totalPages)return;i.preventDefault();this.requestPage(s)}get resolvedFitPageSize(){return Number.isFinite(this.fitPageSize)&&Number(this.fitPageSize)>0?Math.trunc(Number(this.fitPageSize)):undefined}get resolvedState(){return y({pageIndex:this.pageIndex,pageSize:this.pageSize,pageSizeMode:this.pageSizeMode,totalItems:this.totalItems,pageSizeOptions:this.pageSizeOptions})}render(){const i=this.resolvedState;const e=i.pageIndex===0;const a=i.pageIndex===i.totalPages-1;const n=i.totalItems===0?0:i.lastItem-i.firstItem+1;const o=`${n} of ${i.totalItems}`;const d=`${i.pageIndex+1} of ${i.totalPages}`;const c=`${i.firstItem}–${i.lastItem} of ${i.totalItems}`;const r=`Page ${i.pageIndex+1} of ${i.totalPages}`;const p=this.pageSizeAriaLabel??`${this.pageSizeLabel} per page`;const l=i.pageSizeOptions.map((i=>({label:String(i),value:String(i)})));if(this.fitToPage){l.push({label:this.fitPageSizeLabel,value:"fit",isInactive:this.fitToPageInactive||this.resolvedFitPageSize===undefined})}return t(s,{key:"a7f12780491861b6c63426c9570e232b2265a87b"},t("nav",{key:"26959c9f4f720828f9d41fb5e4c73ae043691e63",class:{pagination:true,"pagination--table-compact":this.tableCompact},"aria-label":this.label,"aria-busy":this.loading?"true":undefined,onKeyDown:i=>this.handleKeyDown(i)},t("div",{key:"b7af5a25d018f22bd306fa63d5cb5ae258aac439",class:"pagination__page-size"},t("ds-text",{key:"35199807e7a6af3cab32863bba5f4dc94f2a8eec",class:"pagination__label",as:"span",variant:"text-body-medium",color:"secondary","aria-hidden":"true"},this.pageSizeLabel,":"),t("span",{key:"2b267918462c9c10be6cbaa9569e30ae1095bd6f",id:`${this.pageSizeControlId}-label`,class:"ds-visually-hidden"},p),t("ds-select",{key:"c633d7bfd3b0b0df1b9e0d046a0296559b6ea037",class:"pagination__page-size-select",size:"md",inputId:this.pageSizeControlId,ariaLabelledby:`${this.pageSizeControlId}-label`,options:l,value:i.pageSizeMode==="fit"?"fit":String(i.pageSize),triggerLabel:i.pageSizeMode==="fit"?this.fitPageSizeTriggerLabel:undefined,indicator:"up-down",allowClear:false,activeFill:false,hasBorder:false,isInactive:this.loading,onDsChange:i=>{i.stopPropagation();this.requestPageSize(i.detail)}}),t("ds-text",{key:"a67485350c9aa8cff8ff40eff6af4ac5b42ff1a7",class:"pagination__total",as:"span",variant:"text-body-medium",color:"secondary",fontFeature:"tabular-nums"},o)),t("ds-divider",{key:"b9edc0487574b04ebe274d267f51060e2d07c6dc",class:"pagination__divider",orientation:"vertical",length:"var(--dimension-size-250)"}),t("div",{key:"c8ec4a80ecf71835f599227952acc0d7c4c42491",class:"pagination__navigation"},this.showFirstLastButtons?t("ds-button-unfilled",{class:"pagination__boundary",variant:"icon",size:"md",icon:"ChevronLeftDouble",ariaLabel:"First page",hasBorder:false,isInactive:this.loading||e,onDsClick:()=>this.requestPage(0)}):null,t("ds-button-unfilled",{key:"6b6b76db6860232dfd1677915afb5431a18db14e",variant:"icon",size:"md",icon:"ChevronLeft",ariaLabel:"Previous page",hasBorder:false,isInactive:this.loading||e,onDsClick:()=>this.requestPage(i.pageIndex-1)}),t("ds-text",{key:"de237a0653102086be7b2ae52730a0f35a25cd9b",class:"pagination__page",as:"span",variant:"text-body-medium",color:"secondary",fontFeature:"tabular-nums"},d),t("ds-button-unfilled",{key:"d62972dcc872a447e05fa3cc3d5400492195f41d",variant:"icon",size:"md",icon:"ChevronRight",ariaLabel:"Next page",hasBorder:false,isInactive:this.loading||a,onDsClick:()=>this.requestPage(i.pageIndex+1)}),this.showFirstLastButtons?t("ds-button-unfilled",{class:"pagination__boundary",variant:"icon",size:"md",icon:"ChevronRightDouble",ariaLabel:"Last page",hasBorder:false,isInactive:this.loading||a,onDsClick:()=>this.requestPage(i.totalPages-1)}):null),t("span",{key:"cd9c7a39fe4b0bc815a4b313b067fbfbb3f854c8",class:"ds-visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true"},c," ",this.itemLabel,". ",r,".")))}get el(){return this}static get style(){return S()}},[2,"ds-pagination",{pageIndex:[2,"page-index"],pageSize:[2,"page-size"],pageSizeMode:[1,"page-size-mode"],totalItems:[2,"total-items"],pageSizeOptions:[16],fitToPage:[4,"fit-to-page"],fitToPageInactive:[4,"fit-to-page-inactive"],fitPageSize:[2,"fit-page-size"],fitPageSizeLabel:[1,"fit-page-size-label"],fitPageSizeTriggerLabel:[1,"fit-page-size-trigger-label"],itemLabel:[1,"item-label"],pageSizeLabel:[1,"page-size-label"],pageSizeAriaLabel:[1,"page-size-aria-label"],label:[1],showFirstLastButtons:[4,"show-first-last-buttons"],loading:[4],tableCompact:[32]}]);function P(){if(typeof customElements==="undefined"){return}const i=["ds-pagination","ds-badge","ds-button-unfilled","ds-checkbox","ds-divider","ds-empty-state","ds-icon","ds-input","ds-loader","ds-select","ds-text","ds-tooltip"];i.forEach((i=>{switch(i){case"ds-pagination":if(!customElements.get(n(i))){customElements.define(n(i),k)}break;case"ds-badge":if(!customElements.get(n(i))){c()}break;case"ds-button-unfilled":if(!customElements.get(n(i))){d()}break;case"ds-checkbox":if(!customElements.get(n(i))){r()}break;case"ds-divider":if(!customElements.get(n(i))){p()}break;case"ds-empty-state":if(!customElements.get(n(i))){l()}break;case"ds-icon":if(!customElements.get(n(i))){g()}break;case"ds-input":if(!customElements.get(n(i))){f()}break;case"ds-loader":if(!customElements.get(n(i))){h()}break;case"ds-select":if(!customElements.get(n(i))){b()}break;case"ds-text":if(!customElements.get(n(i))){m()}break;case"ds-tooltip":if(!customElements.get(n(i))){u()}break}}))}P();export{k as P,P as d,y as r};
|
|
2
|
+
//# sourceMappingURL=p-DXbryJHz.js.map
|