@webority/ui-elements 0.128.0 → 0.130.0
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/README.md +7 -4
- package/dist/WuiAutocomplete-Q6lFj3yx.js +13 -0
- package/dist/{WuiCodeBlock-DafK2Kgc.js → WuiCodeBlock-iYtlkQn6.js} +1 -1
- package/dist/{WuiCommandPalette-CiEj7qnn.js → WuiCommandPalette-DS7VtDSy.js} +1 -1
- package/dist/{WuiCommentThread-2U3rwoH1.js → WuiCommentThread-ZXxBt71o.js} +1 -1
- package/dist/WuiConsentBanner-CYOU67bp.js +1 -0
- package/dist/{WuiCountrySelect-kgShmlip.js → WuiCountrySelect-RBhlw3vb.js} +1 -1
- package/dist/{WuiDataTable-BICQ8DT7.js → WuiDataTable-BVagEWAU.js} +1 -1
- package/dist/WuiDatePicker-DR6ZIW_8.js +31 -0
- package/dist/WuiDateRange-BgI9zi3w.js +25 -0
- package/dist/{WuiInlineEdit-DtSFAmEv.js → WuiInlineEdit-C6E6bGpU.js} +1 -1
- package/dist/WuiLeadPopup-CWv93qlo.js +306 -0
- package/dist/{WuiLightbox-D_7mpvkt.js → WuiLightbox-zFBcRDsq.js} +1 -1
- package/dist/WuiMarkdown-DNVK_5BI.js +4 -0
- package/dist/WuiMentionInput-DhJ180iU.js +1 -0
- package/dist/WuiMultiSelect-DwOzpXFZ.js +25 -0
- package/dist/{WuiNotificationCenter-BWL56BPm.js → WuiNotificationCenter-Br_cd0C_.js} +1 -1
- package/dist/WuiOtp-BqWijfNj.js +14 -0
- package/dist/WuiPhone-Bb9OF7-U.js +16 -0
- package/dist/{WuiRelativeTime-9u8XG-nr.js → WuiRelativeTime-CcbKgVjE.js} +1 -1
- package/dist/{WuiRollingNumber-C72xBgyG.js → WuiRollingNumber-D7uHyeQB.js} +1 -1
- package/dist/WuiSavedViews-8KVuepEC.js +1 -0
- package/dist/WuiSelect-Czp_9FoM.js +15 -0
- package/dist/WuiSlider-2kB__6zU.js +51 -0
- package/dist/WuiTagInput-Dpfz3DQQ.js +6 -0
- package/dist/WuiTimePicker-Cp4MfJlU.js +9 -0
- package/dist/WuiTour-ClCXfOtI.js +1 -0
- package/dist/{WuiTree-BNNk1CQ5.js → WuiTree-Dh5Tc_Ex.js} +1 -1
- package/dist/WuiWizardStep-7TdmGpUA.js +1 -0
- package/dist/buttonClass-DpG9WzgJ.js +1 -0
- package/dist/{dataTable-4RjZ1c5V.js → dataTable-CUILMcga.js} +1 -1
- package/dist/drawerDiscard-CZn1VnaB.js +1 -0
- package/dist/elements/autocomplete.js +1 -1
- package/dist/elements/code-block.js +1 -1
- package/dist/elements/command-palette.js +1 -1
- package/dist/elements/comment-thread.js +1 -1
- package/dist/elements/consent-banner.js +1 -1
- package/dist/elements/country-select.js +1 -1
- package/dist/elements/data-table.js +1 -1
- package/dist/elements/date-range.js +1 -1
- package/dist/elements/datepicker.js +1 -1
- package/dist/elements/inline-edit.js +1 -1
- package/dist/elements/kanban.js +1 -1
- package/dist/elements/lead-popup.js +1 -0
- package/dist/elements/lightbox.js +1 -1
- package/dist/elements/markdown.js +1 -1
- package/dist/elements/mention-input.js +1 -1
- package/dist/elements/multiselect.js +1 -1
- package/dist/elements/notification-center.js +1 -1
- package/dist/elements/otp.js +1 -1
- package/dist/elements/phone.js +1 -1
- package/dist/elements/relative-time.js +1 -1
- package/dist/elements/rolling-number.js +1 -1
- package/dist/elements/saved-views.js +1 -1
- package/dist/elements/select.js +1 -1
- package/dist/elements/slider.js +1 -1
- package/dist/elements/taginput.js +1 -1
- package/dist/elements/timepicker.js +1 -1
- package/dist/elements/tour.js +1 -1
- package/dist/elements/tree.js +1 -1
- package/dist/elements/wizard.js +1 -1
- package/dist/fieldState-D-zQcXUS.js +1 -0
- package/dist/{fileViewerImage-Bn5HCF30.js → fileViewerImage-DQYAoEzn.js} +1 -1
- package/dist/{fileViewerMedia-zSDnvCSa.js → fileViewerMedia-DwkIYzmY.js} +1 -1
- package/dist/{fileViewerPdf-C1QZnzCq.js → fileViewerPdf-CvY7afCX.js} +1 -1
- package/dist/fileViewerUi-D9R6-gZt.js +1 -0
- package/dist/{focusOrigin-BPTN3GY3.js → focusOrigin-0sYG-5El.js} +1 -1
- package/dist/formatters-D1zbsEJJ.js +1 -0
- package/dist/helpers.js +1 -1
- package/dist/iconGlyphs.g-DaOONrBK.js +1 -0
- package/dist/kanban-DqdYQ6sC.js +1 -0
- package/dist/{notificationDays-CZNthz7L.js → notificationDays-CMjhBP1Z.js} +1 -1
- package/dist/{optionLabel-BaLjjB-0.js → optionLabel-BkmbyLNL.js} +1 -1
- package/dist/server.js +1 -0
- package/dist/themeTransition-rHRVbhHB.js +1 -0
- package/dist/ui-calendar.global.js +1 -1
- package/dist/ui-calendar.js +1 -1
- package/dist/ui-chart.global.js +2 -2
- package/dist/ui-chart.js +2 -2
- package/dist/ui-consent-banner.global.js +1 -1
- package/dist/ui-elements/autocomplete.global.js +6 -6
- package/dist/ui-elements/carousel.global.js +1 -1
- package/dist/ui-elements/code-block.global.js +1 -1
- package/dist/ui-elements/command-palette.global.js +1 -1
- package/dist/ui-elements/comment-thread.global.js +1 -1
- package/dist/ui-elements/consent-banner.global.js +1 -1
- package/dist/ui-elements/context-menu.global.js +1 -1
- package/dist/ui-elements/date-range.global.js +9 -9
- package/dist/ui-elements/drawer.global.js +1 -1
- package/dist/ui-elements/image-crop.global.js +1 -1
- package/dist/ui-elements/inline-edit.global.js +1 -1
- package/dist/ui-elements/kanban.global.js +1 -1
- package/dist/ui-elements/lead-popup.global.js +306 -0
- package/dist/ui-elements/lightbox.global.js +1 -1
- package/dist/ui-elements/markdown.global.js +3 -3
- package/dist/ui-elements/multiselect.global.js +14 -14
- package/dist/ui-elements/phone.global.js +9 -9
- package/dist/ui-elements/resizable.global.js +1 -1
- package/dist/ui-elements/saved-views.global.js +1 -1
- package/dist/ui-elements/slider.global.js +10 -7
- package/dist/ui-elements/sortable.global.js +1 -1
- package/dist/ui-elements/status-icon.global.js +1 -1
- package/dist/ui-elements/taginput.global.js +4 -4
- package/dist/ui-elements/timepicker.global.js +3 -3
- package/dist/ui-elements/tour.global.js +1 -1
- package/dist/ui-elements/tree.global.js +1 -1
- package/dist/ui-elements/wizard.global.js +1 -1
- package/dist/ui-elements.global.js +30 -30
- package/dist/ui-elements.js +1 -1
- package/dist/ui-file-viewer.global.js +1 -1
- package/dist/ui-file-viewer.js +1 -1
- package/dist/ui-lead-popup.global.js +1 -0
- package/dist/ui-rich-text.global.js +57 -57
- package/dist/ui-rich-text.js +55 -55
- package/dist/ui-tour.global.js +1 -1
- package/dist/wuiHttp-DgnM7K2Q.js +1 -0
- package/dist/zone-D82f-GU_.js +1 -0
- package/package.json +7 -10
- package/dist/WuiAutocomplete-DE9q2G-l.js +0 -13
- package/dist/WuiConsentBanner-BF5ymoH5.js +0 -1
- package/dist/WuiDatePicker-CkBUk76L.js +0 -31
- package/dist/WuiDateRange-3NYNJiIa.js +0 -25
- package/dist/WuiMarkdown-BxmKHb3T.js +0 -4
- package/dist/WuiMentionInput-DIRekJlq.js +0 -1
- package/dist/WuiMultiSelect-Brdm5tAI.js +0 -25
- package/dist/WuiOtp-Hw6srogj.js +0 -14
- package/dist/WuiPhone-D0ixbxGE.js +0 -16
- package/dist/WuiSavedViews-DrJWvWuf.js +0 -1
- package/dist/WuiSelect-Bma_H42p.js +0 -15
- package/dist/WuiSlider-DXJGSJHP.js +0 -48
- package/dist/WuiTagInput-C38b3LfS.js +0 -6
- package/dist/WuiTimePicker-Bw5BKBCD.js +0 -9
- package/dist/WuiTour-DjR-6kr5.js +0 -1
- package/dist/WuiWizardStep-DkEdAXc8.js +0 -1
- package/dist/buttonClass-FD57QNey.js +0 -1
- package/dist/fileViewerUi-CHY-0j9d.js +0 -1
- package/dist/formatters-7rx97Lnm.js +0 -1
- package/dist/iconGlyphs.g-CQcMoS6_.js +0 -1
- package/dist/kanban-CTIFNgJE.js +0 -1
- package/dist/themeTransition-lIK8WDpA.js +0 -1
- package/dist/ui-chat.global.js +0 -11
- package/dist/ui-chat.js +0 -11
- package/dist/wuiHttp-CYxlXwsy.js +0 -1
package/dist/ui-tour.global.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){function e(e,t){if(typeof customElements>`u`||customElements.get(e))return;let n=[];if(typeof document<`u`)for(let r of document.querySelectorAll(e))for(let e of Object.keys(r)){let i=Object.getOwnPropertyDescriptor(t.prototype,e);i&&(i.set||i.get)&&(n.push([r,e,r[e]]),delete r[e])}customElements.define(e,t);for(let[e,t,r]of n)e[t]=r}var t=typeof HTMLElement>`u`?class{}:HTMLElement;function n(e,t){r(e),e._reanchor=t,e._reanchorScroll=n=>{n.target instanceof Node&&typeof e.contains==`function`&&e.contains(n.target)||t()},window.addEventListener(`resize`,e._reanchor),window.addEventListener(`scroll`,e._reanchorScroll,!0)}function r(e){e?._reanchor&&(window.removeEventListener(`resize`,e._reanchor),window.removeEventListener(`scroll`,e._reanchorScroll,!0),e._reanchor=null,e._reanchorScroll=null)}var i=`AppButton`,a={primary:`btn-primary`,secondary:`btn-secondary`,outline:`btn-outline-primary`,ghost:`btn-ghost`,text:`btn-text`,danger:`btn-danger`,success:`btn-success`,"secondary-danger":`btn-secondary-danger`,"outline-danger":`btn-outline-danger`,light:`btn-light`,warning:`btn-warning`,neutral:`btn-neutral`,"outline-light":`btn-outline-light`,"outline-secondary":`btn-outline-secondary`};function o(e=`primary`,t=`md`){let n=a[e];if(!n)throw Error(`buttonClass: unknown variant "${e}"`);return t===`md`?`btn ${n}`:`btn ${n} btn-${t}`}var s=`data-advance`,c=`wui-tour-hint`,l=`Click {actionName} to continue.`,u=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]`,d=(e,t)=>e?.advanceOn===`click`&&!!t,f=e=>(e??``).replace(/\s+/g,` `).trim();function p(e){let t=e.ownerDocument,n=(e.getAttribute(`aria-labelledby`)||``).split(/\s+/).filter(Boolean),r=e.tagName===`INPUT`&&/^(button|submit|reset)$/.test(e.type)?e.value:``,i=[n.map(e=>t.getElementById(e)?.textContent??``).join(` `),e.getAttribute(`aria-label`),Array.from(e.labels??[],e=>e.textContent).join(` `),e.getAttribute(`alt`),r,e.textContent,e.getAttribute(`title`)];for(let e of i){let t=f(e);if(t)return t}return``}function m(e){for(let t of[e,...e.querySelectorAll(u)])if(t.tabIndex>=0&&!t.disabled)return t;return null}function h(e,t,n){let r=(e.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(e=>e&&e!==t);n&&r.push(t),r.length>0?e.setAttribute(`aria-describedby`,r.join(` `)):e.removeAttribute(`aria-describedby`)}function ee(e,t){let n=e.querySelector(`.${c}`),r=e.querySelector(`.wui-tour-text`)?.id,i=r?`${r.replace(/-text$/,``)}-hint`:``;t?(n||(n=e.ownerDocument.createElement(`p`),n.className=c,i&&(n.id=i),e.querySelector(`.wui-tour-actions`).before(n)),n.textContent=t,i&&h(e,i,!0)):(n?.remove(),i&&h(e,i,!1))}var te=e=>getComputedStyle(e).animationName;function g(e,{layer:t,spot:n,card:r},i,a){let o=d(i,a);t.toggleAttribute(s,o&&!(t.getRootNode()instanceof ShadowRoot)),n.hasAttribute(s)&&(n.removeAttribute(s),o&&te(n)),o&&n.setAttribute(s,``);let c=r.querySelector(`.wui-tour-next`);c.classList.toggle(`btn-primary`,!o),c.classList.toggle(`btn-link`,o);let u=o?f(i.actionLabel)||p(a):``,m=e.getAttribute(`advance-label`)||l,h=u?m.replace(/\{actionName\}/g,()=>u):``;return ee(r,h),h}function ne(e,t,n){if(!d(e,t))return()=>{};let r=null,i=()=>{r??=setTimeout(n,0)};return t.addEventListener(`click`,i),()=>{t.removeEventListener(`click`,i),clearTimeout(r)}}function _(e,t,n,r){return e.contains(r)||d(t,n)&&n.contains(r)}function v(e,{card:t,active:n,step:r,target:i}){let a=Array.from(t.querySelectorAll(`button`)).filter(e=>!e.hidden),o=d(r,i)?m(i):null;o&&a.push(o);let s=a.findIndex(e=>e===n||e===o&&i.contains(n));e.preventDefault(),a[s===-1?e.shiftKey?a.length-1:0:(s+(e.shiftKey?-1:1)+a.length)%a.length].focus()}var re=2/3,ie=1e3,ae=new Set([`top`,`left`,`width`,`height`]),y=new WeakMap,b=(e,t)=>typeof e.getAnimations==`function`?e.getAnimations().filter(t):[],x=e=>e.transitionProperty===`opacity`,S=e=>ae.has(e.transitionProperty),C=e=>typeof e.animationName==`string`&&e.animationName.startsWith(`wui-tour-`);function w(e){return e.length===0?null:new Promise(t=>{let n=setTimeout(t,ie);Promise.allSettled(e.map(e=>e.finished)).then(()=>{clearTimeout(n),t()})})}function T(e){let t=e.parentElement?.querySelector(`:scope > .wui-tour-spot`),n=0;for(let e of t?b(t,S):[]){let t=e.effect?.getComputedTiming?.();if(typeof t?.duration!=`number`)continue;let r=typeof e.currentTime==`number`?e.currentTime:0;n=Math.max(n,(t.delay??0)+t.duration*re-r)}return n}function E(e){let t=T(e);t>0?e.style.setProperty(`--wui-tour-card-delay`,`${Math.round(t)}ms`):e.style.removeProperty(`--wui-tour-card-delay`),e.dataset.state=`entering`;let n={};y.set(e,n);let r=()=>{y.get(e)===n&&e.dataset.state===`entering`&&(e.dataset.state=`shown`)},i=b(e,C);i.length===0?r():Promise.allSettled(i.map(e=>e.finished)).then(r)}function D(e){return e.dataset.state=`leaving`,w(b(e,x))}function oe(e){let t=e.classList.contains(`wui-tour-layer`)?e:e.shadowRoot?.querySelector(`.wui-tour-layer`);t&&(t.dataset.state=`leaving`);let n=t?w(b(t,x)):null;n?(e.setAttribute(`inert`,``),n.then(()=>e.remove())):e.remove()}var se=2,O=12,k=8,A=4,j=20,ce=`(max-width: 575.98px)`,le=[`bottom`,`top`,`right`,`left`],M=[`top-left`,`top-right`,`bottom-right`,`bottom-left`],N,P=(e,t,n)=>Math.max(t,Math.min(e,n)),F=(e,t,n,r)=>(Math.max(e,n)+Math.min(t,r))/2;function I(e,t){if(!t?.scrollIntoView)return;e.style.maxHeight=``;let n=H(e),r=e.offsetHeight+O;if(t.getBoundingClientRect().height+4+r*2<=n.bottom-n.top){t.scrollIntoView({block:`center`,inline:`nearest`});return}let i=t.style.scrollMarginTop;t.style.scrollMarginTop=`${n.top+r+se}px`,t.scrollIntoView({block:`start`,inline:`nearest`}),t.style.scrollMarginTop=i}function L(e,t,n){let r=e.style,i=t.style,a=U(t);if(!n){r.top=`50%`,r.left=`50%`,r.width=`0px`,r.height=`0px`,r.boxShadow=`0 0 0 100vmax var(--color-scrim-strong)`;for(let e of M)r.removeProperty(`border-${e}-radius`),r.removeProperty(`corner-${e}-shape`);t.dataset.placement=`center`,a.hidden=!0,i.position=`fixed`,i.top=`50%`,i.left=`50%`,i.transform=`translate(-50%, -50%)`,i.maxHeight=`calc(100vh - 16px)`;return}r.boxShadow=``,i.transform=``,i.position=`fixed`;let o=n.getBoundingClientRect();r.top=`${o.top}px`,r.left=`${o.left}px`,r.width=`${o.width}px`,r.height=`${o.height}px`,R(r,n);let s=t.scrollTop;i.maxHeight=``;let c={width:t.offsetWidth,height:t.offsetHeight},l=H(t),u=l.bottom-l.top,d={bottom:l.bottom-o.bottom-O,top:o.top-O-l.top,right:l.right-o.right-O,left:o.left-O-l.left},f=window.matchMedia(ce).matches,p=le.find(e=>e===`top`||e===`bottom`?c.height<=d[e]+1:!f&&c.width<=d[e]+1&&c.height<=u+1),m=Math.min(o.bottom,l.bottom+k)-Math.max(o.top,l.top-k);p?z(t,a,p,o,l,c):m>=Math.min(c.height,u)+8?B(t,a,o,l,c):V(t,a,d.bottom>=d.top?`bottom`:`top`,o,l,c,d),t.scrollTop=s}function R(e,t){N??=CSS.supports(`corner-top-left-shape`,`squircle`);let n=getComputedStyle(t);for(let t of M)e.setProperty(`border-${t}-radius`,n.getPropertyValue(`border-${t}-radius`)),N&&e.setProperty(`corner-${t}-shape`,n.getPropertyValue(`corner-${t}-shape`))}function z(e,t,n,r,i,a){let o=n===`top`||n===`bottom`,s,c,l;if(o){let e=F(r.left,r.right,i.left,i.right);s=P(e-a.width/2,i.left,i.right-a.width),c=n===`bottom`?r.bottom+O:r.top-O-a.height,l=P(e-s,j,a.width-j)}else{let e=F(r.top,r.bottom,i.top,i.bottom);c=P(e-a.height/2,i.top,i.bottom-a.height),s=n===`right`?r.right+O:r.left-O-a.width,l=P(e-c,j,a.height-j)}e.dataset.placement=n,e.style.top=`${c}px`,e.style.left=`${s}px`,t.hidden=!1,t.style.left=o?`${l-e.clientLeft-t.offsetWidth/2}px`:``,t.style.top=o?``:`${l-e.clientTop-t.offsetHeight/2}px`}function B(e,t,n,r,i){let a=r.bottom-r.top;e.dataset.placement=`overlap`,t.hidden=!0,e.style.maxHeight=i.height>a?`${Math.max(a,0)}px`:``;let o=Math.min(n.bottom,r.bottom)-A;e.style.top=`${Math.max(r.top,o-Math.min(i.height,a))}px`,e.style.left=`${P(n.left+A,r.left,r.right-i.width)}px`}function V(e,t,n,r,i,a,o){let s=Math.max(o[n],0),c=Math.min(a.height,s);e.dataset.placement=n,t.hidden=!0,e.style.maxHeight=a.height>s?`${s}px`:``,e.style.top=`${n===`bottom`?r.bottom+O:r.top-O-c}px`;let l=F(r.left,r.right,i.left,i.right);e.style.left=`${P(l-a.width/2,i.left,i.right-a.width)}px`}function H(e){let t=e.parentElement,n=t?getComputedStyle(t):null,r=e=>Number.parseFloat(n?.[e])||0;return{top:r(`paddingTop`)+k,bottom:window.innerHeight-r(`paddingBottom`)-k,left:r(`paddingLeft`)+k,right:window.innerWidth-r(`paddingRight`)-k}}function U(e){let t=e.querySelector(`:scope > .wui-tour-arrow`);return t||(t=document.createElement(`span`),t.className=`wui-tour-arrow`,t.setAttribute(`aria-hidden`,`true`),t.hidden=!0,e.append(t)),t}var W=0;function ue(e,t,n){let r=`wui-tour-end-${++W}`,a=e.createElement(`div`);return a.className=`wui-tour-card wui-tour-end`,a.dataset.layout=`center`,a.setAttribute(`role`,`dialog`),n&&a.setAttribute(`aria-modal`,`true`),a.tabIndex=-1,a.setAttribute(`aria-labelledby`,`${r}-title`),a.setAttribute(`aria-describedby`,`${r}-message`),a.innerHTML=` <div class="wui-tour-end-mark" aria-hidden="true"><svg viewBox="0 0 24 24" focusable="false"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></div> <h2 class="wui-tour-title wui-tour-end-title" id="${r}-title"></h2> <p class="wui-tour-text wui-tour-end-message" id="${r}-message"></p> <div class="wui-tour-actions"><button type="button" class="${o(`primary`,`sm`)} wui-tour-end-button" data-wui="${i}"></button></div>`,a.querySelector(`.wui-tour-end-title`).textContent=t.title,a.querySelector(`.wui-tour-end-message`).textContent=t.message,a.querySelector(`.wui-tour-end-button`).textContent=t.button,a}function de(e,t,n){let r=e.ownerDocument,i=e.getRootNode()===r,a=e.querySelector(`.wui-tour-card:not(.wui-tour-end)`),o=e.querySelector(`.wui-tour-spot`),s=e.querySelector(`[role=status]`),c=ue(r,t,i),l=c.querySelector(`.wui-tour-end-button`),u=new AbortController;return new Promise(d=>{let f=()=>{u.abort(),d()};if(n?.aborted){f();return}let p={signal:u.signal};n?.addEventListener(`abort`,f,p),l.addEventListener(`click`,f,p),r.addEventListener(`keydown`,e=>{e.altKey||e.ctrlKey||e.metaKey||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),f()):e.key===`Tab`&&i&&(e.preventDefault(),l.focus()))},{capture:!0,signal:u.signal}),i&&r.addEventListener(`focusin`,e=>{c.contains(e.target)||l.focus()},p);let m=()=>{u.signal.aborted||(a.hidden=!0,L(o,a,null),e.append(c),E(c),s.textContent=[t.title,t.message].filter(Boolean).join(`. `),l.focus())},h=D(a);h?h.then(m):m()})}var fe=` :host { all: initial; ${Object.entries({"--wui-z-tour":`1550`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-popover":`0px 8px 28px -6px rgba(7, 20, 55, 0.14)`,"--wui-ease-out":`cubic-bezier(0.22, 1, 0.36, 1)`,"--wui-tour-motion-duration":`200ms`,"--wui-tour-motion-ease":`cubic-bezier(0.22, 1, 0.36, 1)`,"--wui-tour-spot-duration":`240ms`,"--wui-tour-spot-ease":`cubic-bezier(0.32, 0.72, 0, 1)`,"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-text":`#4F46E5`,"--color-focus-ring":`#4F46E5`,"--wui-focus-ring-width":`2px`,"--wui-focus-ring-offset":`2px`,"--color-on-primary":`#FFFFFF`,"--color-success-soft":`#E8FAEE`,"--color-success-text":`#0e7531`,"--color-on-scrim":`#FFFFFF`,"--color-scrim-strong":`color-mix(in srgb, #071437 62%, transparent)`,"--color-surface":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-bg-muted":`#F5F6FA`}).map(([e,t])=>` ${e}: ${t};`).join(` `)} } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; } .btn { display: inline-block; margin: 0; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; text-decoration: none; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; } .btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); } .btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); } .btn-outline-secondary { border-color: var(--color-text-muted); color: var(--color-text-muted); } .btn-outline-secondary:hover { background: var(--color-bg-muted); color: var(--color-text); } .btn-link { font-weight: 400; color: var(--color-primary-text); text-decoration: underline; } .btn-link:hover { color: var(--color-primary-hover); } .wui-tour-layer { pointer-events: none; font-family: "Webority Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-weight: 400; line-height: 1.5; color: var(--color-text); text-align: start; } .wui-tour-card { pointer-events: auto; } .wui-tour-layer { position: fixed; inset: 0; z-index: var(--wui-z-tour); } .wui-tour-spot { position: fixed; box-shadow: 0 0 0 2px var(--color-primary), 0 0 0 100vmax var(--color-scrim-strong); pointer-events: none; } .wui-tour-card { display: flex; flex-direction: column; gap: 8px; width: min(360px, 100vw - 16px); padding: 16px; overflow-y: auto; background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); border-radius: var(--wui-radius-lg); corner-shape: squircle; box-shadow: var(--wui-shadow-popover); } .wui-tour-card:focus { outline: none; } .wui-tour-card:focus-visible { outline: var(--wui-focus-ring-width) solid var(--color-focus-ring); outline-offset: var(--wui-focus-ring-offset); } .wui-tour-title { margin: 0; font-size: 16px; font-weight: 600; } .wui-tour-text { margin: 0; font-size: 14px; color: var(--color-text-muted); } .wui-tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; } .wui-tour-nav { display: flex; gap: 8px; } .wui-tour-skip { color: var(--color-text-muted); } .wui-tour-back, .wui-tour-next { min-width: 64px; } @keyframes wui-tour-fade-in { from { opacity: 0; } to { opacity: 1; } } @keyframes wui-tour-card-enter { from { opacity: 0; scale: 0.96; translate: var(--wui-tour-card-lift, 0 6px); } to { opacity: 1; scale: 1; translate: 0 0; } } .wui-tour-layer[data-state=leaving], .wui-tour-card[data-state=leaving] { opacity: 0; } .wui-tour-layer[data-state=leaving], .wui-tour-layer[data-state=leaving] * { pointer-events: none; } @media (prefers-reduced-motion: no-preference) { .wui-tour-layer { animation: wui-tour-fade-in var(--wui-tour-motion-duration) var(--wui-tour-motion-ease); } .wui-tour-layer[data-state=leaving] { transition: opacity var(--wui-tour-motion-duration) var(--wui-tour-motion-ease); } .wui-tour-spot { transition: top var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), left var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), width var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), height var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), border-radius var(--wui-tour-spot-duration) var(--wui-tour-spot-ease); } .wui-tour-spot[data-tracking] { transition: none; } .wui-tour-card { --wui-tour-card-lift: 0 6px; transform-origin: top center; } .wui-tour-card[data-placement=top] { --wui-tour-card-lift: 0 -6px; transform-origin: bottom center; } .wui-tour-card[data-placement=bottom] { --wui-tour-card-lift: 0 6px; transform-origin: top center; } .wui-tour-card[data-placement=left] { --wui-tour-card-lift: -6px 0; transform-origin: right center; } .wui-tour-card[data-placement=right] { --wui-tour-card-lift: 6px 0; transform-origin: left center; } .wui-tour-card[data-placement=overlap], .wui-tour-card[data-placement=center] { --wui-tour-card-lift: 0 0; transform-origin: center; } .wui-tour-card[data-state=entering] { animation: wui-tour-card-enter var(--wui-tour-motion-duration) var(--wui-tour-motion-ease) var(--wui-tour-card-delay, 0ms) both; } .wui-tour-card[data-state=leaving] { transition: opacity calc(var(--wui-tour-motion-duration) / 2) var(--wui-tour-motion-ease); } } @media (prefers-reduced-motion: reduce) { .wui-tour-layer { animation: wui-tour-fade-in 120ms linear; } .wui-tour-layer[data-state=leaving] { transition: opacity 120ms linear; } .wui-tour-card[data-state=entering] { animation: wui-tour-fade-in 120ms linear both; } } .wui-tour-progress-bar { display: flex; gap: 4px; } .wui-tour-progress-segment { flex: 1 1 0; height: 4px; border-radius: 999px; background: var(--color-border); } .wui-tour-progress-segment[data-filled] { background: var(--color-primary); } .wui-tour-position { margin: 0; font-size: 12px; color: var(--color-text-muted); } .wui-tour-layer { padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); } .wui-tour-card:has(.wui-tour-arrow:not([hidden])) { overflow: visible; } .wui-tour-arrow { position: absolute; width: 8px; height: 8px; background: var(--color-surface); border: 1px solid var(--color-border); rotate: 45deg; pointer-events: none; } .wui-tour-card[data-placement=bottom] .wui-tour-arrow { top: -5px; border-right-color: rgba(0, 0, 0, 0); border-bottom-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=top] .wui-tour-arrow { bottom: -5px; border-top-color: rgba(0, 0, 0, 0); border-left-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=right] .wui-tour-arrow { left: -5px; border-top-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=left] .wui-tour-arrow { right: -5px; border-bottom-color: rgba(0, 0, 0, 0); border-left-color: rgba(0, 0, 0, 0); } @media (max-width: 575.98px) { .wui-tour-card { width: calc(100vw - 16px); } .wui-tour-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; } } .wui-tour-media { position: relative; order: -1; flex: none; aspect-ratio: 16/9; margin: -16px -16px 4px; overflow: hidden; background: var(--color-border); } .wui-tour-media>img, .wui-tour-media>video { display: block; width: 100%; height: 100%; object-fit: cover; } .wui-tour-card[data-media=welcome] { width: min(420px, 100vw - 16px); } .wui-tour-media-toggle { position: absolute; inset-block-end: 8px; inset-inline-end: 8px; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--color-scrim-strong); color: var(--color-on-scrim); cursor: pointer; } .wui-tour-media-toggle>svg { width: 20px; height: 20px; fill: currentColor; } .wui-tour-media-toggle:focus-visible { outline: 2px solid var(--color-on-scrim); outline-offset: 2px; } .wui-tour-layer[data-advance] { pointer-events: none; } .wui-tour-layer[data-advance]:not([data-state=leaving]) .wui-tour-card { pointer-events: auto; } .wui-tour-layer[data-advance]:not([data-state=leaving]) .wui-tour-spot::before { content: ""; position: absolute; inset: -100vmax; pointer-events: auto; clip-path: polygon(evenodd, 0 0, 100% 0, 100% 100%, 0 100%, 0 0, 100vmax 100vmax, calc(100% - 100vmax) 100vmax, calc(100% - 100vmax) calc(100% - 100vmax), 100vmax calc(100% - 100vmax), 100vmax 100vmax); } .wui-tour-hint { margin: 0; font-size: 14px; font-weight: 600; color: var(--color-text); } @keyframes wui-tour-pulse { from { box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 85%, transparent); } to { box-shadow: 0 0 0 14px color-mix(in srgb, var(--color-primary) 0%, transparent); } } @media (prefers-reduced-motion: no-preference) { .wui-tour-spot[data-advance]::after { content: ""; position: absolute; inset: 0; border-radius: inherit; corner-shape: inherit; pointer-events: none; animation: wui-tour-pulse 600ms var(--wui-ease-out) var(--wui-tour-spot-duration); } } @keyframes wui-tour-check { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } } .wui-tour-end[data-layout=center] { --wui-tour-card-lift: 0 0; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); transform-origin: center; align-items: center; gap: 8px; width: min(420px, 100vw - 16px); max-height: calc(100vh - 16px); padding: 24px; text-align: center; } .wui-tour-end[data-layout=center] .wui-tour-actions { justify-content: center; margin-top: 8px; } .wui-tour-end-mark { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--color-success-soft); color: var(--color-success-text); } .wui-tour-end-mark>svg { width: 26px; height: 26px; } .wui-tour-end-mark path { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; } .wui-tour-end-title { font-size: 18px; } .wui-tour-end-message { text-wrap: balance; } .wui-tour-end-button { min-width: 120px; } @media (prefers-reduced-motion: no-preference) { .wui-tour-end-mark path { animation: wui-tour-check 300ms var(--wui-ease-out) calc(var(--wui-tour-card-delay, 0ms) + 120ms) both; } } `,G=`wui-tour-media`,pe=`wui-tour-media-toggle`,K=`http://www.w3.org/2000/svg`,me=`M6 5h4v14H6zM14 5h4v14h-4z`,he=`M8 5v14l11-7z`,ge={pause:`Pause animation`,play:`Play animation`},_e=()=>globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;function ve(e){let t=document.createElementNS(K,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`);let n=document.createElementNS(K,`path`);return n.setAttribute(`d`,e),t.appendChild(n),t}function ye(e){let t=document.createElement(`img`);return t.setAttribute(`alt`,e.mediaAlt??``),t.setAttribute(`width`,`1280`),t.setAttribute(`height`,`720`),t.setAttribute(`loading`,`lazy`),t.setAttribute(`decoding`,`async`),t.setAttribute(`src`,e.media),t}function be(e,t){let n=document.createElement(`video`);return n.muted=!0,n.setAttribute(`muted`,``),n.loop=!0,n.setAttribute(`playsinline`,``),t&&n.setAttribute(`autoplay`,``),n.setAttribute(`preload`,t?`auto`:`metadata`),e.mediaAlt&&n.setAttribute(`aria-label`,e.mediaAlt),e.mediaPoster&&n.setAttribute(`poster`,e.mediaPoster),n.setAttribute(`src`,e.media),n}function xe(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=pe;let r=(r=!e.paused)=>{n.setAttribute(`aria-label`,r?t.pause:t.play),n.replaceChildren(ve(r?me:he))};return e.addEventListener(`play`,()=>r()),e.addEventListener(`pause`,()=>r()),n.addEventListener(`click`,()=>{e.paused?e.play()?.catch(()=>r()):e.pause()}),r(e.hasAttribute(`autoplay`)),n}function Se(e){let t=e.querySelector(`:scope > .${G}`);if(!t)return;let n=t.querySelector(`video`);n&&(n.pause(),n.removeAttribute(`src`),n.load()),t.remove()}function Ce(e,t,n=ge){if(Se(e),!t.media){e.removeAttribute(`data-media`);return}let r=document.createElement(`div`);if(r.className=G,t.mediaType===`video`){let e=be(t,!_e());r.append(e,xe(e,n))}else r.appendChild(ye(t));e.prepend(r),e.setAttribute(`data-media`,t.target?`step`:`welcome`)}var q=`data-wui-tour-open`,we=`Step {current} of {total}`;function Te(e){let t=new Set;return{drop:e=>{t.add(e)},position:e=>{t.delete(e);let n=0;for(let r of t)r<e&&n++;return e+1-n},total:()=>e-t.size}}function Ee(e,t,n){return(e.getAttribute(`progress-label`)||we).replace(/\{(current|total)\}/g,(e,r)=>String(r===`current`?t:n))}function De(e,{text:t,position:n,total:r}){let i=e.querySelector(`.wui-tour-position`);i.textContent=t;let a=e.querySelector(`.wui-tour-progress-bar`);if(!a){let t=e.ownerDocument,n=t.createElement(`div`);n.className=`wui-tour-progress`,n.setAttribute(`aria-hidden`,`true`),a=t.createElement(`div`),a.className=`wui-tour-progress-bar`,n.append(a),i.before(n)}let o=a.children;for(;o.length<r;){let t=e.ownerDocument.createElement(`span`);t.className=`wui-tour-progress-segment`,a.append(t)}for(;o.length>r;)a.lastElementChild.remove();for(let e=0;e<o.length;e++)o[e].toggleAttribute(`data-filled`,e<n)}var Oe=`wui-tour-step`,ke=`wui-tour-host`,Ae=`wui-tour-seen:`,J=`data-tracking`,je={back:`Back`,next:`Next`,skip:`Skip`,done:`Done`,mediaPause:`Pause animation`,mediaPlay:`Play animation`,endTitle:`You're all set`,endMessage:`You know your way around now. Enjoy exploring.`,endButton:`Done`},Y={back:`back-label`,next:`next-label`,skip:`skip-label`,done:`done-label`,mediaPause:`media-pause-label`,mediaPlay:`media-play-label`,endTitle:`end-title`,endMessage:`end-message`,endButton:`end-button`},Me=[[`media`,`media`],[`mediaAlt`,`media-alt`],[`mediaPoster`,`media-poster`],[`mediaType`,`media-type`],[`advanceOn`,`advance-on`],[`actionLabel`,`action-label`]],X={index:null,position:null,total:null},Ne=0;function Pe(e=Ae,t=globalThis.localStorage){return{isSeen:async n=>t.getItem(e+n)===`1`,markSeen:async n=>{t.setItem(e+n,`1`)}}}var Z=e=>!e?.isConnected||getComputedStyle(e).visibility===`hidden`?!1:e.getClientRects().length>0,Q=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),Fe=()=>{let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e},$=null;function Ie(e){$||($=new CSSStyleSheet,$.replaceSync(fe)),e.adoptedStyleSheets=[$]}var Le=class extends t{static get observedAttributes(){return[`open`]}constructor(){super(),this.seenStore=null,this.onBeforeStep=null,this._run=0,this._running=!1,this._layer=null,this._outer=null,this._shadow=null,this._unbindAdvance=null,this._ending=null,this._seenMark=null}connectedCallback(){this.hasAttribute(`open`)&&this.start()}disconnectedCallback(){this.stop()}attributeChangedCallback(e,t,n){e===`open`&&this.isConnected&&(n===null?this.stop():this.start())}get tourId(){return this.getAttribute(`tour-id`)||``}set tourId(e){e==null||e===``?this.removeAttribute(`tour-id`):this.setAttribute(`tour-id`,String(e))}get isolated(){return this.hasAttribute(`isolated`)}set isolated(e){this.toggleAttribute(`isolated`,e===!0||e===``||e===`true`)}_stepList(){return Array.from(this.querySelectorAll(`:scope > ${Oe}`),e=>{let t={target:e.getAttribute(`target`)||``,title:e.getAttribute(`title`)||void 0,description:e.textContent.trim()};for(let[n,r]of Me)e.hasAttribute(r)&&(t[n]=e.getAttribute(r));return t})}_store(){return this.seenStore?this.seenStore:this.getAttribute(`seen-store`)===`local`?Pe():globalThis.window?.WUI?.tour?.seenStore||null}_label(e){return this.getAttribute(Y[e])||je[e]}_endDialogText(){return this.getAttribute(`end-dialog`)===`false`?null:{title:this._label(`endTitle`),message:this._label(`endMessage`),button:this._label(`endButton`)}}_markSeen(e){let t=this._store();return t?t.markSeen(this.tourId,e):null}async start(){if(this._running)return;this._running=!0;let e=++this._run;this.hasAttribute(`open`)||this.setAttribute(`open`,``);try{await this._start(e)}catch(t){throw e===this._run&&(this._running=!1),t}}async _start(e){this._steps=this._stepList(),this._progress=Te(this._steps.length);let t=this._store();if(t&&!this.tourId)throw Error(`<wui-tour> needs a tour-id to use a seen store.`);if(t&&await t.isSeen(this.tourId)){e===this._run&&this._finish(`alreadySeen`);return}for(let[e,t]of this._steps.entries())t.target&&!Z(document.querySelector(t.target))&&this._progress.drop(e);this._returnFocus=document.activeElement;let n=await this._locate(0,1,e);e===this._run&&(n?(this._firstIndex=n.index,this.dispatchEvent(new CustomEvent(`wui-tour:start`,{bubbles:!0,detail:{total:this._progress.total()}})),e===this._run&&(this._build(),this._show(n))):this._finish(`noTargets`))}next(){return this._move(1)}back(){return!this._current||this._current.index<=this._firstIndex?Promise.resolve():this._move(-1)}async goTo(e){if(this._current){if(!Number.isInteger(e)||e<0||e>=this._steps.length)throw RangeError(`<wui-tour> has no step ${e}; it has ${this._steps.length}.`);await this._go(e,1)}}stop(){this._running&&(this._run++,this._teardown(),this._running=!1,this.hasAttribute(`open`)&&this.removeAttribute(`open`))}async _locate(e,t,n){let r=this._steps;for(let i=e;i>=0&&i<r.length;i+=t){let e=r[i];if(await this._beforeStep(e,i),n!==this._run)return null;if(!e.target)return{index:i,target:null};let t=document.querySelector(e.target);if(Z(t))return this._progress.position(i),{index:i,target:t};this._progress.drop(i)}return null}async _beforeStep(e,t){let n=[];this.dispatchEvent(new CustomEvent(`wui-tour:beforestep`,{bubbles:!0,detail:{step:e,index:t,wait:e=>n.push(e)}})),await Promise.all(n),typeof this.onBeforeStep==`function`&&await this.onBeforeStep(e,t)}_build(){let e=`wui-tour-${++Ne}`,t=document.createElement(`div`);t.className=`wui-tour-layer`,t.innerHTML=` <div class="wui-tour-spot" aria-hidden="true"></div> <div class="wui-tour-card" role="dialog" aria-modal="true" tabindex="-1" aria-labelledby="${e}-title" aria-describedby="${e}-text"> <p class="wui-tour-position"></p> <h2 class="wui-tour-title" id="${e}-title"></h2> <p class="wui-tour-text" id="${e}-text"></p> <div class="wui-tour-actions"> <button type="button" class="btn btn-sm btn-link wui-tour-skip"></button> <div class="wui-tour-nav"> <button type="button" class="${o(`outline-secondary`,`sm`)} wui-tour-back" data-wui="${i}"></button> <button type="button" class="${o(`primary`,`sm`)} wui-tour-next" data-wui="${i}"></button> </div> </div> </div> <div class="visually-hidden" role="status" aria-live="polite"></div>`;let r=t;this._shadow=null,this.isolated&&(r=document.createElement(ke),this._shadow=r.attachShadow({mode:`open`}),Ie(this._shadow),this._shadow.appendChild(t)),document.body.appendChild(r),document.documentElement.setAttribute(q,``),this._outer=r,this._layer=t,this._spot=t.querySelector(`.wui-tour-spot`),this._card=t.querySelector(`.wui-tour-card`),this._live=t.querySelector(`[role=status]`),this._card.querySelector(`.wui-tour-skip`).addEventListener(`click`,()=>this._close(`skipped`,`button`)),this._card.querySelector(`.wui-tour-back`).addEventListener(`click`,()=>this._move(-1)),this._card.querySelector(`.wui-tour-next`).addEventListener(`click`,()=>this._move(1)),this._shadow&&this._card.removeAttribute(`aria-modal`),this._onKey=e=>this._key(e),this._onFocusIn=e=>{if(!this._layer||this._ending)return;let t=this._current,n=t?this._steps[t.index]:null;_(this._layer,n,t?.target??null,e.target)||this._card.focus()},document.addEventListener(`keydown`,this._onKey,!0),this._shadow||document.addEventListener(`focusin`,this._onFocusIn),n(r,()=>this._follow())}_active(){return this._shadow?this._shadow.activeElement:document.activeElement}_show(e){this._current=e;let{index:t,target:n}=e,r=this._steps[t],i=this._card,a=this._progress.position(t),o=this._progress.total(),s=a===o&&!this._endDialogText(),c=Ee(this,a,o);De(i,{text:c,position:a,total:o}),Ce(i,r,{pause:this._label(`mediaPause`),play:this._label(`mediaPlay`)});let l=g(this,{layer:this._layer,spot:this._spot,card:i},r,n),u=i.querySelector(`.wui-tour-title`);u.textContent=r.title||``,u.hidden=!r.title,i.querySelector(`.wui-tour-text`).textContent=r.description||``,i.querySelector(`.wui-tour-skip`).textContent=this._label(`skip`),i.querySelector(`.wui-tour-back`).textContent=this._label(`back`),i.querySelector(`.wui-tour-back`).hidden=t<=this._firstIndex,i.querySelector(`.wui-tour-next`).textContent=this._label(s?`done`:`next`);let d=[c,r.title,r.description].filter(Boolean).join(`. `);this._live.textContent=l?[d,l].join(/[.!?]$/.test(d)?` `:`. `):d,I(i,n),this._spot.removeAttribute(J),this._place(),E(i),this._unbindAdvance?.(),this._unbindAdvance=ne(r,n,()=>this._move(1));let f=this._active();(i.contains(f)?!f.hidden:this._shadow!==null&&Q(Fe()))||i.focus(),this.dispatchEvent(new CustomEvent(`wui-tour:step`,{bubbles:!0,detail:{step:r,index:t,position:a,total:o}}))}_place(){this._current&&this._layer&&L(this._spot,this._card,this._current.target)}_follow(){if(!this._current||!this._layer||this._ending)return;let e=this._spot.style.cssText;this._place(),this._spot.style.cssText!==e&&this._spot.setAttribute(J,``)}async _move(e){this._current&&await this._go(this._current.index+e,e)}async _go(e,t){if(!this._current||this._moving)return;this._moving=!0;let n=this._run;try{let r=await this._locate(e,t,n);if(n!==this._run)return;if(r){let e=D(this._card);if(e&&await e,n!==this._run)return;this._show(r)}else if(t>0){let e=this._endDialogText();if(e&&await this._showEnd(e),n!==this._run)return;await this._close(`finished`)}}finally{this._moving=!1}}_showEnd(e){return this._unbindAdvance?.(),this._unbindAdvance=null,g(this,{layer:this._layer,spot:this._spot,card:this._card},null,null),this._spot.removeAttribute(J),this._ending=new AbortController,this._seenMark=this._markSeen(`finished`),de(this._layer,e,this._ending.signal)}_key(e){if(!(!this._layer||this._ending||e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this._close(`skipped`,`escape`);else if(e.key===`ArrowRight`||e.key===`ArrowLeft`){if(Q(e.composedPath?.()[0]??e.target))return;e.preventDefault(),e.key===`ArrowRight`?this._move(1):this._current.index>this._firstIndex&&this._move(-1)}else if(e.key===`Tab`&&!this._shadow){let{index:t,target:n}=this._current;v(e,{card:this._card,active:this._active(),step:this._steps[t],target:n})}}}_teardown(){if(!this._layer)return;document.removeEventListener(`keydown`,this._onKey,!0),document.removeEventListener(`focusin`,this._onFocusIn);let e=!this._shadow||this._shadow.activeElement!==null||!document.activeElement||document.activeElement===document.body;this._unbindAdvance?.(),this._unbindAdvance=null,this._ending?.abort(),this._ending=null,this._seenMark=null,r(this._outer),oe(this._outer),document.documentElement.removeAttribute(q),this._outer=null,this._shadow=null,this._layer=null,this._current=null;let t=this._returnFocus;this._returnFocus=null,e&&t?.isConnected&&t.focus?.()}async _close(e,t=null){let n=this._run,r=this._current,i=r?{index:r.index,position:this._progress.position(r.index),total:this._progress.total()}:X,a=this._seenMark;this._teardown();try{n===this._run&&await(a??this._markSeen(e))}finally{this._finish(e,i,t)}}_finish(e,t=X,n=null){this._run++,this._running=!1,this.hasAttribute(`open`)&&this.removeAttribute(`open`),this.dispatchEvent(new CustomEvent(`wui-tour:close`,{bubbles:!0,detail:{reason:e,...t,via:n}}))}},Re=class extends t{constructor(){super(),this.shadowRoot||this.attachShadow({mode:`open`})}};e(`wui-tour`,Le),e(`wui-tour-step`,Re)})();
|
|
1
|
+
(function(){function e(e,t){if(typeof customElements>`u`||customElements.get(e))return;let n=[];if(typeof document<`u`)for(let r of document.querySelectorAll(e))for(let e of Object.keys(r)){let i=Object.getOwnPropertyDescriptor(t.prototype,e);i&&(i.set||i.get)&&(n.push([r,e,r[e]]),delete r[e])}customElements.define(e,t);for(let[e,t,r]of n)e[t]=r}var t=typeof HTMLElement>`u`?class{}:HTMLElement;function n(e,t){r(e),e._reanchor=t,e._reanchorScroll=n=>{n.target instanceof Node&&typeof e.contains==`function`&&e.contains(n.target)||t()},window.addEventListener(`resize`,e._reanchor),window.addEventListener(`scroll`,e._reanchorScroll,!0)}function r(e){e?._reanchor&&(window.removeEventListener(`resize`,e._reanchor),window.removeEventListener(`scroll`,e._reanchorScroll,!0),e._reanchor=null,e._reanchorScroll=null)}var i=`AppButton`,a={primary:`btn-primary`,soft:`btn-soft-primary`,outline:`btn-outline-primary`,ghost:`btn-ghost-primary`,text:`btn-link-primary`,danger:`btn-danger`,success:`btn-success`,"outline-danger":`btn-outline-danger`,light:`btn-neutral`,warning:`btn-warning`,neutral:`btn-soft-neutral`,"outline-light":`btn-glass`,"outline-secondary":`btn-outline-neutral`};function o(e=`primary`,t=`md`){let n=a[e];if(!n)throw Error(`buttonClass: unknown variant "${e}"`);return t===`md`?`btn ${n}`:`btn ${n} btn-${t}`}var s=`data-advance`,c=`wui-tour-hint`,l=`Click {actionName} to continue.`,u=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]`,d=(e,t)=>e?.advanceOn===`click`&&!!t,f=e=>(e??``).replace(/\s+/g,` `).trim();function p(e){let t=e.ownerDocument,n=(e.getAttribute(`aria-labelledby`)||``).split(/\s+/).filter(Boolean),r=e.tagName===`INPUT`&&/^(button|submit|reset)$/.test(e.type)?e.value:``,i=[n.map(e=>t.getElementById(e)?.textContent??``).join(` `),e.getAttribute(`aria-label`),Array.from(e.labels??[],e=>e.textContent).join(` `),e.getAttribute(`alt`),r,e.textContent,e.getAttribute(`title`)];for(let e of i){let t=f(e);if(t)return t}return``}function m(e){for(let t of[e,...e.querySelectorAll(u)])if(t.tabIndex>=0&&!t.disabled)return t;return null}function h(e,t,n){let r=(e.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(e=>e&&e!==t);n&&r.push(t),r.length>0?e.setAttribute(`aria-describedby`,r.join(` `)):e.removeAttribute(`aria-describedby`)}function ee(e,t){let n=e.querySelector(`.${c}`),r=e.querySelector(`.wui-tour-text`)?.id,i=r?`${r.replace(/-text$/,``)}-hint`:``;t?(n||(n=e.ownerDocument.createElement(`p`),n.className=c,i&&(n.id=i),e.querySelector(`.wui-tour-actions`).before(n)),n.textContent=t,i&&h(e,i,!0)):(n?.remove(),i&&h(e,i,!1))}var te=e=>getComputedStyle(e).animationName;function g(e,{layer:t,spot:n,card:r},i,a){let o=d(i,a);t.toggleAttribute(s,o&&!(t.getRootNode()instanceof ShadowRoot)),n.hasAttribute(s)&&(n.removeAttribute(s),o&&te(n)),o&&n.setAttribute(s,``);let c=r.querySelector(`.wui-tour-next`);c.classList.toggle(`btn-primary`,!o),c.classList.toggle(`btn-link`,o);let u=o?f(i.actionLabel)||p(a):``,m=e.getAttribute(`advance-label`)||l,h=u?m.replace(/\{actionName\}/g,()=>u):``;return ee(r,h),h}function ne(e,t,n){if(!d(e,t))return()=>{};let r=null,i=()=>{r??=setTimeout(n,0)};return t.addEventListener(`click`,i),()=>{t.removeEventListener(`click`,i),clearTimeout(r)}}function _(e,t,n,r){return e.contains(r)||d(t,n)&&n.contains(r)}function v(e,{card:t,active:n,step:r,target:i}){let a=Array.from(t.querySelectorAll(`button`)).filter(e=>!e.hidden),o=d(r,i)?m(i):null;o&&a.push(o);let s=a.findIndex(e=>e===n||e===o&&i.contains(n));e.preventDefault(),a[s===-1?e.shiftKey?a.length-1:0:(s+(e.shiftKey?-1:1)+a.length)%a.length].focus()}var re=2/3,ie=1e3,ae=new Set([`top`,`left`,`width`,`height`]),y=new WeakMap,b=(e,t)=>typeof e.getAnimations==`function`?e.getAnimations().filter(t):[],x=e=>e.transitionProperty===`opacity`,S=e=>ae.has(e.transitionProperty),C=e=>typeof e.animationName==`string`&&e.animationName.startsWith(`wui-tour-`);function w(e){return e.length===0?null:new Promise(t=>{let n=setTimeout(t,ie);Promise.allSettled(e.map(e=>e.finished)).then(()=>{clearTimeout(n),t()})})}function T(e){let t=e.parentElement?.querySelector(`:scope > .wui-tour-spot`),n=0;for(let e of t?b(t,S):[]){let t=e.effect?.getComputedTiming?.();if(typeof t?.duration!=`number`)continue;let r=typeof e.currentTime==`number`?e.currentTime:0;n=Math.max(n,(t.delay??0)+t.duration*re-r)}return n}function E(e){let t=T(e);t>0?e.style.setProperty(`--wui-tour-card-delay`,`${Math.round(t)}ms`):e.style.removeProperty(`--wui-tour-card-delay`),e.dataset.state=`entering`;let n={};y.set(e,n);let r=()=>{y.get(e)===n&&e.dataset.state===`entering`&&(e.dataset.state=`shown`)},i=b(e,C);i.length===0?r():Promise.allSettled(i.map(e=>e.finished)).then(r)}function D(e){return e.dataset.state=`leaving`,w(b(e,x))}function oe(e){let t=e.classList.contains(`wui-tour-layer`)?e:e.shadowRoot?.querySelector(`.wui-tour-layer`);t&&(t.dataset.state=`leaving`);let n=t?w(b(t,x)):null;n?(e.setAttribute(`inert`,``),n.then(()=>e.remove())):e.remove()}var se=2,O=12,k=8,A=4,j=20,ce=`(max-width: 575.98px)`,le=[`bottom`,`top`,`right`,`left`],M=[`top-left`,`top-right`,`bottom-right`,`bottom-left`],N,P=(e,t,n)=>Math.max(t,Math.min(e,n)),F=(e,t,n,r)=>(Math.max(e,n)+Math.min(t,r))/2;function I(e,t){if(!t?.scrollIntoView)return;e.style.maxHeight=``;let n=H(e),r=e.offsetHeight+O;if(t.getBoundingClientRect().height+4+r*2<=n.bottom-n.top){t.scrollIntoView({block:`center`,inline:`nearest`});return}let i=t.style.scrollMarginTop;t.style.scrollMarginTop=`${n.top+r+se}px`,t.scrollIntoView({block:`start`,inline:`nearest`}),t.style.scrollMarginTop=i}function L(e,t,n){let r=e.style,i=t.style,a=U(t);if(!n){r.top=`50%`,r.left=`50%`,r.width=`0px`,r.height=`0px`,r.boxShadow=`0 0 0 100vmax var(--color-scrim-strong)`;for(let e of M)r.removeProperty(`border-${e}-radius`),r.removeProperty(`corner-${e}-shape`);t.dataset.placement=`center`,a.hidden=!0,i.position=`fixed`,i.top=`50%`,i.left=`50%`,i.transform=`translate(-50%, -50%)`,i.maxHeight=`calc(100vh - 16px)`;return}r.boxShadow=``,i.transform=``,i.position=`fixed`;let o=n.getBoundingClientRect();r.top=`${o.top}px`,r.left=`${o.left}px`,r.width=`${o.width}px`,r.height=`${o.height}px`,R(r,n);let s=t.scrollTop;i.maxHeight=``;let c={width:t.offsetWidth,height:t.offsetHeight},l=H(t),u=l.bottom-l.top,d={bottom:l.bottom-o.bottom-O,top:o.top-O-l.top,right:l.right-o.right-O,left:o.left-O-l.left},f=window.matchMedia(ce).matches,p=le.find(e=>e===`top`||e===`bottom`?c.height<=d[e]+1:!f&&c.width<=d[e]+1&&c.height<=u+1),m=Math.min(o.bottom,l.bottom+k)-Math.max(o.top,l.top-k);p?z(t,a,p,o,l,c):m>=Math.min(c.height,u)+8?B(t,a,o,l,c):V(t,a,d.bottom>=d.top?`bottom`:`top`,o,l,c,d),t.scrollTop=s}function R(e,t){N??=CSS.supports(`corner-top-left-shape`,`squircle`);let n=getComputedStyle(t);for(let t of M)e.setProperty(`border-${t}-radius`,n.getPropertyValue(`border-${t}-radius`)),N&&e.setProperty(`corner-${t}-shape`,n.getPropertyValue(`corner-${t}-shape`))}function z(e,t,n,r,i,a){let o=n===`top`||n===`bottom`,s,c,l;if(o){let e=F(r.left,r.right,i.left,i.right);s=P(e-a.width/2,i.left,i.right-a.width),c=n===`bottom`?r.bottom+O:r.top-O-a.height,l=P(e-s,j,a.width-j)}else{let e=F(r.top,r.bottom,i.top,i.bottom);c=P(e-a.height/2,i.top,i.bottom-a.height),s=n===`right`?r.right+O:r.left-O-a.width,l=P(e-c,j,a.height-j)}e.dataset.placement=n,e.style.top=`${c}px`,e.style.left=`${s}px`,t.hidden=!1,t.style.left=o?`${l-e.clientLeft-t.offsetWidth/2}px`:``,t.style.top=o?``:`${l-e.clientTop-t.offsetHeight/2}px`}function B(e,t,n,r,i){let a=r.bottom-r.top;e.dataset.placement=`overlap`,t.hidden=!0,e.style.maxHeight=i.height>a?`${Math.max(a,0)}px`:``;let o=Math.min(n.bottom,r.bottom)-A;e.style.top=`${Math.max(r.top,o-Math.min(i.height,a))}px`,e.style.left=`${P(n.left+A,r.left,r.right-i.width)}px`}function V(e,t,n,r,i,a,o){let s=Math.max(o[n],0),c=Math.min(a.height,s);e.dataset.placement=n,t.hidden=!0,e.style.maxHeight=a.height>s?`${s}px`:``,e.style.top=`${n===`bottom`?r.bottom+O:r.top-O-c}px`;let l=F(r.left,r.right,i.left,i.right);e.style.left=`${P(l-a.width/2,i.left,i.right-a.width)}px`}function H(e){let t=e.parentElement,n=t?getComputedStyle(t):null,r=e=>Number.parseFloat(n?.[e])||0;return{top:r(`paddingTop`)+k,bottom:window.innerHeight-r(`paddingBottom`)-k,left:r(`paddingLeft`)+k,right:window.innerWidth-r(`paddingRight`)-k}}function U(e){let t=e.querySelector(`:scope > .wui-tour-arrow`);return t||(t=document.createElement(`span`),t.className=`wui-tour-arrow`,t.setAttribute(`aria-hidden`,`true`),t.hidden=!0,e.append(t)),t}var W=0;function ue(e,t,n){let r=`wui-tour-end-${++W}`,a=e.createElement(`div`);return a.className=`wui-tour-card wui-tour-end`,a.dataset.layout=`center`,a.setAttribute(`role`,`dialog`),n&&a.setAttribute(`aria-modal`,`true`),a.tabIndex=-1,a.setAttribute(`aria-labelledby`,`${r}-title`),a.setAttribute(`aria-describedby`,`${r}-message`),a.innerHTML=` <div class="wui-tour-end-mark" aria-hidden="true"><svg viewBox="0 0 24 24" focusable="false"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></div> <h2 class="wui-tour-title wui-tour-end-title" id="${r}-title"></h2> <p class="wui-tour-text wui-tour-end-message" id="${r}-message"></p> <div class="wui-tour-actions"><button type="button" class="${o(`primary`,`sm`)} wui-tour-end-button" data-wui="${i}"></button></div>`,a.querySelector(`.wui-tour-end-title`).textContent=t.title,a.querySelector(`.wui-tour-end-message`).textContent=t.message,a.querySelector(`.wui-tour-end-button`).textContent=t.button,a}function de(e,t,n){let r=e.ownerDocument,i=e.getRootNode()===r,a=e.querySelector(`.wui-tour-card:not(.wui-tour-end)`),o=e.querySelector(`.wui-tour-spot`),s=e.querySelector(`[role=status]`),c=ue(r,t,i),l=c.querySelector(`.wui-tour-end-button`),u=new AbortController;return new Promise(d=>{let f=()=>{u.abort(),d()};if(n?.aborted){f();return}let p={signal:u.signal};n?.addEventListener(`abort`,f,p),l.addEventListener(`click`,f,p),r.addEventListener(`keydown`,e=>{e.altKey||e.ctrlKey||e.metaKey||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),f()):e.key===`Tab`&&i&&(e.preventDefault(),l.focus()))},{capture:!0,signal:u.signal}),i&&r.addEventListener(`focusin`,e=>{c.contains(e.target)||l.focus()},p);let m=()=>{u.signal.aborted||(a.hidden=!0,L(o,a,null),e.append(c),E(c),s.textContent=[t.title,t.message].filter(Boolean).join(`. `),l.focus())},h=D(a);h?h.then(m):m()})}var fe=` :host { all: initial; ${Object.entries({"--wui-z-tour":`1550`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-popover":`0px 8px 28px -6px rgba(7, 20, 55, 0.14)`,"--wui-ease-out":`cubic-bezier(0.22, 1, 0.36, 1)`,"--wui-tour-motion-duration":`200ms`,"--wui-tour-motion-ease":`cubic-bezier(0.22, 1, 0.36, 1)`,"--wui-tour-spot-duration":`240ms`,"--wui-tour-spot-ease":`cubic-bezier(0.32, 0.72, 0, 1)`,"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-text":`#4F46E5`,"--color-focus-ring":`#4F46E5`,"--wui-focus-ring-width":`2px`,"--wui-focus-ring-offset":`2px`,"--color-on-primary":`#FFFFFF`,"--color-success-soft":`#E8FAEE`,"--color-success-text":`#0e7531`,"--color-on-scrim":`#FFFFFF`,"--color-scrim-strong":`color-mix(in srgb, #071437 62%, transparent)`,"--color-surface":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-bg-muted":`#F5F6FA`}).map(([e,t])=>` ${e}: ${t};`).join(` `)} } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; } .btn { display: inline-block; margin: 0; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; text-decoration: none; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; } .btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); } .btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); } .btn-outline-neutral { border-color: var(--color-text-muted); color: var(--color-text-muted); } .btn-outline-neutral:hover { background: var(--color-bg-muted); color: var(--color-text); } .btn-link { font-weight: 400; color: var(--color-primary-text); text-decoration: underline; } .btn-link:hover { color: var(--color-primary-hover); } .wui-tour-layer { pointer-events: none; font-family: "Webority Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-weight: 400; line-height: 1.5; color: var(--color-text); text-align: start; } .wui-tour-card { pointer-events: auto; } .wui-tour-layer { position: fixed; inset: 0; z-index: var(--wui-z-tour); } .wui-tour-spot { position: fixed; box-shadow: 0 0 0 2px var(--color-primary), 0 0 0 100vmax var(--color-scrim-strong); pointer-events: none; } .wui-tour-card { display: flex; flex-direction: column; gap: 8px; width: min(360px, 100vw - 16px); padding: 16px; overflow-y: auto; background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); border-radius: var(--wui-radius-lg); corner-shape: squircle; box-shadow: var(--wui-shadow-popover); } .wui-tour-card:focus { outline: none; } .wui-tour-card:focus-visible { outline: var(--wui-focus-ring-width) solid var(--color-focus-ring); outline-offset: var(--wui-focus-ring-offset); } .wui-tour-title { margin: 0; font-size: 16px; font-weight: 600; } .wui-tour-text { margin: 0; font-size: 14px; color: var(--color-text-muted); } .wui-tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; } .wui-tour-nav { display: flex; gap: 8px; } .wui-tour-skip { color: var(--color-text-muted); } .wui-tour-back, .wui-tour-next { min-width: 64px; } @keyframes wui-tour-fade-in { from { opacity: 0; } to { opacity: 1; } } @keyframes wui-tour-card-enter { from { opacity: 0; scale: 0.96; translate: var(--wui-tour-card-lift, 0 6px); } to { opacity: 1; scale: 1; translate: 0 0; } } .wui-tour-layer[data-state=leaving], .wui-tour-card[data-state=leaving] { opacity: 0; } .wui-tour-layer[data-state=leaving], .wui-tour-layer[data-state=leaving] * { pointer-events: none; } @media (prefers-reduced-motion: no-preference) { .wui-tour-layer { animation: wui-tour-fade-in var(--wui-tour-motion-duration) var(--wui-tour-motion-ease); } .wui-tour-layer[data-state=leaving] { transition: opacity var(--wui-tour-motion-duration) var(--wui-tour-motion-ease); } .wui-tour-spot { transition: top var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), left var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), width var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), height var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), border-radius var(--wui-tour-spot-duration) var(--wui-tour-spot-ease); } .wui-tour-spot[data-tracking] { transition: none; } .wui-tour-card { --wui-tour-card-lift: 0 6px; transform-origin: top center; } .wui-tour-card[data-placement=top] { --wui-tour-card-lift: 0 -6px; transform-origin: bottom center; } .wui-tour-card[data-placement=bottom] { --wui-tour-card-lift: 0 6px; transform-origin: top center; } .wui-tour-card[data-placement=left] { --wui-tour-card-lift: -6px 0; transform-origin: right center; } .wui-tour-card[data-placement=right] { --wui-tour-card-lift: 6px 0; transform-origin: left center; } .wui-tour-card[data-placement=overlap], .wui-tour-card[data-placement=center] { --wui-tour-card-lift: 0 0; transform-origin: center; } .wui-tour-card[data-state=entering] { animation: wui-tour-card-enter var(--wui-tour-motion-duration) var(--wui-tour-motion-ease) var(--wui-tour-card-delay, 0ms) both; } .wui-tour-card[data-state=leaving] { transition: opacity calc(var(--wui-tour-motion-duration) / 2) var(--wui-tour-motion-ease); } } @media (prefers-reduced-motion: reduce) { .wui-tour-layer { animation: wui-tour-fade-in 120ms linear; } .wui-tour-layer[data-state=leaving] { transition: opacity 120ms linear; } .wui-tour-card[data-state=entering] { animation: wui-tour-fade-in 120ms linear both; } } .wui-tour-progress-bar { display: flex; gap: 4px; } .wui-tour-progress-segment { flex: 1 1 0; height: 4px; border-radius: 999px; background: var(--color-border); } .wui-tour-progress-segment[data-filled] { background: var(--color-primary); } .wui-tour-position { margin: 0; font-size: 12px; color: var(--color-text-muted); } .wui-tour-layer { padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); } .wui-tour-card:has(.wui-tour-arrow:not([hidden])) { overflow: visible; } .wui-tour-arrow { position: absolute; width: 8px; height: 8px; background: var(--color-surface); border: 1px solid var(--color-border); rotate: 45deg; pointer-events: none; } .wui-tour-card[data-placement=bottom] .wui-tour-arrow { top: -5px; border-right-color: rgba(0, 0, 0, 0); border-bottom-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=top] .wui-tour-arrow { bottom: -5px; border-top-color: rgba(0, 0, 0, 0); border-left-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=right] .wui-tour-arrow { left: -5px; border-top-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=left] .wui-tour-arrow { right: -5px; border-bottom-color: rgba(0, 0, 0, 0); border-left-color: rgba(0, 0, 0, 0); } @media (max-width: 575.98px) { .wui-tour-card { width: calc(100vw - 16px); } .wui-tour-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; } } .wui-tour-media { position: relative; order: -1; flex: none; aspect-ratio: 16/9; margin: -16px -16px 4px; overflow: hidden; background: var(--color-border); } .wui-tour-media>img, .wui-tour-media>video { display: block; width: 100%; height: 100%; object-fit: cover; } .wui-tour-card[data-media=welcome] { width: min(420px, 100vw - 16px); } .wui-tour-media-toggle { position: absolute; inset-block-end: 8px; inset-inline-end: 8px; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--color-scrim-strong); color: var(--color-on-scrim); cursor: pointer; } .wui-tour-media-toggle>svg { width: 20px; height: 20px; fill: currentColor; } .wui-tour-media-toggle:focus-visible { outline: 2px solid var(--color-on-scrim); outline-offset: 2px; } .wui-tour-layer[data-advance] { pointer-events: none; } .wui-tour-layer[data-advance]:not([data-state=leaving]) .wui-tour-card { pointer-events: auto; } .wui-tour-layer[data-advance]:not([data-state=leaving]) .wui-tour-spot::before { content: ""; position: absolute; inset: -100vmax; pointer-events: auto; clip-path: polygon(evenodd, 0 0, 100% 0, 100% 100%, 0 100%, 0 0, 100vmax 100vmax, calc(100% - 100vmax) 100vmax, calc(100% - 100vmax) calc(100% - 100vmax), 100vmax calc(100% - 100vmax), 100vmax 100vmax); } .wui-tour-hint { margin: 0; font-size: 14px; font-weight: 600; color: var(--color-text); } @keyframes wui-tour-pulse { from { box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 85%, transparent); } to { box-shadow: 0 0 0 14px color-mix(in srgb, var(--color-primary) 0%, transparent); } } @media (prefers-reduced-motion: no-preference) { .wui-tour-spot[data-advance]::after { content: ""; position: absolute; inset: 0; border-radius: inherit; corner-shape: inherit; pointer-events: none; animation: wui-tour-pulse 600ms var(--wui-ease-out) var(--wui-tour-spot-duration); } } @keyframes wui-tour-check { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } } .wui-tour-end[data-layout=center] { --wui-tour-card-lift: 0 0; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); transform-origin: center; align-items: center; gap: 8px; width: min(420px, 100vw - 16px); max-height: calc(100vh - 16px); padding: 24px; text-align: center; } .wui-tour-end[data-layout=center] .wui-tour-actions { justify-content: center; margin-top: 8px; } .wui-tour-end-mark { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--color-success-soft); color: var(--color-success-text); } .wui-tour-end-mark>svg { width: 26px; height: 26px; } .wui-tour-end-mark path { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; } .wui-tour-end-title { font-size: 18px; } .wui-tour-end-message { text-wrap: balance; } .wui-tour-end-button { min-width: 120px; } @media (prefers-reduced-motion: no-preference) { .wui-tour-end-mark path { animation: wui-tour-check 300ms var(--wui-ease-out) calc(var(--wui-tour-card-delay, 0ms) + 120ms) both; } } `,G=`wui-tour-media`,pe=`wui-tour-media-toggle`,K=`http://www.w3.org/2000/svg`,me=`M6 5h4v14H6zM14 5h4v14h-4z`,he=`M8 5v14l11-7z`,ge={pause:`Pause animation`,play:`Play animation`},_e=()=>globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;function ve(e){let t=document.createElementNS(K,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`);let n=document.createElementNS(K,`path`);return n.setAttribute(`d`,e),t.appendChild(n),t}function ye(e){let t=document.createElement(`img`);return t.setAttribute(`alt`,e.mediaAlt??``),t.setAttribute(`width`,`1280`),t.setAttribute(`height`,`720`),t.setAttribute(`loading`,`lazy`),t.setAttribute(`decoding`,`async`),t.setAttribute(`src`,e.media),t}function be(e,t){let n=document.createElement(`video`);return n.muted=!0,n.setAttribute(`muted`,``),n.loop=!0,n.setAttribute(`playsinline`,``),t&&n.setAttribute(`autoplay`,``),n.setAttribute(`preload`,t?`auto`:`metadata`),e.mediaAlt&&n.setAttribute(`aria-label`,e.mediaAlt),e.mediaPoster&&n.setAttribute(`poster`,e.mediaPoster),n.setAttribute(`src`,e.media),n}function xe(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=pe;let r=(r=!e.paused)=>{n.setAttribute(`aria-label`,r?t.pause:t.play),n.replaceChildren(ve(r?me:he))};return e.addEventListener(`play`,()=>r()),e.addEventListener(`pause`,()=>r()),n.addEventListener(`click`,()=>{e.paused?e.play()?.catch(()=>r()):e.pause()}),r(e.hasAttribute(`autoplay`)),n}function Se(e){let t=e.querySelector(`:scope > .${G}`);if(!t)return;let n=t.querySelector(`video`);n&&(n.pause(),n.removeAttribute(`src`),n.load()),t.remove()}function Ce(e,t,n=ge){if(Se(e),!t.media){e.removeAttribute(`data-media`);return}let r=document.createElement(`div`);if(r.className=G,t.mediaType===`video`){let e=be(t,!_e());r.append(e,xe(e,n))}else r.appendChild(ye(t));e.prepend(r),e.setAttribute(`data-media`,t.target?`step`:`welcome`)}var q=`data-wui-tour-open`,we=`Step {current} of {total}`;function Te(e){let t=new Set;return{drop:e=>{t.add(e)},position:e=>{t.delete(e);let n=0;for(let r of t)r<e&&n++;return e+1-n},total:()=>e-t.size}}function Ee(e,t,n){return(e.getAttribute(`progress-label`)||we).replace(/\{(current|total)\}/g,(e,r)=>String(r===`current`?t:n))}function De(e,{text:t,position:n,total:r}){let i=e.querySelector(`.wui-tour-position`);i.textContent=t;let a=e.querySelector(`.wui-tour-progress-bar`);if(!a){let t=e.ownerDocument,n=t.createElement(`div`);n.className=`wui-tour-progress`,n.setAttribute(`aria-hidden`,`true`),a=t.createElement(`div`),a.className=`wui-tour-progress-bar`,n.append(a),i.before(n)}let o=a.children;for(;o.length<r;){let t=e.ownerDocument.createElement(`span`);t.className=`wui-tour-progress-segment`,a.append(t)}for(;o.length>r;)a.lastElementChild.remove();for(let e=0;e<o.length;e++)o[e].toggleAttribute(`data-filled`,e<n)}var Oe=`wui-tour-step`,ke=`wui-tour-host`,Ae=`wui-tour-seen:`,J=`data-tracking`,je={back:`Back`,next:`Next`,skip:`Skip`,done:`Done`,mediaPause:`Pause animation`,mediaPlay:`Play animation`,endTitle:`You're all set`,endMessage:`You know your way around now. Enjoy exploring.`,endButton:`Done`},Y={back:`back-label`,next:`next-label`,skip:`skip-label`,done:`done-label`,mediaPause:`media-pause-label`,mediaPlay:`media-play-label`,endTitle:`end-title`,endMessage:`end-message`,endButton:`end-button`},Me=[[`media`,`media`],[`mediaAlt`,`media-alt`],[`mediaPoster`,`media-poster`],[`mediaType`,`media-type`],[`advanceOn`,`advance-on`],[`actionLabel`,`action-label`]],X={index:null,position:null,total:null},Ne=0;function Pe(e=Ae,t=globalThis.localStorage){return{isSeen:async n=>t.getItem(e+n)===`1`,markSeen:async n=>{t.setItem(e+n,`1`)}}}var Z=e=>!e?.isConnected||getComputedStyle(e).visibility===`hidden`?!1:e.getClientRects().length>0,Q=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),Fe=()=>{let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e},$=null;function Ie(e){$||($=new CSSStyleSheet,$.replaceSync(fe)),e.adoptedStyleSheets=[$]}var Le=class extends t{static get observedAttributes(){return[`open`]}constructor(){super(),this.seenStore=null,this.onBeforeStep=null,this._run=0,this._running=!1,this._layer=null,this._outer=null,this._shadow=null,this._unbindAdvance=null,this._ending=null,this._seenMark=null}connectedCallback(){this.hasAttribute(`open`)&&this.start()}disconnectedCallback(){this.stop()}attributeChangedCallback(e,t,n){e===`open`&&this.isConnected&&(n===null?this.stop():this.start())}get tourId(){return this.getAttribute(`tour-id`)||``}set tourId(e){e==null||e===``?this.removeAttribute(`tour-id`):this.setAttribute(`tour-id`,String(e))}get isolated(){return this.hasAttribute(`isolated`)}set isolated(e){this.toggleAttribute(`isolated`,e===!0||e===``||e===`true`)}_stepList(){return Array.from(this.querySelectorAll(`:scope > ${Oe}`),e=>{let t={target:e.getAttribute(`target`)||``,title:e.getAttribute(`title`)||void 0,description:e.textContent.trim()};for(let[n,r]of Me)e.hasAttribute(r)&&(t[n]=e.getAttribute(r));return t})}_store(){return this.seenStore?this.seenStore:this.getAttribute(`seen-store`)===`local`?Pe():globalThis.window?.WUI?.tour?.seenStore||null}_label(e){return this.getAttribute(Y[e])||je[e]}_endDialogText(){return this.getAttribute(`end-dialog`)===`false`?null:{title:this._label(`endTitle`),message:this._label(`endMessage`),button:this._label(`endButton`)}}_markSeen(e){let t=this._store();return t?t.markSeen(this.tourId,e):null}async start(){if(this._running)return;this._running=!0;let e=++this._run;this.hasAttribute(`open`)||this.setAttribute(`open`,``);try{await this._start(e)}catch(t){throw e===this._run&&(this._running=!1),t}}async _start(e){this._steps=this._stepList(),this._progress=Te(this._steps.length);let t=this._store();if(t&&!this.tourId)throw Error(`<wui-tour> needs a tour-id to use a seen store.`);if(t&&await t.isSeen(this.tourId)){e===this._run&&this._finish(`alreadySeen`);return}for(let[e,t]of this._steps.entries())t.target&&!Z(document.querySelector(t.target))&&this._progress.drop(e);this._returnFocus=document.activeElement;let n=await this._locate(0,1,e);e===this._run&&(n?(this._firstIndex=n.index,this.dispatchEvent(new CustomEvent(`wui-tour:start`,{bubbles:!0,detail:{total:this._progress.total()}})),e===this._run&&(this._build(),this._show(n))):this._finish(`noTargets`))}next(){return this._move(1)}back(){return!this._current||this._current.index<=this._firstIndex?Promise.resolve():this._move(-1)}async goTo(e){if(this._current){if(!Number.isInteger(e)||e<0||e>=this._steps.length)throw RangeError(`<wui-tour> has no step ${e}; it has ${this._steps.length}.`);await this._go(e,1)}}stop(){this._running&&(this._run++,this._teardown(),this._running=!1,this.hasAttribute(`open`)&&this.removeAttribute(`open`))}async _locate(e,t,n){let r=this._steps;for(let i=e;i>=0&&i<r.length;i+=t){let e=r[i];if(await this._beforeStep(e,i),n!==this._run)return null;if(!e.target)return{index:i,target:null};let t=document.querySelector(e.target);if(Z(t))return this._progress.position(i),{index:i,target:t};this._progress.drop(i)}return null}async _beforeStep(e,t){let n=[];this.dispatchEvent(new CustomEvent(`wui-tour:beforestep`,{bubbles:!0,detail:{step:e,index:t,wait:e=>n.push(e)}})),await Promise.all(n),typeof this.onBeforeStep==`function`&&await this.onBeforeStep(e,t)}_build(){let e=`wui-tour-${++Ne}`,t=document.createElement(`div`);t.className=`wui-tour-layer`,t.innerHTML=` <div class="wui-tour-spot" aria-hidden="true"></div> <div class="wui-tour-card" role="dialog" aria-modal="true" tabindex="-1" aria-labelledby="${e}-title" aria-describedby="${e}-text"> <p class="wui-tour-position"></p> <h2 class="wui-tour-title" id="${e}-title"></h2> <p class="wui-tour-text" id="${e}-text"></p> <div class="wui-tour-actions"> <button type="button" class="btn btn-sm btn-link wui-tour-skip"></button> <div class="wui-tour-nav"> <button type="button" class="${o(`outline-secondary`,`sm`)} wui-tour-back" data-wui="${i}"></button> <button type="button" class="${o(`primary`,`sm`)} wui-tour-next" data-wui="${i}"></button> </div> </div> </div> <div class="visually-hidden" role="status" aria-live="polite"></div>`;let r=t;this._shadow=null,this.isolated&&(r=document.createElement(ke),this._shadow=r.attachShadow({mode:`open`}),Ie(this._shadow),this._shadow.appendChild(t)),document.body.appendChild(r),document.documentElement.setAttribute(q,``),this._outer=r,this._layer=t,this._spot=t.querySelector(`.wui-tour-spot`),this._card=t.querySelector(`.wui-tour-card`),this._live=t.querySelector(`[role=status]`),this._card.querySelector(`.wui-tour-skip`).addEventListener(`click`,()=>this._close(`skipped`,`button`)),this._card.querySelector(`.wui-tour-back`).addEventListener(`click`,()=>this._move(-1)),this._card.querySelector(`.wui-tour-next`).addEventListener(`click`,()=>this._move(1)),this._shadow&&this._card.removeAttribute(`aria-modal`),this._onKey=e=>this._key(e),this._onFocusIn=e=>{if(!this._layer||this._ending)return;let t=this._current,n=t?this._steps[t.index]:null;_(this._layer,n,t?.target??null,e.target)||this._card.focus()},document.addEventListener(`keydown`,this._onKey,!0),this._shadow||document.addEventListener(`focusin`,this._onFocusIn),n(r,()=>this._follow())}_active(){return this._shadow?this._shadow.activeElement:document.activeElement}_show(e){this._current=e;let{index:t,target:n}=e,r=this._steps[t],i=this._card,a=this._progress.position(t),o=this._progress.total(),s=a===o&&!this._endDialogText(),c=Ee(this,a,o);De(i,{text:c,position:a,total:o}),Ce(i,r,{pause:this._label(`mediaPause`),play:this._label(`mediaPlay`)});let l=g(this,{layer:this._layer,spot:this._spot,card:i},r,n),u=i.querySelector(`.wui-tour-title`);u.textContent=r.title||``,u.hidden=!r.title,i.querySelector(`.wui-tour-text`).textContent=r.description||``,i.querySelector(`.wui-tour-skip`).textContent=this._label(`skip`),i.querySelector(`.wui-tour-back`).textContent=this._label(`back`),i.querySelector(`.wui-tour-back`).hidden=t<=this._firstIndex,i.querySelector(`.wui-tour-next`).textContent=this._label(s?`done`:`next`);let d=[c,r.title,r.description].filter(Boolean).join(`. `);this._live.textContent=l?[d,l].join(/[.!?]$/.test(d)?` `:`. `):d,I(i,n),this._spot.removeAttribute(J),this._place(),E(i),this._unbindAdvance?.(),this._unbindAdvance=ne(r,n,()=>this._move(1));let f=this._active();(i.contains(f)?!f.hidden:this._shadow!==null&&Q(Fe()))||i.focus(),this.dispatchEvent(new CustomEvent(`wui-tour:step`,{bubbles:!0,detail:{step:r,index:t,position:a,total:o}}))}_place(){this._current&&this._layer&&L(this._spot,this._card,this._current.target)}_follow(){if(!this._current||!this._layer||this._ending)return;let e=this._spot.style.cssText;this._place(),this._spot.style.cssText!==e&&this._spot.setAttribute(J,``)}async _move(e){this._current&&await this._go(this._current.index+e,e)}async _go(e,t){if(!this._current||this._moving)return;this._moving=!0;let n=this._run;try{let r=await this._locate(e,t,n);if(n!==this._run)return;if(r){let e=D(this._card);if(e&&await e,n!==this._run)return;this._show(r)}else if(t>0){let e=this._endDialogText();if(e&&await this._showEnd(e),n!==this._run)return;await this._close(`finished`)}}finally{this._moving=!1}}_showEnd(e){return this._unbindAdvance?.(),this._unbindAdvance=null,g(this,{layer:this._layer,spot:this._spot,card:this._card},null,null),this._spot.removeAttribute(J),this._ending=new AbortController,this._seenMark=this._markSeen(`finished`),de(this._layer,e,this._ending.signal)}_key(e){if(!(!this._layer||this._ending||e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this._close(`skipped`,`escape`);else if(e.key===`ArrowRight`||e.key===`ArrowLeft`){if(Q(e.composedPath?.()[0]??e.target))return;e.preventDefault(),e.key===`ArrowRight`?this._move(1):this._current.index>this._firstIndex&&this._move(-1)}else if(e.key===`Tab`&&!this._shadow){let{index:t,target:n}=this._current;v(e,{card:this._card,active:this._active(),step:this._steps[t],target:n})}}}_teardown(){if(!this._layer)return;document.removeEventListener(`keydown`,this._onKey,!0),document.removeEventListener(`focusin`,this._onFocusIn);let e=!this._shadow||this._shadow.activeElement!==null||!document.activeElement||document.activeElement===document.body;this._unbindAdvance?.(),this._unbindAdvance=null,this._ending?.abort(),this._ending=null,this._seenMark=null,r(this._outer),oe(this._outer),document.documentElement.removeAttribute(q),this._outer=null,this._shadow=null,this._layer=null,this._current=null;let t=this._returnFocus;this._returnFocus=null,e&&t?.isConnected&&t.focus?.()}async _close(e,t=null){let n=this._run,r=this._current,i=r?{index:r.index,position:this._progress.position(r.index),total:this._progress.total()}:X,a=this._seenMark;this._teardown();try{n===this._run&&await(a??this._markSeen(e))}finally{this._finish(e,i,t)}}_finish(e,t=X,n=null){this._run++,this._running=!1,this.hasAttribute(`open`)&&this.removeAttribute(`open`),this.dispatchEvent(new CustomEvent(`wui-tour:close`,{bubbles:!0,detail:{reason:e,...t,via:n}}))}},Re=class extends t{constructor(){super(),this.shadowRoot||this.attachShadow({mode:`open`})}};e(`wui-tour`,Le),e(`wui-tour-step`,Re)})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./devWarn-DXdRWZs3.js";var n=Object.freeze([`POST`,`PUT`,`PATCH`,`DELETE`]),r=t=>(e(`[@webority/ui-elements] Wui-Toast-Action: ${t}; the toast shows no action.`),null);function i(e){if(e==null||e===``)return null;let t;try{t=JSON.parse(e)}catch{return r(`the value is not JSON`)}let i=t?.label,a=t?.url,o=String(t?.method??`POST`).toUpperCase();return typeof i!=`string`||i===``||typeof a!=`string`||a===``?r(`label and url must be non-empty strings`):n.includes(o)?{label:i,url:a,method:o}:r(`method must be one of ${n.join(`, `)}`)}var a=`wui-csrf`,o=`RequestVerificationToken`,s={metaName:a,header:o};function c({metaName:e=a,header:t=o}={}){s={metaName:e,header:t}}var l=`Wui-Request`,u=Object.freeze({fragment:`Wui-Fragment`,message:`Wui-Message`,redirect:`Wui-Redirect`,result:`Wui-Result`,keepOpen:`Wui-Keep-Open`,toastVariant:`Wui-Toast-Variant`,toastAction:`Wui-Toast-Action`,data:`Wui-Data`,next:`Wui-Next`}),d=Object.freeze([`ok`,`validation`,`forbidden`,`client`,`server`,`network`,`aborted`,`stale`,`session`]),f=/* @__PURE__ */ new Set([`GET`,`HEAD`]);function p(e=document){let t=[...e.querySelectorAll(`meta`)].find(e=>e.getAttribute(`name`)===s.metaName),n=t?.getAttribute(`content`);return n?{header:t.getAttribute(`data-header`)||s.header,token:n}:null}var m=e=>{try{return new URL(e,window.location.href).origin===window.location.origin}catch{return!1}};function h(e){return e>=200&&e<300?`ok`:e===401?`session`:e===403?`forbidden`:e===422?`validation`:e>=400&&e<500?`client`:`server`}var g=e=>e?.name===`AbortError`,_=e=>{if(e==null||e===``)return null;try{return JSON.parse(e)}catch{return t(`Wui-Data is not JSON; it was ignored.`),null}};async function v(e,t={}){let n=(t.method||`GET`).toUpperCase(),r=t.navigate||(e=>window.location.assign(e)),a={Accept:`text/html`,"X-Requested-With":`XMLHttpRequest`,[l]:`1`,...t.headers};if(!f.has(n)&&m(e)){let e=p();e&&(a[e.header]=e.token)}let o=e=>{if(e==null)return null;try{return decodeURIComponent(e)}catch{return e}},s=(e,t=null,n=``)=>{let r=e=>t?.headers.get(e)??null;return{kind:e,ok:e===`ok`,status:t?.status??0,html:n,response:t,message:o(r(u.message)),redirect:r(u.redirect),result:r(u.result),keepOpen:r(u.keepOpen)===`1`,toastVariant:r(u.toastVariant),toastAction:i(r(u.toastAction)),fragment:r(u.fragment)===`1`,data:_(o(r(u.data))),next:r(u.next)}},c;try{c=await fetch(e,{method:n,body:t.body,headers:a,signal:t.signal,credentials:`same-origin`})}catch(e){return s(g(e)||t.signal?.aborted?`aborted`:`network`)}let d=h(c.status);if(d===`ok`&&c.redirected&&c.headers.get(u.fragment)!==`1`&&(d=`session`),d===`session`)return r(c.status===401?c.headers.get(`Location`)||window.location.href:c.url),s(d,c);let v=``;if(d===`ok`||d===`validation`)try{v=await c.text()}catch(e){return s(g(e)||t.signal?.aborted?`aborted`:`network`,c)}return s(d,c,v)}function y(){let e=null,t=0;return{async run(n,r={}){e?.abort();let i=new AbortController;e=i;let a=++t,o=r.signal;o&&(o.aborted?i.abort():o.addEventListener(`abort`,()=>i.abort(),{once:!0}));let s=await v(n,{...r,signal:i.signal});return e===i&&(e=null),a!==t&&s.kind!==`aborted`?{...s,kind:`stale`,ok:!1}:s},abort(){e?.abort(),e=null}}}export{h as a,p as c,i as d,u as i,v as l,o as n,c as o,d as r,y as s,a as t,n as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`Asia/Kolkata`,t=198e5,n=/* @__PURE__ */ new Map;function r(e){let t=n.get(e);return t||(t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),n.set(e,t)),t}function i(e){if(typeof e!=`string`||e===``)return!1;try{return r(e),!0}catch{return!1}}function a(n,i=e){if(i===`Asia/Kolkata`){let e=new Date(n+t);return{year:e.getUTCFullYear(),month:e.getUTCMonth(),day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds()}}let a=Object.fromEntries(r(i).formatToParts(n).map(e=>[e.type,Number(e.value)]));return{year:a.year,month:a.month-1,day:a.day,hour:a.hour%24,minute:a.minute,second:a.second}}function o(n,r=e){if(r===`Asia/Kolkata`)return t;let i=a(n,r),o=/* @__PURE__ */ new Date(0);return o.setUTCFullYear(i.year,i.month,i.day),o.setUTCHours(i.hour,i.minute,i.second,0),o.getTime()-Math.floor(n/1e3)*1e3}function s(t,n=e){let r=t-o(t,n);return r=t-o(r,n),r}var c=e=>e instanceof Date?e.getTime():e;function l(t,n=e){return new Date(t+o(t,n)).toISOString().slice(0,19)}function u(t=e,n=Date.now()){return l(c(n),t).slice(0,10)}export{s as a,l as i,i as n,o,u as r,a as s,e as t};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/ui-elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.130.0",
|
|
4
4
|
"description": "Webority framework-agnostic UI custom elements (<wui-*>) — the single implementation of the interactive components, styled by @webority/theme. Used natively in Razor and wrapped by @webority/ui-react.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -19,10 +19,8 @@
|
|
|
19
19
|
"module": "./dist/ui-elements.js",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": "./dist/ui-elements.js",
|
|
22
|
-
"./global": "./dist/ui-elements.global.js",
|
|
23
|
-
"./phone-data": "./dist/ui-phone.global.js",
|
|
24
22
|
"./helpers": "./dist/helpers.js",
|
|
25
|
-
"./
|
|
23
|
+
"./server": "./dist/server.js",
|
|
26
24
|
"./elements/autocomplete": "./dist/elements/autocomplete.js",
|
|
27
25
|
"./elements/carousel": "./dist/elements/carousel.js",
|
|
28
26
|
"./elements/code-block": "./dist/elements/code-block.js",
|
|
@@ -41,6 +39,7 @@
|
|
|
41
39
|
"./elements/image-crop": "./dist/elements/image-crop.js",
|
|
42
40
|
"./elements/inline-edit": "./dist/elements/inline-edit.js",
|
|
43
41
|
"./elements/kanban": "./dist/elements/kanban.js",
|
|
42
|
+
"./elements/lead-popup": "./dist/elements/lead-popup.js",
|
|
44
43
|
"./elements/lightbox": "./dist/elements/lightbox.js",
|
|
45
44
|
"./elements/markdown": "./dist/elements/markdown.js",
|
|
46
45
|
"./elements/mention-input": "./dist/elements/mention-input.js",
|
|
@@ -70,18 +69,16 @@
|
|
|
70
69
|
"./elements/truncate": "./dist/elements/truncate.js",
|
|
71
70
|
"./elements/whats-new": "./dist/elements/whats-new.js",
|
|
72
71
|
"./elements/wizard": "./dist/elements/wizard.js",
|
|
73
|
-
"./consent-banner": "./dist/ui-consent-banner.global.js",
|
|
74
|
-
"./tour": "./dist/ui-tour.global.js",
|
|
75
72
|
"./file-viewer": "./dist/ui-file-viewer.js",
|
|
76
73
|
"./chart": "./dist/ui-chart.js",
|
|
77
74
|
"./calendar": "./dist/ui-calendar.js",
|
|
78
75
|
"./rich-text": "./dist/ui-rich-text.js",
|
|
79
|
-
"./chat": "./dist/ui-chat.js",
|
|
80
76
|
"./package.json": "./package.json"
|
|
81
77
|
},
|
|
82
78
|
"sideEffects": [
|
|
83
79
|
"./dist/*",
|
|
84
|
-
"./dist/elements/*"
|
|
80
|
+
"./dist/elements/*",
|
|
81
|
+
"./razor-js/**/*.js"
|
|
85
82
|
],
|
|
86
83
|
"dependencies": {},
|
|
87
84
|
"devDependencies": {
|
|
@@ -95,7 +92,7 @@
|
|
|
95
92
|
"@tiptap/markdown": "3.31.4",
|
|
96
93
|
"@tiptap/starter-kit": "3.31.4",
|
|
97
94
|
"@vitest/coverage-v8": "5.0.1",
|
|
98
|
-
"@webority/markdown-core": "0.
|
|
95
|
+
"@webority/markdown-core": "0.130.0",
|
|
99
96
|
"echarts": "6.1.0",
|
|
100
97
|
"jsdom": "30.1.1",
|
|
101
98
|
"libphonenumber-js": "^1.13.9",
|
|
@@ -105,7 +102,7 @@
|
|
|
105
102
|
"vitest": "5.0.1"
|
|
106
103
|
},
|
|
107
104
|
"scripts": {
|
|
108
|
-
"build": "vite build && vite build -c vite.phone.config.js && vite build -c vite.consent-banner.config.js && vite build -c vite.
|
|
105
|
+
"build": "vite build && vite build -c vite.phone.config.js && vite build -c vite.consent-banner.config.js && vite build -c vite.lead-popup.config.js && vite build -c vite.tour.config.js && vite build -c vite.file-viewer.config.js && vite build -c vite.chart.config.js && vite build -c vite.calendar.config.js && vite build -c vite.rich-text.config.js && node build-global.mjs && vite build -c vite.razor.config.js && node ../../scripts/sync-rcl-assets.mjs elements",
|
|
109
106
|
"test": "vitest run",
|
|
110
107
|
"test:razor-js": "vitest run --config vitest.razor-js.config.js",
|
|
111
108
|
"test:watch": "vitest",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./anchorOverlay-CBMAnDUt.js";import{n as r,r as i,t as a}from"./focusOrigin-BPTN3GY3.js";import{t as o}from"./elementBase-DV9IZZCu.js";import{t as s}from"./formMirror-BMQTenSi.js";import{t as c}from"./iconGlyphs.g-CQcMoS6_.js";import{n as l,t as u}from"./listboxKeyNav-DMIvs9d6.js";import{a as d,i as f,n as p,r as m,t as h}from"./optionLabel-BaLjjB-0.js";var g=class extends o{static formAssociated=!0;_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}static get observedAttributes(){return[`value`,`placeholder`,`disabled`,`min-chars`,`debounce`,`remote`,`size`,`aria-label`,`allow-custom`,`aria-invalid`,`open`,`value-avatar`,`value-initials`]}constructor(){super(),this._value=``,this._label=``,this._valueAvatar=``,this._valueInitials=``,this._optionsProp=null,this._loading=!1,this._active=-1,this._timer=null,this._reqSeq=0,this._pendingSearch=null,this._typeahead=``,this._typeaheadTimer=null;try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){if(!this._rendered)this._defaultCaptured||=(this._defaultValue=this._value,!0),this.render();else if(this._bindGlobal?.(),this._pendingSearch){let{query:e,seq:t}=this._pendingSearch;clearTimeout(this._timer),this._timer=setTimeout(()=>this._fireSearch(e,t),this._debounceMs)}}formResetCallback(){this.value=this._defaultValue||``}attributeChangedCallback(e,t,n){e===`value`?this.value=n:e===`value-avatar`?(this._valueAvatar=n??``,this._syncValueAvatar()):e===`value-initials`?(this._valueInitials=n??``,this._syncValueAvatar()):e===`aria-invalid`?this._syncInvalid():e===`open`?this._syncPinned?.():this._rendered&&this.render()}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get value(){return this._value}set value(e){this._value=e==null?``:String(e),s(this,this._value);let t=this._readOptions().find(e=>String(e.value)===this._value);this._label=t?f(t):``,this._value||(this._valueAvatar=``,this._valueInitials=``),this._syncInput(),this._syncValueAvatar(),this._renderOptions(``)}set options(e){this._optionsProp=Array.isArray(e)?e:[];let t=this._readOptions().find(e=>String(e.value)===this._value);t&&(this._label=f(t)),this._renderOptions(),this._syncInput()}get options(){return this._readOptions()}set loading(e){this._loading=!!e,this._renderLoading(),this._renderOptions()}get loading(){return this._loading}get _remote(){return this.hasAttribute(`remote`)}get _allowCustom(){return this.hasAttribute(`allow-custom`)}_matchesKnownOption(e){let t=e.toLowerCase();return this._readOptions().some(e=>f(e).toLowerCase()===t||String(e.value??``).toLowerCase()===t)}get _minChars(){let e=+!!this._remote,t=this.getAttribute(`min-chars`);if(t==null||t.trim()===``)return e;let n=Number(t);return Number.isInteger(n)&&n>=0?n:e}get _debounceMs(){let e=this.getAttribute(`debounce`);if(e==null||e===``)return 250;let t=Number(e);return Number.isFinite(t)&&t>=0?t:250}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>({value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[h]:!0,selected:e.hasAttribute(`selected`)})))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}render(){this._snapshotDeclared();let e=this.getAttribute(`placeholder`)||`Search…`,t=this.getAttribute(`size`),n=t===`sm`?` search-select-sm`:t===`lg`?` search-select-lg`:t===`xl`?` wui-search-select-xl`:``;this.id||=`wui-autocomplete-${Math.random().toString(36).slice(2,9)}`;let r=`${this.id}-listbox`;this._listboxId=r,this.innerHTML=`
|
|
2
|
-
<div class="search-select${n}">
|
|
3
|
-
<div class="input search-select-control search-select-ac" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${_(r)}" aria-label="${_(this._accessibleName())}"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}>
|
|
4
|
-
<input class="search-select-input search-select-ac-input" placeholder="${_(e)}" aria-autocomplete="list" autocomplete="off"${this.hasAttribute(`disabled`)?` disabled`:``} />
|
|
5
|
-
<span class="search-select-spinner spinner-border spinner-border-sm" role="status" aria-hidden="true" hidden></span>
|
|
6
|
-
<button type="button" class="search-select-clear" aria-label="Clear" hidden>${c(`x`)}</button>
|
|
7
|
-
</div>
|
|
8
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${_(r)}" tabindex="-1" hidden>
|
|
9
|
-
<div class="search-select-options"></div>
|
|
10
|
-
<div class="search-select-empty" hidden>No matches</div>
|
|
11
|
-
<div class="search-select-hint" hidden>Type to search…</div>
|
|
12
|
-
</div>
|
|
13
|
-
</div>`,this._rendered=!0,s(this,this._value),this._wire(),this._syncInput(),this._syncValueAvatar(),this._renderOptions()}_syncValueAvatar(){let e=this.querySelector(`.search-select-control`);if(!e)return;e.querySelector(`.wui-search-select-value-avatar`)?.remove();let t=this._value?i({avatar:this._valueAvatar,initials:this._valueInitials},`avatar-xs`):``;e.classList.toggle(`wui-has-value-avatar`,!!t),t&&e.insertAdjacentHTML(`afterbegin`,`<span class="wui-search-select-value-avatar" aria-hidden="true">${t}</span>`)}_refs(){return{control:this.querySelector(`.search-select-control`),input:this.querySelector(`.search-select-ac-input`),menu:this.querySelector(`.search-select-menu`),spinner:this.querySelector(`.search-select-spinner`),clear:this.querySelector(`.search-select-clear`),optionsWrap:this.querySelector(`.search-select-options`),empty:this.querySelector(`.search-select-empty`),hint:this.querySelector(`.search-select-hint`)}}_optionEls(){return[...this.querySelectorAll(`.search-select-option`)]}_syncInput(){let{input:e,clear:t}=this._refs();e&&document.activeElement!==e&&(e.value=this._label),t&&(t.hidden=!this._value&&!e?.value)}_renderLoading(){let{spinner:e}=this._refs();e&&(e.hidden=!this._loading)}_renderOptions(e){let t=this._refs();if(!t.optionsWrap)return;let n=e??(t.input?t.input.value:``),r=n.trim().toLowerCase(),a=this._readOptions();!this._remote&&r&&(a=a.filter(e=>f(e).toLowerCase().includes(r)));let o=n.trim(),s=this._allowCustom&&o&&!this._matchesKnownOption(o)?[...a,{value:o,custom:!0}]:a,c=this._listboxId||`${this.id||`wui-autocomplete`}-listbox`;t.optionsWrap.innerHTML=s.map((e,t)=>{let n=`${c}-opt-${t}`;if(e.custom){let t=`Add “${p(e.value)}”`;return`<button type="button" role="option" id="${_(n)}" class="search-select-option search-select-option-custom" data-value="${_(e.value)}" data-custom="true" aria-selected="false">${t}</button>`}let r=String(e.value)===String(this._value);return`<button type="button" role="option" id="${_(n)}" class="search-select-option${r?` selected`:``}" data-value="${_(e.value)}" aria-selected="${r}">${i(e)}${m(e)}</button>`}).join(``),this._active=-1,t.control?.removeAttribute(`aria-activedescendant`);let l=r.length<this._minChars;t.hint&&(t.hint.hidden=!(this._remote&&l&&!a.length)),t.empty&&(t.empty.hidden=this._loading||s.length>0||this._remote&&l),this._reanchor?.()}_wire(){this._teardown();let i=this._refs();if(!i.control||!i.input)return;let o=()=>{let e=this.hasAttribute(`open`)?{below:!0}:{};n(i.control,i.menu,{matchWidth:!0,...e})},c=()=>this._optionEls().filter(e=>!e.hidden),p=(e,{reveal:t=!0}={})=>{let n=c();this._active=e,l(i.optionsWrap,e>=0&&n[e]||null),e>=0&&n[e]?(t&&n[e].scrollIntoView({block:`nearest`}),i.control.setAttribute(`aria-activedescendant`,n[e].id)):i.control.removeAttribute(`aria-activedescendant`)},m=()=>!i.menu.hidden,h=()=>{m()&&o()},g=()=>{this._remote&&this._minChars===0&&!i.input.value.trim()&&(clearTimeout(this._timer),this._fireSearch(``,++this._reqSeq))},_=({load:t=!0}={})=>{i.menu.hidden=!1,i.control.setAttribute(`aria-expanded`,`true`),i.control.classList.add(`open`),o(),e(this,h),t&&g(),this._renderOptions()},v=({force:e=!1}={})=>{(e||!this.hasAttribute(`open`))&&(i.menu.hidden=!0,i.control.setAttribute(`aria-expanded`,`false`),i.control.classList.remove(`open`),p(-1),clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null,this._typeahead=``,this._syncInput(),t(this))},y=e=>{let t=e.dataset.custom===`true`;this._value=e.dataset.value;let n=t?null:this._readOptions().find(t=>String(t.value)===e.dataset.value);this._label=t?e.dataset.value:n?f(n):d(e.innerHTML),this._valueAvatar=n?.avatar??``,this._valueInitials=n?.initials??``,this._syncValueAvatar(),s(this,this._value),i.input.value=this._label,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{isCustom:t}})),v(),i.input.focus()},b=e=>{this._value=e,this._label=e,this._valueAvatar=``,this._valueInitials=``,this._syncValueAvatar(),s(this,e),i.input.value=e,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{isCustom:!0}})),v()},x=()=>{let e=i.input.value;if(i.clear&&(i.clear.hidden=!e),m()||_({load:!1}),this._remote){if(this._renderOptions(e),clearTimeout(this._timer),e.trim().length<this._minChars){this._pendingSearch=null;return}let t=++this._reqSeq;this._pendingSearch={query:e,seq:t},this._timer=setTimeout(()=>this._fireSearch(e,t),this._debounceMs)}else this._renderOptions(e)};this._navHandler=u({getVisibleOptions:c,getActive:()=>this._active,setActive:e=>p(e),onEnter:(e,t)=>{if(t[this._active])y(t[this._active]);else if(this._allowCustom){let e=i.input.value.trim();e&&!this._matchesKnownOption(e)&&b(e)}},onEscape:()=>{this._navHandler.clearTypeahead(),v()}});let S=e=>{let t=e.target?.tagName===`INPUT`||e.target?.tagName===`TEXTAREA`;if(e.key===`ArrowDown`){e.preventDefault(),m()||_();let t=c();p(Math.min(this._active+1,t.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),p(Math.max(this._active-1,0))):(e.key!==`Home`&&e.key!==`End`&&e.key!==`PageDown`&&e.key!==`PageUp`||m()&&!t)&&(e.key.length!==1||!e.ctrlKey&&!e.metaKey&&!e.altKey&&m()&&e.target?.tagName!==`INPUT`&&e.target?.tagName!==`TEXTAREA`||m()&&e.target?.tagName!==`INPUT`&&e.target?.tagName!==`TEXTAREA`)&&(e.key===`Escape`&&m()&&(e.preventDefault(),e.stopPropagation()),this._navHandler.handler(e))};r(),i.input.addEventListener(`focus`,()=>{a()&&!m()&&_()}),i.control.addEventListener(`click`,e=>{i.input.disabled||e.target.closest(`.search-select-clear`)||(e.target!==i.input&&i.input.focus(),m()||_())});let C=e=>{e.target?.classList?.contains(`avatar-img`)&&e.target.remove()};i.control.addEventListener(`error`,C,!0),i.optionsWrap.addEventListener(`error`,C,!0),i.input.addEventListener(`input`,x),i.input.addEventListener(`keydown`,S),i.menu.addEventListener(`keydown`,S),i.input.addEventListener(`blur`,e=>{if(!this._allowCustom||e.relatedTarget&&this.contains(e.relatedTarget))return;let t=i.input.value.trim();t&&t!==this._label&&!this._matchesKnownOption(t)&&b(t)}),i.optionsWrap.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&y(t)}),i.optionsWrap.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&!t.classList.contains(`is-active`)&&p(this._optionEls().indexOf(t),{reveal:!1})}),i.optionsWrap.addEventListener(`mouseleave`,()=>p(-1)),i.clear?.addEventListener(`click`,()=>{this._value=``,this._label=``,this._valueAvatar=``,this._valueInitials=``,this._syncValueAvatar(),s(this,``),i.input.value=``,i.clear.hidden=!0,this._renderOptions(``),this.dispatchEvent(new Event(`change`,{bubbles:!0})),i.input.focus(),m()?g():_()}),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{m()&&!this.contains(e.target)&&v()},document.addEventListener(`click`,this._onDocClick),m()&&e(this,h)},this._syncPinned=()=>this.hasAttribute(`open`)?_({load:!0}):v({force:!0}),this.hasAttribute(`open`)&&_({load:!0}),this._bindGlobal()}_fireSearch(e,t){this._pendingSearch=null,this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:t}}))}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),t(this),clearTimeout(this._timer),this._navHandler?.teardown()}disconnectedCallback(){this._teardown()}},_=e=>String(e??``).replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`);export{g as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./buttonClass-FD57QNey.js";import{n}from"./devWarn-DXdRWZs3.js";import{t as r}from"./elementBase-DV9IZZCu.js";import{t as i}from"./tourOpenMark-nPeAJFSo.js";var a={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-text":`#4F46E5`,"--color-on-primary":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-surface":`#FFFFFF`,"--wui-radius-lg":`14px`,"--wui-shadow-modal":`0px 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-fixed":`1030`},o=e=>`var(${e}, ${a[e]})`,s=` :host { all: initial; position: fixed; bottom: 20px; left: 20px; right: auto; z-index: ${o(`--wui-z-fixed`)}; display: block; width: 420px; max-width: calc(100vw - 40px); font-family: inherit; font-size: 16px; line-height: 1.5; color: ${o(`--color-text`)}; } :host([position="bottom-right"]) { right: 20px; left: auto; } :host([position="bar"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } :host([position="bar"]) .wui-consent-banner-panel { padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } :host(:not([open])) { pointer-events: none; } :host([tour-open]) { visibility: hidden; } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .wui-consent-banner-panel { padding: 20px; background: ${o(`--color-surface`)}; border: 1px solid ${o(`--color-border`)}; border-radius: ${o(`--wui-radius-lg`)}; box-shadow: ${o(`--wui-shadow-modal`)}; text-align: start; pointer-events: auto; } .wui-consent-banner-heading { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.3; color: ${o(`--color-text`)}; } .wui-consent-banner-description { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: ${o(`--color-text-muted`)}; } .wui-consent-banner-policy { color: ${o(`--color-primary-text`)}; font-weight: 500; } .wui-consent-banner-settings { display: grid; gap: 12px; max-height: 50vh; margin: 0 0 16px; padding: 12px 0; overflow-y: auto; border-top: 1px solid ${o(`--color-border`)}; border-bottom: 1px solid ${o(`--color-border`)}; } .wui-consent-banner-category-description { margin: 2px 0 0; padding-inline-start: 2.5em; font-size: 12px; line-height: 1.4; color: ${o(`--color-text-muted`)}; } .form-check { display: flex; align-items: center; gap: 0.5em; margin: 0; font-size: 14px; } .form-check-input { appearance: none; flex: none; width: 2em; height: 1em; margin: 0; border: 1px solid rgba(0, 0, 0, 0.25); border-radius: 2em; background: ${o(`--color-surface`)} radial-gradient(circle, rgba(0, 0, 0, 0.25) 0.35em, transparent 0.4em) left / 1em 1em no-repeat; cursor: pointer; transition: background-position 0.15s ease-in-out; } .form-check-input:checked { border-color: ${o(`--color-primary`)}; background: ${o(`--color-primary`)} radial-gradient(circle, #fff 0.35em, transparent 0.4em) right / 1em 1em no-repeat; } .form-check-input:disabled { opacity: 0.5; cursor: default; } .form-check-input:focus-visible { outline: 2px solid ${o(`--color-primary`)}; outline-offset: 2px; } .form-check-label { cursor: pointer; } .wui-consent-banner-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; } .btn { display: inline-block; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid ${o(`--color-primary`)}; outline-offset: 2px; } .btn-primary { background: ${o(`--color-primary`)}; border-color: ${o(`--color-primary`)}; color: ${o(`--color-on-primary`)}; } .btn-primary:hover { background: ${o(`--color-primary-hover`)}; border-color: ${o(`--color-primary-hover`)}; } .btn-outline-secondary { border-color: ${o(`--color-text-muted`)}; color: ${o(`--color-text-muted`)}; } .btn-outline-secondary:hover { background: ${o(`--color-bg-muted`)}; color: ${o(`--color-text`)}; } .btn-link { font-weight: 400; color: ${o(`--color-primary-text`)}; text-decoration: underline; } .btn-link:hover { color: ${o(`--color-primary-hover`)}; } .wui-consent-banner-settings-toggle { margin-inline-end: auto; padding-inline: 0; } .wui-consent-banner-save { flex: 1 1 100%; } @media (max-width: 575.98px) { :host, :host([position="bottom-right"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } .wui-consent-banner-panel { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } /* Hidden on phones, but it stays the dialog's accessible name. */ .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } .wui-consent-banner-description { margin: 0 0 8px; font-size: 13px; line-height: 1.4; } .wui-consent-banner-actions { gap: 6px; } } @media (min-width: 576px) { :host([position="bar"]) .wui-consent-banner-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; } /* Hidden on the bar, but it stays the dialog's accessible name. */ :host([position="bar"]) .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } :host([position="bar"]) .wui-consent-banner-description { margin: 0; flex: 1 1 320px; } :host([position="bar"]) .wui-consent-banner-actions { flex: none; } :host([position="bar"]) .wui-consent-banner-settings { flex-basis: 100%; margin: 0; } } /* The actions are small buttons, which fall under the 44px touch target on touch screens. This sheet's .btn is inline-block, so it centres the label itself. */ @media (max-width: 575.98px), (pointer: coarse) { .wui-consent-banner-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; } } `,c=`wui-consent-save`,l=`[data-consent-settings]`,u=`tour-open`,d=`--wui-consent-banner-block`,f=`--wui-consent-banner-inline`,p={heading:`Cookies on this site`,description:`We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.`,policyLabel:`Cookie policy`,essentialLabel:`Essential cookies`,essentialDescription:`Required for the site to work and stay secure. Always on.`,analyticsLabel:`Analytics cookies`,analyticsDescription:`Help us understand how visitors use the site.`,functionalLabel:`Functional cookies`,functionalDescription:`Remember choices you make, such as your preferences.`,marketingLabel:`Marketing cookies`,marketingDescription:`Measure how well our campaigns work.`,settingsLabel:`Cookie settings`,rejectLabel:`Reject all`,acceptLabel:`Accept all`,saveLabel:`Save preferences`},m=[`analytics`,`functional`,`marketing`],h={analytics:{label:p.analyticsLabel,description:`analyticsDescription`},functional:{label:p.functionalLabel,description:`functionalDescription`},marketing:{label:p.marketingLabel,description:`marketingDescription`}},g=/* @__PURE__ */ new Set;function _(e){g.has(e)||(g.add(e),n(`[@webority/ui-elements] <wui-consent-banner> received categories containing "${e}", which is not one of ${m.map(e=>`"${e}"`).join(` | `)}. It is ignored.`))}var v=0,y=null;function b(e){y||(y=new CSSStyleSheet,y.replaceSync(s)),e.adoptedStyleSheets=[y]}var x=class extends r{static get observedAttributes(){return[`heading`,`description`,`policy-href`,`policy-label`,`analytics-description`,`functional-description`,`marketing-description`,`categories`]}constructor(){super(),v+=1,this._uid=`wui-consent-${v}`,this._preferences={analytics:!1,functional:!1,marketing:!1},this._settings=!1,this._onDocumentClick=e=>{e.target instanceof Element&&e.target.closest(l)&&(e.preventDefault(),this.open({settings:!0,focus:!0}))},this._tourWatch=null,this._roomObserver=null,this._onWindowResize=()=>this._reserveRoom()}get position(){let e=this.getAttribute(`position`);return e===`bottom-right`||e===`bar`?e:`bottom-left`}set position(e){this.setAttribute(`position`,String(e??`bottom-left`))}get standalone(){return this.hasAttribute(`standalone`)}set standalone(e){this.toggleAttribute(`standalone`,e===!0||e===``||e===`true`)}get preview(){return this.hasAttribute(`preview`)}set preview(e){this.toggleAttribute(`preview`,e===!0||e===``||e===`true`)}get heading(){return this.getAttribute(`heading`)||p.heading}set heading(e){this.setAttribute(`heading`,String(e??``))}get description(){return this.getAttribute(`description`)||p.description}set description(e){this.setAttribute(`description`,String(e??``))}get policyHref(){return this.getAttribute(`policy-href`)||``}set policyHref(e){this.setAttribute(`policy-href`,String(e??``))}get policyLabel(){return this.getAttribute(`policy-label`)||p.policyLabel}set policyLabel(e){this.setAttribute(`policy-label`,String(e??``))}get analyticsDescription(){return this.getAttribute(`analytics-description`)||p.analyticsDescription}set analyticsDescription(e){this.setAttribute(`analytics-description`,String(e??``))}get functionalDescription(){return this.getAttribute(`functional-description`)||p.functionalDescription}set functionalDescription(e){this.setAttribute(`functional-description`,String(e??``))}get marketingDescription(){return this.getAttribute(`marketing-description`)||p.marketingDescription}set marketingDescription(e){this.setAttribute(`marketing-description`,String(e??``))}get categories(){let e=this.getAttribute(`categories`);if(!e?.trim())return[...m];let t=e.split(/\s+/).filter(Boolean);for(let e of t)m.includes(e)||_(e);let n=m.filter(e=>t.includes(e));return n.length?n:[...m]}set categories(e){e==null?this.removeAttribute(`categories`):this.setAttribute(`categories`,Array.isArray(e)?e.join(` `):String(e))}get preferences(){let e=this.categories;return Object.fromEntries(m.map(t=>[t,e.includes(t)&&this._preferences[t]]))}set preferences(e){this._preferences={analytics:e?.analytics===!0,functional:e?.functional===!0,marketing:e?.marketing===!0},this._applyPreferences()}get isOpen(){return this.hasAttribute(`open`)}connectedCallback(){this._rendered||this.render(),document.addEventListener(`click`,this._onDocumentClick),this._syncTour(),this._tourWatch??=new MutationObserver(()=>this._syncTour()),this._tourWatch.observe(document.documentElement,{attributes:!0,attributeFilter:[i]}),this.preview&&!this.isOpen&&this.open(),this.isOpen&&this._trackRoom()}disconnectedCallback(){document.removeEventListener(`click`,this._onDocumentClick),this._tourWatch?.disconnect(),this._untrackRoom()}_syncTour(){this.toggleAttribute(u,document.documentElement.hasAttribute(i))}attributeChangedCallback(){this._rendered&&this.render()}render(){let n=this.isOpen,r=this._uid,i=this.policyHref?` <a class="wui-consent-banner-policy" href="${w(this.policyHref)}">${C(this.policyLabel)}</a>`:``,a=this._root();a!==this&&b(a),a.innerHTML=` <div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${r}-heading" aria-describedby="${r}-description" hidden> <h2 class="wui-consent-banner-heading" id="${r}-heading">${C(this.heading)}</h2> <p class="wui-consent-banner-description" id="${r}-description">${C(this.description)}${i}</p> <div class="wui-consent-banner-settings" hidden> ${S(r,`essential`,p.essentialLabel,p.essentialDescription,!0)} ${this.categories.map(e=>S(r,e,h[e].label,this[h[e].description],!1)).join(` `)} </div> <div class="wui-consent-banner-actions"> <button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${p.settingsLabel}</button> <button type="button" class="${e(`outline-secondary`,`sm`)} wui-consent-banner-reject" data-wui="${t}">${p.rejectLabel}</button> <button type="button" class="${e(`primary`,`sm`)} wui-consent-banner-accept" data-wui="${t}">${p.acceptLabel}</button> <button type="button" class="${e(`primary`,`sm`)} wui-consent-banner-save" hidden data-wui="${t}">${p.saveLabel}</button> </div> </div>`,this._rendered=!0,this._wire(),this._applyPreferences(),this._showSettings(this._settings),n&&(this._panel().hidden=!1)}open({settings:e=!1,focus:t=!1}={}){this._rendered||this.render(),this._applyPreferences(),this._showSettings(e),this._panel().hidden=!1,this.setAttribute(`open`,``),this._trackRoom(),t&&(e?this._root().querySelector(`.wui-consent-banner-category input:not([disabled])`):this._root().querySelector(`.wui-consent-banner-accept`))?.focus()}close(){let e=this._panel();e&&(e.hidden=!0),this.removeAttribute(`open`),this._showSettings(!1),this._untrackRoom()}_trackRoom(){this.isConnected&&!this.preview&&(typeof ResizeObserver<`u`&&(this._roomObserver??=new ResizeObserver(()=>this._reserveRoom()),this._roomObserver.observe(this)),window.addEventListener(`resize`,this._onWindowResize),this._reserveRoom())}_untrackRoom(){this._roomObserver?.disconnect(),window.removeEventListener(`resize`,this._onWindowResize),document.documentElement.style.removeProperty(d),document.documentElement.style.removeProperty(f)}_reserveRoom(){let e=this.getBoundingClientRect(),t=this.position===`bar`?0:this.position===`bottom-right`?window.innerWidth-e.left:e.right,n=document.documentElement.style;n.setProperty(d,`${Math.ceil(window.innerHeight-e.top)}px`),n.setProperty(f,`${Math.ceil(t)}px`)}_root(){return this.shadowRoot?this.shadowRoot:this.standalone?this.attachShadow({mode:`open`}):this}_panel(){return this._root().querySelector(`.wui-consent-banner-panel`)}_wire(){let e=this._root();e.querySelector(`.wui-consent-banner-accept`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!0))),e.querySelector(`.wui-consent-banner-reject`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!1))),e.querySelector(`.wui-consent-banner-save`)?.addEventListener(`click`,()=>this._save(this._switchValues())),e.querySelector(`.wui-consent-banner-settings-toggle`)?.addEventListener(`click`,()=>this._showSettings(!this._settings))}_save(e){this._preferences={...e},this.dispatchEvent(new CustomEvent(c,{bubbles:!0,composed:!0,detail:{...e}})),this.close()}_choiceForShown(e){let t=this.categories;return Object.fromEntries(m.map(n=>[n,e&&t.includes(n)]))}_switchValues(){let e={};for(let t of m)e[t]=this._root().querySelector(`input[data-category="${t}"]`)?.checked===!0;return e}_applyPreferences(){for(let e of m){let t=this._root().querySelector(`input[data-category="${e}"]`);t&&(t.checked=this._preferences[e])}}_showSettings(e){this._settings=e;let t=this._root(),n=t.querySelector(`.wui-consent-banner-settings`);if(!n)return;n.hidden=!e,t.querySelector(`.wui-consent-banner-settings-toggle`)?.setAttribute(`aria-expanded`,e?`true`:`false`);let r=t.querySelector(`.wui-consent-banner-save`);r&&(r.hidden=!e);for(let n of[`.wui-consent-banner-reject`,`.wui-consent-banner-accept`]){let r=t.querySelector(n);r&&(r.hidden=e)}}};function S(e,t,n,r,i){let a=`${e}-${t}`;return`<div class="wui-consent-banner-category"> <div class="form-check form-switch"> <input class="form-check-input" type="checkbox" role="switch" id="${a}" data-category="${t}"${i?` checked disabled`:``} /> <label class="form-check-label" for="${a}">${C(n)}</label> </div> <p class="wui-consent-banner-category-description">${C(r)}</p> </div>`}var C=e=>String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`),w=e=>String(e??``).replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`);export{x as t};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./anchorOverlay-CBMAnDUt.js";import{a as r,c as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./calendarMath-BC2wGCD-.js";import{t as d}from"./elementBase-DV9IZZCu.js";import{t as f}from"./formMirror-BMQTenSi.js";import{t as p}from"./iconGlyphs.g-CQcMoS6_.js";import{n as m}from"./optionLabel-BaLjjB-0.js";var h=class extends d{static formAssociated=!0;static get observedAttributes(){return[`value`,`min`,`max`,`placeholder`,`disabled`,`first-day`,`disabled-weekdays`,`display-format`,`size`,`aria-label`,`aria-describedby`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth(),this._mode=`days`,this._focus=null,this._slide=``}connectedCallback(){this._rendered?this._bindGlobal?.():this.render()}attributeChangedCallback(e,t,n){e===`aria-invalid`?this._syncInvalid():this._rendered&&(e===`value`?(this._value=n||``,this._syncFormValue(),this._syncTrigger()):e===`display-format`?this._syncTrigger():e===`first-day`?this.querySelector(`.datepicker-pop`)?.hidden||this._renderView():this.render())}_syncInvalid(){let e=this.querySelector(`.datepicker-trigger`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e||``,f(this,this._value),this._syncTrigger()}_firstDay(){return r(this)}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``,this._value=this._defaultValue||this._value);let e=this.getAttribute(`placeholder`)||`Choose a date`,t=l(this._value);t&&(this._viewY=t.y,this._viewM=t.m);let n=this.getAttribute(`size`),r=n===`sm`?` input-sm`:n===`lg`?` input-lg`:``,i=this.getAttribute(`aria-label`),a=this.getAttribute(`aria-describedby`);this.innerHTML=`
|
|
2
|
-
<div class="datepicker">
|
|
3
|
-
<button type="button" class="input datepicker-trigger${r}${t?` has-value`:``}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``}${i?` aria-label="${m(i)}"`:``}${a?` aria-describedby="${m(a)}"`:``}>
|
|
4
|
-
<span data-trigger-label class="${t?``:`search-select-placeholder`}">${m(t?s(this._value,this.getAttribute(`display-format`)):e)}</span>
|
|
5
|
-
${p(`calendar-dots`)}
|
|
6
|
-
</button>
|
|
7
|
-
<div class="datepicker-pop" role="dialog" aria-modal="false" hidden></div>
|
|
8
|
-
</div>`,this._rendered=!0,f(this,this._value),this._wire()}_syncFormValue(){f(this,this._value)}_syncTrigger(){let e=this.querySelector(`.datepicker-trigger`),t=this.querySelector(`[data-trigger-label]`);if(!t)return;let n=l(this._value);t.textContent=n?s(this._value,this.getAttribute(`display-format`)):this.getAttribute(`placeholder`)||`Choose a date`,t.classList.toggle(`search-select-placeholder`,!n),e?.classList.toggle(`has-value`,!!n)}_limits(){let e=l(this.getAttribute(`min`)),t=l(this.getAttribute(`max`)),n=e?new Date(e.y,e.m,e.d).getTime():-1/0,r=t?new Date(t.y,t.m,t.d).getTime():1/0,i=/* @__PURE__ */ new Set;for(let e of(this.getAttribute(`disabled-weekdays`)||``).split(`,`)){let t=e.trim();/^[0-6]$/.test(t)&&i.add(Number(t))}return{dayDisabled:(e,t,a)=>{let o=new Date(e,t,a),s=o.getTime();return s<n||s>r||i.has(o.getDay())},monthDisabled:(e,t)=>{let i=new Date(e,t,1).getTime();return new Date(e,t,a(e,t)).getTime()<n||i>r},yearDisabled:e=>{let t=new Date(e,0,1).getTime();return new Date(e,11,31).getTime()<n||t>r}}}_renderView(){let e=this.querySelector(`.datepicker-pop`);e&&(e.innerHTML=this._mode===`months`?this._monthsHtml():this._mode===`years`?this._yearsHtml():this._daysHtml(),this._focusActive())}_daysHtml(){let e=this._firstDay(),t=(new Date(this._viewY,this._viewM,1).getDay()-e+7)%7,n=a(this._viewY,this._viewM),r=l(this._value),s=/* @__PURE__ */ new Date,{dayDisabled:d}=this._limits(),f=this._focus||r||{y:this._viewY,m:this._viewM,d:1},m=(e,t,n,a)=>{let o=i(e,t,n),c=r&&r.y===e&&r.m===t&&r.d===n,l=s.getFullYear()===e&&s.getMonth()===t&&s.getDate()===n,u=f.y===e&&f.m===t&&f.d===n,p=d(e,t,n);return`<button type="button" class="${[`datepicker-day`,a?`is-outside`:``,l?`is-today`:``,c?`is-selected`:``].filter(Boolean).join(` `)}" data-iso="${o}" role="gridcell" tabindex="${u&&!p?`0`:`-1`}"${c?` aria-selected="true"`:``}${p?` disabled aria-disabled="true"`:``}>${n}</button>`},h=``,g=c(this._viewY,this._viewM-1),_=a(g.y,g.m);for(let e=t-1;e>=0;e--)h+=m(g.y,g.m,_-e,!0);for(let e=1;e<=n;e++)h+=m(this._viewY,this._viewM,e,!1);let v=c(this._viewY,this._viewM+1),y=(7-(t+n)%7)%7;for(let e=1;e<=y;e++)h+=m(v.y,v.m,e,!0);let b=d(s.getFullYear(),s.getMonth(),s.getDate()),x=o.map((t,n)=>o[(n+e)%7]).map(e=>`<span>${e}</span>`).join(``);return`
|
|
9
|
-
<div class="datepicker-head">
|
|
10
|
-
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${p(`chevron-left`)}</button>
|
|
11
|
-
<button type="button" class="datepicker-month" data-view="months" aria-label="Choose month and year">${u[this._viewM]} ${this._viewY}</button>
|
|
12
|
-
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${p(`chevron-right`)}</button>
|
|
13
|
-
</div>
|
|
14
|
-
<div class="datepicker-weekdays">${x}</div>
|
|
15
|
-
<div class="datepicker-grid${this._slide?` ${this._slide}`:``}" role="grid">${h}</div>
|
|
16
|
-
<div class="datepicker-foot">
|
|
17
|
-
<button type="button" class="datepicker-link" data-today${b?` disabled`:``}>Today</button>
|
|
18
|
-
<button type="button" class="datepicker-link" data-clear>Clear</button>
|
|
19
|
-
</div>`}_monthsHtml(){let e=l(this._value),t=/* @__PURE__ */ new Date,{monthDisabled:n}=this._limits(),r=``;for(let i=0;i<12;i++){let a=e&&e.y===this._viewY&&e.m===i,o=t.getFullYear()===this._viewY&&t.getMonth()===i,s=n(this._viewY,i),c=[`datepicker-cell`,o?`is-today`:``,a?`is-selected`:``].filter(Boolean).join(` `);r+=`<button type="button" class="${c}" data-month="${i}"${s?` disabled`:``}>${u[i].slice(0,3)}</button>`}return`
|
|
20
|
-
<div class="datepicker-head">
|
|
21
|
-
<button type="button" class="datepicker-nav-btn" data-nav-year="-1" aria-label="Previous year">${p(`chevron-left`)}</button>
|
|
22
|
-
<button type="button" class="datepicker-month" data-view="years" aria-label="Choose year">${this._viewY}</button>
|
|
23
|
-
<button type="button" class="datepicker-nav-btn" data-nav-year="1" aria-label="Next year">${p(`chevron-right`)}</button>
|
|
24
|
-
</div>
|
|
25
|
-
<div class="datepicker-cells">${r}</div>`}_yearsHtml(){let e=l(this._value),t=(/* @__PURE__ */ new Date()).getFullYear(),{yearDisabled:n}=this._limits(),r=this._viewY-(this._viewY%10+10)%10-1,i=``;for(let a=0;a<12;a++){let o=r+a,s=e&&e.y===o,c=t===o,l=n(o),u=[`datepicker-cell`,c?`is-today`:``,s?`is-selected`:``].filter(Boolean).join(` `);i+=`<button type="button" class="${u}" data-year="${o}"${l?` disabled`:``}>${o}</button>`}return`
|
|
26
|
-
<div class="datepicker-head">
|
|
27
|
-
<button type="button" class="datepicker-nav-btn" data-nav-decade="-1" aria-label="Previous decade">${p(`chevron-left`)}</button>
|
|
28
|
-
<span class="datepicker-month">${r+1} to ${r+10}</span>
|
|
29
|
-
<button type="button" class="datepicker-nav-btn" data-nav-decade="1" aria-label="Next decade">${p(`chevron-right`)}</button>
|
|
30
|
-
</div>
|
|
31
|
-
<div class="datepicker-cells">${i}</div>`}_focusActive(){let e=this.querySelector(`.datepicker-pop`),t=e?.querySelector(`[tabindex="0"]`)||e?.querySelector(`.is-selected`)||e?.querySelector(`.datepicker-day:not(:disabled), .datepicker-cell:not(:disabled)`);t&&e.contains(document.activeElement)&&t.focus()}_position(e,t){n(e,t,{clampHeight:!0})}_setFocus(e,t,n,r){let{y:a,m:o}=c(e,t);this._focus={y:a,m:o,d:n};let s=a!==this._viewY||o!==this._viewM;this._viewY=a,this._viewM=o,this._slide=s&&r||``,this._renderView(),this._slide=``,this.querySelector(`.datepicker-day[data-iso="${i(a,o,n)}"]`)?.focus()}_seek(e,t,n,r){let{dayDisabled:i}=this._limits(),a=new Date(e,t,n);for(let e=0;e<400;e++,a.setDate(a.getDate()+r))if(!i(a.getFullYear(),a.getMonth(),a.getDate()))return new Date(a);return null}_onKey(e){if(this._mode!==`days`)return;let t=this._focus||l(this._value)||{y:this._viewY,m:this._viewM,d:1},n=(e,t,n,r,i)=>{let a=this._seek(e,t,n,r);a&&this._setFocus(a.getFullYear(),a.getMonth(),a.getDate(),i)},r=(r,i,a=r<0?-1:1)=>{e.preventDefault(),n(t.y,t.m,t.d+r,a,i)};switch(e.key){case`ArrowLeft`:return r(-1,`slide-prev`);case`ArrowRight`:return r(1,`slide-next`);case`ArrowUp`:return r(-7,`slide-prev`);case`ArrowDown`:return r(7,`slide-next`);case`Home`:return r(-((new Date(t.y,t.m,t.d).getDay()-this._firstDay()+7)%7),`slide-prev`,1);case`End`:return r(6-(new Date(t.y,t.m,t.d).getDay()-this._firstDay()+7)%7,`slide-next`,-1);case`PageUp`:{e.preventDefault();let r=c(t.y,t.m-(e.shiftKey?12:1));return n(r.y,r.m,Math.min(t.d,a(r.y,r.m)),-1,`slide-prev`)}case`PageDown`:{e.preventDefault();let r=c(t.y,t.m+(e.shiftKey?12:1));return n(r.y,r.m,Math.min(t.d,a(r.y,r.m)),1,`slide-next`)}case`Enter`:case` `:e.preventDefault(),this._limits().dayDisabled(t.y,t.m,t.d)||(this.value=i(t.y,t.m,t.d),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close());return}}_wire(){this._teardown();let n=this.querySelector(`.datepicker-trigger`),r=this.querySelector(`.datepicker-pop`),a=this.querySelector(`.datepicker`);if(!n||!r)return;let o=()=>!r.hidden,s=()=>{o()&&this._position(n,r)};this._open=()=>{let t=/* @__PURE__ */ new Date,i=l(this._value);(i||!this._viewNavigated)&&(this._viewY=t.getFullYear(),this._viewM=t.getMonth()),this._mode=`days`;let o=t.getFullYear()===this._viewY&&t.getMonth()===this._viewM,c=i&&i.y===this._viewY&&i.m===this._viewM;if(this._focus=c?i:{y:this._viewY,m:this._viewM,d:o?t.getDate():1},this._limits().dayDisabled(this._focus.y,this._focus.m,this._focus.d)){let e=this._focus,t=[1,-1].map(t=>this._seek(e.y,e.m,e.d,t)).find(t=>t&&t.getMonth()===e.m);t&&(this._focus={y:t.getFullYear(),m:t.getMonth(),d:t.getDate()})}this._renderView(),r.hidden=!1,a?.classList.add(`open`),this._position(n,r),e(this,s),n.setAttribute(`aria-expanded`,`true`),r.querySelector(`[tabindex="0"]`)?.focus()},this._close=()=>{r.hidden=!0,a?.classList.remove(`open`),n.setAttribute(`aria-expanded`,`false`),t(this),n.focus()},n.addEventListener(`click`,()=>o()?this._close():this._open()),r.addEventListener(`click`,e=>{this._popClick=!0;let t=e.target.closest(`[data-nav]`);if(t){this._viewNavigated=!0,this._slide=Number(t.dataset.nav)<0?`slide-prev`:`slide-next`;let e=c(this._viewY,this._viewM+Number(t.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._focus={y:e.y,m:e.m,d:1},this._renderView(),this._slide=``;return}let n=e.target.closest(`[data-nav-year]`);if(n){this._viewY+=Number(n.dataset.navYear),this._renderView();return}let r=e.target.closest(`[data-nav-decade]`);if(r){this._viewY+=Number(r.dataset.navDecade)*10,this._renderView();return}let a=e.target.closest(`[data-view]`);if(a){this._mode=a.dataset.view,this._renderView();return}let o=e.target.closest(`[data-month]`);if(o&&!o.disabled){this._viewNavigated=!0,this._viewM=Number(o.dataset.month),this._mode=`days`,this._focus={y:this._viewY,m:this._viewM,d:1},this._renderView();return}let s=e.target.closest(`[data-year]`);if(s&&!s.disabled){this._viewNavigated=!0,this._viewY=Number(s.dataset.year),this._mode=`months`,this._renderView();return}if(e.target.closest(`[data-today]`)){let e=/* @__PURE__ */ new Date;if(this._limits().dayDisabled(e.getFullYear(),e.getMonth(),e.getDate()))return;this.value=i(e.getFullYear(),e.getMonth(),e.getDate()),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close();return}if(e.target.closest(`[data-clear]`)){this.value=``,this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close();return}let l=e.target.closest(`.datepicker-day[data-iso]`);l&&!l.disabled&&(this.value=l.dataset.iso,this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close())}),this._onKeyBound=e=>{o()&&this._onKey(e)},r.addEventListener(`keydown`,this._onKeyBound),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{let t=this._popClick;this._popClick=!1,o()&&!t&&!this.contains(e.target)&&this._close()},document.addEventListener(`click`,this._onDocClick),this._onDocKey=e=>{o()&&e.key===`Escape`&&this._close()},document.addEventListener(`keydown`,this._onDocKey),this._onHostKey=e=>{o()&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),this._close())},this.addEventListener(`keydown`,this._onHostKey),o()&&e(this,s)},this._bindGlobal(),this._syncFormValue()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),this._onDocKey&&=(document.removeEventListener(`keydown`,this._onDocKey),null),this._onHostKey&&=(this.removeEventListener(`keydown`,this._onHostKey),null),t(this)}disconnectedCallback(){this._teardown()}};export{h as t};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./anchorOverlay-CBMAnDUt.js";import{a as r,c as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./calendarMath-BC2wGCD-.js";import{n as d}from"./devWarn-DXdRWZs3.js";import{t as f}from"./elementBase-DV9IZZCu.js";import{t as p}from"./iconGlyphs.g-CQcMoS6_.js";import{n as m}from"./optionLabel-BaLjjB-0.js";var h=`Asia/Kolkata`,g=3,_=[`today`,`yesterday`,`last7Days`,`last30Days`,`thisMonth`,`lastMonth`,`thisFinancialYear`],v={today:`Today`,yesterday:`Yesterday`,last7Days:`Last 7 days`,last30Days:`Last 30 days`,thisMonth:`This month`,lastMonth:`Last month`,thisFinancialYear:`This financial year`},y=e=>String(e).padStart(2,`0`),b=e=>`${e.getUTCFullYear()}-${y(e.getUTCMonth()+1)}-${y(e.getUTCDate())}`;function x(e=/* @__PURE__ */ new Date){let t=new Intl.DateTimeFormat(`en-US`,{timeZone:h,year:`numeric`,month:`2-digit`,day:`2-digit`}).formatToParts(e),n=e=>t.find(t=>t.type===e).value;return`${n(`year`)}-${n(`month`)}-${n(`day`)}`}function S(e,t=/* @__PURE__ */ new Date){let{y:n,m:r,d:i}=l(x(t)),a=(e,t,n)=>b(new Date(Date.UTC(e,t,n))),o=v[e];switch(e){case`today`:return{label:o,start:a(n,r,i),end:a(n,r,i)};case`yesterday`:return{label:o,start:a(n,r,i-1),end:a(n,r,i-1)};case`last7Days`:return{label:o,start:a(n,r,i-6),end:a(n,r,i)};case`last30Days`:return{label:o,start:a(n,r,i-29),end:a(n,r,i)};case`thisMonth`:return{label:o,start:a(n,r,1),end:a(n,r+1,0)};case`lastMonth`:return{label:o,start:a(n,r-1,1),end:a(n,r,0)};case`thisFinancialYear`:{let e=r>=g?n:n-1;return{label:o,start:a(e,g,1),end:a(e+1,g,0)}}default:return null}}function C(e){d(`[@webority/ui-elements] <wui-date-range> presets: ${e}`)}function w(e,t=/* @__PURE__ */ new Date){let n=String(e??``).trim();if(!n)return[];let r;if(n.startsWith(`[`))try{r=JSON.parse(n)}catch{return C(`the attribute is not valid JSON`),[]}else r=n.split(`,`).map(e=>e.trim());let i=[];for(let e of r)if(typeof e==`string`){let n=S(e,t);n?i.push(n):C(`"${e}" is not one of ${_.join(`, `)}`)}else e&&typeof e.label==`string`&&e.label&&l(e.start)&&l(e.end)?i.push({label:e.label,start:e.start,end:e.end}):C(`an item needs a label and ISO start and end dates, or a preset name`);return i}var T=class extends f{static formAssociated=!0;static get observedAttributes(){return[`start`,`end`,`min`,`max`,`placeholder`,`disabled`,`first-day`,`size`,`aria-label`,`aria-describedby`,`name`,`start-name`,`end-name`,`presets`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._start=``,this._end=``,this._hover=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth()}connectedCallback(){this._rendered?this._bindGlobal?.():this.render()}attributeChangedCallback(e,t,n){e===`aria-invalid`?this._syncInvalid():this._rendered&&(e===`start`||e===`end`?(this._start=this.getAttribute(`start`)||``,this._end=this.getAttribute(`end`)||``,this._syncTrigger(),this._syncMirrors()):this.render())}_syncInvalid(){let e=this.querySelector(`.daterange-trigger`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get value(){return{start:this._start,end:this._end}}set value(e){this._start=e?.start||``,this._end=e?.end||``,this._syncTrigger(),this._syncMirrors()}_firstDay(){return r(this)}_label(){let e=this.getAttribute(`placeholder`)||`Start to End`;return!this._start&&!this._end?{text:e,empty:!0}:{text:`${s(this._start)||`Start`} to ${s(this._end)||`End`}`,empty:!1}}render(){this._defaultStart===void 0&&(this._defaultStart=this.getAttribute(`start`)||``,this._defaultEnd=this.getAttribute(`end`)||``,this._start=this._defaultStart||this._start,this._end=this._defaultEnd||this._end);let e=l(this._start);e&&(this._viewY=e.y,this._viewM=e.m);let t=this.getAttribute(`size`),n=t===`sm`?` input-sm`:t===`lg`?` input-lg`:``,{text:r,empty:i}=this._label(),a=this.getAttribute(`aria-label`),o=this.getAttribute(`aria-describedby`);this.innerHTML=`
|
|
2
|
-
<div class="daterange">
|
|
3
|
-
<button type="button" class="input daterange-trigger${n}${i?``:` has-value`}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``}${a?` aria-label="${m(a)}"`:``}${o?` aria-describedby="${m(o)}"`:``}>
|
|
4
|
-
<span data-range-label class="${i?`search-select-placeholder`:``}">${m(r)}</span>
|
|
5
|
-
${p(`calendar`)}
|
|
6
|
-
</button>
|
|
7
|
-
<div class="daterange-pop" role="dialog" aria-modal="false" hidden></div>
|
|
8
|
-
</div>`,this._rendered=!0,this._syncMirrors(),this._wire()}formResetCallback(){this.value={start:this._defaultStart||``,end:this._defaultEnd||``}}_syncTrigger(){let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`[data-range-label]`);if(!t)return;let{text:n,empty:r}=this._label();t.textContent=n,t.classList.toggle(`search-select-placeholder`,r),e?.classList.toggle(`has-value`,!r)}_syncMirrors(){let e=this.getAttribute(`start-name`)||this.getAttribute(`name`),t=this.getAttribute(`end-name`);this._mirror(`start`,e,this._start),this._mirror(`end`,t,this._end)}_mirror(e,t,n){if(!t)return;let r=this.querySelector(`input[type="hidden"][data-range-mirror="${e}"]`);r||(r=document.createElement(`input`),r.type=`hidden`,r.setAttribute(`data-range-mirror`,e),this.appendChild(r)),r.name=t,r.value=n||``,r.disabled=this.hasAttribute(`disabled`)}_limits(){let e=l(this.getAttribute(`min`)),t=l(this.getAttribute(`max`)),n=e?new Date(e.y,e.m,e.d).getTime():-1/0,r=t?new Date(t.y,t.m,t.d).getTime():1/0;return(e,t,i)=>{let a=new Date(e,t,i).getTime();return a<n||a>r}}_monthHtml(e,t){let n=this._firstDay(),r=(new Date(e,t,1).getDay()-n+7)%7,s=a(e,t),l=this._limits(),d=o.map((e,t)=>o[(t+n)%7]).map(e=>`<span>${e}</span>`).join(``),f=(e,t,n,r)=>{let a=i(e,t,n),o=l(e,t,n);return`<button type="button" class="${[`datepicker-day`,r?`is-outside`:``].filter(Boolean).join(` `)}" data-iso="${a}"${o?` disabled`:``}>${n}</button>`},p=``,m=c(e,t-1),h=a(m.y,m.m);for(let e=r-1;e>=0;e--)p+=f(m.y,m.m,h-e,!0);for(let n=1;n<=s;n++)p+=f(e,t,n,!1);let g=c(e,t+1),_=(7-(r+s)%7)%7;for(let e=1;e<=_;e++)p+=f(g.y,g.m,e,!0);return`
|
|
9
|
-
<div class="daterange-cal">
|
|
10
|
-
<div class="datepicker-month-label">${u[t]} ${e}</div>
|
|
11
|
-
<div class="datepicker-weekdays">${d}</div>
|
|
12
|
-
<div class="datepicker-grid" role="grid">${p}</div>
|
|
13
|
-
</div>`}_presetsHtml(){if(!this._presetList?.length)return``;let e=this._limits(),t=t=>{let n=l(t);return e(n.y,n.m,n.d)};return`<div class="wui-daterange-presets" role="group" aria-label="Quick ranges">${this._presetList.map((e,n)=>`<button type="button" class="wui-daterange-preset" data-preset="${n}"${t(e.start)||t(e.end)?` disabled`:``}>${m(e.label)}</button>`).join(``)}</div>`}_renderView(){let e=this.querySelector(`.daterange-pop`);if(!e)return;let t=c(this._viewY,this._viewM+1),n=this._presetsHtml(),r=`
|
|
14
|
-
<div class="daterange-head">
|
|
15
|
-
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${p(`chevron-left`)}</button>
|
|
16
|
-
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${p(`chevron-right`)}</button>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="daterange-cals">
|
|
19
|
-
${this._monthHtml(this._viewY,this._viewM)}
|
|
20
|
-
${this._monthHtml(t.y,t.m)}
|
|
21
|
-
</div>
|
|
22
|
-
<div class="datepicker-foot">
|
|
23
|
-
<span class="daterange-hint" data-range-hint></span>
|
|
24
|
-
<button type="button" class="datepicker-link" data-clear>Clear</button>
|
|
25
|
-
</div>`;e.classList.toggle(`wui-daterange-pop--presets`,n!==``),e.innerHTML=n?`${n}<div class="wui-daterange-main">${r}</div>`:r,this._paint()}_paint(){let e=this.querySelector(`.daterange-pop`);if(!e)return;let t=this._start?new Date(this._start).getTime():null,n=this._end;t&&!this._end&&this._hover&&new Date(this._hover).getTime()>=t&&(n=this._hover);let r=n?new Date(n).getTime():null;for(let n of e.querySelectorAll(`.datepicker-day[data-iso]`)){let e=new Date(n.dataset.iso).getTime(),i=t!=null&&e===t,a=r!=null&&e===r,o=t!=null&&r!=null&&e>t&&e<r;n.classList.toggle(`is-range-start`,i),n.classList.toggle(`is-range-end`,a),n.classList.toggle(`in-range`,o)}e.querySelectorAll(`[data-preset]`).forEach(e=>{let t=this._presetList?.[Number(e.dataset.preset)],n=!!t&&t.start===this._start&&t.end===this._end;e.classList.toggle(`is-active`,n),e.setAttribute(`aria-pressed`,String(n))});let i=e.querySelector(`[data-range-hint]`);i&&(i.textContent=this._start?this._end?`${s(this._start)} to ${s(this._end)}`:`Pick an end date`:`Pick a start date`)}_position(e,t){n(e,t,{clampHeight:!0})}_pick(e){!this._start||this._start&&this._end?(this._start=e,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint()):new Date(e).getTime()<new Date(this._start).getTime()?(this._start=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0}))):(this._end=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close())}_applyPreset({start:e,end:t}){this._start=e,this._end=t,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close()}_wire(){this._teardown();let n=this.querySelector(`.daterange-trigger`),r=this.querySelector(`.daterange-pop`),i=this.querySelector(`.daterange`);if(!n||!r)return;let a=()=>!r.hidden,o=()=>{a()&&this._position(n,r)};this._open=()=>{let t=l(this._start);if(t)this._viewY=t.y,this._viewM=t.m;else{let e=/* @__PURE__ */ new Date;this._viewY=e.getFullYear(),this._viewM=e.getMonth()}this._presetList=w(this.getAttribute(`presets`)),this._renderView(),r.hidden=!1,i?.classList.add(`open`),this._position(n,r),e(this,o),n.setAttribute(`aria-expanded`,`true`)},this._close=()=>{r.hidden=!0,this._hover=``,i?.classList.remove(`open`),n.setAttribute(`aria-expanded`,`false`),t(this)},n.addEventListener(`click`,()=>a()?this._close():this._open()),r.addEventListener(`click`,e=>{this._popClick=!0;let t=e.target.closest(`[data-nav]`);if(t){let e=c(this._viewY,this._viewM+Number(t.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._renderView();return}if(e.target.closest(`[data-clear]`)){this._start=``,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._renderView(),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}let n=e.target.closest(`[data-preset]`);if(n&&!n.disabled){let e=this._presetList?.[Number(n.dataset.preset)];e&&this._applyPreset(e);return}let r=e.target.closest(`.datepicker-day[data-iso]`);r&&!r.disabled&&this._pick(r.dataset.iso)}),r.addEventListener(`mouseover`,e=>{let t=e.target.closest(`.datepicker-day[data-iso]`);t&&this._start&&!this._end&&(this._hover=t.dataset.iso,this._paint())}),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{let t=this._popClick;this._popClick=!1,a()&&!t&&!this.contains(e.target)&&this._close()},document.addEventListener(`click`,this._onDocClick),this._onDocKey=e=>{a()&&e.key===`Escape`&&this._close()},document.addEventListener(`keydown`,this._onDocKey),this._onHostKey=e=>{a()&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),this._close())},this.addEventListener(`keydown`,this._onHostKey),a()&&e(this,o)},this._bindGlobal(),this._syncMirrors()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),this._onDocKey&&=(document.removeEventListener(`keydown`,this._onDocKey),null),this._onHostKey&&=(this.removeEventListener(`keydown`,this._onHostKey),null),t(this)}disconnectedCallback(){this._teardown()}};export{T as t};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./elementBase-DV9IZZCu.js";var t=/\[([^[\]\n]+)\](?!\()/g,n=/* @__PURE__ */ new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`),r=/\[([^\]\n]+)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,i=/!\[([^\]\n]*)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,a=new RegExp(t.source,`y`),o=e=>/[\p{L}\p{N}]/u.test(e);function s(e,t){let n=0;for(let r=t-1;r>=0&&e.charAt(r)===`\\`;--r)n+=1;return n%2==1}function c(e,t,n){let r=n.length===1;for(let i=e.indexOf(n,t);i!==-1;i=e.indexOf(n,i+1)){let a=i>t&&!/\s/.test(e.charAt(t))&&!/\s/.test(e.charAt(i-1)),c=r&&(e.charAt(i+1)===n||e.charAt(i-1)===n),l=n===`_`&&o(e.charAt(i+n.length));if(a&&!c&&!l&&!s(e,i))return i}return-1}function l(e,t){let s=t?.isCitation,u=[],d=``,f=()=>{d&&=(u.push({type:`text`,text:d}),``)},p=0;for(;p<e.length;){let m=e.charAt(p),h=e.charAt(p+1);if(m===`\\`&&n.has(h)){d+=h,p+=2;continue}if(m==="`"){let t=e.indexOf("`",p+1);if(t>p+1){f(),u.push({type:`code`,text:e.slice(p+1,t)}),p=t+1;continue}}let g=m+h;if(g===`**`||g===`__`||g===`~~`){let n=c(e,p+2,g);if(n!==-1&&!(g===`__`&&o(e.charAt(p-1)))){f();let r=l(e.slice(p+2,n),t);g===`~~`?u.push({type:`strike`,children:r}):u.push({type:`strong`,children:r}),p=n+2;continue}d+=g,p+=2}else{if(m===`*`||m===`_`){let n=c(e,p+1,m);if(n!==-1&&!(m===`_`&&o(e.charAt(p-1)))){f(),u.push({type:`em`,children:l(e.slice(p+1,n),t)}),p=n+1;continue}}if(m===`[`){r.lastIndex=p;let t=r.exec(e);if(t){f(),u.push({type:`link`,href:t[2],children:l(t[1])}),p+=t[0].length;continue}if(s){a.lastIndex=p;let t=a.exec(e);if(t&&s(t[1])){f(),u.push({type:`citation`,text:t[1]}),p+=t[0].length;continue}}}if(m===`!`){i.lastIndex=p;let t=i.exec(e);if(t){f(),u.push({type:`image`,children:l(t[1])}),p+=t[0].length;continue}}d+=m,p+=1}}return f(),u.map((e,t)=>({...e,key:t}))}var u=/^[a-z][a-z0-9+.-]*:[a-z0-9_-]+\/[a-z0-9_.~-]+$/i,d=/^https?:/i,f=/^(mailto|tel):/i;function p(e,t,n){if(n&&u.test(e)){let t=n(e);if(t!=null)return{kind:`app`,target:t}}return t===`app`?null:d.test(e)?{kind:`web`,href:e}:f.test(e)?{kind:`contact`,href:e}:null}function m(e){return typeof e!=`string`||!e.startsWith(`/`)||e[1]===`/`||e[1]===`\\`?null:e}var h=/^\s*```/,g=/^\s*```\s*(\S*)/,_=/^\s{0,3}(#{1,6})\s+(.*?)(?:\s+#+)?\s*$/,v=/^\s*([-*_])(\s*\1){2,}\s*$/,y=/^(\s*)[-*+]\s+(.*)$/,b=/^(\s*)(\d{1,9})[.)]\s+(.*)$/,x=/^\s*>\s?(.*)$/,S=/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/,C=e=>e.includes(`|`);function w(e){let t=e.trim();return t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1)),t.split(`|`).map(e=>e.trim())}function T(e,t){return C(e[t])&&t+1<e.length&&e[t+1].includes(`|`)&&S.test(e[t+1])}function E(e,t){let n=e[t];return h.test(n)||x.test(n)||y.test(n)||b.test(n)||_.test(n)||v.test(n)||T(e,t)}function D(e){let t=e.replace(/\t/g,` `).length;return Math.min(Math.floor(t/2),4)}function O(e){let t=b.exec(e);if(t)return{text:t[3],depth:D(t[1]),ordered:!0,number:Number(t[2])};let n=y.exec(e);return n?{text:n[2],depth:D(n[1]),ordered:!1,number:0}:null}function k(e){let t=(e??``).replace(/\r\n?/g,`
|
|
2
|
-
`).split(`
|
|
3
|
-
`),n=[],r=0;for(;r<t.length;){let e=t[r];if(!e.trim()){r+=1;continue}if(h.test(e)){let i=g.exec(e)?.[1]||null,a=[];for(r+=1;r<t.length&&!h.test(t[r]);)a.push(t[r]),r+=1;r+=1,n.push({type:`code`,text:a.join(`
|
|
4
|
-
`),language:i});continue}if(T(t,r)){let i=w(e),a=[];for(r+=2;r<t.length&&t[r].trim()&&C(t[r]);)a.push(w(t[r])),r+=1;n.push({type:`table`,header:i,rows:a});continue}if(v.test(e)){n.push({type:`rule`}),r+=1;continue}let i=_.exec(e);if(i){n.push({type:`heading`,level:i[1].length,text:i[2]}),r+=1;continue}if(x.test(e)){let e=[];for(;r<t.length;){let n=x.exec(t[r]);if(!n)break;e.push(n[1]),r+=1}n.push({type:`quote`,lines:e});continue}let a=O(e);if(a){let e=[];for(;r<t.length&&t[r].trim();){let n=O(t[r]);if(n){if(n.depth===0&&n.ordered!==a.ordered)break;e.push(n)}else if(E(t,r))break;else e[e.length-1].text+=` ${t[r].trim()}`;r+=1}n.push({type:`list`,ordered:a.ordered,start:a.ordered?a.number:1,items:e});continue}let o=[e];for(r+=1;r<t.length&&t[r].trim()&&!E(t,r);)o.push(t[r]),r+=1;n.push({type:`paragraph`,lines:o})}return n.map((e,t)=>({...e,key:t}))}var A=[`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`css`];function j(e,t,n,r,i=null){let a=M(e.ownerDocument,n,r).map((e,n)=>{let r=t[n]?.sig===e.sig?t[n].nodes:null;return{sig:e.sig,nodes:r??e.build()}}),o=new Set(a.flatMap(e=>e.nodes));for(let e of t)for(let t of e.nodes)o.has(t)||t.remove();let s=i;for(let t of a.flatMap(e=>e.nodes))(t.parentNode!==e||t.previousSibling!==s)&&e.insertBefore(t,s?s.nextSibling:e.firstChild),s=t;return a}function M(e,t,n){let r={doc:e,links:n.links===`app`?`app`:`web`,headings:n.headings===`text`?`text`:`outline`,resolveLink:n.resolveLink,isCitation:n.isCitation},i=n.resolverGeneration??0;return k(t).map(e=>({sig:`${JSON.stringify(e)}|${r.links}|${r.headings}|${i}`,build:()=>F(r,e)}))}var N=class extends e{static get observedAttributes(){return[`links`,`headings`]}constructor(){super(),this._drawn=[],this._blocks=[],this._observer=null,this._connected=!1,this._resolveLink=void 0,this._isCitation=void 0,this._resolverGeneration=0}connectedCallback(){this._connected=!0,this._render(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._drawn.some(t=>t.contains(e.target)))&&this._render()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._connected=!1,this._observer?.disconnect(),this._observer=null}get resolveLink(){return this._resolveLink}set resolveLink(e){this._resolveLink=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}get isCitation(){return this._isCitation}set isCitation(e){this._isCitation=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}attributeChangedCallback(e,t,n){t!==n&&this._connected&&this._render()}_source(){return Array.from(this.children).find(e=>e.tagName===`PRE`&&e.classList.contains(`wui-markdown-source`))}_render(){let e=this._source();e&&(this._blocks=j(this,this._blocks,e.textContent??``,{links:this.getAttribute(`links`)??void 0,headings:this.getAttribute(`headings`)??void 0,resolveLink:this._resolveLink,isCitation:this._isCitation,resolverGeneration:this._resolverGeneration},e),this._drawn=this._blocks.flatMap(e=>e.nodes),e.hidden=!0,this._observer?.takeRecords())}};function P(e,t,n=[]){let r=e.createElement(t);return r.append(...n),r}function F(e,t){switch(t.type){case`paragraph`:return[P(e.doc,`p`,I(e,t.lines))];case`heading`:return[L(e,t)];case`list`:return R(e,t.items);case`table`:return[B(e,t)];case`code`:return[V(e.doc,t)];case`quote`:return[P(e.doc,`blockquote`,I(e,t.lines))];case`rule`:return[e.doc.createElement(`hr`)];default:return[]}}function I(e,t){let n=[];return t.forEach((t,r)=>{r>0&&n.push(e.doc.createElement(`br`)),n.push(...H(e,t))}),n}function L(e,t){let n=H(e,t.text);if(e.headings===`text`){let t=P(e.doc,`p`,n);return t.className=`fw-semibold`,t}return P(e.doc,`h2`,n)}function R(e,t){let n=[];for(let r=0;r<t.length;){let i=z(e,t,r);n.push(i.list),r=i.next}return n}function z(e,t,n){let{depth:r,ordered:i,number:a}=t[n],o=e.doc.createElement(i?`ol`:`ul`);i&&a!==1&&o.setAttribute(`start`,String(a));let s=null,c=n;for(;c<t.length&&t[c].depth>=r;)if(t[c].depth===r)s=P(e.doc,`li`,H(e,t[c].text)),o.append(s),c+=1;else{let n=z(e,t,c);s.append(n.list),c=n.next}return{list:o,next:c}}function B(e,t){let n=t.header.map(t=>{let n=P(e.doc,`th`,H(e,t));return n.setAttribute(`scope`,`col`),n}),r=t.rows.map(n=>P(e.doc,`tr`,t.header.map((t,r)=>P(e.doc,`td`,H(e,n[r]??``))))),i=P(e.doc,`table`,[P(e.doc,`thead`,[P(e.doc,`tr`,n)]),P(e.doc,`tbody`,r)]);i.className=`table`;let a=P(e.doc,`div`,[i]);return a.className=`table-responsive`,a}function V(e,t){let n=P(e,`pre`,[P(e,`code`,[e.createTextNode(t.text)])]);n.className=`wui-code-source`;let r=P(e,`wui-code-block`,[n]);return r.className=`wui-code-block`,r.setAttribute(`language`,A.includes(t.language)?t.language:`text`),r}function H(e,t){return U(e,l(t,{isCitation:e.isCitation}))}function U(e,t){return t.flatMap(t=>W(e,t))}function W(e,t){let{doc:n}=e;switch(t.type){case`code`:return[P(n,`code`,[n.createTextNode(t.text)])];case`strong`:return[P(n,`strong`,U(e,t.children))];case`em`:return[P(n,`em`,U(e,t.children))];case`strike`:return[P(n,`del`,U(e,t.children))];case`image`:return[n.createTextNode(`[`),...U(e,t.children),n.createTextNode(`]`)];case`link`:return G(e,t);case`citation`:return[K(n,t.text)];default:return[n.createTextNode(t.text)]}}function G(e,t){let n=U(e,t.children),r=p(t.href,e.links,e.resolveLink);if(!r)return n;if(r.kind===`app`){let t=m(r.target);return t?[q(e.doc,t,n,!1)]:n}return[q(e.doc,r.href,n,r.kind===`web`)]}function K(e,t){let n=e.createElement(`span`);n.className=`chip primary chip-outline chip-sm chip-clickable wui-markdown-citation`,n.setAttribute(`data-wui`,`AppChip`);let r=e.createElement(`button`);r.type=`button`,r.className=`chip-body`,r.setAttribute(`aria-label`,t),r.addEventListener(`click`,()=>{r.dispatchEvent(new CustomEvent(`wui-markdown-citation`,{bubbles:!0,detail:{citation:t}}))});let i=e.createElement(`span`);return i.className=`chip-label`,i.textContent=t,r.append(i),n.append(r),n}function q(e,t,n,r){let i=P(e,`span`,n);i.className=`wui-link__label`;let a=P(e,`a`,[i]);return a.className=`wui-link wui-link--static`,a.setAttribute(`data-wui`,`AppLink`),a.setAttribute(`href`,t),r&&(a.setAttribute(`target`,`_blank`),a.setAttribute(`rel`,`noopener noreferrer`)),a}export{N as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./anchorOverlay-CBMAnDUt.js";import{t as r}from"./elementBase-DV9IZZCu.js";import{p as i}from"./formatters-7rx97Lnm.js";import{n as a}from"./listboxKeyNav-DMIvs9d6.js";import{c as o}from"./wuiHttp-CYxlXwsy.js";var s=/^[A-Za-z0-9_.:-]{1,64}$/,c=/@(\\+)\[|@\[([^[\]\n]{1,100})\]\(([A-Za-z0-9_.:-]{1,64})\)/g,l=/@(\\*)\[/g;function u(e){return String(e??``).replace(/[[\]\r\n]+/g,` `).replace(/\s+/g,` `).trim().slice(0,100)}var d=e=>e.replace(l,(e,t)=>`@\\${t}[`);function f(e){let t=String(e??``),n=[],r=e=>{if(!e)return;let t=n[n.length-1];t&&`text`in t?t.text+=e:n.push({text:e})},i=0;for(let e of t.matchAll(c))r(t.slice(i,e.index)),e[1]===void 0?n.push({id:e[3],label:e[2]}):r(`@${e[1].slice(1)}[`),i=e.index+e[0].length;return r(t.slice(i)),n}function p(e){let t=``,n=[];for(let r of f(e)){if(`text`in r){t+=r.text;continue}let e=`@${r.label}`;n.push({start:t.length,end:t.length+e.length,id:r.id,label:r.label}),t+=e}return{text:t,mentions:n}}function m(e,t=[]){let n=String(e??``),r=[...t].sort((e,t)=>e.start-t.start),i=``,a=0;for(let e of r)e.start<a||n.slice(e.start,e.end)!==`@${e.label}`||!s.test(e.id)||(i+=d(n.slice(a,e.start)),i+=`@[${e.label}](${e.id})`,a=e.end);return i+d(n.slice(a))}function h(e){let t=[];for(let n of f(e))`id`in n&&!t.includes(n.id)&&t.push(n.id);return t}var g=8,_=40,v=Object.freeze({listName:`People`,searching:`Searching…`,noMatch:`No one matches`,found:e=>`${e===1?`1 person`:`${i(e,{decimals:0})} people`}. Up and down to choose, Enter to mention.`,mentioned:e=>`Mentioned ${e}.`}),y=`[data-wui-control]`,b=`[data-wui-field]`,x=`[data-wui-menu]`,S=`[data-wui-live]`,C=0,w=e=>e&&s.test(String(e.value??``))&&u(e.label)!==``;function T(e){let t=e.ownerDocument;e.id||=`wui-mention-${++C}`;let n=t.createElement(`textarea`);n.id=`${e.id}-text`,n.className=`form-control textarea wui-mention-input-text`,n.rows=Number(e.getAttribute(`rows`))>0?Number(e.getAttribute(`rows`)):3,n.setAttribute(`data-wui-control`,``),n.setAttribute(`aria-autocomplete`,`list`),n.setAttribute(`aria-controls`,`${e.id}-people`);let r=e.getAttribute(`label`);r&&n.setAttribute(`aria-label`,r);let i=e.getAttribute(`placeholder`);i&&(n.placeholder=i);for(let t of[`aria-describedby`,`aria-invalid`]){let r=e.getAttribute(t);r&&n.setAttribute(t,r)}n.disabled=e.hasAttribute(`disabled`),e.appendChild(n);let a=e.getAttribute(`name`);if(a){let n=t.createElement(`input`);n.type=`hidden`,n.name=a,n.value=e.getAttribute(`value`)??``,n.setAttribute(`data-wui-field`,``),e.appendChild(n)}let o=t.createElement(`div`);o.className=`wui-mention-menu`,o.id=`${e.id}-people`,o.setAttribute(`role`,`listbox`),o.setAttribute(`aria-label`,v.listName),o.setAttribute(`data-wui-menu`,``),o.hidden=!0,e.appendChild(o);let s=t.createElement(`span`);s.className=`visually-hidden`,s.setAttribute(`data-wui-live`,``),s.setAttribute(`aria-live`,`polite`),s.setAttribute(`aria-atomic`,`true`),e.appendChild(s)}var E=class extends r{static get observedAttributes(){return[`disabled`,`aria-invalid`,`aria-describedby`]}constructor(){super(),this._wired=!1,this._text=``,this._mentions=[],this._peopleProp=null,this._declared=null,this._loading=!1,this._query=null,this._results=[],this._active=-1,this._timer=null,this._searchSeq=0,this._abort=null,this._onInput=this._onInput.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onCaret=this._onCaret.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onMenuDown=e=>e.preventDefault(),this._onMenuClick=this._onMenuClick.bind(this),this._reposition=()=>{this._isOpen()&&this._position()}}connectedCallback(){for(let e of[`people`,`loading`,`value`])if(Object.hasOwn(this,e)){let t=this[e];delete this[e],this[e]=t}if(this._wired)return;this._wired=!0,this.querySelector(y)||T(this);let e=this._control(),t=this.querySelector(b)?.value??this.getAttribute(`value`)??``;this._pendingValue===void 0?this._load(t):this._load(this._pendingValue),this._pendingValue=void 0,e.addEventListener(`input`,this._onInput),e.addEventListener(`keydown`,this._onKeyDown),e.addEventListener(`click`,this._onCaret),e.addEventListener(`keyup`,this._onCaret),this.addEventListener(`focusout`,this._onFocusOut);let n=this._menu();n.addEventListener(`mousedown`,this._onMenuDown),n.addEventListener(`click`,this._onMenuClick),n.addEventListener(`mousemove`,e=>{let t=e.target.closest?.(`.wui-mention-option`);t&&Number(t.dataset.index)!==this._active&&this._setActive(Number(t.dataset.index),{reveal:!1})})}disconnectedCallback(){this._close(),clearTimeout(this._timer),this._abort?.abort()}attributeChangedCallback(e,t,n){let r=this._control();r&&(e===`disabled`?(r.disabled=n!==null,n!==null&&this._close()):n===null?r.removeAttribute(e):r.setAttribute(e,n))}get value(){return m(this._text,this._mentions)}set value(e){let t=e==null?``:String(e);this._wired?t!==this.value&&this._load(t):this._pendingValue=t}get mentions(){let e=/* @__PURE__ */ new Set,t=[];for(let n of[...this._mentions].sort((e,t)=>e.start-t.start))e.has(n.id)||(e.add(n.id),t.push({id:n.id,label:n.label}));return t}get people(){return this._peopleProp?this._peopleProp:(this._declared||=[...this.querySelectorAll(`[data-wui-people] > wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})),this._declared)}set people(e){this._peopleProp=Array.isArray(e)?e.filter(w):[],(this._isOpen()||this._query!==null)&&this._refresh()}get loading(){return this._loading}set loading(e){this._loading=!!e,this._query!==null&&this._renderMenu()}focus(e){this._control()?.focus(e)}clear(){this._load(``),this._emit()}_control(){return this.querySelector(y)}_menu(){return this.querySelector(x)}_load(e){let{text:t,mentions:n}=p(e);this._text=t,this._mentions=n;let r=this._control();r&&(r.defaultValue=t,r.value=t),this._syncField(),this._close()}_syncField(){let e=this.querySelector(b);e&&(e.value=this.value)}_emit(){this._syncField(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{value:this.value,mentions:this.mentions}}))}_onInput(){let e=this._control(),t=e.value,n=this._text,r=t.length-n.length,i=Math.min(n.length,t.length),a=Math.max(0,Math.min(i,e.selectionEnd-Math.max(r,0))),o=0;for(;o<a&&n[o]===t[o];)o++;let s=0;for(;s<i-o&&n[n.length-1-s]===t[t.length-1-s];)s++;let c=n.length-s;this._mentions=this._mentions.filter(e=>e.end<=o||e.start>=c).map(e=>e.start>=c?{...e,start:e.start+r,end:e.end+r}:e),this._text=t,this._emit(),this._onCaret()}_onCaret(e){if(e?.type===`keyup`&&[`ArrowUp`,`ArrowDown`,`Enter`,`Tab`,`Escape`].includes(e.key))return;let t=this._queryAtCaret();t?this._query&&t.text===this._query.text&&t.start===this._query.start||(this._query=t,this._refresh()):this._close()}_queryAtCaret(){let e=this._control();if(!e||e.disabled||e.selectionStart!==e.selectionEnd)return null;let t=e.selectionStart,n=this._text,r=n.lastIndexOf(`@`,t-1);if(r<0||r>0&&!/[\s([{"'“‘]/.test(n[r-1]))return null;let i=n.slice(r+1,t);return i.length>40||/[\n@]/.test(i)||/^\s/.test(i)||/\s{2}/.test(i)||this._mentions.some(e=>r>=e.start&&r<e.end)?null:{start:r,end:t,text:i}}_refresh(){if(!this._query)return;let e=this.hasAttribute(`remote`)||this.hasAttribute(`source`);if(e&&this._query.text.length<this._minChars()){this._results=[],this._close();return}e&&!this._answered(this._query.text)&&this._search(this._query.text);let t=this._query.text.toLowerCase(),n=e?this.people:this.people.filter(e=>u(e.label).toLowerCase().includes(t));this._results=n.slice(0,8),this._renderMenu()}_answered(e){return this._lastSearch===e}_minChars(){let e=this.getAttribute(`min-chars`),t=e==null||e===``?1:Number(e);return Number.isFinite(t)&&t>=0?t:1}_debounce(){let e=this.getAttribute(`debounce`),t=e==null||e===``?250:Number(e);return Number.isFinite(t)&&t>=0?t:250}_search(e){this._lastSearch=e,clearTimeout(this._timer);let t=++this._searchSeq;this._timer=setTimeout(()=>{let n=this.getAttribute(`source`);n?this._fetchPeople(n,e,t):this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:t}}))},this._debounce())}async _fetchPeople(e,t,n){this._abort?.abort();let r=new AbortController;this._abort=r,this.loading=!0;let i=`${e}${e.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`,a=await o(i,{signal:r.signal});if(n!==this._searchSeq)return;if(this._abort=null,!a.ok){this._peopleProp=[],this.loading=!1;return}let s=this.ownerDocument.createElement(`template`);s.innerHTML=a.html,this._peopleProp=[...s.content.querySelectorAll(`wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})).filter(w),this.loading=!1,this._refresh()}_isOpen(){let e=this._menu();return!(!e||e.hidden)}_renderMenu(){let t=this._menu(),n=this._control();if(!t||!n||!this._query)return;let r=this.ownerDocument;if(t.replaceChildren(),this._results.forEach((e,n)=>{let i=r.createElement(`div`);if(i.className=`wui-mention-option`,i.id=`${t.id}-${n}`,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,`false`),i.dataset.index=String(n),e.src){let t=r.createElement(`img`);t.className=`wui-mention-option-photo`,t.src=e.src,t.alt=``,i.appendChild(t)}let a=r.createElement(`span`);a.className=`wui-mention-option-text`;let o=r.createElement(`span`);if(o.className=`wui-mention-option-label`,o.textContent=u(e.label),a.appendChild(o),e.description){let t=r.createElement(`span`);t.className=`wui-mention-option-description`,t.textContent=String(e.description),a.appendChild(t)}i.appendChild(a),t.appendChild(i)}),!this._results.length){let e=r.createElement(`div`);e.className=`wui-mention-empty`,e.textContent=this._loading?v.searching:`${v.noMatch} “${this._query.text}”`,t.appendChild(e)}let i=this._isOpen();t.hidden=!1,i||e(this,this._reposition),this._position(),this._setActive(this._results.length?0:-1),this._loading||this._announce(this._results.length?v.found(this._results.length):`${v.noMatch}.`)}_position(){n(this._control(),this._menu())}_close(){this._query=null,this._lastSearch=void 0,clearTimeout(this._timer);let e=this._menu();e&&!e.hidden&&(e.hidden=!0,e.replaceChildren()),this._active=-1,this._control()?.removeAttribute(`aria-activedescendant`),t(this)}_setActive(e,{reveal:t=!0}={}){let n=this._menu(),r=[...n.querySelectorAll(`.wui-mention-option`)];this._active=e>=0&&e<r.length?e:-1;let i=this._active>=0?r[this._active]:null;for(let e of r)e.setAttribute(`aria-selected`,e===i?`true`:`false`);a(n,i),i?(t&&i.scrollIntoView?.({block:`nearest`}),this._control().setAttribute(`aria-activedescendant`,i.id)):this._control().removeAttribute(`aria-activedescendant`)}_onKeyDown(e){if(this._isOpen()&&this._query){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=this._results.length;if(!t)return;let n=e.key===`ArrowDown`?1:-1;this._setActive((this._active+n+t)%t);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this._active>=0){e.preventDefault(),this._pick(this._results[this._active]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close();return}}e.key===`Enter`&&(e.ctrlKey||e.metaKey)?(e.preventDefault(),this.dispatchEvent(new CustomEvent(`wui:mention-input:submit`,{bubbles:!0,detail:{value:this.value}}))):e.key===`Backspace`&&this._removeWholeMention(e)}_removeWholeMention(e){let t=this._control();if(t.selectionStart!==t.selectionEnd)return;let n=t.selectionStart,r=this._mentions.find(e=>e.end===n);r&&(e.preventDefault(),this._replace(r.start,r.end,``))}_onMenuClick(e){let t=e.target.closest?.(`.wui-mention-option`);t&&this._pick(this._results[Number(t.dataset.index)])}_pick(e){if(!e||!this._query)return;let t=u(e.label),{start:n,end:r}=this._query,i=this._text.slice(r),a=`@${t}${/^\s/.test(i)?``:` `}`;this._replace(n,r,a,{id:String(e.value),label:t}),this._announce(v.mentioned(t))}_replace(e,t,n,r){let i=this._control(),a=n.length-(t-e);this._mentions=this._mentions.filter(n=>n.end<=e||n.start>=t).map(e=>e.start>=t?{...e,start:e.start+a,end:e.end+a}:e),r&&this._mentions.push({start:e,end:e+1+r.label.length,id:r.id,label:r.label}),this._text=this._text.slice(0,e)+n+this._text.slice(t),i.value=this._text;let o=e+n.length;i.setSelectionRange(o,o),this._close(),i.focus(),this._emit()}_onFocusOut(e){e.relatedTarget&&this.contains(e.relatedTarget)||this._close()}_announce(e){let t=this.querySelector(S);t&&(t.textContent=``,t.textContent=e)}};export{s as a,m as c,E as i,h as l,g as n,u as o,v as r,p as s,_ as t,f as u};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./anchorOverlay-CBMAnDUt.js";import{n as r,r as i,t as a}from"./focusOrigin-BPTN3GY3.js";import{n as o}from"./devWarn-DXdRWZs3.js";import{t as s}from"./elementBase-DV9IZZCu.js";import{n as c}from"./formMirror-BMQTenSi.js";import{t as l}from"./iconGlyphs.g-CQcMoS6_.js";import{n as u,t as d}from"./listboxKeyNav-DMIvs9d6.js";import{a as f,i as p,n as m,r as h,t as g}from"./optionLabel-BaLjjB-0.js";import{i as _,t as v}from"./tokenCommit-BKckxgtg.js";var y=class extends s{static formAssociated=!0;_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}static get observedAttributes(){return[`placeholder`,`search-placeholder`,`searchable`,`disabled`,`icon`,`size`,`collapse-chips`,`aria-label`,`aria-invalid`,`allow-custom`,`custom-pattern`,`custom-invalid-message`]}constructor(){super(),this._values=[],this._optionsProp=null,this._active=-1,this._typeahead=``,this._typeaheadTimer=null,this._customError=``;try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){if(this._rendered)this._bindGlobal?.();else{if(!this._valuesInit&&!this._optionsProp&&!this._values.length){let e=this.getAttribute(`value`);if(e!=null&&e!==``)this._values=e.split(`,`).map(e=>e.trim()).filter(Boolean);else{let e=[...this.querySelectorAll(`:scope > wui-option[selected]`)].map(e=>e.getAttribute(`value`)??e.textContent.trim());e.length&&(this._values=e.map(String))}}this._valuesInit=!0,this._defaultCaptured||=(this._defaultValues=this._values.slice(),!0),this.render()}}formResetCallback(){this.values=(this._defaultValues||[]).slice();let e=this.querySelector(`[data-input]`);e&&(e.value=``),this._setCustomError(``)}attributeChangedCallback(e){e===`aria-invalid`?this._syncInvalid():e!==`custom-pattern`&&e!==`custom-invalid-message`&&this._rendered&&this.render()}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)||this._customError?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get values(){return this._values.slice()}set values(e){this._values=Array.isArray(e)?e.map(String):[],c(this,this._values),this._rendered&&(this._renderControl(),this._renderOptions(this._query()))}set options(e){this._optionsProp=Array.isArray(e)?e:null,this._rendered&&this._allowCustom?(this._renderControl(),this._renderOptions(this._query())):this.isConnected&&this.render()}get options(){return this._readOptions()}get validateCustom(){return this._validateCustom??null}set validateCustom(e){this._validateCustom=typeof e==`function`?e:null}get _allowCustom(){return this.hasAttribute(`allow-custom`)}_query(){let e=this.querySelector(this._allowCustom?`[data-input]`:`.search-select-input`);return e?e.value:``}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>{let t={value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[g]:!0,selected:e.hasAttribute(`selected`)};for(let[n,r]of x){let i=e.getAttribute(n);i&&(t[r]=i)}return e.hasAttribute(`disabled`)&&(t.disabled=!0),t}))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}_labelFor(e){let t=this._readOptions().find(t=>String(t.value)===String(e));return t?p(t):f(e)}_labelHtmlFor(e){let t=this._readOptions().find(t=>String(t.value)===String(e));return t?h(t):m(e)}render(){this._snapshotDeclared();let e=this._allowCustom,t=this.hasAttribute(`searchable`)&&!e,n=this.getAttribute(`search-placeholder`)||`Search…`,r=this.getAttribute(`icon`),i=this.getAttribute(`size`),a=i===`sm`?` search-select-sm`:i===`lg`?` search-select-lg`:``;c(this,this._values),this.id||=`wui-multiselect-${Math.random().toString(36).slice(2,9)}`;let o=`${this.id}-listbox`;this._listboxId=o;let s=this.hasAttribute(`disabled`);if(e){let e=`${this.id}-custom-error`;this.innerHTML=`
|
|
2
|
-
<div class="search-select${a}">
|
|
3
|
-
<div class="input search-select-control search-select-multi"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${s?` aria-disabled="true"`:``}>
|
|
4
|
-
${r?l(r,{className:`search-select-icon`}):``}
|
|
5
|
-
<div class="ms-chips" data-chips><input type="text" class="ms-input" data-input role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false" aria-controls="${E(o)}" aria-label="${E(this._accessibleName())}" aria-describedby="${E(e)}" autocomplete="off"${s?` disabled`:``} /></div>
|
|
6
|
-
${l(`chevron-down`,{className:`search-select-caret`})}
|
|
7
|
-
</div>
|
|
8
|
-
<div class="search-select-menu search-select-menu-fixed" hidden>
|
|
9
|
-
<div class="search-select-options" role="listbox" id="${E(o)}" aria-multiselectable="true" tabindex="-1"></div>
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
12
|
-
<div class="field-error wui-ms-custom-error" id="${E(e)}" aria-live="polite" hidden></div>`}else this.innerHTML=`
|
|
13
|
-
<div class="search-select${a}">
|
|
14
|
-
<div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${E(o)}" aria-label="${E(this._accessibleName())}"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${s?` aria-disabled="true"`:` tabindex="0"`}>
|
|
15
|
-
${r?l(r,{className:`search-select-icon`}):``}
|
|
16
|
-
<div class="ms-chips" data-chips></div>
|
|
17
|
-
${l(`chevron-down`,{className:`search-select-caret`})}
|
|
18
|
-
</div>
|
|
19
|
-
<div class="search-select-menu search-select-menu-fixed" hidden>
|
|
20
|
-
${t?`<div class="search-select-search">${l(`search`)}<input class="search-select-input" placeholder="${E(n)}" aria-label="${E(n)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${l(`x`)}</button></div>`:``}
|
|
21
|
-
<div class="search-select-options" role="listbox" id="${E(o)}" aria-multiselectable="true" tabindex="-1"></div>
|
|
22
|
-
<div class="search-select-empty" hidden>No matches</div>
|
|
23
|
-
</div>
|
|
24
|
-
</div>`;this._rendered=!0,this._customError=``,c(this,this._values),this._renderControl(),this._renderOptions(),this._wire()}_renderControl(){let e=this.querySelector(`[data-chips]`);if(!e)return;let t=this.getAttribute(`placeholder`)||`Select…`,n=this._allowCustom?e.querySelector(`[data-input]`):null,r=this._values.map(e=>`<span class="chip chip-sm"><span class="chip-label">${this._labelHtmlFor(e)}</span><button type="button" class="chip-remove" data-remove="${E(e)}" aria-label="Remove ${E(this._labelFor(e))}">${l(`x`)}</button></span>`).join(``);if(n){for(let t of[...e.querySelectorAll(`:scope > .chip`)])t.remove();n.insertAdjacentHTML(`beforebegin`,r),n.placeholder=this._values.length?``:t,this._collapseChips()}else this._values.length?(e.innerHTML=r,this._collapseChips()):e.innerHTML=`<span class="search-select-placeholder">${m(t)}</span>`}_collapseChips(){let e=this.querySelector(`[data-chips]`);if(!e||!this.hasAttribute(`collapse-chips`)||!this._values.length)return;e.querySelector(`.chip-more`)?.remove();let t=[...e.querySelectorAll(`:scope > .chip:not(.chip-more)`)];for(let e of t)e.style.display=``;if(!t.length)return;let n=e.clientWidth,r=e=>e.offsetLeft+e.offsetWidth;if(r(t[t.length-1])<=n)return;let i=document.createElement(`span`);i.className=`chip chip-sm chip-more`,i.textContent=`+${t.length}`,t[t.length-1].after(i);let a=i.offsetWidth+6,o=0;for(let e of t)if(r(e)<=n-a)o+=1;else break;o<1&&(o=1);for(let e=o;e<t.length;e+=1)t[e].style.display=`none`;i.textContent=`+${t.length-o}`}_matches(e,t){return p(e).toLowerCase().includes(t)||String(e.description??``).toLowerCase().includes(t)}_optionNamed(e){let t=e.trim().toLowerCase();return this._readOptions().find(e=>String(e.value??``).toLowerCase()===t||p(e).trim().toLowerCase()===t)}_renderOptions(e){let t=this.querySelector(`.search-select-options`),n=this.querySelector(`.search-select-empty`);if(!t)return;let r=(e||``).trim(),i=r.toLowerCase(),a=this._readOptions();i&&(a=a.filter(e=>this._matches(e,i)));let o=this._listboxId||`${this.id||`wui-multiselect`}-listbox`,s=this._allowCustom&&r&&!this._optionNamed(r),c=a.map((e,t)=>{let n=this._values.includes(String(e.value)),r=`${o}-opt-${t}`;return S(e)?C(e,r,n):`<button type="button" role="option" id="${E(r)}" class="search-select-option${n?` selected`:``}" data-value="${E(e.value)}" aria-selected="${n}"><span class="ms-opt-label">${h(e)}</span><span class="ms-check">${l(`check`)}</span></button>`});s&&c.push(`<button type="button" role="option" id="${E(`${o}-opt-${a.length}`)}" class="search-select-option search-select-option-custom" data-value="${E(r)}" data-custom="true" aria-selected="false">Add “${m(r)}”</button>`),t.innerHTML=c.join(``),n&&(n.hidden=a.length>0),this._active=-1,this._combobox()?.removeAttribute(`aria-activedescendant`),this._allowCustom&&this._syncCustomMenu?.(),this._reanchor?.()}_combobox(){return this._allowCustom?this.querySelector(`[data-input]`):this.querySelector(`.search-select-control`)}_setCustomError(e){this._customError=e||``;let t=this.querySelector(`.wui-ms-custom-error`),n=this.querySelector(`[data-input]`);t&&(t.textContent=this._customError,t.hidden=!this._customError),n&&(this._customError?n.setAttribute(`aria-invalid`,`true`):n.removeAttribute(`aria-invalid`)),this._syncInvalid()}_customRefusal(e){let t=this.getAttribute(`custom-invalid-message`)||`Enter a valid value.`,n=this.getAttribute(`custom-pattern`);if(n){let r=T(n);if(r&&!r.test(e))return t}let r=this._validateCustom;if(r){let n=r(e);return n===!0?``:typeof n==`string`&&n?n:t}return``}_commitTyped(e){let t=e.trim().replace(/,+$/,``).trim();if(!t)return``;let n=this._optionNamed(t),r;if(n){if(n.disabled)return n.disabledHint||this.getAttribute(`custom-invalid-message`)||`That option is not available.`;r=String(n.value)}else{let e=this._customRefusal(t);if(e)return e;r=t}let i=r.toLowerCase();return this._values.some(e=>e.toLowerCase()===i)||(this._values=[...this._values,r]),``}_wire(){this._teardown();let i=this.querySelector(`.search-select-control`),o=this.querySelector(`.search-select-menu`),s=this.querySelector(`.search-select-input`),l=this.querySelector(`.search-select-clear`),f=this.querySelector(`.search-select-options`),p=this._allowCustom,m=p?this.querySelector(`[data-input]`):null,h=m||i;if(!i||!o)return;let g=()=>this.hasAttribute(`disabled`),y=()=>n(i,o,{matchWidth:!0}),x=()=>[...this.querySelectorAll(`.search-select-option`)],S=()=>x().filter(e=>!e.hidden),C=(e,{reveal:t=!0}={})=>{let n=S();this._active=e,u(f,e>=0&&n[e]||null),e>=0&&n[e]?(t&&n[e].scrollIntoView({block:`nearest`}),h.setAttribute(`aria-activedescendant`,n[e].id)):h.removeAttribute(`aria-activedescendant`)},w=!1,T=()=>p?w:!o.hidden,E=()=>{let e=w&&x().length>0,t=o.hidden;o.hidden=!e,h.setAttribute(`aria-expanded`,String(e)),i.classList.toggle(`open`,e),e&&t&&y()};this._syncCustomMenu=p?E:null;let D=()=>{T()&&y()},O=()=>{g()||(e(this,D),p?(w=!0,E()):(o.hidden=!1,i.setAttribute(`aria-expanded`,`true`),i.classList.add(`open`),y(),s&&(s.value=``,this._renderOptions(``),s.focus())))},k=()=>{let e=p?w:i.getAttribute(`aria-expanded`)===`true`;p?(w=!1,E()):(o.hidden=!0,i.setAttribute(`aria-expanded`,`false`),i.classList.remove(`open`)),C(-1),clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null,this._typeahead=``,t(this),e&&this.dispatchEvent(new Event(`wui-multiselect:close`,{bubbles:!0}))},A=()=>{c(this,this._values),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},j=e=>{let t=String(e);if(this._values.includes(t))this._values=this._values.filter(e=>e!==t);else if(p&&this._values.some(e=>e.toLowerCase()===t.toLowerCase()))return;else this._values=[...this._values,t];this._renderControl(),this._renderOptions(this._query()),A()},M=e=>{this._values=this._values.filter(t=>t!==String(e)),this._renderControl(),this._renderOptions(this._query()),A()},N=(e,{quiet:t=!1}={})=>{let n=this._values.length,r=v(e,b)?_(e,b):[e],i=[],a=``;for(let e of r){let t=this._commitTyped(e);t&&(i.push(e.trim()),a||=t)}t&&i.length||(m.value=i.join(`, `),this._setCustomError(a),this._values.length!==n&&(this._renderControl(),A()),this._renderOptions(m.value))},P=e=>{e&&e.getAttribute(`aria-disabled`)!==`true`&&(e.dataset.custom===`true`?N(e.dataset.value):(j(e.dataset.value),m?.value&&(m.value=``,this._setCustomError(``),this._renderOptions(``))))};i.addEventListener(`click`,e=>{if(g())return;let t=e.target.closest(`[data-remove]`);if(t)e.stopPropagation(),M(t.dataset.remove),m?.focus();else if(m){let t=T();e.target!==m&&m.focus(),e.target===m||!t?O():k()}else T()?k():O()}),f.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&(P(t),(m||s)?.focus())}),f.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&!t.classList.contains(`is-active`)&&C(S().indexOf(t),{reveal:!1})}),f.addEventListener(`mouseleave`,()=>C(-1)),f.addEventListener(`error`,e=>{e.target?.classList?.contains(`avatar-img`)&&e.target.remove()},!0),s?.addEventListener(`input`,()=>{this._renderOptions(s.value),l&&(l.hidden=!s.value),C(-1)}),this._navHandler=d({getVisibleOptions:S,getActive:()=>this._active,setActive:e=>C(e),onEnter:e=>{e?P(e):m?.value.trim()&&N(m.value)},onEscape:()=>{this._navHandler.clearTypeahead(),k(),m||i.focus()}});let F=e=>{let t=m||s;e.key===`Backspace`&&!t?.value&&this._values.length?M(this._values[this._values.length-1]):(e.key===`Escape`&&T()&&(e.preventDefault(),e.stopPropagation()),this._navHandler.handler(e))};if(s?.addEventListener(`keydown`,F),l?.addEventListener(`click`,()=>{s.value=``,this._renderOptions(``),l.hidden=!0,s.focus()}),m){let e=e=>{e.target!==m&&e.preventDefault()};f.addEventListener(`mousedown`,e),i.addEventListener(`mousedown`,e),r(),m.addEventListener(`focus`,()=>{a()&&O()}),m.addEventListener(`input`,()=>{this._customError&&this._setCustomError(``),this._renderOptions(m.value),O()}),m.addEventListener(`keydown`,e=>{if(e.key===`,`&&m.value.trim())e.preventDefault(),N(m.value);else if(e.key===`Enter`){if(this._active<0&&!m.value.trim())return;this._navHandler.handler(e)}else e.key!==`ArrowDown`&&e.key!==`ArrowUp`||T()||O(),F(e)}),m.addEventListener(`paste`,e=>{let t=e.clipboardData?.getData(`text/plain`)??``;v(t,b)&&(e.preventDefault(),N(`${m.value}${t}`))}),m.addEventListener(`blur`,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(m.value.trim()&&N(m.value,{quiet:!0}),k())})}else i.addEventListener(`keydown`,e=>{T()?F(e):(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),O())});this._bindGlobal=()=>{this._teardown(),!this._ro&&typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this._collapseChips()),this._ro.observe(this)),this._onDocClick=e=>{T()&&!this.contains(e.target)&&k()},document.addEventListener(`click`,this._onDocClick),T()&&e(this,D)},this._bindGlobal()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),t(this),this._navHandler?.teardown()}disconnectedCallback(){this._teardown(),this._ro?.disconnect(),this._ro=null}},b=[`,`,`;`,`
|
|
25
|
-
`,` `],x=[[`description`,`description`],[`avatar`,`avatar`],[`initials`,`initials`],[`disabled-hint`,`disabledHint`]],S=e=>!!(e.description||e.avatar||e.initials||e.disabled||e.disabledHint),C=(e,t,n)=>{let r=!!e.disabled,a=e.description?`<span class="wui-opt-desc">${m(e.description)}</span>`:``,o=e.disabledHint&&r?`<span class="wui-opt-hint">${m(e.disabledHint)}</span>`:``;return`<button type="button" role="option" id="${E(t)}" class="search-select-option wui-opt-rich${n?` selected`:``}" data-value="${E(e.value)}" aria-selected="${n}"${r?` aria-disabled="true"`:``}><span class="ms-opt-label"><span class="wui-opt-name">${h(e)}</span>${a}</span>${o}${i(e)}<span class="ms-check">${l(`check`)}</span></button>`},w=/* @__PURE__ */ new Map,T=e=>{if(w.has(e))return w.get(e);let t=null;try{t=RegExp(`^(?:${e})$`,`u`)}catch{o(`<wui-multiselect> custom-pattern is not a valid regular expression and is ignored: ${e}`)}return w.set(e,t),t},E=e=>String(e??``).replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`);export{y as t};
|
package/dist/WuiOtp-Hw6srogj.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./elementBase-DV9IZZCu.js";import{t}from"./formMirror-BMQTenSi.js";var n=/[^0-9]/g,r=/[^0-9a-zA-Z]/g,i=class extends e{static formAssociated=!0;static get observedAttributes(){return[`value`,`length`,`mode`,`disabled`,`aria-label`]}get length(){let e=Number.parseInt(this.getAttribute(`length`)??`6`,10);return Number.isFinite(e)&&e>0?e:6}set length(e){this.setAttribute(`length`,String(e))}get mode(){return this.getAttribute(`mode`)===`alphanumeric`?`alphanumeric`:`numeric`}set mode(e){this.setAttribute(`mode`,String(e??`numeric`))}get value(){return this._value??``}set value(e){this._value=this._clean(e),t(this,this._value),this._paint()}_clean(e){return(e==null?``:String(e)).replace(this.mode===`alphanumeric`?r:n,``).slice(0,this.length)}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){this._rendered?this._onSelectionChange&&document.addEventListener(`selectionchange`,this._onSelectionChange):(this._defaultCaptured||=(this._defaultValue=this._value,!0),this.render())}formResetCallback(){this._value=this._defaultValue||``,t(this,this._value),this._paint()}attributeChangedCallback(e,n,r){this._rendered&&(e===`value`?(this._value=this._clean(r),t(this,this._value),this._paint()):this.render())}render(){this._value=this._clean(this.getAttribute(`value`)??this._value);let e=this.length,n=this.mode===`numeric`,r=this.hasAttribute(`disabled`),i=Array.from({length:e},()=>`<span class="otp-slot" aria-hidden="true"></span>`).join(``),a=this.getAttribute(`aria-label`),o=a?` aria-label="${a.replace(/"/g,`"`)}"`:``;this.innerHTML=`
|
|
2
|
-
<div class="otp">
|
|
3
|
-
<input
|
|
4
|
-
class="otp-field"
|
|
5
|
-
type="text"
|
|
6
|
-
autocomplete="one-time-code"
|
|
7
|
-
inputmode="${n?`numeric`:`text`}"
|
|
8
|
-
${n?`pattern="[0-9]*"`:``}${o}
|
|
9
|
-
autocapitalize="off"
|
|
10
|
-
autocorrect="off"
|
|
11
|
-
spellcheck="false"
|
|
12
|
-
${r?`disabled`:``} />
|
|
13
|
-
<div class="otp-slots" aria-hidden="true">${i}</div>
|
|
14
|
-
</div>`,this._rendered=!0,t(this,this._value),this._wire(),this._paint()}_refs(){return{input:this.querySelector(`.otp-field`),slots:[...this.querySelectorAll(`.otp-slot`)]}}_paint(){let{input:e,slots:t}=this._refs();if(!e||!t.length)return;e.value!==this._value&&(e.value=this._value);let n=e.selectionStart??this._value.length,r=Math.min(n,t.length-1),i=document.activeElement===e;t.forEach((e,t)=>{e.textContent=this._value[t]??``,e.classList.toggle(`filled`,!!this._value[t]),e.classList.toggle(`active`,i&&t===r)})}_wire(){let{input:e}=this._refs();if(!e)return;let n=e=>{let n=this._clean(e),r=n!==this._value;this._value=n,t(this,this._value),this._paint(),r&&this.dispatchEvent(new Event(`change`,{bubbles:!0})),r&&n.length===this.length&&this.dispatchEvent(new CustomEvent(`complete`,{bubbles:!0,detail:n}))};e.addEventListener(`input`,()=>{let t=e.value;if(this._value.length===this.length&&t.length>this._value.length&&t.startsWith(this._value)){let e=this._clean(t.slice(this._value.length));if(e){n(e);return}}n(t)}),e.addEventListener(`paste`,e=>{let t=e.clipboardData?.getData(`text`);t!=null&&(e.preventDefault(),n(t))});for(let t of[`keyup`,`click`,`blur`,`select`])e.addEventListener(t,()=>this._paint());e.addEventListener(`focus`,()=>{this._value.length===this.length&&e.select(),this._paint()}),this._onSelectionChange&&document.removeEventListener(`selectionchange`,this._onSelectionChange),this._onSelectionChange=()=>{document.activeElement===e&&this._paint()},document.addEventListener(`selectionchange`,this._onSelectionChange)}disconnectedCallback(){this._onSelectionChange&&document.removeEventListener(`selectionchange`,this._onSelectionChange)}};export{i as t};
|