@webority/ui-elements 0.170.0 → 0.171.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/dist/{WuiCodeBlock-DTckR_z3.js → WuiCodeBlock-Du-JZO3A.js} +1 -1
- package/dist/{WuiCommandPalette-CSzl5yGf.js → WuiCommandPalette-BKW0e-ho.js} +1 -1
- package/dist/{WuiCommentThread-RB100aB1.js → WuiCommentThread-DZEYOHsk.js} +1 -1
- package/dist/{WuiContextMenu-ClMVFeos.js → WuiContextMenu-DvYwIicr.js} +1 -1
- package/dist/{WuiDatePicker-u0oZ6fJj.js → WuiDatePicker-DxPethoe.js} +1 -1
- package/dist/{WuiDateRange-CtWUcQ-g.js → WuiDateRange-zPmNewOW.js} +1 -1
- package/dist/{WuiDrawer-n8WlVPq_.js → WuiDrawer-BMkPnEFz.js} +1 -1
- package/dist/{WuiDropdown-D2jEbCfv.js → WuiDropdown-B9WeT-gH.js} +1 -1
- package/dist/{WuiGantt-BsQUCR2U.js → WuiGantt-DaEgtdOU.js} +1 -1
- package/dist/{WuiHoverCard-DmApQa9R.js → WuiHoverCard-D6JBAqdW.js} +1 -1
- package/dist/{WuiLightbox-cm5eHcMK.js → WuiLightbox-BnLEEkj1.js} +1 -1
- package/dist/{WuiMentionInput-D7HC7U2Q.js → WuiMentionInput-DvKw8MXS.js} +1 -1
- package/dist/{WuiModal-DuBerYTv.js → WuiModal-DMGgOCBU.js} +1 -1
- package/dist/{WuiNavigationMenu-VG-ZJstT.js → WuiNavigationMenu-CfD0FWvt.js} +1 -1
- package/dist/{WuiNotificationCenter-hluDIzO8.js → WuiNotificationCenter-DgcJYPV3.js} +1 -1
- package/dist/{WuiPhone-C03OuI7-.js → WuiPhone-BFb_LjJa.js} +1 -1
- package/dist/{WuiPopover-BxQj74kE.js → WuiPopover-BYO_H-fk.js} +1 -1
- package/dist/{WuiSelect-DpZbgU4v.js → WuiSelect-iE3EVUWK.js} +1 -1
- package/dist/{WuiShortcuts-CSFOyAKI.js → WuiShortcuts-Crj8lFVz.js} +1 -1
- package/dist/WuiTimePicker-BsnPOYNw.js +9 -0
- package/dist/{WuiTour-Beop0n-H.js → WuiTour-C2CRQvS7.js} +1 -1
- package/dist/{WuiTree-DGclk55_.js → WuiTree-DGZSXgBh.js} +1 -1
- package/dist/{WuiTreePicker-CBhasmC5.js → WuiTreePicker-CkTfNUQx.js} +1 -1
- package/dist/{WuiWhatsNew-BtWJkzTv.js → WuiWhatsNew-DjnQWqlF.js} +1 -1
- package/dist/{WuiWizardStep-Ce6O_8oc.js → WuiWizardStep-CryQ5BlK.js} +1 -1
- package/dist/{avatarHtml-BtbN7cA5.js → avatarHtml-BWlA0cm-.js} +1 -1
- package/dist/{chips-IbfKMhVk.js → chips-B4ZNRO-h.js} +1 -1
- package/dist/drawerDiscard-B4OcoR8S.js +1 -0
- 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/context-menu.js +1 -1
- package/dist/elements/date-range.js +1 -1
- package/dist/elements/datepicker.js +1 -1
- package/dist/elements/drawer.js +1 -1
- package/dist/elements/dropdown.js +1 -1
- package/dist/elements/filter-popover.js +1 -1
- package/dist/elements/gantt.js +1 -1
- package/dist/elements/hover-card.js +1 -1
- package/dist/elements/lightbox.js +1 -1
- package/dist/elements/mention-input.js +1 -1
- package/dist/elements/modal.js +1 -1
- package/dist/elements/navigation-menu.js +1 -1
- package/dist/elements/notification-center.js +1 -1
- package/dist/elements/phone.js +1 -1
- package/dist/elements/popover.js +1 -1
- package/dist/elements/select.js +1 -1
- package/dist/elements/shortcuts.js +1 -1
- package/dist/elements/timepicker.js +1 -1
- package/dist/elements/tour.js +1 -1
- package/dist/elements/tree-picker.js +1 -1
- package/dist/elements/tree.js +1 -1
- package/dist/elements/whats-new.js +1 -1
- package/dist/elements/wizard.js +1 -1
- package/dist/fileViewer.g-D5lbrn8g.js +1 -0
- package/dist/{fileViewerImage-DT0a9KaL.js → fileViewerImage-uL9m83k1.js} +1 -1
- package/dist/{fileViewerMedia-BFNxdaYX.js → fileViewerMedia-cfmycjzl.js} +1 -1
- package/dist/{fileViewerPdf-Boo6uXQO.js → fileViewerPdf-BsSc-9fL.js} +1 -1
- package/dist/{filterPopover-BVBxgtc5.js → filterPopover-C_oDfQBg.js} +1 -1
- package/dist/helpers.js +1 -1
- package/dist/iconGlyphs.g-BUF97bUu.js +1 -0
- package/dist/nativeOverlay-DGady-wN.js +1 -0
- package/dist/{optionLabel-B2cU4Ax0.js → optionLabel-CWMhBkdO.js} +1 -1
- package/dist/{search-BVox4aaA.js → search-w5M6FzD9.js} +1 -1
- package/dist/server.js +1 -1
- package/dist/text/en.json +1 -0
- package/dist/text.js +1 -1
- package/dist/{themeTransition-CDB0Mx61.js → themeTransition-CA1qzCZk.js} +1 -1
- package/dist/timePicker.g-IEczeE48.js +1 -0
- 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 +1 -1
- package/dist/ui-elements/drawer.global.js +1 -1
- package/dist/ui-elements/dropdown.global.js +1 -1
- package/dist/ui-elements/entry-grid.global.js +1 -1
- package/dist/ui-elements/gantt.global.js +1 -1
- package/dist/ui-elements/glyphs.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 +1 -1
- package/dist/ui-elements/lightbox.global.js +1 -1
- package/dist/ui-elements/markdown.global.js +1 -1
- package/dist/ui-elements/org-tree.global.js +1 -1
- package/dist/ui-elements/phone.global.js +1 -1
- package/dist/ui-elements/popover.global.js +1 -1
- package/dist/ui-elements/saved-views.global.js +1 -1
- package/dist/ui-elements/select-chips.global.js +1 -1
- package/dist/ui-elements/select-recents.global.js +1 -1
- package/dist/ui-elements/select-search.global.js +1 -1
- package/dist/ui-elements/select-window.global.js +1 -1
- package/dist/ui-elements/slider.global.js +1 -1
- package/dist/ui-elements/sortable.global.js +1 -1
- package/dist/ui-elements/status-icon.global.js +1 -1
- package/dist/ui-elements/timepicker.global.js +6 -6
- package/dist/ui-elements/tour.global.js +1 -1
- package/dist/ui-elements/tree-picker.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 +8 -8
- 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/package.json +5 -5
- package/types/WuiTimePicker.d.ts +3 -1
- package/types/nativeOverlay.d.ts +1 -1
- package/types/server/remoteModal.d.ts +6 -2
- package/types/text/web/timePicker.g.d.ts +1 -0
- package/dist/WuiTimePicker-BxcImgm1.js +0 -9
- package/dist/drawerDiscard-CM6a_8-l.js +0 -1
- package/dist/fileViewer.g-DQ-YkF8l.js +0 -1
- package/dist/iconGlyphs.g-DxSJLQJ8.js +0 -1
- package/dist/nativeOverlay-D3VmY8qn.js +0 -1
- package/dist/timePicker.g-DM61i-ZE.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./elementBase-Cxeyx0tU.js";import{h as t,o as n,p as r,u as i}from"./nativeOverlay-
|
|
1
|
+
import{t as e}from"./elementBase-Cxeyx0tU.js";import{h as t,o as n,p as r,u as i}from"./nativeOverlay-DGady-wN.js";var a=class extends e{_doc;_release;_opener;_returnTo;_session;_closing;_reopen;static get observedAttributes(){return[`open`,`static`,`no-escape`]}constructor(){super(),this._doc=null,this._release=null,this._opener=null,this._returnTo=null,this._session=0,this._closing=!1,this._reopen=!1}connectedCallback(){this._doc=this.ownerDocument,t(this._doc),this.hasAttribute(`open`)&&this._open()}disconnectedCallback(){this._session++,this._closing=!1,this._reopen=!1;let e=this.querySelector(`dialog`);this._release&&e instanceof HTMLDialogElement&&e.close(),this._releaseDialog(),this._opener=null,this._returnTo=null,this._doc=null}attributeChangedCallback(e){this._doc&&e===`open`&&(this.hasAttribute(`open`)?this._open():this._close())}get isOpen(){return this.hasAttribute(`open`)}show(e){e&&(this._opener=e),this.setAttribute(`open`,``)}hide(){this.removeAttribute(`open`)}_open(){if(this._closing){this._reopen=!0;return}if(this._release)return;let e=++this._session,t=this._opener;if(this._returnTo=t,this._opener=null,this.dispatchEvent(new CustomEvent(`wui-modal-open`,{bubbles:!0,detail:{trigger:t}})),!this.isOpen)return;let n=this._dialog();this._release=i(n,{escape:!this.hasAttribute(`no-escape`),backdrop:!this.hasAttribute(`static`),focus:`first-control`,onRequestClose:e=>this._requestClose(e)}),this._settle(e,n)}_close(){if(this._closing){this._reopen=!1;return}if(!this._release)return;this._closing=!0;let e=this._session,t=this._dialog();n(t).then(()=>{e===this._session&&(this._closing=!1,this._releaseDialog(),r(this._returnTo,t),this._returnTo=null,this.dispatchEvent(new CustomEvent(`wui-modal-closed`,{bubbles:!0})),this._reopen&&(this._reopen=!1,this.isOpen&&this._open()))})}_settle(e,t){let n=t.getAnimations?.()??[];n.length?Promise.allSettled(n.map(e=>e.finished)).then(()=>{e===this._session&&this.isOpen&&this._announceOpened()}):this._announceOpened()}_announceOpened(){this.dispatchEvent(new CustomEvent(`wui-modal-opened`,{bubbles:!0}))}_requestClose(e){this.dispatchEvent(new CustomEvent(`wui-modal-close`,{bubbles:!0,cancelable:!0,detail:{reason:e}}))&&this.removeAttribute(`open`)}_releaseDialog(){let e=this._release;this._release=null,e?.()}_dialog(){let e=this.querySelector(`dialog`);if(!(e instanceof HTMLDialogElement))throw TypeError(`wui-modal has no <dialog>`);return e}};export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./dom-Do1pAA12.js";import{t}from"./elementBase-Cxeyx0tU.js";import{a as n,l as r,s as i}from"./nativeOverlay-
|
|
1
|
+
import{r as e}from"./dom-Do1pAA12.js";import{t}from"./elementBase-Cxeyx0tU.js";import{a as n,l as r,s as i}from"./nativeOverlay-DGady-wN.js";var a=`.wui-nav-menu-link`,o=`(max-width: 767.98px)`,s=`data-open`,c=e=>e instanceof Element?e:e instanceof Node?e.parentElement:null,l=e=>[...e].filter(e=>e instanceof HTMLElement),u=e=>{let t=e.children[0];if(!(t instanceof HTMLElement))throw Error(`Navigation entry has no control.`);return t},d=e=>{let t=e.children[1];return t instanceof HTMLElement?t:null},f=(e,t,n)=>{let r=e[t];if(r===void 0)throw Error(n);return r},p=class extends t{constructor(){super(),this._onClick=e=>this._handleClick(e),this._onKeyDown=e=>this._handleKeyDown(e),this._onFocusOut=e=>{let t=this._openItem(),n=e.relatedTarget;t&&n instanceof Node&&!t.contains(n)&&this._set(t,!1)},this._onPointerDown=()=>{this._pressedOpen=this._openItem()},this._onModeChange=()=>{let e=this._openItem();e&&this._set(e,!1)},this._onOutsidePress=e=>{let t=this._openItem();t&&!e.composedPath().includes(t)&&this._set(t,!1)},this._pressedOpen=null,this._media=null}connectedCallback(){this._teardown(),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`pointerdown`,this._onPointerDown,!0),this._media=window.matchMedia(o),this._media.addEventListener(`change`,this._onModeChange)}disconnectedCallback(){this._teardown()}open(e){let t=this._items().find(t=>{let n=t.children[0];return n instanceof HTMLElement&&this._isTrigger(n)&&n.dataset.key===e});t&&this._set(t,!0)}close(e=!1){let t=this._openItem();t&&(this._set(t,!1),e&&u(t).focus({preventScroll:!0}))}_items(){return l(this.querySelectorAll(`.wui-nav-menu-item`))}_openItem(){return this._items().find(e=>{let t=d(e);return t!==null&&this._isOpen(t)})??null}_isOpen(e){return e.hasAttribute(s)||i(e)}_isTrigger(e){return!!e?.classList.contains(`wui-nav-menu-trigger`)}_entries(){return this._items().map(u)}_links(e){let t=d(e);return t?l(t.querySelectorAll(a)):[]}_set(e,t){let a=d(e);if(!a)return;let c=u(e);if(t){let t=this._openItem();if(t&&t!==e&&this._set(t,!1),this._isOpen(a))return;c.setAttribute(`aria-expanded`,`true`),window.matchMedia(o).matches?(a.setAttribute(s,``),document.addEventListener(`pointerdown`,this._onOutsidePress,!0)):r(c,a,{mode:`auto`,below:!0,flipAlign:!0,onClosed:()=>this._settle(e)}),this._emit(c,!0)}else a.removeAttribute(s),document.removeEventListener(`pointerdown`,this._onOutsidePress,!0),i(a)&&n(a),this._settle(e)}_settle(e){let t=u(e);t.getAttribute(`aria-expanded`)!==`false`&&(t.setAttribute(`aria-expanded`,`false`),this._emit(t,!1))}_emit(e,t){this.dispatchEvent(new CustomEvent(`wui-navigation-menu:toggle`,{bubbles:!0,detail:{key:e.dataset.key??null,open:t}}))}_handleClick(t){let n=this._pressedOpen;this._pressedOpen=null;let r=c(t.target),i=r?.closest(`.wui-nav-menu-trigger`);if(i&&this.contains(i)){let t=e(i.parentElement,`Navigation trigger has no entry.`),r=e(d(t),`Navigation entry has no panel.`),a=n===t||this._isOpen(r);this._set(t,!a);return}let o=r?.closest(a);o&&this.contains(o)&&this.close()}_handleKeyDown(t){if(this._pressedOpen=null,t.altKey||t.ctrlKey||t.metaKey)return;let n=c(t.target)?.closest(`.wui-nav-menu-trigger, .wui-nav-menu-toplink, .wui-nav-menu-link`);if(!(n instanceof HTMLElement)||!this.contains(n))return;let r=this._openItem();if(t.key===`Escape`){if(!r||!d(r)?.hasAttribute(s))return;t.preventDefault(),t.stopPropagation();let e=r.contains(n);this._set(r,!1),e&&u(r).focus({preventScroll:!0});return}if(n.matches(a)){this._linkKey(t,n);return}let i=this._entries(),o=i.indexOf(n);if(t.key===`ArrowRight`||t.key===`ArrowLeft`||t.key===`Home`||t.key===`End`){t.preventDefault();let e=t.key===`Home`?0:t.key===`End`?i.length-1:(o+(t.key===`ArrowRight`?1:-1)+i.length)%i.length;r&&this._set(r,!1),f(i,e,`Navigation has no entry to focus.`).focus({preventScroll:!0})}else if(t.key===`ArrowDown`&&this._isTrigger(n)){t.preventDefault();let r=e(n.parentElement,`Navigation trigger has no entry.`);this._set(r,!0),f(this._links(r),0,`Navigation panel has no link to focus.`).focus({preventScroll:!0})}}_linkKey(t,n){let r=e(n.closest(`.wui-nav-menu-item`),`Navigation link has no entry.`),i=this._links(r),a=i.indexOf(n);t.key===`ArrowDown`||t.key===`ArrowUp`?(t.preventDefault(),f(i,(a+(t.key===`ArrowDown`?1:-1)+i.length)%i.length,`Navigation panel has no link to focus.`).focus({preventScroll:!0})):t.key===`Home`?(t.preventDefault(),f(i,0,`Navigation panel has no link to focus.`).focus({preventScroll:!0})):t.key===`End`&&(t.preventDefault(),f(i,i.length-1,`Navigation panel has no link to focus.`).focus({preventScroll:!0}))}_teardown(){for(let e of this._items()){let t=d(e);if(!t)continue;let r=t.hasAttribute(s);t.removeAttribute(s),n(t),r&&this._settle(e)}this._media?.removeEventListener(`change`,this._onModeChange),this._media=null,document.removeEventListener(`pointerdown`,this._onOutsidePress,!0),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),this.removeEventListener(`pointerdown`,this._onPointerDown,!0)}};export{p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./dom-Do1pAA12.js";import{t}from"./elementBase-Cxeyx0tU.js";import{t as n}from"./isDrawn-BbF4phmB.js";import{a as r,l as i,m as a,s as o}from"./nativeOverlay-
|
|
1
|
+
import{r as e}from"./dom-Do1pAA12.js";import{t}from"./elementBase-Cxeyx0tU.js";import{t as n}from"./isDrawn-BbF4phmB.js";import{a as r,l as i,m as a,s as o}from"./nativeOverlay-DGady-wN.js";import{o as s,r as c,s as l}from"./notificationDays-DQlrEZ3z.js";import{l as u}from"./wuiHttp-DGbD7Fra.js";import{r as d}from"./textStore-opIEM4lu.js";import{t as f}from"./notificationCentre.g-UsAurkUz.js";var p=()=>d(`notificationCentre`,f),m=`.wui-notification-center-trigger`,h=`.wui-notification-center-panel`,g=`.wui-notification-center-count`,_=`.wui-notification-center-live`,v=`.wui-notification-center-markall`,y=`.wui-notification-center-item`,b=`wui-notification-center-item-read`,x=`.wui-notification-center-unread-label`,S=`.app-tabs`,C=`.wui-notification-center-tabs [role='tablist']`,w=`.wui-notification-center-tabs [role='tab']`,T=`.wui-notification-center-empty`,E=`(max-width: 767.98px)`,D={ArrowDown:1,ArrowUp:-1,Home:`first`,End:`last`},O=e=>!!e,k=()=>({forbidden:p().forbiddenMessage,client:p().clientMessage,validation:p().clientMessage,server:p().serverMessage,network:p().networkMessage}),A=(e,t)=>{let n=e.querySelector(t);return n instanceof HTMLElement?n:null},j=(e,t)=>[...e.querySelectorAll(t)].filter(e=>e instanceof HTMLElement),M=class extends t{constructor(){super(),this._unread=0,this._busy=!1,this._sheet=!1,this._awaitChildren=null,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onToggle=e=>{e.type===`toggle`&&`newState`in e&&e.newState===`closed`&&this._closedByBrowser()},this._onFocusOut=e=>{let t=e.relatedTarget;t instanceof Node&&!this.contains(t)&&this.close()}}static get observedAttributes(){return[`open`]}connectedCallback(){this._unread=this._initialUnread(),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`toggle`,this._onToggle,!0),this.isOpen&&(A(this,h)===null||A(this,m)===null)?(this._awaitChildren=new MutationObserver(()=>this._finishAwaitedOpen()),this._awaitChildren.observe(this,{childList:!0})):(this._syncOpen(),this.isOpen&&this._showPanel())}disconnectedCallback(){this._disarmAwait(),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),this.removeEventListener(`toggle`,this._onToggle,!0);let e=A(this,h);e&&r(e)}attributeChangedCallback(e,t,n){e===`open`&&t!==n&&(this._awaitChildren?n===null&&this._disarmAwait():this.isConnected&&(n===null?this._hidePanel():this._showPanel()))}_finishAwaitedOpen(){A(this,h)!==null&&A(this,m)!==null&&(this._disarmAwait(),this._syncOpen(),this._showPanel())}_disarmAwait(){this._awaitChildren?.disconnect(),this._awaitChildren=null}_showPanel(){let t=e(A(this,h),`<wui-notification-center> needs its panel to open.`),n=e(A(this,m),`<wui-notification-center> needs its trigger to open.`);o(t)||(this._sheet=window.matchMedia(E).matches,this._sheet?a(t,!0):i(n,t,{mode:`auto`,onClosed:()=>this._closedByBrowser()}),o(t)&&this._layoutTabs())}_hidePanel(){let e=A(this,h);e&&o(e)&&(this._sheet?a(e,!1):r(e))}_closedByBrowser(){if(!this.isConnected||!this.hasAttribute(`open`))return;let e=A(this,h);this.close({restoreFocus:e?.contains(this.ownerDocument.activeElement)??!1})}get isOpen(){return this.hasAttribute(`open`)}open(){this.isOpen||(e(A(this,h),`<wui-notification-center> needs its panel to open.`),e(A(this,m),`<wui-notification-center> needs its trigger to open.`),this.setAttribute(`open`,``),this._syncOpen(),A(this,h)?.focus(),this._announceToggle())}close({restoreFocus:e=!1}={}){this.isOpen&&(this.removeAttribute(`open`),this._syncOpen(),e&&A(this,m)?.focus(),this._announceToggle())}toggle(){this.isOpen?this.close():this.open()}_announceToggle(){this.dispatchEvent(new CustomEvent(`wui:notification-center:toggle`,{bubbles:!0,detail:{open:this.isOpen}}))}_syncOpen(){this.querySelector(m)?.setAttribute(`aria-expanded`,this.isOpen?`true`:`false`)}_initialUnread(){let e=Number.parseInt(this.getAttribute(`unread`)??``,10);return Number.isInteger(e)&&e>=0?e:this.querySelectorAll(`${y}:not(.${b}):not([data-archived="true"])`).length}_click(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(w);if(n instanceof HTMLElement&&this.contains(n)){if(this.hasAttribute(`controlled`))return;this._pickTab(n);return}let r=t.closest(`${m}, ${v}, ${y}`);r instanceof HTMLElement&&this.contains(r)&&(r.matches(m)?this.toggle():this.hasAttribute(`controlled`)||(r.matches(v)?this._markAll():this._markItem(r)))}_key(e){if(!this.isOpen)return;let t=e.target;if(!(t instanceof Element))throw Error(`Keyboard event target is not an element.`);if(!this.querySelector(h)?.contains(t)||t.closest(S))return;let r=D[e.key];if(r===void 0)return;let i=j(this,y).filter(n);if(i.length===0)return;let a=t.closest(y),o=a instanceof HTMLElement?i.indexOf(a):-1,s;s=r===`first`?0:r===`last`?i.length-1:o===-1?r===1?0:i.length-1:Math.min(i.length-1,Math.max(0,o+r)),e.preventDefault(),i[s]?.focus()}_markItem(e){e.classList.contains(b)||(this._applyRead(e),e.dataset.archived!==`true`&&(this._unread=Math.max(0,this._unread-1)),this._render(),this._say(l(this._unread)),this._emitRead([e.dataset.id].filter(O),!1))}async _markAll(){if(this._busy)return;let e=j(this,`${y}:not(.${b})`);if(e.length===0&&this._unread===0)return;let t=e.map(e=>e.dataset.id).filter(O),n=this.getAttribute(`read-action`);if(n){this._setBusy(!0);let e=new URLSearchParams;for(let n of t)e.append(`ids`,n);let r=await u(n,{method:`POST`,body:e});if(this._setBusy(!1),!r.ok){if(r.kind===`session`||r.kind===`aborted`)return;let e=r.kind,t=r.message||k()[e]||p().serverMessage;this._say(t),this.dispatchEvent(new CustomEvent(`wui:notification-center:failed`,{bubbles:!0,detail:{kind:e,message:t}}));return}}for(let t of e)this._applyRead(t);this._unread=0,this._render(),this._say(p().allReadText),this._emitRead(t,!0)}_pickTab(e){let t=e.closest(C);if(t instanceof HTMLElement){for(let n of j(t,w)){let t=n===e;n.classList.toggle(`active`,t),n.setAttribute(`aria-selected`,t?`true`:`false`),n.setAttribute(`tabindex`,t?`0`:`-1`)}this._layoutTabs(),this._filterItems(e.dataset.key)}}_layoutTabs(){for(let e of j(this,C)){let t=A(e,`.app-tab.active`);t&&(e.style.setProperty(`--wui-tab-x`,`${t.offsetLeft}px`),e.style.setProperty(`--wui-tab-w`,`${t.offsetWidth}px`)),e.setAttribute(`data-wui-tabs`,``)}}_filterItems(e){let t=!1;for(let n of j(this,y)){let r=n.dataset.archived===`true`,i=n.classList.contains(b),a=e===`archived`?r:!r&&(e!==`unread`||!i);a&&(t=!0);let o=n.closest(`li`);o&&(o.hidden=!a)}for(let e of j(this,`.wui-notification-center-list section`))e.hidden=[...e.querySelectorAll(`li`)].every(e=>e.hidden);let n=A(this,T);n&&(n.hidden=t)}_applyRead(e){e.classList.add(b),e.querySelector(x)?.remove()}_setBusy(e){this._busy=e;let t=this.querySelector(v);t instanceof HTMLButtonElement&&(t.disabled=e||this._unread===0,e?t.setAttribute(`aria-busy`,`true`):t.removeAttribute(`aria-busy`))}_render(){let e=A(this,g);e&&(e.textContent=c(this._unread),e.hidden=this._unread===0),this.querySelector(m)?.setAttribute(`aria-label`,s(this.getAttribute(`label`)||p().label,this._unread));let t=this.querySelector(v);t instanceof HTMLButtonElement&&(t.disabled=this._unread===0)}_say(e){let t=this.querySelector(_);t&&(t.textContent=e)}_emitRead(e,t){this.dispatchEvent(new CustomEvent(`wui:notification-center:read`,{bubbles:!0,detail:{ids:e,all:t}}))}};export{M as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,t}from"./countries-DQL9nAUt.js";import{t as n}from"./devWarn-DXdRWZs3.js";import{t as r}from"./elementBase-Cxeyx0tU.js";import{r as i,t as a}from"./fieldState-D-zQcXUS.js";import{t as o}from"./formMirror-9IpSgeZb.js";import{t as s}from"./iconGlyphs.g-DxSJLQJ8.js";import{t as c}from"./imeSafeEnter-DPs9qL3S.js";import{n as l}from"./listboxKeyNav-DtlIOryj.js";import{a as u,l as d,s as f}from"./nativeOverlay-D3VmY8qn.js";import{r as p,t as m}from"./textStore-opIEM4lu.js";import{t as h}from"./phone.g-P66U-SK5.js";var g={AD:[`Europe/Andorra`],AE:[`Asia/Dubai`],AF:[`Asia/Kabul`],AG:[`America/Antigua`],AI:[`America/Anguilla`],AL:[`Europe/Tirane`],AM:[`Asia/Yerevan`],AO:[`Africa/Luanda`],AR:[`America/Argentina/Buenos_Aires`,`America/Argentina/Catamarca`,`America/Argentina/ComodRivadavia`,`America/Argentina/Cordoba`,`America/Argentina/Jujuy`,`America/Argentina/La_Rioja`,`America/Argentina/Mendoza`,`America/Argentina/Rio_Gallegos`,`America/Argentina/Salta`,`America/Argentina/San_Juan`,`America/Argentina/San_Luis`,`America/Argentina/Tucuman`,`America/Argentina/Ushuaia`,`America/Buenos_Aires`,`America/Catamarca`,`America/Cordoba`,`America/Jujuy`,`America/Mendoza`,`America/Rosario`],AS:[`Pacific/Pago_Pago`,`Pacific/Samoa`,`US/Samoa`],AT:[`Europe/Vienna`],AU:[`Antarctica/Macquarie`,`Australia/Adelaide`,`Australia/Brisbane`,`Australia/Broken_Hill`,`Australia/Canberra`,`Australia/Currie`,`Australia/Darwin`,`Australia/Eucla`,`Australia/Hobart`,`Australia/LHI`,`Australia/Lindeman`,`Australia/Lord_Howe`,`Australia/Melbourne`,`Australia/NSW`,`Australia/North`,`Australia/Perth`,`Australia/Queensland`,`Australia/South`,`Australia/Sydney`,`Australia/Tasmania`,`Australia/Victoria`,`Australia/West`,`Australia/Yancowinna`],AW:[`America/Aruba`],AX:[`Europe/Mariehamn`],AZ:[`Asia/Baku`],BA:[`Europe/Sarajevo`],BB:[`America/Barbados`],BD:[`Asia/Dacca`,`Asia/Dhaka`],BE:[`Europe/Brussels`],BF:[`Africa/Ouagadougou`],BG:[`Europe/Sofia`],BH:[`Asia/Bahrain`],BI:[`Africa/Bujumbura`],BJ:[`Africa/Porto-Novo`],BL:[`America/St_Barthelemy`],BM:[`Atlantic/Bermuda`],BN:[`Asia/Brunei`],BO:[`America/La_Paz`],BQ:[`America/Kralendijk`],BR:[`America/Araguaina`,`America/Bahia`,`America/Belem`,`America/Boa_Vista`,`America/Campo_Grande`,`America/Cuiaba`,`America/Eirunepe`,`America/Fortaleza`,`America/Maceio`,`America/Manaus`,`America/Noronha`,`America/Porto_Acre`,`America/Porto_Velho`,`America/Recife`,`America/Rio_Branco`,`America/Santarem`,`America/Sao_Paulo`,`Brazil/DeNoronha`,`Brazil/East`,`Brazil/West`],BS:[`America/Nassau`],BT:[`Asia/Thimbu`,`Asia/Thimphu`],BW:[`Africa/Gaborone`],BY:[`Europe/Minsk`],BZ:[`America/Belize`],CA:/* @__PURE__ */ `America/Atikokan.America/Blanc-Sablon.America/Cambridge_Bay.America/Coral_Harbour.America/Creston.America/Dawson.America/Dawson_Creek.America/Edmonton.America/Fort_Nelson.America/Glace_Bay.America/Goose_Bay.America/Halifax.America/Inuvik.America/Iqaluit.America/Moncton.America/Montreal.America/Nipigon.America/Pangnirtung.America/Rainy_River.America/Rankin_Inlet.America/Regina.America/Resolute.America/St_Johns.America/Swift_Current.America/Thunder_Bay.America/Toronto.America/Vancouver.America/Whitehorse.America/Winnipeg.America/Yellowknife.Canada/Atlantic.Canada/Central.Canada/Eastern.Canada/Mountain.Canada/Newfoundland.Canada/Pacific.Canada/Saskatchewan.Canada/Yukon`.split(`.`),CC:[`Indian/Cocos`],CD:[`Africa/Kinshasa`,`Africa/Lubumbashi`],CF:[`Africa/Bangui`],CG:[`Africa/Brazzaville`],CH:[`Europe/Zurich`],CI:[`Africa/Abidjan`],CK:[`Pacific/Rarotonga`],CL:[`America/Coyhaique`,`America/Punta_Arenas`,`America/Santiago`,`Chile/Continental`,`Chile/EasterIsland`,`Pacific/Easter`],CM:[`Africa/Douala`],CN:[`Asia/Chongqing`,`Asia/Harbin`,`Asia/Kashgar`,`Asia/Shanghai`,`Asia/Urumqi`],CO:[`America/Bogota`],CR:[`America/Costa_Rica`],CU:[`America/Havana`],CV:[`Atlantic/Cape_Verde`],CW:[`America/Curacao`],CX:[`Indian/Christmas`],CY:[`Asia/Famagusta`,`Asia/Nicosia`,`Europe/Nicosia`],CZ:[`Europe/Prague`],DE:[`Europe/Berlin`,`Europe/Busingen`],DJ:[`Africa/Djibouti`],DK:[`Europe/Copenhagen`],DM:[`America/Dominica`],DO:[`America/Santo_Domingo`],DZ:[`Africa/Algiers`],EC:[`America/Guayaquil`,`Pacific/Galapagos`],EE:[`Europe/Tallinn`],EG:[`Africa/Cairo`],EH:[`Africa/El_Aaiun`],ER:[`Africa/Asmara`,`Africa/Asmera`],ES:[`Africa/Ceuta`,`Atlantic/Canary`,`Europe/Madrid`],ET:[`Africa/Addis_Ababa`],FI:[`Europe/Helsinki`],FJ:[`Pacific/Fiji`],FK:[`Atlantic/Stanley`],FM:[`Pacific/Chuuk`,`Pacific/Kosrae`,`Pacific/Pohnpei`,`Pacific/Ponape`,`Pacific/Truk`,`Pacific/Yap`],FO:[`Atlantic/Faeroe`,`Atlantic/Faroe`],FR:[`Europe/Paris`],GA:[`Africa/Libreville`],GB:[`Europe/Belfast`,`Europe/London`],GD:[`America/Grenada`],GE:[`Asia/Tbilisi`],GF:[`America/Cayenne`],GG:[`Europe/Guernsey`],GH:[`Africa/Accra`],GI:[`Europe/Gibraltar`],GL:[`America/Danmarkshavn`,`America/Godthab`,`America/Nuuk`,`America/Scoresbysund`,`America/Thule`],GM:[`Africa/Banjul`],GN:[`Africa/Conakry`],GP:[`America/Guadeloupe`],GQ:[`Africa/Malabo`],GR:[`Europe/Athens`],GT:[`America/Guatemala`],GU:[`Pacific/Guam`],GW:[`Africa/Bissau`],GY:[`America/Guyana`],HK:[`Asia/Hong_Kong`],HN:[`America/Tegucigalpa`],HR:[`Europe/Zagreb`],HT:[`America/Port-au-Prince`],HU:[`Europe/Budapest`],ID:[`Asia/Jakarta`,`Asia/Jayapura`,`Asia/Makassar`,`Asia/Pontianak`,`Asia/Ujung_Pandang`],IE:[`Europe/Dublin`],IL:[`Asia/Jerusalem`,`Asia/Tel_Aviv`],IM:[`Europe/Isle_of_Man`],IN:[`Asia/Calcutta`,`Asia/Kolkata`],IO:[`Indian/Chagos`],IQ:[`Asia/Baghdad`],IR:[`Asia/Tehran`],IS:[`Atlantic/Reykjavik`],IT:[`Europe/Rome`],JE:[`Europe/Jersey`],JM:[`America/Jamaica`],JO:[`Asia/Amman`],JP:[`Asia/Tokyo`],KE:[`Africa/Nairobi`],KG:[`Asia/Bishkek`],KH:[`Asia/Phnom_Penh`],KI:[`Pacific/Enderbury`,`Pacific/Kanton`,`Pacific/Kiritimati`,`Pacific/Tarawa`],KM:[`Indian/Comoro`],KN:[`America/St_Kitts`],KP:[`Asia/Pyongyang`],KR:[`Asia/Seoul`],KW:[`Asia/Kuwait`],KY:[`America/Cayman`],KZ:[`Asia/Almaty`,`Asia/Aqtau`,`Asia/Aqtobe`,`Asia/Atyrau`,`Asia/Oral`,`Asia/Qostanay`,`Asia/Qyzylorda`],LA:[`Asia/Vientiane`],LB:[`Asia/Beirut`],LC:[`America/St_Lucia`],LI:[`Europe/Vaduz`],LK:[`Asia/Colombo`],LR:[`Africa/Monrovia`],LS:[`Africa/Maseru`],LT:[`Europe/Vilnius`],LU:[`Europe/Luxembourg`],LV:[`Europe/Riga`],LY:[`Africa/Tripoli`],MA:[`Africa/Casablanca`],MC:[`Europe/Monaco`],MD:[`Europe/Chisinau`,`Europe/Tiraspol`],ME:[`Europe/Podgorica`],MF:[`America/Marigot`],MG:[`Indian/Antananarivo`],MH:[`Pacific/Kwajalein`,`Pacific/Majuro`],MK:[`Europe/Skopje`],ML:[`Africa/Bamako`,`Africa/Timbuktu`],MM:[`Asia/Rangoon`,`Asia/Yangon`],MN:[`Asia/Choibalsan`,`Asia/Hovd`,`Asia/Ulaanbaatar`,`Asia/Ulan_Bator`],MO:[`Asia/Macao`,`Asia/Macau`],MP:[`Pacific/Saipan`],MQ:[`America/Martinique`],MR:[`Africa/Nouakchott`],MS:[`America/Montserrat`],MT:[`Europe/Malta`],MU:[`Indian/Mauritius`],MV:[`Indian/Maldives`],MW:[`Africa/Blantyre`],MX:[`America/Bahia_Banderas`,`America/Cancun`,`America/Chihuahua`,`America/Ciudad_Juarez`,`America/Ensenada`,`America/Hermosillo`,`America/Matamoros`,`America/Mazatlan`,`America/Merida`,`America/Mexico_City`,`America/Monterrey`,`America/Ojinaga`,`America/Santa_Isabel`,`America/Tijuana`,`Mexico/BajaNorte`,`Mexico/BajaSur`,`Mexico/General`],MY:[`Asia/Kuala_Lumpur`,`Asia/Kuching`],MZ:[`Africa/Maputo`],NA:[`Africa/Windhoek`],NC:[`Pacific/Noumea`],NE:[`Africa/Niamey`],NF:[`Pacific/Norfolk`],NG:[`Africa/Lagos`],NI:[`America/Managua`],NL:[`Europe/Amsterdam`],NO:[`Europe/Oslo`],NP:[`Asia/Kathmandu`,`Asia/Katmandu`],NR:[`Pacific/Nauru`],NU:[`Pacific/Niue`],NZ:[`Pacific/Auckland`,`Pacific/Chatham`],OM:[`Asia/Muscat`],PA:[`America/Panama`],PE:[`America/Lima`],PF:[`Pacific/Gambier`,`Pacific/Marquesas`,`Pacific/Tahiti`],PG:[`Pacific/Bougainville`,`Pacific/Port_Moresby`],PH:[`Asia/Manila`],PK:[`Asia/Karachi`],PL:[`Europe/Warsaw`],PM:[`America/Miquelon`],PR:[`America/Puerto_Rico`],PS:[`Asia/Gaza`,`Asia/Hebron`],PT:[`Atlantic/Azores`,`Atlantic/Madeira`,`Europe/Lisbon`],PW:[`Pacific/Palau`],PY:[`America/Asuncion`],QA:[`Asia/Qatar`],RE:[`Indian/Reunion`],RO:[`Europe/Bucharest`],RS:[`Europe/Belgrade`],RU:/* @__PURE__ */ `Asia/Anadyr.Asia/Barnaul.Asia/Chita.Asia/Irkutsk.Asia/Kamchatka.Asia/Khandyga.Asia/Krasnoyarsk.Asia/Magadan.Asia/Novokuznetsk.Asia/Novosibirsk.Asia/Omsk.Asia/Sakhalin.Asia/Srednekolymsk.Asia/Tomsk.Asia/Ust-Nera.Asia/Vladivostok.Asia/Yakutsk.Asia/Yekaterinburg.Europe/Astrakhan.Europe/Kaliningrad.Europe/Kirov.Europe/Moscow.Europe/Samara.Europe/Saratov.Europe/Ulyanovsk.Europe/Volgograd`.split(`.`),RW:[`Africa/Kigali`],SA:[`Asia/Riyadh`],SB:[`Pacific/Guadalcanal`],SC:[`Indian/Mahe`],SD:[`Africa/Khartoum`],SE:[`Europe/Stockholm`],SG:[`Asia/Singapore`],SH:[`Atlantic/St_Helena`],SI:[`Europe/Ljubljana`],SJ:[`Arctic/Longyearbyen`,`Atlantic/Jan_Mayen`],SK:[`Europe/Bratislava`],SL:[`Africa/Freetown`],SM:[`Europe/San_Marino`],SN:[`Africa/Dakar`],SO:[`Africa/Mogadishu`],SR:[`America/Paramaribo`],SS:[`Africa/Juba`],ST:[`Africa/Sao_Tome`],SV:[`America/El_Salvador`],SX:[`America/Lower_Princes`],SY:[`Asia/Damascus`],SZ:[`Africa/Mbabane`],TC:[`America/Grand_Turk`],TD:[`Africa/Ndjamena`],TG:[`Africa/Lome`],TH:[`Asia/Bangkok`],TJ:[`Asia/Dushanbe`],TK:[`Pacific/Fakaofo`],TL:[`Asia/Dili`],TM:[`Asia/Ashgabat`,`Asia/Ashkhabad`],TN:[`Africa/Tunis`],TO:[`Pacific/Tongatapu`],TR:[`Asia/Istanbul`,`Europe/Istanbul`],TT:[`America/Port_of_Spain`],TV:[`Pacific/Funafuti`],TW:[`Asia/Taipei`],TZ:[`Africa/Dar_es_Salaam`],UA:[`Europe/Kiev`,`Europe/Kyiv`,`Europe/Simferopol`,`Europe/Uzhgorod`,`Europe/Zaporozhye`],UG:[`Africa/Kampala`],US:/* @__PURE__ */ `America/Adak.America/Anchorage.America/Atka.America/Boise.America/Chicago.America/Denver.America/Detroit.America/Fort_Wayne.America/Indiana/Indianapolis.America/Indiana/Knox.America/Indiana/Marengo.America/Indiana/Petersburg.America/Indiana/Tell_City.America/Indiana/Vevay.America/Indiana/Vincennes.America/Indiana/Winamac.America/Indianapolis.America/Juneau.America/Kentucky/Louisville.America/Kentucky/Monticello.America/Knox_IN.America/Los_Angeles.America/Louisville.America/Menominee.America/Metlakatla.America/New_York.America/Nome.America/North_Dakota/Beulah.America/North_Dakota/Center.America/North_Dakota/New_Salem.America/Phoenix.America/Shiprock.America/Sitka.America/Yakutat.Pacific/Honolulu.US/Alaska.US/Aleutian.US/Arizona.US/Central.US/East-Indiana.US/Eastern.US/Hawaii.US/Indiana-Starke.US/Michigan.US/Mountain.US/Pacific`.split(`.`),UY:[`America/Montevideo`],UZ:[`Asia/Samarkand`,`Asia/Tashkent`],VA:[`Europe/Vatican`],VC:[`America/St_Vincent`],VE:[`America/Caracas`],VG:[`America/Tortola`],VI:[`America/St_Thomas`,`America/Virgin`],VN:[`Asia/Ho_Chi_Minh`,`Asia/Saigon`],VU:[`Pacific/Efate`],WF:[`Pacific/Wallis`],WS:[`Pacific/Apia`],YE:[`Asia/Aden`],YT:[`Indian/Mayotte`],ZA:[`Africa/Johannesburg`],ZM:[`Africa/Lusaka`],ZW:[`Africa/Harare`]},_=new Set(t.map(([e])=>e)),v=/* @__PURE__ */ new Map;for(let[e,t]of Object.entries(g))for(let n of t)v.set(n,e);function y(e){let t=e===void 0?void 0:v.get(e);return t&&_.has(t)?t:null}function b(e){if(!e)return null;let t;try{t=new Intl.Locale(e).region}catch{return null}return t&&_.has(t)?t:null}function x(){let e;try{e=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{e=void 0}let t=typeof navigator>`u`?void 0:navigator.language;return y(e)||b(t)||null}function S(){return Promise.all([import(`./max-ByBKGsXq.js`),import(`./examples.mobile.json-GS1_MGh9.js`)]).then(([e,t])=>C(e,t.default||t))}function C(e,t){return{AsYouType:e.AsYouType,getExampleNumber:e.getExampleNumber,isSupportedCountry:e.isSupportedCountry,isValidPhoneNumber:e.isValidPhoneNumber,parsePhoneNumber:e.parsePhoneNumber,examples:t}}var w=()=>p(`phone`,h);function T(e,t){return e.isSupportedCountry(t)}var E=e=>e?`wui-flag wui-flag-${String(e).toLowerCase()}`:`wui-flag`,D=t=>t?`+${e(t)}`:``,O=null,k=null;function A(){return O?Promise.resolve(O):(k||=S().then(e=>(O=e,O)).catch(e=>(n(`[@webority/ui-elements] <wui-phone> could not load its phone number metadata.`,e),null)),k)}function j(t,n){let r=`+${e(t)}`;return n?.startsWith(r)?n.slice(r.length).trimStart():null}function M(t,n){if(!O||!n||!t||!T(O,t))return n;try{return j(t,new O.AsYouType(t).input(`+${e(t)}${n}`))||n}catch{return n}}function N(e,t){if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(/[0-9]/.test(e[r]??``)&&(n+=1,n===t))return r+1;return e.length}function P(e){if(!O||!e||!T(O,e))return null;try{return j(e,O.getExampleNumber(e,O.examples)?.formatInternational())||null}catch{return null}}function F(e){let t=P(e);return t?m(w().examplePlaceholder,{example:t}):null}function I(e){if(!O||!e)return null;try{if(!O.isValidPhoneNumber(e))return!1;let t=O.parsePhoneNumber(e)?.getType?.();return t===void 0||t===`MOBILE`||t===`FIXED_LINE_OR_MOBILE`}catch{return null}}function L(e){if(!O||!e||!T(O,e))return null;try{let t=O.getExampleNumber(e,O.examples);return t?.nationalNumber?t.nationalNumber.length:null}catch{return null}}function R(e,t,n){if(!O||!T(O,e))return null;try{let r=O.parsePhoneNumber(t,e),i=r?.nationalNumber;return!i||r.country!==e||i.length>n||!t.endsWith(i)?null:i}catch{return null}}function z(e){if(!O||!e?.trim().startsWith(`+`))return null;try{let t=new O.AsYouType;t.input(e.trim());let n=t.getCountry();return!n||!G(t)?null:{country:n,national:t.getNationalNumber()||``}}catch{return null}}function B(t,n){let r=String(n??``).trim();if(!r.startsWith(`+`))return null;let i=r.replace(/[^0-9]/g,``),a=String(e(t));return{country:t,national:i.startsWith(a)?i.slice(a.length):i}}var V=class extends r{static formAssociated=!0;static whenFormatted(){return A().then(()=>void 0)}static get observedAttributes(){return[`value`,`country`,`locked-country`,`placeholder`,`disabled`,`readonly`,`loading`,`required`,`aria-label`,`aria-describedby`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._defaultCountry=x()||``,this._country=this._defaultCountry,this._national=``,this._active=-1,this._committedValue=``,this._validateOnInput=!1}connectedCallback(){this._rendered||this.render()}disconnectedCallback(){let e=U(this.querySelector(`.country-dropdown-menu`),HTMLElement);e&&u(e)}attributeChangedCallback(e,t,n){if(e===`value`)this.value=n;else if(this._rendered){if(e===`aria-label`){let t=this.querySelector(`input[type=tel]`);t&&(n==null?t.removeAttribute(e):t.setAttribute(e,n))}else if(e===`aria-describedby`)this._syncDescribedBy();else if(e===`country`){if(this._locked)return;let e=this.value;if(this._country=n||this._defaultCountry,this._suppressCountryRender)return;this.render(),this.value!==e&&(this._emitInput(),this._emitChange())}else this.render()}}formResetCallback(){this._validateOnInput=!1,this.value=this._defaultValue||``}get _locked(){return(this.getAttribute(`locked-country`)||``).toUpperCase()||null}get value(){return this._national&&this._country?`+${e(this._country)}${this._national}`:``}set value(t){let n=String(t??``).trim();this._locked&&(this._country=this._locked);let r=this._locked?null:z(n);if(r)this._country=r.country,this._national=r.national.replace(/[^0-9]/g,``);else if(n.startsWith(`+`)){let t=n.replace(/[^0-9]/g,``),r=String(e(this._locked||this.getAttribute(`country`)||this._country));r&&t.startsWith(r)&&(t=t.slice(r.length)),this._national=t}else this._national=n.replace(/[^0-9]/g,``);r&&this.getAttribute(`country`)!==this._country?this.setAttribute(`country`,this._country):this._rendered&&this.render(),this._committedValue=this.value,this._syncMirror()}_syncMirror(){o(this,this.value)}_syncDescribedBy(){let e=this.querySelector(`input[type=tel]`);if(!e)return;let t=[this.getAttribute(`aria-describedby`),this.querySelector(`[data-phone-error]`)?.id].filter(Boolean);t.length?e.setAttribute(`aria-describedby`,t.join(` `)):e.removeAttribute(`aria-describedby`)}_emitInput(){this.dispatchEvent(new Event(`input`,{bubbles:!0}))}_emitChange(){this._committedValue=this.value,this.dispatchEvent(new Event(`change`,{bubbles:!0}))}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``),this._country=this._locked||this.getAttribute(`country`)||this._country;let e=this.getAttribute(`placeholder`)||F(this._country)||w().placeholder;this.id||=`wui-phone-${Math.random().toString(36).slice(2,9)}`;let t=`${this.id}-listbox`;this._listboxId=t;let n=this._locked?`<div class="phone-country-adornment"><span class="wui-phone-prefix"><span class="${E(this._country)}" data-flag aria-hidden="true"></span><span class="phone-dial" data-dial>${D(this._country)}</span></span></div>`:`<div class="phone-country-adornment">
|
|
1
|
+
import{n as e,t}from"./countries-DQL9nAUt.js";import{t as n}from"./devWarn-DXdRWZs3.js";import{t as r}from"./elementBase-Cxeyx0tU.js";import{r as i,t as a}from"./fieldState-D-zQcXUS.js";import{t as o}from"./formMirror-9IpSgeZb.js";import{t as s}from"./iconGlyphs.g-BUF97bUu.js";import{t as c}from"./imeSafeEnter-DPs9qL3S.js";import{n as l}from"./listboxKeyNav-DtlIOryj.js";import{a as u,l as d,s as f}from"./nativeOverlay-DGady-wN.js";import{r as p,t as m}from"./textStore-opIEM4lu.js";import{t as h}from"./phone.g-P66U-SK5.js";var g={AD:[`Europe/Andorra`],AE:[`Asia/Dubai`],AF:[`Asia/Kabul`],AG:[`America/Antigua`],AI:[`America/Anguilla`],AL:[`Europe/Tirane`],AM:[`Asia/Yerevan`],AO:[`Africa/Luanda`],AR:[`America/Argentina/Buenos_Aires`,`America/Argentina/Catamarca`,`America/Argentina/ComodRivadavia`,`America/Argentina/Cordoba`,`America/Argentina/Jujuy`,`America/Argentina/La_Rioja`,`America/Argentina/Mendoza`,`America/Argentina/Rio_Gallegos`,`America/Argentina/Salta`,`America/Argentina/San_Juan`,`America/Argentina/San_Luis`,`America/Argentina/Tucuman`,`America/Argentina/Ushuaia`,`America/Buenos_Aires`,`America/Catamarca`,`America/Cordoba`,`America/Jujuy`,`America/Mendoza`,`America/Rosario`],AS:[`Pacific/Pago_Pago`,`Pacific/Samoa`,`US/Samoa`],AT:[`Europe/Vienna`],AU:[`Antarctica/Macquarie`,`Australia/Adelaide`,`Australia/Brisbane`,`Australia/Broken_Hill`,`Australia/Canberra`,`Australia/Currie`,`Australia/Darwin`,`Australia/Eucla`,`Australia/Hobart`,`Australia/LHI`,`Australia/Lindeman`,`Australia/Lord_Howe`,`Australia/Melbourne`,`Australia/NSW`,`Australia/North`,`Australia/Perth`,`Australia/Queensland`,`Australia/South`,`Australia/Sydney`,`Australia/Tasmania`,`Australia/Victoria`,`Australia/West`,`Australia/Yancowinna`],AW:[`America/Aruba`],AX:[`Europe/Mariehamn`],AZ:[`Asia/Baku`],BA:[`Europe/Sarajevo`],BB:[`America/Barbados`],BD:[`Asia/Dacca`,`Asia/Dhaka`],BE:[`Europe/Brussels`],BF:[`Africa/Ouagadougou`],BG:[`Europe/Sofia`],BH:[`Asia/Bahrain`],BI:[`Africa/Bujumbura`],BJ:[`Africa/Porto-Novo`],BL:[`America/St_Barthelemy`],BM:[`Atlantic/Bermuda`],BN:[`Asia/Brunei`],BO:[`America/La_Paz`],BQ:[`America/Kralendijk`],BR:[`America/Araguaina`,`America/Bahia`,`America/Belem`,`America/Boa_Vista`,`America/Campo_Grande`,`America/Cuiaba`,`America/Eirunepe`,`America/Fortaleza`,`America/Maceio`,`America/Manaus`,`America/Noronha`,`America/Porto_Acre`,`America/Porto_Velho`,`America/Recife`,`America/Rio_Branco`,`America/Santarem`,`America/Sao_Paulo`,`Brazil/DeNoronha`,`Brazil/East`,`Brazil/West`],BS:[`America/Nassau`],BT:[`Asia/Thimbu`,`Asia/Thimphu`],BW:[`Africa/Gaborone`],BY:[`Europe/Minsk`],BZ:[`America/Belize`],CA:/* @__PURE__ */ `America/Atikokan.America/Blanc-Sablon.America/Cambridge_Bay.America/Coral_Harbour.America/Creston.America/Dawson.America/Dawson_Creek.America/Edmonton.America/Fort_Nelson.America/Glace_Bay.America/Goose_Bay.America/Halifax.America/Inuvik.America/Iqaluit.America/Moncton.America/Montreal.America/Nipigon.America/Pangnirtung.America/Rainy_River.America/Rankin_Inlet.America/Regina.America/Resolute.America/St_Johns.America/Swift_Current.America/Thunder_Bay.America/Toronto.America/Vancouver.America/Whitehorse.America/Winnipeg.America/Yellowknife.Canada/Atlantic.Canada/Central.Canada/Eastern.Canada/Mountain.Canada/Newfoundland.Canada/Pacific.Canada/Saskatchewan.Canada/Yukon`.split(`.`),CC:[`Indian/Cocos`],CD:[`Africa/Kinshasa`,`Africa/Lubumbashi`],CF:[`Africa/Bangui`],CG:[`Africa/Brazzaville`],CH:[`Europe/Zurich`],CI:[`Africa/Abidjan`],CK:[`Pacific/Rarotonga`],CL:[`America/Coyhaique`,`America/Punta_Arenas`,`America/Santiago`,`Chile/Continental`,`Chile/EasterIsland`,`Pacific/Easter`],CM:[`Africa/Douala`],CN:[`Asia/Chongqing`,`Asia/Harbin`,`Asia/Kashgar`,`Asia/Shanghai`,`Asia/Urumqi`],CO:[`America/Bogota`],CR:[`America/Costa_Rica`],CU:[`America/Havana`],CV:[`Atlantic/Cape_Verde`],CW:[`America/Curacao`],CX:[`Indian/Christmas`],CY:[`Asia/Famagusta`,`Asia/Nicosia`,`Europe/Nicosia`],CZ:[`Europe/Prague`],DE:[`Europe/Berlin`,`Europe/Busingen`],DJ:[`Africa/Djibouti`],DK:[`Europe/Copenhagen`],DM:[`America/Dominica`],DO:[`America/Santo_Domingo`],DZ:[`Africa/Algiers`],EC:[`America/Guayaquil`,`Pacific/Galapagos`],EE:[`Europe/Tallinn`],EG:[`Africa/Cairo`],EH:[`Africa/El_Aaiun`],ER:[`Africa/Asmara`,`Africa/Asmera`],ES:[`Africa/Ceuta`,`Atlantic/Canary`,`Europe/Madrid`],ET:[`Africa/Addis_Ababa`],FI:[`Europe/Helsinki`],FJ:[`Pacific/Fiji`],FK:[`Atlantic/Stanley`],FM:[`Pacific/Chuuk`,`Pacific/Kosrae`,`Pacific/Pohnpei`,`Pacific/Ponape`,`Pacific/Truk`,`Pacific/Yap`],FO:[`Atlantic/Faeroe`,`Atlantic/Faroe`],FR:[`Europe/Paris`],GA:[`Africa/Libreville`],GB:[`Europe/Belfast`,`Europe/London`],GD:[`America/Grenada`],GE:[`Asia/Tbilisi`],GF:[`America/Cayenne`],GG:[`Europe/Guernsey`],GH:[`Africa/Accra`],GI:[`Europe/Gibraltar`],GL:[`America/Danmarkshavn`,`America/Godthab`,`America/Nuuk`,`America/Scoresbysund`,`America/Thule`],GM:[`Africa/Banjul`],GN:[`Africa/Conakry`],GP:[`America/Guadeloupe`],GQ:[`Africa/Malabo`],GR:[`Europe/Athens`],GT:[`America/Guatemala`],GU:[`Pacific/Guam`],GW:[`Africa/Bissau`],GY:[`America/Guyana`],HK:[`Asia/Hong_Kong`],HN:[`America/Tegucigalpa`],HR:[`Europe/Zagreb`],HT:[`America/Port-au-Prince`],HU:[`Europe/Budapest`],ID:[`Asia/Jakarta`,`Asia/Jayapura`,`Asia/Makassar`,`Asia/Pontianak`,`Asia/Ujung_Pandang`],IE:[`Europe/Dublin`],IL:[`Asia/Jerusalem`,`Asia/Tel_Aviv`],IM:[`Europe/Isle_of_Man`],IN:[`Asia/Calcutta`,`Asia/Kolkata`],IO:[`Indian/Chagos`],IQ:[`Asia/Baghdad`],IR:[`Asia/Tehran`],IS:[`Atlantic/Reykjavik`],IT:[`Europe/Rome`],JE:[`Europe/Jersey`],JM:[`America/Jamaica`],JO:[`Asia/Amman`],JP:[`Asia/Tokyo`],KE:[`Africa/Nairobi`],KG:[`Asia/Bishkek`],KH:[`Asia/Phnom_Penh`],KI:[`Pacific/Enderbury`,`Pacific/Kanton`,`Pacific/Kiritimati`,`Pacific/Tarawa`],KM:[`Indian/Comoro`],KN:[`America/St_Kitts`],KP:[`Asia/Pyongyang`],KR:[`Asia/Seoul`],KW:[`Asia/Kuwait`],KY:[`America/Cayman`],KZ:[`Asia/Almaty`,`Asia/Aqtau`,`Asia/Aqtobe`,`Asia/Atyrau`,`Asia/Oral`,`Asia/Qostanay`,`Asia/Qyzylorda`],LA:[`Asia/Vientiane`],LB:[`Asia/Beirut`],LC:[`America/St_Lucia`],LI:[`Europe/Vaduz`],LK:[`Asia/Colombo`],LR:[`Africa/Monrovia`],LS:[`Africa/Maseru`],LT:[`Europe/Vilnius`],LU:[`Europe/Luxembourg`],LV:[`Europe/Riga`],LY:[`Africa/Tripoli`],MA:[`Africa/Casablanca`],MC:[`Europe/Monaco`],MD:[`Europe/Chisinau`,`Europe/Tiraspol`],ME:[`Europe/Podgorica`],MF:[`America/Marigot`],MG:[`Indian/Antananarivo`],MH:[`Pacific/Kwajalein`,`Pacific/Majuro`],MK:[`Europe/Skopje`],ML:[`Africa/Bamako`,`Africa/Timbuktu`],MM:[`Asia/Rangoon`,`Asia/Yangon`],MN:[`Asia/Choibalsan`,`Asia/Hovd`,`Asia/Ulaanbaatar`,`Asia/Ulan_Bator`],MO:[`Asia/Macao`,`Asia/Macau`],MP:[`Pacific/Saipan`],MQ:[`America/Martinique`],MR:[`Africa/Nouakchott`],MS:[`America/Montserrat`],MT:[`Europe/Malta`],MU:[`Indian/Mauritius`],MV:[`Indian/Maldives`],MW:[`Africa/Blantyre`],MX:[`America/Bahia_Banderas`,`America/Cancun`,`America/Chihuahua`,`America/Ciudad_Juarez`,`America/Ensenada`,`America/Hermosillo`,`America/Matamoros`,`America/Mazatlan`,`America/Merida`,`America/Mexico_City`,`America/Monterrey`,`America/Ojinaga`,`America/Santa_Isabel`,`America/Tijuana`,`Mexico/BajaNorte`,`Mexico/BajaSur`,`Mexico/General`],MY:[`Asia/Kuala_Lumpur`,`Asia/Kuching`],MZ:[`Africa/Maputo`],NA:[`Africa/Windhoek`],NC:[`Pacific/Noumea`],NE:[`Africa/Niamey`],NF:[`Pacific/Norfolk`],NG:[`Africa/Lagos`],NI:[`America/Managua`],NL:[`Europe/Amsterdam`],NO:[`Europe/Oslo`],NP:[`Asia/Kathmandu`,`Asia/Katmandu`],NR:[`Pacific/Nauru`],NU:[`Pacific/Niue`],NZ:[`Pacific/Auckland`,`Pacific/Chatham`],OM:[`Asia/Muscat`],PA:[`America/Panama`],PE:[`America/Lima`],PF:[`Pacific/Gambier`,`Pacific/Marquesas`,`Pacific/Tahiti`],PG:[`Pacific/Bougainville`,`Pacific/Port_Moresby`],PH:[`Asia/Manila`],PK:[`Asia/Karachi`],PL:[`Europe/Warsaw`],PM:[`America/Miquelon`],PR:[`America/Puerto_Rico`],PS:[`Asia/Gaza`,`Asia/Hebron`],PT:[`Atlantic/Azores`,`Atlantic/Madeira`,`Europe/Lisbon`],PW:[`Pacific/Palau`],PY:[`America/Asuncion`],QA:[`Asia/Qatar`],RE:[`Indian/Reunion`],RO:[`Europe/Bucharest`],RS:[`Europe/Belgrade`],RU:/* @__PURE__ */ `Asia/Anadyr.Asia/Barnaul.Asia/Chita.Asia/Irkutsk.Asia/Kamchatka.Asia/Khandyga.Asia/Krasnoyarsk.Asia/Magadan.Asia/Novokuznetsk.Asia/Novosibirsk.Asia/Omsk.Asia/Sakhalin.Asia/Srednekolymsk.Asia/Tomsk.Asia/Ust-Nera.Asia/Vladivostok.Asia/Yakutsk.Asia/Yekaterinburg.Europe/Astrakhan.Europe/Kaliningrad.Europe/Kirov.Europe/Moscow.Europe/Samara.Europe/Saratov.Europe/Ulyanovsk.Europe/Volgograd`.split(`.`),RW:[`Africa/Kigali`],SA:[`Asia/Riyadh`],SB:[`Pacific/Guadalcanal`],SC:[`Indian/Mahe`],SD:[`Africa/Khartoum`],SE:[`Europe/Stockholm`],SG:[`Asia/Singapore`],SH:[`Atlantic/St_Helena`],SI:[`Europe/Ljubljana`],SJ:[`Arctic/Longyearbyen`,`Atlantic/Jan_Mayen`],SK:[`Europe/Bratislava`],SL:[`Africa/Freetown`],SM:[`Europe/San_Marino`],SN:[`Africa/Dakar`],SO:[`Africa/Mogadishu`],SR:[`America/Paramaribo`],SS:[`Africa/Juba`],ST:[`Africa/Sao_Tome`],SV:[`America/El_Salvador`],SX:[`America/Lower_Princes`],SY:[`Asia/Damascus`],SZ:[`Africa/Mbabane`],TC:[`America/Grand_Turk`],TD:[`Africa/Ndjamena`],TG:[`Africa/Lome`],TH:[`Asia/Bangkok`],TJ:[`Asia/Dushanbe`],TK:[`Pacific/Fakaofo`],TL:[`Asia/Dili`],TM:[`Asia/Ashgabat`,`Asia/Ashkhabad`],TN:[`Africa/Tunis`],TO:[`Pacific/Tongatapu`],TR:[`Asia/Istanbul`,`Europe/Istanbul`],TT:[`America/Port_of_Spain`],TV:[`Pacific/Funafuti`],TW:[`Asia/Taipei`],TZ:[`Africa/Dar_es_Salaam`],UA:[`Europe/Kiev`,`Europe/Kyiv`,`Europe/Simferopol`,`Europe/Uzhgorod`,`Europe/Zaporozhye`],UG:[`Africa/Kampala`],US:/* @__PURE__ */ `America/Adak.America/Anchorage.America/Atka.America/Boise.America/Chicago.America/Denver.America/Detroit.America/Fort_Wayne.America/Indiana/Indianapolis.America/Indiana/Knox.America/Indiana/Marengo.America/Indiana/Petersburg.America/Indiana/Tell_City.America/Indiana/Vevay.America/Indiana/Vincennes.America/Indiana/Winamac.America/Indianapolis.America/Juneau.America/Kentucky/Louisville.America/Kentucky/Monticello.America/Knox_IN.America/Los_Angeles.America/Louisville.America/Menominee.America/Metlakatla.America/New_York.America/Nome.America/North_Dakota/Beulah.America/North_Dakota/Center.America/North_Dakota/New_Salem.America/Phoenix.America/Shiprock.America/Sitka.America/Yakutat.Pacific/Honolulu.US/Alaska.US/Aleutian.US/Arizona.US/Central.US/East-Indiana.US/Eastern.US/Hawaii.US/Indiana-Starke.US/Michigan.US/Mountain.US/Pacific`.split(`.`),UY:[`America/Montevideo`],UZ:[`Asia/Samarkand`,`Asia/Tashkent`],VA:[`Europe/Vatican`],VC:[`America/St_Vincent`],VE:[`America/Caracas`],VG:[`America/Tortola`],VI:[`America/St_Thomas`,`America/Virgin`],VN:[`Asia/Ho_Chi_Minh`,`Asia/Saigon`],VU:[`Pacific/Efate`],WF:[`Pacific/Wallis`],WS:[`Pacific/Apia`],YE:[`Asia/Aden`],YT:[`Indian/Mayotte`],ZA:[`Africa/Johannesburg`],ZM:[`Africa/Lusaka`],ZW:[`Africa/Harare`]},_=new Set(t.map(([e])=>e)),v=/* @__PURE__ */ new Map;for(let[e,t]of Object.entries(g))for(let n of t)v.set(n,e);function y(e){let t=e===void 0?void 0:v.get(e);return t&&_.has(t)?t:null}function b(e){if(!e)return null;let t;try{t=new Intl.Locale(e).region}catch{return null}return t&&_.has(t)?t:null}function x(){let e;try{e=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{e=void 0}let t=typeof navigator>`u`?void 0:navigator.language;return y(e)||b(t)||null}function S(){return Promise.all([import(`./max-ByBKGsXq.js`),import(`./examples.mobile.json-GS1_MGh9.js`)]).then(([e,t])=>C(e,t.default||t))}function C(e,t){return{AsYouType:e.AsYouType,getExampleNumber:e.getExampleNumber,isSupportedCountry:e.isSupportedCountry,isValidPhoneNumber:e.isValidPhoneNumber,parsePhoneNumber:e.parsePhoneNumber,examples:t}}var w=()=>p(`phone`,h);function T(e,t){return e.isSupportedCountry(t)}var E=e=>e?`wui-flag wui-flag-${String(e).toLowerCase()}`:`wui-flag`,D=t=>t?`+${e(t)}`:``,O=null,k=null;function A(){return O?Promise.resolve(O):(k||=S().then(e=>(O=e,O)).catch(e=>(n(`[@webority/ui-elements] <wui-phone> could not load its phone number metadata.`,e),null)),k)}function j(t,n){let r=`+${e(t)}`;return n?.startsWith(r)?n.slice(r.length).trimStart():null}function M(t,n){if(!O||!n||!t||!T(O,t))return n;try{return j(t,new O.AsYouType(t).input(`+${e(t)}${n}`))||n}catch{return n}}function N(e,t){if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(/[0-9]/.test(e[r]??``)&&(n+=1,n===t))return r+1;return e.length}function P(e){if(!O||!e||!T(O,e))return null;try{return j(e,O.getExampleNumber(e,O.examples)?.formatInternational())||null}catch{return null}}function F(e){let t=P(e);return t?m(w().examplePlaceholder,{example:t}):null}function I(e){if(!O||!e)return null;try{if(!O.isValidPhoneNumber(e))return!1;let t=O.parsePhoneNumber(e)?.getType?.();return t===void 0||t===`MOBILE`||t===`FIXED_LINE_OR_MOBILE`}catch{return null}}function L(e){if(!O||!e||!T(O,e))return null;try{let t=O.getExampleNumber(e,O.examples);return t?.nationalNumber?t.nationalNumber.length:null}catch{return null}}function R(e,t,n){if(!O||!T(O,e))return null;try{let r=O.parsePhoneNumber(t,e),i=r?.nationalNumber;return!i||r.country!==e||i.length>n||!t.endsWith(i)?null:i}catch{return null}}function z(e){if(!O||!e?.trim().startsWith(`+`))return null;try{let t=new O.AsYouType;t.input(e.trim());let n=t.getCountry();return!n||!G(t)?null:{country:n,national:t.getNationalNumber()||``}}catch{return null}}function B(t,n){let r=String(n??``).trim();if(!r.startsWith(`+`))return null;let i=r.replace(/[^0-9]/g,``),a=String(e(t));return{country:t,national:i.startsWith(a)?i.slice(a.length):i}}var V=class extends r{static formAssociated=!0;static whenFormatted(){return A().then(()=>void 0)}static get observedAttributes(){return[`value`,`country`,`locked-country`,`placeholder`,`disabled`,`readonly`,`loading`,`required`,`aria-label`,`aria-describedby`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._defaultCountry=x()||``,this._country=this._defaultCountry,this._national=``,this._active=-1,this._committedValue=``,this._validateOnInput=!1}connectedCallback(){this._rendered||this.render()}disconnectedCallback(){let e=U(this.querySelector(`.country-dropdown-menu`),HTMLElement);e&&u(e)}attributeChangedCallback(e,t,n){if(e===`value`)this.value=n;else if(this._rendered){if(e===`aria-label`){let t=this.querySelector(`input[type=tel]`);t&&(n==null?t.removeAttribute(e):t.setAttribute(e,n))}else if(e===`aria-describedby`)this._syncDescribedBy();else if(e===`country`){if(this._locked)return;let e=this.value;if(this._country=n||this._defaultCountry,this._suppressCountryRender)return;this.render(),this.value!==e&&(this._emitInput(),this._emitChange())}else this.render()}}formResetCallback(){this._validateOnInput=!1,this.value=this._defaultValue||``}get _locked(){return(this.getAttribute(`locked-country`)||``).toUpperCase()||null}get value(){return this._national&&this._country?`+${e(this._country)}${this._national}`:``}set value(t){let n=String(t??``).trim();this._locked&&(this._country=this._locked);let r=this._locked?null:z(n);if(r)this._country=r.country,this._national=r.national.replace(/[^0-9]/g,``);else if(n.startsWith(`+`)){let t=n.replace(/[^0-9]/g,``),r=String(e(this._locked||this.getAttribute(`country`)||this._country));r&&t.startsWith(r)&&(t=t.slice(r.length)),this._national=t}else this._national=n.replace(/[^0-9]/g,``);r&&this.getAttribute(`country`)!==this._country?this.setAttribute(`country`,this._country):this._rendered&&this.render(),this._committedValue=this.value,this._syncMirror()}_syncMirror(){o(this,this.value)}_syncDescribedBy(){let e=this.querySelector(`input[type=tel]`);if(!e)return;let t=[this.getAttribute(`aria-describedby`),this.querySelector(`[data-phone-error]`)?.id].filter(Boolean);t.length?e.setAttribute(`aria-describedby`,t.join(` `)):e.removeAttribute(`aria-describedby`)}_emitInput(){this.dispatchEvent(new Event(`input`,{bubbles:!0}))}_emitChange(){this._committedValue=this.value,this.dispatchEvent(new Event(`change`,{bubbles:!0}))}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``),this._country=this._locked||this.getAttribute(`country`)||this._country;let e=this.getAttribute(`placeholder`)||F(this._country)||w().placeholder;this.id||=`wui-phone-${Math.random().toString(36).slice(2,9)}`;let t=`${this.id}-listbox`;this._listboxId=t;let n=this._locked?`<div class="phone-country-adornment"><span class="wui-phone-prefix"><span class="${E(this._country)}" data-flag aria-hidden="true"></span><span class="phone-dial" data-dial>${D(this._country)}</span></span></div>`:`<div class="phone-country-adornment">
|
|
2
2
|
<button type="button" class="country-toggle" aria-label="${K(w().chooseCountryLabel)}" aria-haspopup="listbox" aria-expanded="false" aria-controls="${K(t)}"${this.hasAttribute(`disabled`)?` disabled`:``}>
|
|
3
3
|
<span class="${E(this._country)}" data-flag aria-hidden="true"></span>
|
|
4
4
|
${s(`chevron-down`,{className:`phone-chevron`})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./elementBase-Cxeyx0tU.js";import{a as t,l as n,s as r}from"./nativeOverlay-
|
|
1
|
+
import{t as e}from"./elementBase-Cxeyx0tU.js";import{a as t,l as n,s as r}from"./nativeOverlay-DGady-wN.js";var i=80,a=220,o=`:scope > [data-wui-popover-trigger]`,s=`:scope > [data-wui-popover-panel]`,c=`.popover-arrow`,l=`.popover-header`,u=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,d=[`click`,`hover`,`focus`],f=[`top`,`bottom`,`start`,`end`,`auto`],p=0;function m(e,t){let n=e.querySelector(t);return n instanceof HTMLElement?n:null}function h(e){return e.pointerType===`touch`||e.pointerType===`pen`}var g=class extends e{_open;_timer;_pressOpen;_refocusing;_awaitChildren;_onPress;_onClick;_onOver;_onOut;_onFocusIn;_onFocusOut;_onKeyDown;static get observedAttributes(){return[`open`,`trigger`,`placement`,`open-delay`,`close-delay`,`role-dialog`,`auto-focus`,`labelled-by`]}constructor(){super(),this._open=!1,this._timer=null,this._pressOpen=null,this._refocusing=!1,this._awaitChildren=null,this._onPress=e=>{this._pressOpen=this._zone(e.target)===`trigger`?this._open:null},this._onClick=e=>{if(this._zone(e.target)!==`trigger`||!this._kinds().includes(`click`))return;let t=this._pressOpen??this._open;this._pressOpen=null,this._requestOpen(!t)},this._onOver=e=>{if(h(e))return;let t=this._zone(e.target);t===`panel`?this._clear():t===`trigger`&&this._kinds().includes(`hover`)&&this._schedule(!0)},this._onOut=e=>{!h(e)&&this._kinds().includes(`hover`)&&this._zone(e.target)&&!this._zone(e.relatedTarget)&&this._schedule(!1)},this._onFocusIn=e=>{if(this._refocusing)return;let t=this._zone(e.target);t===`trigger`&&this._kinds().includes(`focus`)?this._requestOpen(!0):t===`panel`&&this._clear()},this._onFocusOut=e=>{this._kinds().includes(`focus`)&&this._zone(e.target)&&!this._zone(e.relatedTarget)&&this._requestOpen(!1)},this._onKeyDown=e=>{if(e.key!==`Escape`||!this._open)return;e.preventDefault();let t=this._zone(this.ownerDocument.activeElement)===`panel`;this._clear(),this._requestOpen(!1),t&&!this._open&&this._trigger?.focus()}}get isOpen(){return this._open}show(){this._open||(this._applyOpen(!0),this._notify(!0,!1))}hide(){this._open&&(this._applyOpen(!1),this._notify(!1,!1))}connectedCallback(){this.addEventListener(`pointerdown`,this._onPress),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerover`,this._onOver),this.addEventListener(`pointerout`,this._onOut),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._stampTrigger(),this._openOrAwaitChildren()}attributeChangedCallback(e){e===`open`&&this._awaitChildren?this.hasAttribute(`open`)||this._disarmAwait():e===`open`&&this.isConnected&&this._openOrAwaitChildren()}disconnectedCallback(){this._disarmAwait(),this._clear(),this.removeEventListener(`pointerdown`,this._onPress),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerover`,this._onOver),this.removeEventListener(`pointerout`,this._onOut),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this.ownerDocument.removeEventListener(`keydown`,this._onKeyDown),this._open=!1;let e=this._panel;e&&t(e)}get _panel(){return m(this,s)}get _trigger(){let e=m(this,o);if(e)return e;for(let e of this.children)if(e instanceof HTMLElement&&!e.hasAttribute(`data-wui-popover-panel`))return e;return null}_stampTrigger(){let e=this._trigger;e&&(e.setAttribute(`data-wui-popover-trigger`,``),(this.getAttribute(`trigger`)??`click`).split(/\s+/).includes(`click`)&&!e.hasAttribute(`aria-expanded`)&&e.setAttribute(`aria-expanded`,`false`))}_zone(e){if(!(e instanceof Node)||!this.contains(e))return null;let t=e instanceof Element?e:e.parentElement;return this._panel?.contains(t)?`panel`:this._trigger?.contains(t)?`trigger`:null}_kinds(){let e=(this.getAttribute(`trigger`)??`click`).split(/\s+/).filter(Boolean),t=[];for(let n of e){let e=d.find(e=>e===n);if(!e)throw RangeError(`<wui-popover>: trigger="${n}" is not click, hover or focus.`);t.push(e)}if(t.length===0)throw RangeError(`<wui-popover>: trigger is empty; name click, hover or focus.`);return t}_side(){let e=this.getAttribute(`placement`)??`bottom`,t=f.find(t=>t===e);if(!t)throw RangeError(`<wui-popover>: placement="${e}" is not top, bottom, start, end or auto.`);return t}_delay(e,t){if(!this.hasAttribute(e))return t;let n=this.getAttribute(e)??``,r=Number(n);if(n.trim()===``||!Number.isFinite(r)||r<0)throw RangeError(`<wui-popover>: ${e}="${n}" is not zero or more milliseconds.`);return r}_clear(){this._timer!==null&&clearTimeout(this._timer),this._timer=null}_schedule(e){if(this._clear(),this._open===e)return;let t=e?this._delay(`open-delay`,i):this._delay(`close-delay`,a);this._timer=setTimeout(()=>{this._timer=null,this._requestOpen(e)},t)}_requestOpen(e){e!==this._open&&(e&&this._ready(),this._notify(e,!0)&&this._applyOpen(e))}_notify(e,t){return this.dispatchEvent(new CustomEvent(`wui-popover-toggle`,{bubbles:!0,cancelable:t,detail:{open:e}}))}_mode(){return this._kinds().includes(`click`)?`auto`:`manual`}_ready(){let e=this._panel;if(!e)throw Error(`<wui-popover> has no panel: a child with data-wui-popover-panel is required to open.`);let t=this._trigger;if(!t)throw Error(`<wui-popover> has no trigger: a child element is required to open.`);return{panel:e,trigger:t,side:this._side(),mode:this._mode()}}_applyOpen(e){if(this._stampTrigger(),e===this._open)return;if(e){let{panel:e,trigger:i,side:a,mode:o}=this._ready();this._open=!0,this._name(e);try{n(i,e,{mode:o,side:a,align:`center`,clampHeight:!0,arrow:m(e,c),onClosed:()=>this._onNativeClose()})}catch(n){throw this._open=!1,t(e),n}this.setAttribute(`open`,``),o===`manual`&&this.ownerDocument.addEventListener(`keydown`,this._onKeyDown),this.hasAttribute(`auto-focus`)&&queueMicrotask(()=>{this._open&&r(e)&&m(e,u)?.focus()}),i.hasAttribute(`aria-expanded`)&&i.setAttribute(`aria-expanded`,`true`);return}let i=this._panel;if(!i)throw Error(`<wui-popover> has no panel: a child with data-wui-popover-panel is required to close.`);let a=this._trigger;if(!a)throw Error(`<wui-popover> has no trigger: a child element is required to close.`);this._open=!1,this.ownerDocument.removeEventListener(`keydown`,this._onKeyDown),this.hasAttribute(`auto-focus`)&&this._mode()===`manual`&&i.contains(this.ownerDocument.activeElement)&&this._refocus(),t(i),this.removeAttribute(`open`),a.hasAttribute(`aria-expanded`)&&a.setAttribute(`aria-expanded`,`false`)}_openOrAwaitChildren(){if(this.hasAttribute(`open`)&&(this._panel===null||this._trigger===null)){if(this._awaitChildren)return;this._awaitChildren=new MutationObserver(()=>this._finishAwaitedOpen()),this._awaitChildren.observe(this,{childList:!0})}else this._applyOpen(this.hasAttribute(`open`))}_finishAwaitedOpen(){this._panel!==null&&this._trigger!==null&&(this._disarmAwait(),this._applyOpen(this.hasAttribute(`open`)))}_disarmAwait(){this._awaitChildren?.disconnect(),this._awaitChildren=null}_onNativeClose(){let e=this._panel;if(!this._open||!e||r(e))return;let t=e.contains(this.ownerDocument.activeElement);this._applyOpen(!1),t&&this._refocus(),this._notify(!1,!1)}_refocus(){let e=this._trigger;e&&(this._refocusing=!0,e.focus(),this._refocusing=!1)}_name(e){if(!this.hasAttribute(`role-dialog`))return;e.setAttribute(`role`,`dialog`);let t=this.getAttribute(`labelled-by`);if(t){e.setAttribute(`aria-labelledby`,t);return}let n=m(e,l);n&&(n.id||=`wui-popover-title-${++p}`,e.setAttribute(`aria-labelledby`,n.id))}};export{g as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./anchorOverlay-DSzkGQPi.js";import{t}from"./avatarHtml-BtbN7cA5.js";import{n}from"./devWarn-DXdRWZs3.js";import{r}from"./dom-Do1pAA12.js";import{t as i}from"./elementBase-Cxeyx0tU.js";import{r as a,t as o}from"./fieldState-D-zQcXUS.js";import{n as s,t as c}from"./formMirror-9IpSgeZb.js";import{n as l}from"./loader-Cf_ozcXz.js";import{t as u}from"./iconGlyphs.g-DxSJLQJ8.js";import{t as d}from"./imeSafeEnter-DPs9qL3S.js";import{n as f,t as p}from"./listboxKeyNav-DtlIOryj.js";import{a as m,l as h,s as g}from"./nativeOverlay-D3VmY8qn.js";import{i as _,n as v,r as y,t as b}from"./optionLabel-B2cU4Ax0.js";import{r as x}from"./textStore-opIEM4lu.js";import{n as S,r as C,t as w}from"./search.g-B5d1s59A.js";import{n as T,r as E,t as D}from"./window-BZWK3rQk.js";var O=()=>x(`select`,C);function k(e,t){let n=String(t??``).trim().toLowerCase();return n?e.filter(e=>[_(e),e.description,e.meta].some(e=>String(e??``).toLowerCase().includes(n))):e}var A=/* @__PURE__ */ new WeakMap,j=e=>e?` data-index="${e.index}" aria-setsize="${e.size}" aria-posinset="${e.index+1}"`:``,M;function ee(e){M=e}function N(e,t,n={}){let{selected:r=[],query:i=``,status:a=`idle`,emptyText:o=O().emptyText,searchingText:s=O().searchingText,hintText:c=O().hintText,actionRow:l=[],recents:u=null}=n,d=new Set(r.map(String)),f=k(t,i),p=e.id,m=l.filter(e=>e.position===`top`),h=l.filter(e=>e.position===`bottom`),g=u?.options.length?u.options:[],_=m.length+g.length+f.length+h.length,y=f.length>300,b=M,x=y&&b!==void 0,S=e=>x?{index:e,size:_}:void 0,C=0,w=e=>{let t=C++;return`<button type="button" role="option" id="${v(P(p,t))}" class="wui-select-option wui-select-add" data-value="${v(e.value)}" data-custom="true" aria-selected="false"${j(S(t))}>${v(e.label)}</button>`},T=e=>{let t=C++;return R(e,P(p,t),d.has(String(e.value)),S(t))},E=m.map(w).join(``),D=g.length&&u?`<div class="wui-select-group">${v(u.label)}</div>${g.map(T).join(``)}<div class="wui-select-sep" aria-hidden="true"></div>`:``,ee=C,N=``;if(x)C+=f.length;else{let e=``;for(let t of f)t.group&&t.group!==e&&(N+=`<div class="wui-select-group">${v(t.group)}</div>`),e=t.group??``,N+=T(t)}let F=h.map(w).join(``),I=``;if(a===`loading`?I=`<div class="wui-select-loading"><span class="wui-select-spinner spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>${v(s)}</div>`:a===`hint`?I=`<div class="wui-select-hint">${v(c)}</div>`:(a===`empty`||f.length===0&&l.length===0)&&(I=`<div class="wui-select-empty">${v(o)}</div>`),x&&b)return b.render(e,{options:t,query:i,rows:f,pre:E+D,post:F+I,picked:d,top:m,recent:g,bottom:h,bodyBase:ee,total:_}),{rows:_,windowed:!0,long:y};b?.clear(e);let L=E+D+N+F+I;return A.get(e)===L||(A.set(e,L),e.innerHTML=L),{rows:C,windowed:!1,long:y}}var P=(e,t)=>`${e}-opt-${t}`,F=e=>[...e.querySelectorAll(`.wui-select-option`)];function I(e){return M?M.refresh(e):!1}function L(e,t){return M?M.reveal(e,t):F(e)[t]??null}function te(e,t){if(M)return M.indexOfValue(e,t);let n=new Set(t.map(String));return F(e).findIndex(e=>n.has(e.dataset.value??``))}function ne(e,t){return M?M.indexByPrefix(e,t):F(e).findIndex(e=>(e.textContent??``).trim().toLowerCase().startsWith(t))}function R(e,n,r,i){let a=!!e.disabled,o=a&&e.disabledHint?` title="${v(e.disabledHint)}"`:``,s=`id="${v(n)}" role="option" data-value="${v(e.value)}" aria-selected="${r}"${a?` aria-disabled="true"`:``}${o}${j(i)}`,c=`<span class="wui-select-check" aria-hidden="true">${u(`check`)}</span>`;if(!e.description&&!e.meta)return`<button type="button" class="wui-select-option${r?` selected`:``}" ${s}>${t(e)}<span class="wui-select-opt-name">${y(e)}</span>${c}</button>`;let l=e.description?`<span class="wui-select-opt-desc">${v(e.description)}</span>`:``,d=e.meta?`<span class="wui-select-opt-meta">${v(e.meta)}</span>`:``;return`<div class="wui-select-option wui-select-option-rich${r?` selected`:``}" ${s}>${t(e)}<span class="wui-select-option-text"><span class="wui-opt-label">${y(e)}</span>${l}</span>${d}${c}</div>`}var re=Object.freeze([`single`,`multiple`,`search`,`tag`,`country`]),z=e=>e===`multiple`||e===`tag`,ie={recents:()=>import(`./recents-BQ0fD7Y0.js`),chips:()=>import(`./chips-IbfKMhVk.js`),search:()=>import(`./search-BVox4aaA.js`),country:()=>import(`./country-B7jmc--B.js`)};function ae(e){let t=Object.hasOwn(ie,e)?ie[e]:void 0;return t?t():Promise.reject(/* @__PURE__ */ Error(`Unknown <wui-select> part: ${e}.`))}var B=e=>typeof e.loadOptions==`function`||!!e.getAttribute(`source`)||e.hasAttribute(`remote`),oe=300,V=`<div class="wui-select-spacer" aria-hidden="true"></div>`,H=/* @__PURE__ */ new WeakMap;function se(e,t,n,r){let i=H.get(e);if(i&&i.options===t&&i.query===n&&i.count===r.length)return i;let a=[],o=new Int32Array(r.length),s=``;r.forEach((e,t)=>{e.group&&e.group!==s&&a.push({kind:`group`,label:e.group}),s=e.group??``,o[t]=a.length,a.push({kind:`option`,option:e,ord:t})});let c={options:t,query:n,count:r.length,entries:a,optionEntry:o,heights:D(a.length),estimated:!1,bodyTop:0,start:0,end:0,pre:``,post:``,picked:/* @__PURE__ */ new Set,top:[],recent:[],bottom:[],bodyBase:0,total:0};return H.set(e,c),e.scrollTop=0,c}var U=e=>e.clientHeight||oe,W=(e,t)=>E(t.heights,{scrollTop:Math.max(0,e.scrollTop-t.bodyTop),viewport:U(e)});function ce(e,t,n,r){let i=``;for(let a=n;a<r;a++){let n=e.entries[a];if(n){if(n.kind===`group`)i+=`<div class="wui-select-group" data-entry="${a}">${v(n.label)}</div>`;else{let r=e.bodyBase+n.ord;i+=R(n.option,P(t,r),e.picked.has(String(n.option.value)),{index:r,size:e.total})}}}return i}function G(e,t){let[n,r]=e.querySelectorAll(`.wui-select-spacer`);n&&r&&(n.style.flex=r.style.flex=`none`,n.style.height=`${t.heights.offsetOf(t.start)}px`,r.style.height=`${t.heights.total()-t.heights.offsetOf(t.end)}px`)}function K(e,t){let{start:n,end:r}=W(e,t);t.start=n,t.end=r;let i=t.pre+V+ce(t,e.id,n,r)+V+t.post,a=e.scrollTop;A.get(e)!==i&&(A.set(e,i),e.innerHTML=i),G(e,t),e.scrollTop!==a&&(e.scrollTop=a)}function le(e,t){let n={changed:!1,delta:0};if(!e.clientHeight)return n;let{heights:r}=t,i=e.querySelector(`.wui-select-spacer`),a=[],o=!0,s=!1;if(i){let n=i.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;Math.abs(n-t.bodyTop)>.5&&(t.bodyTop=n,s=!0)}let c=r.indexAt(Math.max(0,e.scrollTop-t.bodyTop)),l=r.offsetOf(c),u=0;for(let n of e.querySelectorAll(`.wui-select-option[data-index], .wui-select-group[data-entry]`)){let e=n.getBoundingClientRect().height;if(n.dataset.entry!==void 0)a.push([Number(n.dataset.entry),e]);else{let r=Number(n.dataset.index)-t.bodyBase,i=r>=0?t.optionEntry[r]:void 0;if(i===void 0)continue;o&&(u=e),o=!1,a.push([i,e])}}if(!t.estimated&&u>0){let e=r.estimate;r.setEstimate(u),t.estimated=!0,r.estimate!==e&&(s=!0)}for(let[e,t]of a)r.set(e,t)&&(s=!0);return s?{changed:s,delta:r.offsetOf(c)-l}:n}function q(e,t){K(e,t);for(let n=0;n<2;n++){let{changed:n,delta:r}=le(e,t);if(!n)return;G(e,t),r&&(e.scrollTop+=r),K(e,t)}}function ue(e,t){let n=se(e,t.options,t.query,t.rows);Object.assign(n,{pre:t.pre,post:t.post,picked:t.picked,top:t.top,recent:t.recent,bottom:t.bottom,bodyBase:t.bodyBase,total:t.total}),q(e,n)}function de(e){let t=H.get(e);if(!t)return!1;let{start:n,end:r}=W(e,t);return n===t.start&&r===t.end?!1:(q(e,t),!0)}function fe(e,t){let n=H.get(e);if(!n||t<0||t>=n.total)return null;let r=t-n.bodyBase,i=r>=0?n.optionEntry[r]:void 0,a=()=>e.querySelector(`[data-index="${t}"]`);if(i===void 0)return a();for(let t=0;t<2;t++){let t={scrollTop:e.scrollTop-n.bodyTop,viewport:U(e)},r=n.bodyTop+T(n.heights,i,t);if(Math.abs(r-e.scrollTop)>.5)e.scrollTop=r;else if(a())break;q(e,n)}return a()}function J(e,t){if(t<0||t>=e.total)return;if(t<e.top.length)return e.top[t];let n=t-e.top.length;if(n<e.recent.length)return e.recent[n];let r=t-e.bodyBase;if(r<e.count){let t=e.entries[e.optionEntry[r]??-1];return t?.kind===`option`?t.option:void 0}return e.bottom[r-e.count]}var pe=e=>e&&!(`position`in e)?e:void 0;function me(e,t){let n=H.get(e);if(!n||t.length===0)return-1;let r=new Set(t.map(String));for(let e=0;e<n.total;e++){let t=pe(J(n,e));if(t&&r.has(String(t.value)))return e}return-1}var he=e=>`position`in e?e.label:`${e.initials??``}${_(e)}${e.description??``}${e.meta??``}`;function ge(e,t){let n=H.get(e);if(!n)return-1;for(let e=0;e<n.total;e++){let r=J(n,e);if(r&&he(r).trim().toLowerCase().startsWith(t))return e}return-1}ee({render:ue,refresh:de,reveal:fe,indexOfValue:me,indexByPrefix:ge,clear(e){H.delete(e)}});function _e(){return Promise.resolve()}var Y=()=>x(`select`,C),X=()=>x(`search`,w),ve=()=>x(`field`,S),ye=class extends i{static formAssociated=!0;_internals;_value;_optionsProp;_partOptions;_known;_loadOptionsFn;_validateFn;_declared;_query;_ownsFilter;_active;_rows;_windowed;_windowLoad;_windowFailed;_scrollFrame;_status;_error;_nav;_parts;_partSig;_partsMounted;_partToken;_rendered;_searchShown;_defaultValue;_warnedMode;_warnedDensity;_hoverTimer;_hoverOpened;_onHoverOver;_onHoverOut;_panelShown;_pressOpen;static get observedAttributes(){return/* @__PURE__ */ `mode.value.placeholder.search-placeholder.empty-text.searchable.clearable.disabled.readonly.loading.required.size.density.icon.prefix.open.open-on-hover.aria-label.aria-describedby.aria-invalid.min-chars.debounce.source.remote.allow-custom.add-label.searching-text.hint-text.value-label.value-avatar.value-initials.max-tags.allow-duplicates.separators.pattern.invalid-message.create-label.collapse-chips.selected-text.clear-all-label.countries.suggested.suggested-label.all-countries-label.recents-key.recents-limit.recents-label`.split(`.`)}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._optionsProp=null,this._partOptions=null,this._known=/* @__PURE__ */ new Map,this._loadOptionsFn=null,this._validateFn=null,this._declared=void 0,this._query=``,this._ownsFilter=!1,this._active=-1,this._rows=0,this._windowed=!1,this._windowLoad=null,this._windowFailed=!1,this._scrollFrame=null,this._status=`idle`,this._error=``,this._nav=null,this._parts=null,this._partSig=``,this._partsMounted=!1,this._partToken=0,this._rendered=!1,this._searchShown=!1,this._defaultValue=void 0,this._warnedMode=null,this._hoverTimer=null,this._hoverOpened=!1,this._panelShown=!1,this._pressOpen=null,this._onHoverOver=e=>{e.pointerType===`mouse`&&this._hoverZone(e.target)&&(this._clearHover(),!this._menuOpen()&&this._hoverEligible()&&(this._hoverTimer=setTimeout(()=>{this._hoverTimer=null,!this._menuOpen()&&this._hoverEligible()&&(this._open({focus:!1}),this._hoverOpened=!0)},Ce)))},this._onHoverOut=e=>{e.pointerType===`mouse`&&this._hoverZone(e.target)&&!this._hoverZone(e.relatedTarget)&&(this._clearHover(),this._menuOpen()&&this.hasAttribute(`open-on-hover`)&&(this._hoverTimer=setTimeout(()=>{this._hoverTimer=null,this._close()},we)))}}connectedCallback(){this.addEventListener(`pointerover`,this._onHoverOver),this.addEventListener(`pointerout`,this._onHoverOut),this._rendered||this.render(),this._ensureParts(),this._mountParts()}disconnectedCallback(){this.removeEventListener(`pointerover`,this._onHoverOver),this.removeEventListener(`pointerout`,this._onHoverOut),this._clearHover(),this._dropMenu(),this._teardown(),this._teardownParts()}attributeChangedCallback(e,t,n){e===`value`?(this._value=Z(n,z(this.mode)),this._applyValue()):e===`aria-invalid`?this._syncInvalid():e===`open`?this._rendered&&(this.hasAttribute(`open`)?this._open({focus:!1}):this._close({force:!0})):e===`open-on-hover`?this.hasAttribute(`open-on-hover`)||this._clearHover():(e===`mode`&&(this._value=Z(this._value,z(this.mode)),this._partOptions=null,this._known.clear(),this._ensureParts()),(e===`source`||e===`remote`||e===`recents-key`)&&this._ensureParts(),Oe.has(e)?this._rendered&&(this._drawValue(),this.renderList()):De.has(e)?this._remountParts():this._rendered&&this.render())}formResetCallback(){if(this.value=this._defaultValue??``,!this._rendered)return;let e=this._refs();e.input&&(e.input.value=``,e.input.removeAttribute(`aria-invalid`)),e.search&&(e.search.value=``),this.setError(``),this._query!==``&&this._onQueryChange(``)}get mode(){let e=this.getAttribute(`mode`);return e===null?`single`:xe(e)?e:(e!==this._warnedMode&&(this._warnedMode=e,n(`<wui-select> mode "${e}" is not one of ${re.join(`, `)}; it is treated as "single".`)),`single`)}_checkDensity(){let e=this.getAttribute(`density`);e===null||Se.includes(e)||e===this._warnedDensity||(this._warnedDensity=e,n(`<wui-select> density "${e}" is not one of ${Se.join(`, `)}; it is treated as "comfortable".`))}set mode(e){this.setAttribute(`mode`,String(e))}get value(){return Array.isArray(this._value)?this._value.slice():this._value}set value(e){this._value=Z(e,z(this.mode)),this._applyValue()}get options(){return this._readOptions()}set options(e){this._optionsProp=Array.isArray(e)?e:null,this.mode!==`country`&&(this._partOptions=null);for(let e of this._activePartsList())e.onOptions?.();if(this._rendered){if(this.mode===`single`&&this.getAttribute(`searchable`)===null&&this._autoSearch()!==this._searchShown){this.render();return}this._drawValue(),this.renderList()}}get loadOptions(){return this._loadOptionsFn}set loadOptions(e){this._loadOptionsFn=typeof e==`function`?e:null,this._ensureParts()}get validate(){return this._validateFn}set validate(e){this._validateFn=typeof e==`function`?e:null}commit(e,t={}){this.value=e,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{isCustom:!!t.isCustom}}))}setPartOptions(e){this._partOptions=Array.isArray(e)?e:null,this._drawValue(),this.renderList()}setStatus(e){this._status=e,this.renderList()}setError(e){this._error=e?String(e):``,this._syncError()}openMenu(){o(this)||this._open({focus:!1})}closeMenu({focusControl:e=!1}={}){this._close(),e&&this._refs().control?.focus()}renderList(){let e=this._refs();if(!e.list)return;let t=N(e.list,this._listOptions(),{selected:this._selectedValues(),query:this._ownsFilter?``:this._query,status:this._status,emptyText:this.getAttribute(`empty-text`)||Y().emptyText,searchingText:this.getAttribute(`searching-text`)||Y().searchingText,hintText:this.getAttribute(`hint-text`)||void 0,actionRow:this._actionRows(),recents:this._recents()});this._rows=t.rows,this._windowed=t.windowed,t.long&&!t.windowed&&!this._windowFailed&&this._loadWindow(),this._active>=this._rowCount()&&(this._active=-1),this._active>=0&&this._setActive(this._active,{reveal:!1}),this._anchorMenu()}render(){this._dropMenu();let e=this._carry();this._teardownParts(),this._snapshotDeclared();let t=this.mode;this._checkDensity();let n=z(t),r=t===`tag`,i=n&&(r||this.hasAttribute(`allow-custom`));this._value=Z(this._value,n),this._defaultValue===void 0&&n&&this._value.length===0&&(this._value=this._declaredSelected()),n||this._preselect(),this._defaultValue===void 0&&(this._defaultValue=Z(this._value,n));let o=this.getAttribute(`size`),s=o===`sm`?` wui-select-sm`:o===`lg`?` wui-select-lg`:o===`xl`?` wui-select-xl`:``,c=this.getAttribute(`icon`),l=this.getAttribute(`prefix`),d=this.hasAttribute(`clearable`),f=this.hasAttribute(`disabled`);this.id||=`wui-select-${Math.random().toString(36).slice(2,9)}`;let p=`${this.id}-listbox`,m=`${this.id}-entry-error`,h=this.getAttribute(`aria-describedby`)?.trim(),g=h?`${h} ${m}`:m,_=this.hasAttribute(`aria-invalid`)||this._error?` aria-invalid="true"`:``,y=this.hasAttribute(`required`)&&!i?` aria-required="true"`:``,b=` aria-label="${v(this._accessibleName())}" aria-describedby="${v(g)}"${_}${y}`,x=i?``:` role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${v(p)}"`,S=n?`<div class="input wui-select-control wui-select-multi"${x}${b}${f?` aria-disabled="true"`:r?``:` tabindex="0"`}>`:`<button type="button" class="input wui-select-control"${x}${b}${f?` disabled`:``}>`,C=`${c?u(c,{className:`wui-select-icon`}):``}${l?`<span class="wui-select-prefix">${v(l)}</span>`:``}<span class="wui-select-value" data-label></span>${d?`<span class="wui-select-reset" role="button" aria-label="${v(Y().clearSelectionLabel)}" hidden>${u(`x`)}</span>`:``}${u(`chevron-down`,{className:`wui-select-caret`})}`,w=this.getAttribute(`searchable`),T=w===null?t===`multiple`||t===`country`||this._autoSearch():w!==`false`,E=t===`search`||T&&!i;this._searchShown=E;let D=this.getAttribute(`search-placeholder`)||(t===`country`?Y().countrySearchPlaceholder:X().placeholder),O=E?`<div class="wui-select-search">${u(`search`)}<input class="wui-select-input" placeholder="${v(D)}" aria-label="${v(D)}" aria-autocomplete="list" /><button type="button" class="wui-select-clear" aria-label="${v(X().clearLabel)}" hidden>${u(`x`)}</button></div>`:``;this.innerHTML=`
|
|
1
|
+
import{t as e}from"./anchorOverlay-DSzkGQPi.js";import{t}from"./avatarHtml-BWlA0cm-.js";import{n}from"./devWarn-DXdRWZs3.js";import{r}from"./dom-Do1pAA12.js";import{t as i}from"./elementBase-Cxeyx0tU.js";import{r as a,t as o}from"./fieldState-D-zQcXUS.js";import{n as s,t as c}from"./formMirror-9IpSgeZb.js";import{n as l}from"./loader-Cf_ozcXz.js";import{t as u}from"./iconGlyphs.g-BUF97bUu.js";import{t as d}from"./imeSafeEnter-DPs9qL3S.js";import{n as f,t as p}from"./listboxKeyNav-DtlIOryj.js";import{a as m,l as h,s as g}from"./nativeOverlay-DGady-wN.js";import{i as _,n as v,r as y,t as b}from"./optionLabel-CWMhBkdO.js";import{r as x}from"./textStore-opIEM4lu.js";import{n as S,r as C,t as w}from"./search.g-B5d1s59A.js";import{n as T,r as E,t as D}from"./window-BZWK3rQk.js";var O=()=>x(`select`,C);function k(e,t){let n=String(t??``).trim().toLowerCase();return n?e.filter(e=>[_(e),e.description,e.meta].some(e=>String(e??``).toLowerCase().includes(n))):e}var A=/* @__PURE__ */ new WeakMap,j=e=>e?` data-index="${e.index}" aria-setsize="${e.size}" aria-posinset="${e.index+1}"`:``,M;function ee(e){M=e}function N(e,t,n={}){let{selected:r=[],query:i=``,status:a=`idle`,emptyText:o=O().emptyText,searchingText:s=O().searchingText,hintText:c=O().hintText,actionRow:l=[],recents:u=null}=n,d=new Set(r.map(String)),f=k(t,i),p=e.id,m=l.filter(e=>e.position===`top`),h=l.filter(e=>e.position===`bottom`),g=u?.options.length?u.options:[],_=m.length+g.length+f.length+h.length,y=f.length>300,b=M,x=y&&b!==void 0,S=e=>x?{index:e,size:_}:void 0,C=0,w=e=>{let t=C++;return`<button type="button" role="option" id="${v(P(p,t))}" class="wui-select-option wui-select-add" data-value="${v(e.value)}" data-custom="true" aria-selected="false"${j(S(t))}>${v(e.label)}</button>`},T=e=>{let t=C++;return R(e,P(p,t),d.has(String(e.value)),S(t))},E=m.map(w).join(``),D=g.length&&u?`<div class="wui-select-group">${v(u.label)}</div>${g.map(T).join(``)}<div class="wui-select-sep" aria-hidden="true"></div>`:``,ee=C,N=``;if(x)C+=f.length;else{let e=``;for(let t of f)t.group&&t.group!==e&&(N+=`<div class="wui-select-group">${v(t.group)}</div>`),e=t.group??``,N+=T(t)}let F=h.map(w).join(``),I=``;if(a===`loading`?I=`<div class="wui-select-loading"><span class="wui-select-spinner spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>${v(s)}</div>`:a===`hint`?I=`<div class="wui-select-hint">${v(c)}</div>`:(a===`empty`||f.length===0&&l.length===0)&&(I=`<div class="wui-select-empty">${v(o)}</div>`),x&&b)return b.render(e,{options:t,query:i,rows:f,pre:E+D,post:F+I,picked:d,top:m,recent:g,bottom:h,bodyBase:ee,total:_}),{rows:_,windowed:!0,long:y};b?.clear(e);let L=E+D+N+F+I;return A.get(e)===L||(A.set(e,L),e.innerHTML=L),{rows:C,windowed:!1,long:y}}var P=(e,t)=>`${e}-opt-${t}`,F=e=>[...e.querySelectorAll(`.wui-select-option`)];function I(e){return M?M.refresh(e):!1}function L(e,t){return M?M.reveal(e,t):F(e)[t]??null}function te(e,t){if(M)return M.indexOfValue(e,t);let n=new Set(t.map(String));return F(e).findIndex(e=>n.has(e.dataset.value??``))}function ne(e,t){return M?M.indexByPrefix(e,t):F(e).findIndex(e=>(e.textContent??``).trim().toLowerCase().startsWith(t))}function R(e,n,r,i){let a=!!e.disabled,o=a&&e.disabledHint?` title="${v(e.disabledHint)}"`:``,s=`id="${v(n)}" role="option" data-value="${v(e.value)}" aria-selected="${r}"${a?` aria-disabled="true"`:``}${o}${j(i)}`,c=`<span class="wui-select-check" aria-hidden="true">${u(`check`)}</span>`;if(!e.description&&!e.meta)return`<button type="button" class="wui-select-option${r?` selected`:``}" ${s}>${t(e)}<span class="wui-select-opt-name">${y(e)}</span>${c}</button>`;let l=e.description?`<span class="wui-select-opt-desc">${v(e.description)}</span>`:``,d=e.meta?`<span class="wui-select-opt-meta">${v(e.meta)}</span>`:``;return`<div class="wui-select-option wui-select-option-rich${r?` selected`:``}" ${s}>${t(e)}<span class="wui-select-option-text"><span class="wui-opt-label">${y(e)}</span>${l}</span>${d}${c}</div>`}var re=Object.freeze([`single`,`multiple`,`search`,`tag`,`country`]),z=e=>e===`multiple`||e===`tag`,ie={recents:()=>import(`./recents-BQ0fD7Y0.js`),chips:()=>import(`./chips-B4ZNRO-h.js`),search:()=>import(`./search-w5M6FzD9.js`),country:()=>import(`./country-B7jmc--B.js`)};function ae(e){let t=Object.hasOwn(ie,e)?ie[e]:void 0;return t?t():Promise.reject(/* @__PURE__ */ Error(`Unknown <wui-select> part: ${e}.`))}var B=e=>typeof e.loadOptions==`function`||!!e.getAttribute(`source`)||e.hasAttribute(`remote`),oe=300,V=`<div class="wui-select-spacer" aria-hidden="true"></div>`,H=/* @__PURE__ */ new WeakMap;function se(e,t,n,r){let i=H.get(e);if(i&&i.options===t&&i.query===n&&i.count===r.length)return i;let a=[],o=new Int32Array(r.length),s=``;r.forEach((e,t)=>{e.group&&e.group!==s&&a.push({kind:`group`,label:e.group}),s=e.group??``,o[t]=a.length,a.push({kind:`option`,option:e,ord:t})});let c={options:t,query:n,count:r.length,entries:a,optionEntry:o,heights:D(a.length),estimated:!1,bodyTop:0,start:0,end:0,pre:``,post:``,picked:/* @__PURE__ */ new Set,top:[],recent:[],bottom:[],bodyBase:0,total:0};return H.set(e,c),e.scrollTop=0,c}var U=e=>e.clientHeight||oe,W=(e,t)=>E(t.heights,{scrollTop:Math.max(0,e.scrollTop-t.bodyTop),viewport:U(e)});function ce(e,t,n,r){let i=``;for(let a=n;a<r;a++){let n=e.entries[a];if(n){if(n.kind===`group`)i+=`<div class="wui-select-group" data-entry="${a}">${v(n.label)}</div>`;else{let r=e.bodyBase+n.ord;i+=R(n.option,P(t,r),e.picked.has(String(n.option.value)),{index:r,size:e.total})}}}return i}function G(e,t){let[n,r]=e.querySelectorAll(`.wui-select-spacer`);n&&r&&(n.style.flex=r.style.flex=`none`,n.style.height=`${t.heights.offsetOf(t.start)}px`,r.style.height=`${t.heights.total()-t.heights.offsetOf(t.end)}px`)}function K(e,t){let{start:n,end:r}=W(e,t);t.start=n,t.end=r;let i=t.pre+V+ce(t,e.id,n,r)+V+t.post,a=e.scrollTop;A.get(e)!==i&&(A.set(e,i),e.innerHTML=i),G(e,t),e.scrollTop!==a&&(e.scrollTop=a)}function le(e,t){let n={changed:!1,delta:0};if(!e.clientHeight)return n;let{heights:r}=t,i=e.querySelector(`.wui-select-spacer`),a=[],o=!0,s=!1;if(i){let n=i.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;Math.abs(n-t.bodyTop)>.5&&(t.bodyTop=n,s=!0)}let c=r.indexAt(Math.max(0,e.scrollTop-t.bodyTop)),l=r.offsetOf(c),u=0;for(let n of e.querySelectorAll(`.wui-select-option[data-index], .wui-select-group[data-entry]`)){let e=n.getBoundingClientRect().height;if(n.dataset.entry!==void 0)a.push([Number(n.dataset.entry),e]);else{let r=Number(n.dataset.index)-t.bodyBase,i=r>=0?t.optionEntry[r]:void 0;if(i===void 0)continue;o&&(u=e),o=!1,a.push([i,e])}}if(!t.estimated&&u>0){let e=r.estimate;r.setEstimate(u),t.estimated=!0,r.estimate!==e&&(s=!0)}for(let[e,t]of a)r.set(e,t)&&(s=!0);return s?{changed:s,delta:r.offsetOf(c)-l}:n}function q(e,t){K(e,t);for(let n=0;n<2;n++){let{changed:n,delta:r}=le(e,t);if(!n)return;G(e,t),r&&(e.scrollTop+=r),K(e,t)}}function ue(e,t){let n=se(e,t.options,t.query,t.rows);Object.assign(n,{pre:t.pre,post:t.post,picked:t.picked,top:t.top,recent:t.recent,bottom:t.bottom,bodyBase:t.bodyBase,total:t.total}),q(e,n)}function de(e){let t=H.get(e);if(!t)return!1;let{start:n,end:r}=W(e,t);return n===t.start&&r===t.end?!1:(q(e,t),!0)}function fe(e,t){let n=H.get(e);if(!n||t<0||t>=n.total)return null;let r=t-n.bodyBase,i=r>=0?n.optionEntry[r]:void 0,a=()=>e.querySelector(`[data-index="${t}"]`);if(i===void 0)return a();for(let t=0;t<2;t++){let t={scrollTop:e.scrollTop-n.bodyTop,viewport:U(e)},r=n.bodyTop+T(n.heights,i,t);if(Math.abs(r-e.scrollTop)>.5)e.scrollTop=r;else if(a())break;q(e,n)}return a()}function J(e,t){if(t<0||t>=e.total)return;if(t<e.top.length)return e.top[t];let n=t-e.top.length;if(n<e.recent.length)return e.recent[n];let r=t-e.bodyBase;if(r<e.count){let t=e.entries[e.optionEntry[r]??-1];return t?.kind===`option`?t.option:void 0}return e.bottom[r-e.count]}var pe=e=>e&&!(`position`in e)?e:void 0;function me(e,t){let n=H.get(e);if(!n||t.length===0)return-1;let r=new Set(t.map(String));for(let e=0;e<n.total;e++){let t=pe(J(n,e));if(t&&r.has(String(t.value)))return e}return-1}var he=e=>`position`in e?e.label:`${e.initials??``}${_(e)}${e.description??``}${e.meta??``}`;function ge(e,t){let n=H.get(e);if(!n)return-1;for(let e=0;e<n.total;e++){let r=J(n,e);if(r&&he(r).trim().toLowerCase().startsWith(t))return e}return-1}ee({render:ue,refresh:de,reveal:fe,indexOfValue:me,indexByPrefix:ge,clear(e){H.delete(e)}});function _e(){return Promise.resolve()}var Y=()=>x(`select`,C),X=()=>x(`search`,w),ve=()=>x(`field`,S),ye=class extends i{static formAssociated=!0;_internals;_value;_optionsProp;_partOptions;_known;_loadOptionsFn;_validateFn;_declared;_query;_ownsFilter;_active;_rows;_windowed;_windowLoad;_windowFailed;_scrollFrame;_status;_error;_nav;_parts;_partSig;_partsMounted;_partToken;_rendered;_searchShown;_defaultValue;_warnedMode;_warnedDensity;_hoverTimer;_hoverOpened;_onHoverOver;_onHoverOut;_panelShown;_pressOpen;static get observedAttributes(){return/* @__PURE__ */ `mode.value.placeholder.search-placeholder.empty-text.searchable.clearable.disabled.readonly.loading.required.size.density.icon.prefix.open.open-on-hover.aria-label.aria-describedby.aria-invalid.min-chars.debounce.source.remote.allow-custom.add-label.searching-text.hint-text.value-label.value-avatar.value-initials.max-tags.allow-duplicates.separators.pattern.invalid-message.create-label.collapse-chips.selected-text.clear-all-label.countries.suggested.suggested-label.all-countries-label.recents-key.recents-limit.recents-label`.split(`.`)}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._optionsProp=null,this._partOptions=null,this._known=/* @__PURE__ */ new Map,this._loadOptionsFn=null,this._validateFn=null,this._declared=void 0,this._query=``,this._ownsFilter=!1,this._active=-1,this._rows=0,this._windowed=!1,this._windowLoad=null,this._windowFailed=!1,this._scrollFrame=null,this._status=`idle`,this._error=``,this._nav=null,this._parts=null,this._partSig=``,this._partsMounted=!1,this._partToken=0,this._rendered=!1,this._searchShown=!1,this._defaultValue=void 0,this._warnedMode=null,this._hoverTimer=null,this._hoverOpened=!1,this._panelShown=!1,this._pressOpen=null,this._onHoverOver=e=>{e.pointerType===`mouse`&&this._hoverZone(e.target)&&(this._clearHover(),!this._menuOpen()&&this._hoverEligible()&&(this._hoverTimer=setTimeout(()=>{this._hoverTimer=null,!this._menuOpen()&&this._hoverEligible()&&(this._open({focus:!1}),this._hoverOpened=!0)},Ce)))},this._onHoverOut=e=>{e.pointerType===`mouse`&&this._hoverZone(e.target)&&!this._hoverZone(e.relatedTarget)&&(this._clearHover(),this._menuOpen()&&this.hasAttribute(`open-on-hover`)&&(this._hoverTimer=setTimeout(()=>{this._hoverTimer=null,this._close()},we)))}}connectedCallback(){this.addEventListener(`pointerover`,this._onHoverOver),this.addEventListener(`pointerout`,this._onHoverOut),this._rendered||this.render(),this._ensureParts(),this._mountParts()}disconnectedCallback(){this.removeEventListener(`pointerover`,this._onHoverOver),this.removeEventListener(`pointerout`,this._onHoverOut),this._clearHover(),this._dropMenu(),this._teardown(),this._teardownParts()}attributeChangedCallback(e,t,n){e===`value`?(this._value=Z(n,z(this.mode)),this._applyValue()):e===`aria-invalid`?this._syncInvalid():e===`open`?this._rendered&&(this.hasAttribute(`open`)?this._open({focus:!1}):this._close({force:!0})):e===`open-on-hover`?this.hasAttribute(`open-on-hover`)||this._clearHover():(e===`mode`&&(this._value=Z(this._value,z(this.mode)),this._partOptions=null,this._known.clear(),this._ensureParts()),(e===`source`||e===`remote`||e===`recents-key`)&&this._ensureParts(),Oe.has(e)?this._rendered&&(this._drawValue(),this.renderList()):De.has(e)?this._remountParts():this._rendered&&this.render())}formResetCallback(){if(this.value=this._defaultValue??``,!this._rendered)return;let e=this._refs();e.input&&(e.input.value=``,e.input.removeAttribute(`aria-invalid`)),e.search&&(e.search.value=``),this.setError(``),this._query!==``&&this._onQueryChange(``)}get mode(){let e=this.getAttribute(`mode`);return e===null?`single`:xe(e)?e:(e!==this._warnedMode&&(this._warnedMode=e,n(`<wui-select> mode "${e}" is not one of ${re.join(`, `)}; it is treated as "single".`)),`single`)}_checkDensity(){let e=this.getAttribute(`density`);e===null||Se.includes(e)||e===this._warnedDensity||(this._warnedDensity=e,n(`<wui-select> density "${e}" is not one of ${Se.join(`, `)}; it is treated as "comfortable".`))}set mode(e){this.setAttribute(`mode`,String(e))}get value(){return Array.isArray(this._value)?this._value.slice():this._value}set value(e){this._value=Z(e,z(this.mode)),this._applyValue()}get options(){return this._readOptions()}set options(e){this._optionsProp=Array.isArray(e)?e:null,this.mode!==`country`&&(this._partOptions=null);for(let e of this._activePartsList())e.onOptions?.();if(this._rendered){if(this.mode===`single`&&this.getAttribute(`searchable`)===null&&this._autoSearch()!==this._searchShown){this.render();return}this._drawValue(),this.renderList()}}get loadOptions(){return this._loadOptionsFn}set loadOptions(e){this._loadOptionsFn=typeof e==`function`?e:null,this._ensureParts()}get validate(){return this._validateFn}set validate(e){this._validateFn=typeof e==`function`?e:null}commit(e,t={}){this.value=e,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{isCustom:!!t.isCustom}}))}setPartOptions(e){this._partOptions=Array.isArray(e)?e:null,this._drawValue(),this.renderList()}setStatus(e){this._status=e,this.renderList()}setError(e){this._error=e?String(e):``,this._syncError()}openMenu(){o(this)||this._open({focus:!1})}closeMenu({focusControl:e=!1}={}){this._close(),e&&this._refs().control?.focus()}renderList(){let e=this._refs();if(!e.list)return;let t=N(e.list,this._listOptions(),{selected:this._selectedValues(),query:this._ownsFilter?``:this._query,status:this._status,emptyText:this.getAttribute(`empty-text`)||Y().emptyText,searchingText:this.getAttribute(`searching-text`)||Y().searchingText,hintText:this.getAttribute(`hint-text`)||void 0,actionRow:this._actionRows(),recents:this._recents()});this._rows=t.rows,this._windowed=t.windowed,t.long&&!t.windowed&&!this._windowFailed&&this._loadWindow(),this._active>=this._rowCount()&&(this._active=-1),this._active>=0&&this._setActive(this._active,{reveal:!1}),this._anchorMenu()}render(){this._dropMenu();let e=this._carry();this._teardownParts(),this._snapshotDeclared();let t=this.mode;this._checkDensity();let n=z(t),r=t===`tag`,i=n&&(r||this.hasAttribute(`allow-custom`));this._value=Z(this._value,n),this._defaultValue===void 0&&n&&this._value.length===0&&(this._value=this._declaredSelected()),n||this._preselect(),this._defaultValue===void 0&&(this._defaultValue=Z(this._value,n));let o=this.getAttribute(`size`),s=o===`sm`?` wui-select-sm`:o===`lg`?` wui-select-lg`:o===`xl`?` wui-select-xl`:``,c=this.getAttribute(`icon`),l=this.getAttribute(`prefix`),d=this.hasAttribute(`clearable`),f=this.hasAttribute(`disabled`);this.id||=`wui-select-${Math.random().toString(36).slice(2,9)}`;let p=`${this.id}-listbox`,m=`${this.id}-entry-error`,h=this.getAttribute(`aria-describedby`)?.trim(),g=h?`${h} ${m}`:m,_=this.hasAttribute(`aria-invalid`)||this._error?` aria-invalid="true"`:``,y=this.hasAttribute(`required`)&&!i?` aria-required="true"`:``,b=` aria-label="${v(this._accessibleName())}" aria-describedby="${v(g)}"${_}${y}`,x=i?``:` role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${v(p)}"`,S=n?`<div class="input wui-select-control wui-select-multi"${x}${b}${f?` aria-disabled="true"`:r?``:` tabindex="0"`}>`:`<button type="button" class="input wui-select-control"${x}${b}${f?` disabled`:``}>`,C=`${c?u(c,{className:`wui-select-icon`}):``}${l?`<span class="wui-select-prefix">${v(l)}</span>`:``}<span class="wui-select-value" data-label></span>${d?`<span class="wui-select-reset" role="button" aria-label="${v(Y().clearSelectionLabel)}" hidden>${u(`x`)}</span>`:``}${u(`chevron-down`,{className:`wui-select-caret`})}`,w=this.getAttribute(`searchable`),T=w===null?t===`multiple`||t===`country`||this._autoSearch():w!==`false`,E=t===`search`||T&&!i;this._searchShown=E;let D=this.getAttribute(`search-placeholder`)||(t===`country`?Y().countrySearchPlaceholder:X().placeholder),O=E?`<div class="wui-select-search">${u(`search`)}<input class="wui-select-input" placeholder="${v(D)}" aria-label="${v(D)}" aria-autocomplete="list" /><button type="button" class="wui-select-clear" aria-label="${v(X().clearLabel)}" hidden>${u(`x`)}</button></div>`:``;this.innerHTML=`
|
|
2
2
|
<div class="wui-select${s}">
|
|
3
3
|
${S}${C}${n?`</div>`:`</button>`}
|
|
4
4
|
<div class="wui-select-menu wui-select-menu-fixed" popover="auto">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./dom-Do1pAA12.js";import{t as n}from"./elementBase-Cxeyx0tU.js";import{a as r,l as i,s as a}from"./nativeOverlay-
|
|
1
|
+
import{r as e,t}from"./dom-Do1pAA12.js";import{t as n}from"./elementBase-Cxeyx0tU.js";import{a as r,l as i,s as a}from"./nativeOverlay-DGady-wN.js";import{a as o,c as s,d as c,f as l,l as u,o as d,p as f,r as p}from"./shortcutKeys-DmPiY4T7.js";var m=`wui-shortcuts-open-change`;function h(e,t){let n=e.querySelector(t);return n instanceof HTMLElement?n:null}function g(e,t){return[...e.querySelectorAll(t)].filter(e=>e instanceof HTMLElement)}var _=class extends n{_doc;_onKeyDown;_onClick;_onDocClick;_onPointerDown;_onPressEnd;_pressedOpen;_pinned;_mirroring;static get observedAttributes(){return[`open`,`no-trigger`]}constructor(){super(),this._doc=null,this._pressedOpen=!1,this._pinned=!1,this._mirroring=!1,this._onKeyDown=e=>this._keydown(e),this._onClick=e=>this._click(e),this._onDocClick=e=>{let n=t(e.target,`[data-wui-shortcuts-open]`)?.getAttribute(`data-wui-shortcuts-open`);n&&this.matches(n)&&this.setOpen(!0)},this._onPointerDown=e=>{t(e.target,`.wui-shortcut-toggle`)&&(this._pressedOpen=this.open)},this._onPressEnd=e=>{e.type===`pointerup`&&t(e.target,`.wui-shortcut-toggle`)||(this._pressedOpen=!1)}}connectedCallback(){this._doc=this.ownerDocument,this._doc.addEventListener(`keydown`,this._onKeyDown),this._doc.addEventListener(`click`,this._onDocClick),this._doc.addEventListener(`pointerup`,this._onPressEnd,!0),this._doc.addEventListener(`pointercancel`,this._onPressEnd,!0),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerdown`,this._onPointerDown,!0),this.hasAttribute(`open`)&&!this.open&&(this._pinned=!0,this.setOpen(!0,{focus:!1})),this._syncTrigger()}attributeChangedCallback(e,t,n){e===`no-trigger`?this._syncTrigger():(this._mirroring||(this._pinned=n!==null),this._sheet()&&n!==null!==this.open&&this.setOpen(n!==null))}disconnectedCallback(){let e=this._sheet();e&&r(e),this._doc?.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`click`,this._onDocClick),this._doc?.removeEventListener(`pointerup`,this._onPressEnd,!0),this._doc?.removeEventListener(`pointercancel`,this._onPressEnd,!0),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerdown`,this._onPointerDown,!0),this._doc=null}get open(){let e=this._sheet();return!!(e&&a(e))}set open(e){let t=e===!0||e===``||e===`true`;this._pinned=t,this._sheet()?t!==this.open&&this.setOpen(t):this.toggleAttribute(`open`,t)}setOpen(t,{focus:n=!0}={}){let o=this._sheet();if(!o)return;let s=h(this,`.wui-shortcut-toggle`);if(t||(this._pinned=!1),t){o.removeAttribute(`hidden`);let t=this.hasAttribute(`no-trigger`)?s??this:e(s,`<wui-shortcuts> needs its toggle to anchor the sheet.`);i(t,o,{mode:`auto`,side:`top`,align:`end`,flipAlign:!0,gap:8,keepOffscreen:this._pinned,onClosed:()=>{this._pinned=!1,this._mirror(!1)}})}else r(o);this._mirror(t),n&&(t?queueMicrotask(()=>{a(o)&&h(o,`.wui-shortcut-close`)?.focus()}):s?.focus())}_mirror(e){let t=this._sheet();t&&(t.hidden=!e),h(this,`.wui-shortcut-toggle`)?.setAttribute(`aria-expanded`,String(e)),this.hasAttribute(`open`)!==e&&(this._mirroring=!0,this.toggleAttribute(`open`,e),this._mirroring=!1,this.dispatchEvent(new CustomEvent(m,{bubbles:!0,detail:{open:e}})))}_sheet(){return h(this,`.wui-shortcut-sheet`)}_syncTrigger(){let e=h(this,`.wui-shortcut-toggle`);e&&(e.hidden=this.hasAttribute(`no-trigger`))}_scope(){let e=this.closest(`[${p}]`);return e instanceof HTMLElement?e:null}_items(){let t=this.getAttribute(`items`);return t?g(e(this._scope()??this._doc,`WuiShortcuts used before it was connected`),t):[]}_click(e){let t=e.target;if(t instanceof Element){if(t.closest(`.wui-shortcut-toggle`)){let e=this._pressedOpen;this._pressedOpen=!1,this.setOpen(!e&&!this.open)}else t.closest(`.wui-shortcut-close`)&&this.setOpen(!1)}}_tickFocused(){let t=this._items(),n=e(this._doc,`WuiShortcuts used before it was connected`).activeElement,r=n?.closest?.(`li, tr`),i=t.find(e=>e===n||e.contains(n)||r?.contains(e)),a=(i?.closest(`li, tr`)??i)?.querySelector(`input[type="checkbox"]`);a instanceof HTMLInputElement&&a.click()}_focusSearch(){let t=this.getAttribute(`search`);if(!t)return;let n=e(this._doc,`WuiShortcuts used before it was connected`);(h(this._scope()??n,t)??h(n,t))?.focus()}_keydown(t){if(t.defaultPrevented)return;let n=l(t);if(!n)return;if(n===`esc`&&this.open){t.preventDefault(),this.setOpen(!1);return}let r=this._scope(),i={help:()=>this.setOpen(!this.open)};if(this.getAttribute(`items`)&&(i.j=()=>s(this._items(),1),i.k=()=>s(this._items(),-1),i.x=()=>this._tickFocused()),this.getAttribute(`search`)&&(i.slash=()=>this._focusSearch()),i[n]){u(t,i,r);return}if(n===`enter`)return;let a=e(this._doc,`WuiShortcuts used before it was connected`),p=t.target instanceof Node?t.target:null;if(f(a)||!o(p,r)||d(p))return;let m=c(n),_=g(this,`.wui-shortcut-keys [data-shortcut]`).find(e=>e.dataset.shortcut===m);if(!_)return;let v=(r??a).querySelector(`[aria-current="true"]`)?.closest(`[data-key]`),y=v instanceof HTMLElement?v.dataset.key??null:null;if(!this.dispatchEvent(new CustomEvent(`wui:shortcut`,{bubbles:!0,cancelable:!0,detail:{key:m,itemKey:y}}))){t.preventDefault();return}let b=_.dataset.target,x=b?h(a,b):null;x&&(t.preventDefault(),x.click())}};export{_ as t};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{n as e}from"./devWarn-DXdRWZs3.js";import{t}from"./elementBase-Cxeyx0tU.js";import{r as n,t as r}from"./fieldState-D-zQcXUS.js";import{t as i}from"./formMirror-9IpSgeZb.js";import{t as a}from"./iconGlyphs.g-BUF97bUu.js";import{t as o}from"./imeSafeEnter-DPs9qL3S.js";import{a as s,l as c,s as l}from"./nativeOverlay-DGady-wN.js";import{n as u}from"./optionLabel-CWMhBkdO.js";import{r as d,t as f}from"./textStore-opIEM4lu.js";import{t as p}from"./timePicker.g-IEczeE48.js";var m=()=>d(`timePicker`,p),h=e=>String(e).padStart(2,`0`),g=(e,t)=>`${h(e)}:${h(t)}`,_=e=>{let t=/^(\d{2}):(\d{2})$/.exec(e||``);return t?{h:Number(t[1]),m:Number(t[2])}:null},v=(e,t=`24`)=>{if(!e)return``;if(t===`24`)return g(e.h,e.m);let n=e.h%12||12,r=e.h>=12?`PM`:`AM`;return`${n}:${h(e.m)} ${r}`},y=e=>{let t=String(e||``).trim().toLowerCase(),n=/^(\d{1,2})(?:[:.](\d{2})|(\d{2}))?\s*(?:([ap])\.?\s*(?:m\.?)?)?$/.exec(t);if(!n)return null;let r=Number(n[1]),i=+(n[2]??n[3]??`0`);if(i>59)return null;if(n[4]){if(r<1||r>12)return null;r=r%12+(n[4]===`p`?12:0)}else if(r>23)return null;return{h:r,m:i}},b=(e,t,n)=>{let r=e.querySelector(t);return r instanceof n?r:null},x=(e,t,n)=>[...e.querySelectorAll(t)].filter(e=>e instanceof n),S=(e,t,n)=>{let r=e.closest(t);return r instanceof n?r:null},C=()=>{throw Error(`wui-timepicker is not rendered`)},w=0,T=class extends t{static formAssociated=!0;_internals;_value;_uid;_typedError;_typeahead;_typeaheadTimer;_rendered;_defaultValue;_isOpen;_lastPointer;_open=C;_close=C;_revertOnClose=!1;_refocusOnClose=!1;static get observedAttributes(){return[`value`,`min`,`max`,`step`,`format`,`placeholder`,`disabled`,`readonly`,`loading`,`required`,`size`,`aria-label`,`aria-describedby`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._uid=`wui-tp-${++w}`,this._typedError=``,this._typeahead=``,this._typeaheadTimer=void 0,this.addEventListener(`focusout`,e=>{this._isOpen?.()&&e.relatedTarget instanceof Node&&!this.contains(e.relatedTarget)&&this._close({commit:!0})})}connectedCallback(){this._rendered||this.render()}attributeChangedCallback(e,t,n){if(this._rendered)switch(e){case`value`:this._value=n||``,this._typedError=``,this._syncFormValue(),this._syncText(),this._syncInvalid();return;case`aria-invalid`:case`aria-describedby`:this._syncInvalid();return;case`aria-label`:case`placeholder`:case`disabled`:case`readonly`:case`loading`:case`required`:this._syncAttrs();return;default:this.render()}}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e||``,this._typedError=``,i(this,this._value),this._syncText(),this._syncInvalid()}_format(){return this.getAttribute(`format`)||`24`}_step(){let e=this.getAttribute(`step`);return e===null||e===``?1:/^[1-9]\d*$/.test(e)?Number(e):null}_bounds(){let e=_(this.getAttribute(`min`))||{h:0,m:0},t=_(this.getAttribute(`max`))||{h:23,m:59};return{min:e.h*60+e.m,max:t.h*60+t.m}}_allowed(e,t){let n=this._step();if(n===null)return!1;let r=e*60+t,{min:i,max:a}=this._bounds();return r>=i&&r<=a&&r%n===0}_times(){let e=[],t=this._step();if(t===null)return e;for(let n=0;n<1440;n+=t){let t=Math.floor(n/60),r=n%60;this._allowed(t,r)&&e.push({h:t,m:r})}return e}_example(){let e=this._times(),t=e.find(e=>e.h*60+e.m>=540)??e[0];return t?v(t,this._format()):null}_notATime(){let e=this._example();return e?f(m().refusalText,{example:e}):m().noTimeText}_refusal(e){if(this._allowed(e.h,e.m))return``;let t=this._step();if(t===null)return m().noTimeText;let n=this._format(),{min:r,max:i}=this._bounds(),a=e.h*60+e.m,o=e=>v({h:Math.floor(e/60),m:e%60},n);if(a<r||a>i){let e=!!_(this.getAttribute(`min`)),t=!!_(this.getAttribute(`max`));return e&&t?f(m().rangeText,{min:o(r),max:o(i)}):e?f(m().minText,{min:o(r)}):f(m().maxText,{max:o(i)})}return f(m().stepText,{step:t})}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``,this._value=this._defaultValue||this._value),this._step()===null&&e(`[@webority/ui-elements] <wui-timepicker> step="${this.getAttribute(`step`)}" is not a whole number of minutes, 1 or more; no time can be picked until it is.`),this._endOpenColumns(),this._isOpen=null;let t=this.getAttribute(`size`),n=t===`sm`?` wui-input-sm`:t===`lg`?` wui-input-lg`:t===`xl`?` wui-input-xl`:``,r=this._uid;this.innerHTML=`
|
|
2
|
+
<div class="timepicker">
|
|
3
|
+
<div class="wui-timepicker-field">
|
|
4
|
+
<input type="text" class="input timepicker-trigger${n}" id="${r}-input" role="combobox" aria-haspopup="dialog" aria-expanded="false" aria-controls="${r}-pop" aria-autocomplete="none" autocomplete="off" spellcheck="false">
|
|
5
|
+
<button type="button" class="wui-timepicker-toggle" tabindex="-1" aria-label="${u(m().chooseTimeLabel)}" aria-haspopup="dialog" aria-expanded="false" aria-controls="${r}-pop">${a(`clock`)}</button>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="timepicker-pop" id="${r}-pop" role="dialog" aria-label="${u(m().chooseTimeLabel)}" popover="auto"></div>
|
|
8
|
+
<div class="field-error wui-timepicker-error" id="${r}-error" hidden></div>
|
|
9
|
+
</div>`,this._rendered=!0,this._syncAttrs(),this._syncText(),this._syncInvalid(),i(this,this._value),this._wire()}_input(){return b(this,`.timepicker-trigger`,HTMLInputElement)}_pop(){return b(this,`.timepicker-pop`,HTMLDivElement)}_syncFormValue(){i(this,this._value)}_syncAttrs(){let e=this._input(),t=b(this,`.wui-timepicker-toggle`,HTMLButtonElement);if(!e)return;let a=this.hasAttribute(`disabled`);e.disabled=a,e.readOnly=r(this),t&&(t.disabled=a),n(this,e),e.placeholder=this.getAttribute(`placeholder`)||m().placeholder,this.hasAttribute(`required`)?e.setAttribute(`aria-required`,`true`):e.removeAttribute(`aria-required`);let o=this.getAttribute(`aria-label`);o?e.setAttribute(`aria-label`,o):e.removeAttribute(`aria-label`),i(this,this._value),r(this)&&this._isOpen?.()&&this._close({commit:!1})}_syncText(){let e=this._input();e&&(e.value=v(_(this._value),this._format()),this._isOpen?.()&&this._syncColumns())}_syncInvalid(){let e=this._input(),t=b(this,`.wui-timepicker-error`,HTMLDivElement);if(!e||!t)return;let n=this._typedError;t.textContent=n,t.hidden=!n,this.hasAttribute(`aria-invalid`)||n?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`);let r=[this.getAttribute(`aria-describedby`),n?t.id:null].filter(Boolean).join(` `);r?e.setAttribute(`aria-describedby`,r):e.removeAttribute(`aria-describedby`),e.setCustomValidity?.(n)}_commitText(){let e=this._input();if(!e||e.value===v(_(this._value),this._format()))return!0;let t=e.value.trim(),n=``;if(t){let e=y(t),r=e?this._refusal(e):this._notATime();if(!e||r)return this._typedError=r,this._syncInvalid(),!1;n=g(e.h,e.m)}let r=n!==this._value;return this.value=n,r&&this.dispatchEvent(new Event(`change`,{bubbles:!0})),!0}_pending(){let e=y(this._input()?.value);return e&&this._allowed(e.h,e.m)?e:null}_columnsHtml(){let e=this._format(),t=this._times(),n=(e,t,n)=>`<div class="wui-timepicker-col" role="listbox" aria-label="${u(t)}" data-col="${e}">${n.map(e=>`<button type="button" class="timepicker-option" role="option" tabindex="-1" aria-selected="false" data-v="${e.v}">${e.text}</button>`).join(``)}</div>`,r=[...new Set(t.map(e=>e.h))],i=[...new Set(t.map(e=>e.m))].sort((e,t)=>e-t),a;if(e===`12`){let e=[...new Set(r.map(e=>e%12))].sort((e,t)=>e-t),t=[...new Set(r.map(e=>e>=12?`pm`:`am`))].sort();a=n(`hour`,m().hour,e.map(e=>({v:e,text:String(e||12)})))+n(`minute`,m().minute,i.map(e=>({v:e,text:h(e)})))+n(`period`,m().periodLabel,t.map(e=>({v:e,text:e.toUpperCase()})))}else a=n(`hour`,m().hour,r.map(e=>({v:e,text:h(e)})))+n(`minute`,m().minute,i.map(e=>({v:e,text:h(e)})));return`<div class="wui-timepicker-cols">${a}</div>`}_selectedIn(e,t){return t?e===`minute`?String(t.m):e===`period`?t.h>=12?`pm`:`am`:String(this._format()===`12`?t.h%12:t.h):null}_optionEnabled(e,t,n){if(!n)return!0;let r=this._format()===`12`,i=n.h>=12,a=e=>r?[e+(i?12:0)]:[e],o=Array.from({length:60},(e,t)=>t);if(e===`hour`)return a(Number(t)).some(e=>o.some(t=>this._allowed(e,t)));if(e===`minute`)return this._allowed(n.h,Number(t));let s=t===`pm`?12:0;return Array.from({length:12},(e,t)=>s+t).some(e=>o.some(t=>this._allowed(e,t)))}_syncColumns({scroll:e=!1}={}){let t=this._pop();if(!t)return;let n=this._pending();for(let r of x(t,`.wui-timepicker-col`,HTMLElement)){let t=r.dataset.col,i=this._selectedIn(t,n),a=x(r,`.timepicker-option`,HTMLButtonElement),o=null;for(let e of a){let r=e.dataset.v===i;e.classList.toggle(`is-selected`,r),e.setAttribute(`aria-selected`,r?`true`:`false`),e.disabled=!r&&!this._optionEnabled(t,e.dataset.v,n),r&&(o=e)}o=o||a.find(e=>!e.disabled)||null;for(let e of a)e.tabIndex=e===o?0:-1;e&&o&&(r.scrollTop=o.offsetTop-(r.clientHeight-o.offsetHeight)/2)}}_pick(e,t){let n=this._times(),r=n[0];if(!r)return;let i=this._pending()||r,a=this._format()===`12`,o=i.h,s=i.m;if(e===`minute`?s=Number(t):o=e===`period`?o%12+(t===`pm`?12:0):a?Number(t)+(i.h>=12?12:0):Number(t),!this._allowed(o,s)){let t=o*60+s,r=n.filter(t=>e===`minute`?t.m===s:e===`period`?t.h>=12==o>=12:a?t.h%12==o%12&&t.h>=12==o>=12:t.h===o).sort((e,n)=>Math.abs(e.h*60+e.m-t)-Math.abs(n.h*60+n.m-t))[0];if(!r)return;o=r.h,s=r.m}let c=this._input();c&&(c.value=v({h:o,m:s},this._format()),this._typedError=``,this._syncInvalid(),this._syncColumns())}_onColumnKey(e){let t=e.target instanceof Element?S(e.target,`.timepicker-option`,HTMLButtonElement):null,n=t&&S(t,`.wui-timepicker-col`,HTMLElement);if(!t||!n)return;let r=x(n,`.timepicker-option`,HTMLButtonElement).filter(e=>!e.disabled),i=r.indexOf(t),a=this._pop();if(!a)return;let s=x(a,`.wui-timepicker-col`,HTMLElement),c=e=>{e&&(this._pick(n.dataset.col,e.dataset.v),(b(n,`.timepicker-option.is-selected`,HTMLElement)||e).focus())};switch(e.key){case`ArrowDown`:e.preventDefault(),c(r[Math.min(i+1,r.length-1)]);return;case`ArrowUp`:e.preventDefault(),c(r[Math.max(i-1,0)]);return;case`Home`:e.preventDefault(),c(r[0]);return;case`End`:e.preventDefault(),c(r[r.length-1]);return;case`PageDown`:e.preventDefault(),c(r[Math.min(i+8,r.length-1)]);return;case`PageUp`:e.preventDefault(),c(r[Math.max(i-8,0)]);return;case`ArrowRight`:case`ArrowLeft`:{e.preventDefault();let t=s[s.indexOf(n)+(e.key===`ArrowRight`?1:-1)];(t&&b(t,`.timepicker-option[tabindex="0"]`,HTMLButtonElement))?.focus();return}case`Enter`:if(!o(e))return;e.preventDefault(),this._close({commit:!0,refocus:!0});return;case` `:e.preventDefault(),c(t);return;case`Escape`:e.preventDefault(),e.stopPropagation(),this._close({commit:!1,refocus:!0});return;default:e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey||(e.preventDefault(),clearTimeout(this._typeaheadTimer),this._typeahead+=e.key.toLowerCase(),this._typeaheadTimer=window.setTimeout(()=>{this._typeahead=``,this._typeaheadTimer=void 0},500),c(r.find(e=>(e.textContent??``).trim().toLowerCase().startsWith(this._typeahead))))}}_wire(){this._teardown();let e=this._input(),t=b(this,`.wui-timepicker-toggle`,HTMLButtonElement),n=this._pop(),i=b(this,`.timepicker`,HTMLDivElement);if(!e)throw Error(`<wui-timepicker> has no .timepicker-trigger input.`);if(!n)throw Error(`<wui-timepicker> has no .timepicker-pop list.`);let a=b(this,`.wui-timepicker-field`,HTMLElement);if(!a)throw Error(`<wui-timepicker> has no .wui-timepicker-field to place its list against.`);let u=()=>l(n);this._isOpen=u;let d=()=>b(n,`.wui-timepicker-col .timepicker-option[tabindex="0"]`,HTMLElement)?.focus(),f=e=>{e.key===`Escape`&&(this._revertOnClose=!0,this._refocusOnClose=!0)};this._open=({focus:o=!1}={})=>{if(!r(this)){if(!u()){if(n.innerHTML=this._columnsHtml(),c(a,n,{mode:`auto`,onClosed:()=>{this.removeEventListener(`keydown`,f,!0);let e=this._revertOnClose,t=this._refocusOnClose;this._revertOnClose=!1,this._refocusOnClose=!1,p({commit:!e,refocus:t})}}),!u())return;i?.classList.add(`open`),e.setAttribute(`aria-expanded`,`true`),t?.setAttribute(`aria-expanded`,`true`),this.addEventListener(`keydown`,f,!0),this._syncColumns({scroll:!0})}o&&d()}};let p=({commit:r=!0,refocus:a=!1}={})=>{let o=n.contains(document.activeElement);n.innerHTML=``,i?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`),t?.setAttribute(`aria-expanded`,`false`),clearTimeout(this._typeaheadTimer),this._typeaheadTimer=void 0,this._typeahead=``,r?this._commitText():(this._typedError=``,this._syncText(),this._syncInvalid()),(a||o)&&e.focus()};this._close=(e={})=>{if(!u())return;let{commit:t=!0,refocus:r=!1}=e;this._revertOnClose=!t,this._refocusOnClose=r,s(n)},e.addEventListener(`pointerdown`,e=>{this._lastPointer=e.pointerType}),e.addEventListener(`click`,()=>{this._lastPointer!==`touch`&&!u()&&this._open(),this._lastPointer=null}),t?.addEventListener(`click`,()=>{u()?this._close({commit:!0,refocus:!0}):this._open({focus:!0})}),t?.addEventListener(`keydown`,e=>{e.key===`Escape`&&u()&&(e.preventDefault(),e.stopPropagation(),this._close({commit:!1,refocus:!0}))}),e.addEventListener(`keydown`,e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),this._open({focus:!0});else if(o(e)){let t=u(),n=this._commitText();t&&n&&this._close({commit:!1}),(!n||t)&&e.preventDefault()}else e.key===`Escape`&&u()?(e.preventDefault(),e.stopPropagation(),this._close({commit:!1})):e.key===`Tab`&&u()&&this._close({commit:!0})}),e.addEventListener(`input`,e=>{e.stopPropagation(),this._typedError&&(this._typedError=``,this._syncInvalid()),u()&&this._syncColumns({scroll:!0})}),e.addEventListener(`change`,e=>{e.stopPropagation(),u()||this._commitText()}),n.addEventListener(`click`,e=>{let t=e.target instanceof Element?S(e.target,`.timepicker-option`,HTMLButtonElement):null,n=t&&S(t,`.wui-timepicker-col`,HTMLElement);t&&n&&!t.disabled&&this._pick(n.dataset.col,t.dataset.v)}),n.addEventListener(`keydown`,e=>{u()&&this._onColumnKey(e)})}_teardown(){clearTimeout(this._typeaheadTimer),this._typeaheadTimer=void 0,this._typeahead=``}_endOpenColumns(){let e=this._pop();e&&(this._revertOnClose=!0,s(e),this._revertOnClose=!1)}disconnectedCallback(){this._teardown(),this._endOpenColumns()}};export{T as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t}from"./anchorOverlay-DSzkGQPi.js";import{n,t as r}from"./buttonClass-GtEi8hAY.js";import{t as i}from"./elementBase-Cxeyx0tU.js";import{d as a,f as o,o as s,u as c}from"./nativeOverlay-D3VmY8qn.js";import{r as l}from"./textStore-opIEM4lu.js";import{n as u,t as d}from"./tourAdvance.g-BJqDnqag.js";import{t as f}from"./imeSafeEnter-DPs9qL3S.js";import{t as p}from"./tourOpenMark-nPeAJFSo.js";import{t as m}from"./tourSeenStore-z0Y_Znzx.js";var h=`data-advance`,g=`wui-tour-hint`,_=`wui-tour-pointer`,v=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]`,y=()=>l(`tourAdvance`,d),b=(e,t)=>e?.advanceOn===`click`&&!!t,x=e=>(e??``).replace(/\s+/g,` `).trim(),ee=e=>e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLMeterElement||e instanceof HTMLOutputElement||e instanceof HTMLProgressElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement?e.labels:null,te=e=>e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLFieldSetElement||e instanceof HTMLOptGroupElement||e instanceof HTMLOptionElement?e.disabled:!1;function ne(e){let t=e.ownerDocument,n=(e.getAttribute(`aria-labelledby`)||``).split(/\s+/).filter(Boolean),r=e instanceof HTMLInputElement&&/^(button|submit|reset)$/.test(e.type)?e.value:``,i=[n.map(e=>t.getElementById(e)?.textContent??``).join(` `),e.getAttribute(`aria-label`),Array.from(ee(e)??[],e=>e.textContent).join(` `),e.getAttribute(`alt`),r,e.textContent,e.getAttribute(`title`)];for(let e of i){let t=x(e);if(t)return t}return``}function re(e){for(let t of[e,...e.querySelectorAll(v)])if((t instanceof HTMLElement||t instanceof SVGElement)&&t.tabIndex>=0&&!te(t))return t;return null}function S(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 ie(e,t){let n=e.querySelector(`.${g}`),r=e.querySelector(`.wui-tour-text`)?.id,i=r?`${r.replace(/-text$/,``)}-hint`:``;if(!t)n?.remove(),i&&S(e,i,!1);else{if(!n){n=e.ownerDocument.createElement(`p`),n.className=g,i&&(n.id=i);let t=e.querySelector(`.wui-tour-actions`);if(!t)throw Error(`Tour card has no actions row.`);t.before(n)}n.textContent=t,i&&S(e,i,!0)}}function ae(e,t){let n=e.querySelector(`.${_}`);if(!t){n?.remove();return}if(n)return;let r=e.ownerDocument.createElement(`span`);r.className=_,r.setAttribute(`aria-hidden`,`true`),e.append(r)}var oe=e=>getComputedStyle(e).animationName;function C(e,{layer:t,spot:n,card:r},i,a){let o=b(i,a);t.toggleAttribute(h,o&&!(t.getRootNode()instanceof ShadowRoot)),n.hasAttribute(h)&&(n.removeAttribute(h),o&&oe(n)),o&&n.setAttribute(h,``),ae(n,o);let s=r.querySelector(`.wui-tour-next`);if(!(s instanceof HTMLElement))throw Error(`Tour card has no next button.`);s.classList.toggle(`btn-primary`,!o),s.classList.toggle(`btn-link`,o);let c=o?x(i?.actionLabel)||ne(a):``,l=e.getAttribute(`advance-label`)||y().advanceLabel,u=c?l.replace(/\{actionName\}/g,()=>c):``;return ie(r,u),u}function se(e,t,n){if(!b(e,t))return()=>{};let r,i=()=>{r??=setTimeout(n,0)};return t.addEventListener(`click`,i),()=>{t.removeEventListener(`click`,i),clearTimeout(r)}}function ce(e,t,n,r){return e.contains(r)||b(t,n)&&n.contains(r)}function le(e,{card:t,active:n,step:r,target:i}){let a=Array.from(t.querySelectorAll(`button`)).filter(e=>!e.hidden),o=b(r,i)?re(i):null;o&&a.push(o);let s=a.findIndex(e=>e===n||e===o&&i?.contains(n));e.preventDefault();let c=a[s===-1?e.shiftKey?a.length-1:0:(s+(e.shiftKey?-1:1)+a.length)%a.length];if(!c)throw Error(`Tour card has no focus stop.`);c.focus()}var ue=2/3,de=1e3,w=/* @__PURE__ */ new Set([`top`,`left`,`width`,`height`]),T=/* @__PURE__ */ new WeakMap,E=(e,t)=>typeof e.getAnimations==`function`?e.getAnimations().filter(t):[],D=e=>`transitionProperty`in e&&e.transitionProperty===`opacity`,fe=e=>`transitionProperty`in e&&typeof e.transitionProperty==`string`&&w.has(e.transitionProperty),pe=e=>`animationName`in e&&typeof e.animationName==`string`&&e.animationName.startsWith(`wui-tour-`);function O(e){return e.length===0?null:new Promise(t=>{let n=setTimeout(t,de);Promise.allSettled(e.map(e=>e.finished)).then(()=>{clearTimeout(n),t()})})}function me(e){let t=e.parentElement?.querySelector(`:scope > .wui-tour-spot`),n=0;for(let e of t?E(t,fe):[]){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*ue-r)}return n}function k(e){let t=me(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={};T.set(e,n);let r=()=>{T.get(e)===n&&e.dataset.state===`entering`&&(e.dataset.state=`shown`)},i=E(e,pe);i.length===0?r():Promise.allSettled(i.map(e=>e.finished)).then(r)}function A(e){return e.dataset.state=`leaving`,O(E(e,D))}function he(e){let t=e.shadowRoot?.querySelector(`.wui-tour-layer`),n=e.classList.contains(`wui-tour-layer`)?e:t instanceof HTMLElement?t:null;n&&(n.dataset.state=`leaving`);let r=n?O(E(n,D)):null;r?(e.setAttribute(`inert`,``),r.then(()=>e.remove())):e.remove()}var ge=2,j=12,M=8,N=4,P=20,_e=`(max-width: 575.98px)`,ve=[`bottom`,`top`,`right`,`left`],F=[`top-left`,`top-right`,`bottom-right`,`bottom-left`],I,L=(e,t,n)=>Math.max(t,Math.min(e,n)),R=(e,t,n,r)=>(Math.max(e,n)+Math.min(t,r))/2;function ye(e,t){if(!t?.scrollIntoView)return;e.style.maxHeight=``;let n=B(e),r=e.offsetHeight+j;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+ge}px`,t.scrollIntoView({block:`start`,inline:`nearest`}),t.style.scrollMarginTop=i}function z(e,t,n){let r=e.style,i=t.style,a=we(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 F)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`,be(r,n);let s=t.scrollTop;i.maxHeight=``;let c={width:t.offsetWidth,height:t.offsetHeight},l=B(t),u=l.bottom-l.top,d={bottom:l.bottom-o.bottom-j,top:o.top-j-l.top,right:l.right-o.right-j,left:o.left-j-l.left},f=window.matchMedia(_e).matches,p=ve.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+M)-Math.max(o.top,l.top-M);p?xe(t,a,p,o,l,c):m>=Math.min(c.height,u)+8?Se(t,a,o,l,c):Ce(t,a,d.bottom>=d.top?`bottom`:`top`,o,l,c,d),t.scrollTop=s}function be(e,t){I??=CSS.supports(`corner-top-left-shape`,`squircle`);let n=getComputedStyle(t);for(let t of F)e.setProperty(`border-${t}-radius`,n.getPropertyValue(`border-${t}-radius`)),I&&e.setProperty(`corner-${t}-shape`,n.getPropertyValue(`corner-${t}-shape`))}function xe(e,t,n,r,i,a){let o=n===`top`||n===`bottom`,s,c,l;if(o){let e=R(r.left,r.right,i.left,i.right);s=L(e-a.width/2,i.left,i.right-a.width),c=n===`bottom`?r.bottom+j:r.top-j-a.height,l=L(e-s,P,a.width-P)}else{let e=R(r.top,r.bottom,i.top,i.bottom);c=L(e-a.height/2,i.top,i.bottom-a.height),s=n===`right`?r.right+j:r.left-j-a.width,l=L(e-c,P,a.height-P)}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 Se(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)-N;e.style.top=`${Math.max(r.top,o-Math.min(i.height,a))}px`,e.style.left=`${L(n.left+N,r.left,r.right-i.width)}px`}function Ce(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+j:r.top-j-c}px`;let l=R(r.left,r.right,i.left,i.right);e.style.left=`${L(l-a.width/2,i.left,i.right-a.width)}px`}function B(e){let t=e.parentElement,n=t?getComputedStyle(t):null,r=e=>Number.parseFloat(n?.[e]??``)||0;return{top:r(`paddingTop`)+M,bottom:window.innerHeight-r(`paddingBottom`)-M,left:r(`paddingLeft`)+M,right:window.innerWidth-r(`paddingRight`)-M}}function we(e){let t=e.querySelector(`:scope > .wui-tour-arrow`);if(t instanceof HTMLElement)return t;let n=document.createElement(`span`);return n.className=`wui-tour-arrow`,n.setAttribute(`aria-hidden`,`true`),n.hidden=!0,e.append(n),n}var Te=0,Ee=`btn btn-sm btn-link`;function V(e,t,n){let r=e.querySelector(t);if(!(r instanceof n))throw Error(`Expected "${t}" to match a ${n.name}.`);return r}function De(e,t,i){let a=`wui-tour-end-${++Te}`,o=!!(t.nextLabel&&t.nextHref),s=i?e.createElement(`dialog`):e.createElement(`div`);s.className=`wui-tour-card wui-tour-end`,s.dataset.layout=`center`,o&&(s.dataset.next=``),s.setAttribute(`role`,`dialog`),s.tabIndex=-1,s.setAttribute(`aria-labelledby`,`${a}-title`),s.setAttribute(`aria-describedby`,`${a}-message`),s.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="${a}-title"></h2> <p class="wui-tour-text wui-tour-end-message" id="${a}-message"></p> <div class="wui-tour-actions">${o?`<a class="${n(`primary`,`solid`,`sm`)} wui-tour-end-next" data-wui="${r}"></a>`:``}<button type="button" class="${o?Ee:n(`primary`,`solid`,`sm`)} wui-tour-end-button" data-wui="${r}"></button></div>`,V(s,`.wui-tour-end-title`,HTMLElement).textContent=t.title,V(s,`.wui-tour-end-message`,HTMLElement).textContent=t.message,V(s,`.wui-tour-end-button`,HTMLButtonElement).textContent=t.button;let{nextLabel:c,nextHref:l}=t;if(o&&c&&l){let e=V(s,`.wui-tour-end-next`,HTMLAnchorElement);e.textContent=c,e.setAttribute(`href`,l)}return s}var Oe=e=>e.button===0&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey;function ke(e,t,n){let r=e.ownerDocument,i=De(r,t,e.getRootNode()===r),a=V(i,`.wui-tour-end-button`,HTMLButtonElement),o=i.querySelector(`.wui-tour-end-next`);if(o!==null&&!(o instanceof HTMLAnchorElement))throw Error(`The end dialog's next link is not a link.`);let l=o,u=l??a,d=new AbortController,p=i instanceof HTMLDialogElement?i:null,m=null;return new Promise(o=>{let h=e=>{if(d.abort(),m&&p){let e=m;m=null,s(p).then(e)}o(e)};if(n?.aborted){h(`done`);return}let g=V(e,`.wui-tour-card:not(.wui-tour-end)`,HTMLElement),_=V(e,`.wui-tour-spot`,HTMLElement),v=V(e,`[role=status]`,HTMLElement),y={signal:d.signal};n?.addEventListener(`abort`,()=>h(`done`),y),a.addEventListener(`click`,()=>h(`done`),y),l&&l.addEventListener(`click`,e=>{Oe(e)&&(e.preventDefault(),h(`next`))},y),r.addEventListener(`keydown`,e=>{if(!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`){if(m)return;e.preventDefault(),e.stopPropagation(),h(`done`)}else f(e)&&l&&!e.shiftKey&&(e.composedPath?.()[0]??e.target)===l&&(e.preventDefault(),h(`next`))}},{capture:!0,signal:d.signal});let b=()=>{d.signal.aborted||(g.hidden=!0,z(_,g,null),e.append(i),k(i),p&&(m=c(p,{escape:!0,backdrop:!1,focus:`first-control`,onRequestClose:()=>h(`done`)})),v.textContent=[t.title,t.message].filter(Boolean).join(`. `),u.focus())},x=A(g);x?x.then(b):b()})}var Ae=` :host { all: initial; display: revert-layer; position: fixed; inset: 0; ${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-ease-linear":`cubic-bezier(0, 0, 1, 1)`,"--wui-duration-fast":`150ms`,"--wui-duration-default":`250ms`,"--wui-duration-slow":`400ms`,"--wui-space-xs":`4px`,"--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); width: auto; height: auto; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: visible; background: none; } .wui-tour-spot { position: fixed; box-shadow: 0 0 0 2px var(--color-primary), 0 0 4px 2px color-mix(in srgb, var(--color-primary) 30%, transparent), 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 var(--wui-duration-fast) var(--wui-ease-linear); } .wui-tour-layer[data-state=leaving] { transition: opacity var(--wui-duration-fast) var(--wui-ease-linear); } .wui-tour-card[data-state=entering] { animation: wui-tour-fade-in var(--wui-duration-fast) var(--wui-ease-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-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: var(--wui-focus-ring-offset); } .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); } .wui-tour-pointer { position: absolute; top: 50%; left: 50%; width: 18px; height: 24px; pointer-events: none; } .wui-tour-pointer::before { content: ""; position: absolute; inset: 0; background: var(--color-primary); clip-path: polygon(0 0, 0 75%, 28% 58%, 46% 100%, 62% 92%, 45% 52%, 85% 52%); filter: drop-shadow(1px 0 0 var(--color-surface)) drop-shadow(-1px 0 0 var(--color-surface)) drop-shadow(0 1px 0 var(--color-surface)) drop-shadow(0 -1px 0 var(--color-surface)); } .wui-tour-pointer::after { content: ""; position: absolute; top: -16px; left: -16px; width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary); opacity: 0; display: none; } @media (max-width: 575.98px) { .wui-tour-pointer { width: 24px; height: 24px; translate: -50% -50%; } .wui-tour-pointer::before { clip-path: none; border-radius: 50%; box-shadow: 0 0 0 2px var(--color-surface); filter: none; } .wui-tour-pointer::after { top: -4px; left: -4px; } } @keyframes wui-tour-tap { 0% { opacity: 0; transform: translate(56px, 44px) scale(1); } 10% { opacity: 1; transform: translate(56px, 44px) scale(1); } 45% { transform: translate(0, 0) scale(1); } 52% { transform: translate(0, 0) scale(0.86); } 60% { transform: translate(0, 0) scale(1); } 85% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(0, 0) scale(1); } } @keyframes wui-tour-tap-rtl { 0% { opacity: 0; transform: translate(-56px, 44px) scale(1); } 10% { opacity: 1; transform: translate(-56px, 44px) scale(1); } 45% { transform: translate(0, 0) scale(1); } 52% { transform: translate(0, 0) scale(0.86); } 60% { transform: translate(0, 0) scale(1); } 85% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(0, 0) scale(1); } } @keyframes wui-tour-ripple { 0%, 50% { opacity: 0; transform: scale(0.2); } 52% { opacity: 0.35; transform: scale(0.2); } 80%, 100% { opacity: 0; transform: scale(1); } } @media (prefers-reduced-motion: no-preference) { .wui-tour-pointer { opacity: 0; animation: wui-tour-tap calc(var(--wui-duration-slow) * 6) var(--wui-ease-out) var(--wui-tour-spot-duration) infinite; } .wui-tour-pointer:dir(rtl) { animation-name: wui-tour-tap-rtl; } .wui-tour-pointer::after { display: block; animation: wui-tour-ripple calc(var(--wui-duration-slow) * 6) var(--wui-ease-out) var(--wui-tour-spot-duration) infinite; } } @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[data-layout=center][data-next] .wui-tour-actions { flex-direction: column; align-items: stretch; width: 100%; gap: var(--wui-space-xs); } .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-next { 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 var(--wui-duration-default) var(--wui-ease-out) calc(var(--wui-tour-card-delay, 0ms) + var(--wui-duration-fast)) both; } } `,H=()=>l(`tour`,u),U=`wui-tour-media`,je=`wui-tour-media-toggle`,W=`http://www.w3.org/2000/svg`,Me=`M6 5h4v14H6zM14 5h4v14h-4z`,Ne=`M8 5v14l11-7z`,Pe=()=>({pause:H().mediaPauseLabel,play:H().mediaPlayLabel}),Fe=()=>globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;function Ie(e){let t=document.createElementNS(W,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`);let n=document.createElementNS(W,`path`);return n.setAttribute(`d`,e),t.appendChild(n),t}function Le(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 Re(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 ze(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=je;let r=(r=!e.paused)=>{n.setAttribute(`aria-label`,r?t.pause:t.play),n.replaceChildren(Ie(r?Me:Ne))};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 Be(e){let t=e.querySelector(`:scope > .${U}`);if(!t)return;let n=t.querySelector(`video`);n&&(n.pause(),n.removeAttribute(`src`),n.load()),t.remove()}function Ve(e,t,n=Pe()){if(Be(e),!t.media){e.removeAttribute(`data-media`);return}let r=document.createElement(`div`);if(r.className=U,t.mediaType===`video`){let e=Re(t,!Fe());r.append(e,ze(e,n))}else r.appendChild(Le(t));e.prepend(r),e.setAttribute(`data-media`,t.target?`step`:`welcome`)}var He=()=>l(`tour`,u);function G(e){let t=/* @__PURE__ */ 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 Ue(e,t,n){return(e.getAttribute(`progress-label`)||He().progressLabel).replace(/\{(current|total)\}/g,(e,r)=>String(r===`current`?t:n))}function We(e,{text:t,position:n,total:r}){let i=e.querySelector(`.wui-tour-position`);if(!(i instanceof HTMLElement))throw Error(`tour position label missing`);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;){let e=a.lastElementChild;if(!e)throw Error(`progress bar segment missing`);e.remove()}for(let e=0;e<o.length;e++){let t=o[e];if(!t)throw Error(`progress bar segment missing`);t.toggleAttribute(`data-filled`,e<n)}}var Ge=`wui-tour-step`,Ke=`wui-tour-host`,K=`data-tracking`,q=()=>l(`tour`,u),qe=()=>({back:q().backLabel,next:q().nextLabel,skip:q().skipLabel,done:q().doneLabel,mediaPause:q().mediaPauseLabel,mediaPlay:q().mediaPlayLabel,endTitle:q().endTitle,endMessage:q().endMessage,endButton:q().doneLabel}),Je={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`},Ye=[[`media`,`media`],[`mediaAlt`,`media-alt`],[`mediaPoster`,`media-poster`],[`mediaType`,`media-type`],[`advanceOn`,`advance-on`],[`actionLabel`,`action-label`]],J={index:null,position:null,total:null},Xe=0,Y=e=>!e?.isConnected||getComputedStyle(e).visibility===`hidden`?!1:e.getClientRects().length>0,X=e=>e instanceof HTMLElement&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function Z(e,t,n){let r=e.querySelector(t);if(!(r instanceof n))throw Error(`<wui-tour> layer has no ${t}`);return r}var Q=()=>{let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e},$=null;function Ze(e){$||($=new CSSStyleSheet,$.replaceSync(Ae)),e.adoptedStyleSheets=[$]}var Qe=class extends i{seenStore;onBeforeStep;_run;_running;_layer;_outer;_shadow;_unbindAdvance;_ending;_seenMark;_steps=[];_progress=G(0);_firstIndex=0;_returnFocus=null;_current=null;_moving=!1;_card=null;_spot=null;_live=null;_onKey=null;_onFocusIn=null;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 > ${Ge}`),e=>{let t={target:e.getAttribute(`target`)||``,title:e.getAttribute(`title`)||void 0,description:(e.textContent??``).trim()};for(let[n,r]of Ye)e.hasAttribute(r)&&(t[n]=e.getAttribute(r)??``);return t})}_stepAt(e){let t=this._steps[e];if(!t)throw RangeError(`<wui-tour> has no step ${e}; it has ${this._steps.length}.`);return t}_store(){return this.seenStore?this.seenStore:this.getAttribute(`seen-store`)===`local`?m():globalThis.window?.WUI?.tour?.seenStore||null}_label(e){return this.getAttribute(Je[e])||qe()[e]}_endDialogText(){if(this.getAttribute(`end-dialog`)===`false`)return null;let e=(this.getAttribute(`end-next-label`)??``).trim(),t=(this.getAttribute(`end-next-href`)??``).trim();return{title:this._label(`endTitle`),message:this._label(`endMessage`),button:this._label(`endButton`),nextLabel:e,nextHref:t}}_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=G(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&&!Y(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(!e)break;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),a=t instanceof HTMLElement||t instanceof SVGElement?t:null;if(Y(a))return this._progress.position(i),{index:i,target:a};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 t=`wui-tour-${++Xe}`,i=document.createElement(`div`);i.className=`wui-tour-layer`,i.innerHTML=` <div class="wui-tour-spot" aria-hidden="true"></div> <div class="wui-tour-card" role="dialog" tabindex="-1" aria-labelledby="${t}-title" aria-describedby="${t}-text"> <p class="wui-tour-position"></p> <h2 class="wui-tour-title" id="${t}-title"></h2> <p class="wui-tour-text" id="${t}-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="${n(`neutral`,`outline`,`sm`)} wui-tour-back" data-wui="${r}"></button> <button type="button" class="${n(`primary`,`solid`,`sm`)} wui-tour-next" data-wui="${r}"></button> </div> </div> </div> <div class="visually-hidden" role="status" aria-live="polite"></div>`;let o=i;this._shadow=null,this.isolated&&(o=document.createElement(Ke),this._shadow=o.attachShadow({mode:`open`}),Ze(this._shadow),this._shadow.appendChild(i)),o.setAttribute(`popover`,`manual`),a(document).appendChild(o),document.documentElement.setAttribute(p,``),this._outer=o,this._layer=i;let s=Z(i,`.wui-tour-spot`,HTMLDivElement),c=Z(i,`.wui-tour-card`,HTMLDivElement),l=Z(i,`[role=status]`,HTMLElement);this._spot=s,this._card=c,this._live=l,Z(c,`.wui-tour-skip`,HTMLElement).addEventListener(`click`,()=>this._close(`skipped`,`button`)),Z(c,`.wui-tour-back`,HTMLElement).addEventListener(`click`,()=>this._move(-1)),Z(c,`.wui-tour-next`,HTMLElement).addEventListener(`click`,()=>this._move(1));let u=e=>this._key(e);this._onKey=u;let d=e=>{let t=this._layer;if(!t||this._ending)return;let n=this._current,r=n?this._stepAt(n.index):null;if(!(e.target instanceof Node))throw Error(`<wui-tour> saw a focus change from a non-node target`);ce(t,r,n?.target??null,e.target)||c.focus()};this._onFocusIn=d,document.addEventListener(`keydown`,u,!0),this._shadow||document.addEventListener(`focusin`,d),e(o,()=>this._follow())}_active(){return this._shadow?this._shadow.activeElement:document.activeElement}_raise(){let e=this._outer;if(!e)throw Error(`<wui-tour> raises a step before its host is built`);let t=a(this.ownerDocument);e.parentElement!==t&&t.appendChild(e),o(e)}_show(e){this._current=e;let{index:t,target:n}=e,r=this._stepAt(t),i=this._layer,a=this._spot,o=this._card,s=this._live;if(!i||!a||!o||!s)throw Error(`<wui-tour> shows a step before its layer is built`);this._raise();let c=this._progress.position(t),l=this._progress.total(),u=c===l&&!this._endDialogText(),d=Ue(this,c,l);We(o,{text:d,position:c,total:l}),Ve(o,r,{pause:this._label(`mediaPause`),play:this._label(`mediaPlay`)}),o.toggleAttribute(`data-welcome`,!n);let f=C(this,{layer:i,spot:a,card:o},r,n),p=Z(o,`.wui-tour-title`,HTMLElement);p.textContent=r.title||``,p.hidden=!r.title,Z(o,`.wui-tour-text`,HTMLElement).textContent=r.description||``,Z(o,`.wui-tour-skip`,HTMLElement).textContent=this._label(`skip`);let m=Z(o,`.wui-tour-back`,HTMLElement);m.textContent=this._label(`back`),m.hidden=t<=this._firstIndex,Z(o,`.wui-tour-next`,HTMLElement).textContent=this._label(u?`done`:`next`);let h=[d,r.title,r.description].filter(Boolean).join(`. `);s.textContent=f?[h,f].join(/[.!?]$/.test(h)?` `:`. `):h,ye(o,n),a.removeAttribute(K),this._place(),k(o),this._unbindAdvance?.(),this._unbindAdvance=se(r,n,()=>this._move(1));let g=this._active();(g!==null&&o.contains(g)?!(g instanceof HTMLElement&&g.hidden):this._shadow!==null&&X(Q()))||o.focus(),this.dispatchEvent(new CustomEvent(`wui-tour:step`,{bubbles:!0,detail:{step:r,index:t,position:c,total:l}}))}_place(){if(!this._current||!this._layer)return;let e=this._spot,t=this._card;if(!e||!t)throw Error(`<wui-tour> places a step before its layer is built`);z(e,t,this._current.target)}_follow(){if(!this._current||!this._layer||this._ending)return;let e=this._spot;if(!e)throw Error(`<wui-tour> follows a step before its spot is built`);let t=e.style.cssText;this._place(),e.style.cssText!==t&&e.setAttribute(K,``)}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=this._card;if(!e)throw Error(`<wui-tour> moved with no card showing`);let t=A(e);if(t&&await t,n!==this._run)return;this._show(r)}else if(t>0){let e=this._endDialogText(),t=e?await this._showEnd(e):`done`;if(n!==this._run)return;let r=await this._close(t===`next`?`next`:`finished`);if(t===`next`&&r&&e){let t=this.ownerDocument.defaultView;if(!t)throw Error(`<wui-tour> has no window to follow its next link in`);t.location.assign(e.nextHref)}}}finally{this._moving=!1}}_showEnd(e){this._unbindAdvance?.(),this._unbindAdvance=null;let t=this._layer,n=this._spot,r=this._card;if(!t||!n||!r)throw Error(`<wui-tour> ends a tour before its layer is built`);return C(this,{layer:t,spot:n,card:r},null,null),n.removeAttribute(K),this._ending=new AbortController,this._seenMark=this._markSeen(`finished`),ke(t,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(X(e.composedPath?.()[0]??e.target))return;if(e.preventDefault(),e.key===`ArrowRight`)this._move(1);else{let e=this._current;if(!e)throw Error(`<wui-tour> moved back with no step showing`);e.index>this._firstIndex&&this._move(-1)}}else if(e.key===`Tab`&&!this._shadow){let t=this._current,n=this._card;if(!t||!n)throw Error(`<wui-tour> cycled focus with no step showing`);le(e,{card:n,active:this._active(),step:this._stepAt(t.index),target:t.target})}}}_teardown(){if(!this._layer)return;this._onKey&&document.removeEventListener(`keydown`,this._onKey,!0),this._onFocusIn&&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;let n=this._outer;if(t(n),!n)throw Error(`<wui-tour> has a layer with no host to remove`);he(n),document.documentElement.removeAttribute(p),this._outer=null,this._shadow=null,this._layer=null,this._current=null;let r=this._returnFocus;this._returnFocus=null,e&&r?.isConnected&&(r instanceof HTMLElement||r instanceof SVGElement)&&r.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()}:J,a=this._seenMark;this._teardown();let o=e===`next`?`finished`:e,s=!1;try{n===this._run&&await(a??this._markSeen(o)),s=n===this._run}finally{this._finish(e,i,t)}return s}_finish(e,t=J,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}}))}};export{Qe as t};
|
|
1
|
+
import{n as e,r as t}from"./anchorOverlay-DSzkGQPi.js";import{n,t as r}from"./buttonClass-GtEi8hAY.js";import{t as i}from"./elementBase-Cxeyx0tU.js";import{d as a,f as o,o as s,u as c}from"./nativeOverlay-DGady-wN.js";import{r as l}from"./textStore-opIEM4lu.js";import{n as u,t as d}from"./tourAdvance.g-BJqDnqag.js";import{t as f}from"./imeSafeEnter-DPs9qL3S.js";import{t as p}from"./tourOpenMark-nPeAJFSo.js";import{t as m}from"./tourSeenStore-z0Y_Znzx.js";var h=`data-advance`,g=`wui-tour-hint`,_=`wui-tour-pointer`,v=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]`,y=()=>l(`tourAdvance`,d),b=(e,t)=>e?.advanceOn===`click`&&!!t,x=e=>(e??``).replace(/\s+/g,` `).trim(),ee=e=>e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLMeterElement||e instanceof HTMLOutputElement||e instanceof HTMLProgressElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement?e.labels:null,te=e=>e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLFieldSetElement||e instanceof HTMLOptGroupElement||e instanceof HTMLOptionElement?e.disabled:!1;function ne(e){let t=e.ownerDocument,n=(e.getAttribute(`aria-labelledby`)||``).split(/\s+/).filter(Boolean),r=e instanceof HTMLInputElement&&/^(button|submit|reset)$/.test(e.type)?e.value:``,i=[n.map(e=>t.getElementById(e)?.textContent??``).join(` `),e.getAttribute(`aria-label`),Array.from(ee(e)??[],e=>e.textContent).join(` `),e.getAttribute(`alt`),r,e.textContent,e.getAttribute(`title`)];for(let e of i){let t=x(e);if(t)return t}return``}function re(e){for(let t of[e,...e.querySelectorAll(v)])if((t instanceof HTMLElement||t instanceof SVGElement)&&t.tabIndex>=0&&!te(t))return t;return null}function S(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 ie(e,t){let n=e.querySelector(`.${g}`),r=e.querySelector(`.wui-tour-text`)?.id,i=r?`${r.replace(/-text$/,``)}-hint`:``;if(!t)n?.remove(),i&&S(e,i,!1);else{if(!n){n=e.ownerDocument.createElement(`p`),n.className=g,i&&(n.id=i);let t=e.querySelector(`.wui-tour-actions`);if(!t)throw Error(`Tour card has no actions row.`);t.before(n)}n.textContent=t,i&&S(e,i,!0)}}function ae(e,t){let n=e.querySelector(`.${_}`);if(!t){n?.remove();return}if(n)return;let r=e.ownerDocument.createElement(`span`);r.className=_,r.setAttribute(`aria-hidden`,`true`),e.append(r)}var oe=e=>getComputedStyle(e).animationName;function C(e,{layer:t,spot:n,card:r},i,a){let o=b(i,a);t.toggleAttribute(h,o&&!(t.getRootNode()instanceof ShadowRoot)),n.hasAttribute(h)&&(n.removeAttribute(h),o&&oe(n)),o&&n.setAttribute(h,``),ae(n,o);let s=r.querySelector(`.wui-tour-next`);if(!(s instanceof HTMLElement))throw Error(`Tour card has no next button.`);s.classList.toggle(`btn-primary`,!o),s.classList.toggle(`btn-link`,o);let c=o?x(i?.actionLabel)||ne(a):``,l=e.getAttribute(`advance-label`)||y().advanceLabel,u=c?l.replace(/\{actionName\}/g,()=>c):``;return ie(r,u),u}function se(e,t,n){if(!b(e,t))return()=>{};let r,i=()=>{r??=setTimeout(n,0)};return t.addEventListener(`click`,i),()=>{t.removeEventListener(`click`,i),clearTimeout(r)}}function ce(e,t,n,r){return e.contains(r)||b(t,n)&&n.contains(r)}function le(e,{card:t,active:n,step:r,target:i}){let a=Array.from(t.querySelectorAll(`button`)).filter(e=>!e.hidden),o=b(r,i)?re(i):null;o&&a.push(o);let s=a.findIndex(e=>e===n||e===o&&i?.contains(n));e.preventDefault();let c=a[s===-1?e.shiftKey?a.length-1:0:(s+(e.shiftKey?-1:1)+a.length)%a.length];if(!c)throw Error(`Tour card has no focus stop.`);c.focus()}var ue=2/3,de=1e3,w=/* @__PURE__ */ new Set([`top`,`left`,`width`,`height`]),T=/* @__PURE__ */ new WeakMap,E=(e,t)=>typeof e.getAnimations==`function`?e.getAnimations().filter(t):[],D=e=>`transitionProperty`in e&&e.transitionProperty===`opacity`,fe=e=>`transitionProperty`in e&&typeof e.transitionProperty==`string`&&w.has(e.transitionProperty),pe=e=>`animationName`in e&&typeof e.animationName==`string`&&e.animationName.startsWith(`wui-tour-`);function O(e){return e.length===0?null:new Promise(t=>{let n=setTimeout(t,de);Promise.allSettled(e.map(e=>e.finished)).then(()=>{clearTimeout(n),t()})})}function me(e){let t=e.parentElement?.querySelector(`:scope > .wui-tour-spot`),n=0;for(let e of t?E(t,fe):[]){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*ue-r)}return n}function k(e){let t=me(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={};T.set(e,n);let r=()=>{T.get(e)===n&&e.dataset.state===`entering`&&(e.dataset.state=`shown`)},i=E(e,pe);i.length===0?r():Promise.allSettled(i.map(e=>e.finished)).then(r)}function A(e){return e.dataset.state=`leaving`,O(E(e,D))}function he(e){let t=e.shadowRoot?.querySelector(`.wui-tour-layer`),n=e.classList.contains(`wui-tour-layer`)?e:t instanceof HTMLElement?t:null;n&&(n.dataset.state=`leaving`);let r=n?O(E(n,D)):null;r?(e.setAttribute(`inert`,``),r.then(()=>e.remove())):e.remove()}var ge=2,j=12,M=8,N=4,P=20,_e=`(max-width: 575.98px)`,ve=[`bottom`,`top`,`right`,`left`],F=[`top-left`,`top-right`,`bottom-right`,`bottom-left`],I,L=(e,t,n)=>Math.max(t,Math.min(e,n)),R=(e,t,n,r)=>(Math.max(e,n)+Math.min(t,r))/2;function ye(e,t){if(!t?.scrollIntoView)return;e.style.maxHeight=``;let n=B(e),r=e.offsetHeight+j;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+ge}px`,t.scrollIntoView({block:`start`,inline:`nearest`}),t.style.scrollMarginTop=i}function z(e,t,n){let r=e.style,i=t.style,a=we(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 F)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`,be(r,n);let s=t.scrollTop;i.maxHeight=``;let c={width:t.offsetWidth,height:t.offsetHeight},l=B(t),u=l.bottom-l.top,d={bottom:l.bottom-o.bottom-j,top:o.top-j-l.top,right:l.right-o.right-j,left:o.left-j-l.left},f=window.matchMedia(_e).matches,p=ve.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+M)-Math.max(o.top,l.top-M);p?xe(t,a,p,o,l,c):m>=Math.min(c.height,u)+8?Se(t,a,o,l,c):Ce(t,a,d.bottom>=d.top?`bottom`:`top`,o,l,c,d),t.scrollTop=s}function be(e,t){I??=CSS.supports(`corner-top-left-shape`,`squircle`);let n=getComputedStyle(t);for(let t of F)e.setProperty(`border-${t}-radius`,n.getPropertyValue(`border-${t}-radius`)),I&&e.setProperty(`corner-${t}-shape`,n.getPropertyValue(`corner-${t}-shape`))}function xe(e,t,n,r,i,a){let o=n===`top`||n===`bottom`,s,c,l;if(o){let e=R(r.left,r.right,i.left,i.right);s=L(e-a.width/2,i.left,i.right-a.width),c=n===`bottom`?r.bottom+j:r.top-j-a.height,l=L(e-s,P,a.width-P)}else{let e=R(r.top,r.bottom,i.top,i.bottom);c=L(e-a.height/2,i.top,i.bottom-a.height),s=n===`right`?r.right+j:r.left-j-a.width,l=L(e-c,P,a.height-P)}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 Se(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)-N;e.style.top=`${Math.max(r.top,o-Math.min(i.height,a))}px`,e.style.left=`${L(n.left+N,r.left,r.right-i.width)}px`}function Ce(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+j:r.top-j-c}px`;let l=R(r.left,r.right,i.left,i.right);e.style.left=`${L(l-a.width/2,i.left,i.right-a.width)}px`}function B(e){let t=e.parentElement,n=t?getComputedStyle(t):null,r=e=>Number.parseFloat(n?.[e]??``)||0;return{top:r(`paddingTop`)+M,bottom:window.innerHeight-r(`paddingBottom`)-M,left:r(`paddingLeft`)+M,right:window.innerWidth-r(`paddingRight`)-M}}function we(e){let t=e.querySelector(`:scope > .wui-tour-arrow`);if(t instanceof HTMLElement)return t;let n=document.createElement(`span`);return n.className=`wui-tour-arrow`,n.setAttribute(`aria-hidden`,`true`),n.hidden=!0,e.append(n),n}var Te=0,Ee=`btn btn-sm btn-link`;function V(e,t,n){let r=e.querySelector(t);if(!(r instanceof n))throw Error(`Expected "${t}" to match a ${n.name}.`);return r}function De(e,t,i){let a=`wui-tour-end-${++Te}`,o=!!(t.nextLabel&&t.nextHref),s=i?e.createElement(`dialog`):e.createElement(`div`);s.className=`wui-tour-card wui-tour-end`,s.dataset.layout=`center`,o&&(s.dataset.next=``),s.setAttribute(`role`,`dialog`),s.tabIndex=-1,s.setAttribute(`aria-labelledby`,`${a}-title`),s.setAttribute(`aria-describedby`,`${a}-message`),s.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="${a}-title"></h2> <p class="wui-tour-text wui-tour-end-message" id="${a}-message"></p> <div class="wui-tour-actions">${o?`<a class="${n(`primary`,`solid`,`sm`)} wui-tour-end-next" data-wui="${r}"></a>`:``}<button type="button" class="${o?Ee:n(`primary`,`solid`,`sm`)} wui-tour-end-button" data-wui="${r}"></button></div>`,V(s,`.wui-tour-end-title`,HTMLElement).textContent=t.title,V(s,`.wui-tour-end-message`,HTMLElement).textContent=t.message,V(s,`.wui-tour-end-button`,HTMLButtonElement).textContent=t.button;let{nextLabel:c,nextHref:l}=t;if(o&&c&&l){let e=V(s,`.wui-tour-end-next`,HTMLAnchorElement);e.textContent=c,e.setAttribute(`href`,l)}return s}var Oe=e=>e.button===0&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey;function ke(e,t,n){let r=e.ownerDocument,i=De(r,t,e.getRootNode()===r),a=V(i,`.wui-tour-end-button`,HTMLButtonElement),o=i.querySelector(`.wui-tour-end-next`);if(o!==null&&!(o instanceof HTMLAnchorElement))throw Error(`The end dialog's next link is not a link.`);let l=o,u=l??a,d=new AbortController,p=i instanceof HTMLDialogElement?i:null,m=null;return new Promise(o=>{let h=e=>{if(d.abort(),m&&p){let e=m;m=null,s(p).then(e)}o(e)};if(n?.aborted){h(`done`);return}let g=V(e,`.wui-tour-card:not(.wui-tour-end)`,HTMLElement),_=V(e,`.wui-tour-spot`,HTMLElement),v=V(e,`[role=status]`,HTMLElement),y={signal:d.signal};n?.addEventListener(`abort`,()=>h(`done`),y),a.addEventListener(`click`,()=>h(`done`),y),l&&l.addEventListener(`click`,e=>{Oe(e)&&(e.preventDefault(),h(`next`))},y),r.addEventListener(`keydown`,e=>{if(!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`){if(m)return;e.preventDefault(),e.stopPropagation(),h(`done`)}else f(e)&&l&&!e.shiftKey&&(e.composedPath?.()[0]??e.target)===l&&(e.preventDefault(),h(`next`))}},{capture:!0,signal:d.signal});let b=()=>{d.signal.aborted||(g.hidden=!0,z(_,g,null),e.append(i),k(i),p&&(m=c(p,{escape:!0,backdrop:!1,focus:`first-control`,onRequestClose:()=>h(`done`)})),v.textContent=[t.title,t.message].filter(Boolean).join(`. `),u.focus())},x=A(g);x?x.then(b):b()})}var Ae=` :host { all: initial; display: revert-layer; position: fixed; inset: 0; ${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-ease-linear":`cubic-bezier(0, 0, 1, 1)`,"--wui-duration-fast":`150ms`,"--wui-duration-default":`250ms`,"--wui-duration-slow":`400ms`,"--wui-space-xs":`4px`,"--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); width: auto; height: auto; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: visible; background: none; } .wui-tour-spot { position: fixed; box-shadow: 0 0 0 2px var(--color-primary), 0 0 4px 2px color-mix(in srgb, var(--color-primary) 30%, transparent), 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 var(--wui-duration-fast) var(--wui-ease-linear); } .wui-tour-layer[data-state=leaving] { transition: opacity var(--wui-duration-fast) var(--wui-ease-linear); } .wui-tour-card[data-state=entering] { animation: wui-tour-fade-in var(--wui-duration-fast) var(--wui-ease-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-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: var(--wui-focus-ring-offset); } .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); } .wui-tour-pointer { position: absolute; top: 50%; left: 50%; width: 18px; height: 24px; pointer-events: none; } .wui-tour-pointer::before { content: ""; position: absolute; inset: 0; background: var(--color-primary); clip-path: polygon(0 0, 0 75%, 28% 58%, 46% 100%, 62% 92%, 45% 52%, 85% 52%); filter: drop-shadow(1px 0 0 var(--color-surface)) drop-shadow(-1px 0 0 var(--color-surface)) drop-shadow(0 1px 0 var(--color-surface)) drop-shadow(0 -1px 0 var(--color-surface)); } .wui-tour-pointer::after { content: ""; position: absolute; top: -16px; left: -16px; width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary); opacity: 0; display: none; } @media (max-width: 575.98px) { .wui-tour-pointer { width: 24px; height: 24px; translate: -50% -50%; } .wui-tour-pointer::before { clip-path: none; border-radius: 50%; box-shadow: 0 0 0 2px var(--color-surface); filter: none; } .wui-tour-pointer::after { top: -4px; left: -4px; } } @keyframes wui-tour-tap { 0% { opacity: 0; transform: translate(56px, 44px) scale(1); } 10% { opacity: 1; transform: translate(56px, 44px) scale(1); } 45% { transform: translate(0, 0) scale(1); } 52% { transform: translate(0, 0) scale(0.86); } 60% { transform: translate(0, 0) scale(1); } 85% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(0, 0) scale(1); } } @keyframes wui-tour-tap-rtl { 0% { opacity: 0; transform: translate(-56px, 44px) scale(1); } 10% { opacity: 1; transform: translate(-56px, 44px) scale(1); } 45% { transform: translate(0, 0) scale(1); } 52% { transform: translate(0, 0) scale(0.86); } 60% { transform: translate(0, 0) scale(1); } 85% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(0, 0) scale(1); } } @keyframes wui-tour-ripple { 0%, 50% { opacity: 0; transform: scale(0.2); } 52% { opacity: 0.35; transform: scale(0.2); } 80%, 100% { opacity: 0; transform: scale(1); } } @media (prefers-reduced-motion: no-preference) { .wui-tour-pointer { opacity: 0; animation: wui-tour-tap calc(var(--wui-duration-slow) * 6) var(--wui-ease-out) var(--wui-tour-spot-duration) infinite; } .wui-tour-pointer:dir(rtl) { animation-name: wui-tour-tap-rtl; } .wui-tour-pointer::after { display: block; animation: wui-tour-ripple calc(var(--wui-duration-slow) * 6) var(--wui-ease-out) var(--wui-tour-spot-duration) infinite; } } @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[data-layout=center][data-next] .wui-tour-actions { flex-direction: column; align-items: stretch; width: 100%; gap: var(--wui-space-xs); } .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-next { 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 var(--wui-duration-default) var(--wui-ease-out) calc(var(--wui-tour-card-delay, 0ms) + var(--wui-duration-fast)) both; } } `,H=()=>l(`tour`,u),U=`wui-tour-media`,je=`wui-tour-media-toggle`,W=`http://www.w3.org/2000/svg`,Me=`M6 5h4v14H6zM14 5h4v14h-4z`,Ne=`M8 5v14l11-7z`,Pe=()=>({pause:H().mediaPauseLabel,play:H().mediaPlayLabel}),Fe=()=>globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;function Ie(e){let t=document.createElementNS(W,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`);let n=document.createElementNS(W,`path`);return n.setAttribute(`d`,e),t.appendChild(n),t}function Le(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 Re(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 ze(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=je;let r=(r=!e.paused)=>{n.setAttribute(`aria-label`,r?t.pause:t.play),n.replaceChildren(Ie(r?Me:Ne))};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 Be(e){let t=e.querySelector(`:scope > .${U}`);if(!t)return;let n=t.querySelector(`video`);n&&(n.pause(),n.removeAttribute(`src`),n.load()),t.remove()}function Ve(e,t,n=Pe()){if(Be(e),!t.media){e.removeAttribute(`data-media`);return}let r=document.createElement(`div`);if(r.className=U,t.mediaType===`video`){let e=Re(t,!Fe());r.append(e,ze(e,n))}else r.appendChild(Le(t));e.prepend(r),e.setAttribute(`data-media`,t.target?`step`:`welcome`)}var He=()=>l(`tour`,u);function G(e){let t=/* @__PURE__ */ 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 Ue(e,t,n){return(e.getAttribute(`progress-label`)||He().progressLabel).replace(/\{(current|total)\}/g,(e,r)=>String(r===`current`?t:n))}function We(e,{text:t,position:n,total:r}){let i=e.querySelector(`.wui-tour-position`);if(!(i instanceof HTMLElement))throw Error(`tour position label missing`);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;){let e=a.lastElementChild;if(!e)throw Error(`progress bar segment missing`);e.remove()}for(let e=0;e<o.length;e++){let t=o[e];if(!t)throw Error(`progress bar segment missing`);t.toggleAttribute(`data-filled`,e<n)}}var Ge=`wui-tour-step`,Ke=`wui-tour-host`,K=`data-tracking`,q=()=>l(`tour`,u),qe=()=>({back:q().backLabel,next:q().nextLabel,skip:q().skipLabel,done:q().doneLabel,mediaPause:q().mediaPauseLabel,mediaPlay:q().mediaPlayLabel,endTitle:q().endTitle,endMessage:q().endMessage,endButton:q().doneLabel}),Je={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`},Ye=[[`media`,`media`],[`mediaAlt`,`media-alt`],[`mediaPoster`,`media-poster`],[`mediaType`,`media-type`],[`advanceOn`,`advance-on`],[`actionLabel`,`action-label`]],J={index:null,position:null,total:null},Xe=0,Y=e=>!e?.isConnected||getComputedStyle(e).visibility===`hidden`?!1:e.getClientRects().length>0,X=e=>e instanceof HTMLElement&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function Z(e,t,n){let r=e.querySelector(t);if(!(r instanceof n))throw Error(`<wui-tour> layer has no ${t}`);return r}var Q=()=>{let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e},$=null;function Ze(e){$||($=new CSSStyleSheet,$.replaceSync(Ae)),e.adoptedStyleSheets=[$]}var Qe=class extends i{seenStore;onBeforeStep;_run;_running;_layer;_outer;_shadow;_unbindAdvance;_ending;_seenMark;_steps=[];_progress=G(0);_firstIndex=0;_returnFocus=null;_current=null;_moving=!1;_card=null;_spot=null;_live=null;_onKey=null;_onFocusIn=null;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 > ${Ge}`),e=>{let t={target:e.getAttribute(`target`)||``,title:e.getAttribute(`title`)||void 0,description:(e.textContent??``).trim()};for(let[n,r]of Ye)e.hasAttribute(r)&&(t[n]=e.getAttribute(r)??``);return t})}_stepAt(e){let t=this._steps[e];if(!t)throw RangeError(`<wui-tour> has no step ${e}; it has ${this._steps.length}.`);return t}_store(){return this.seenStore?this.seenStore:this.getAttribute(`seen-store`)===`local`?m():globalThis.window?.WUI?.tour?.seenStore||null}_label(e){return this.getAttribute(Je[e])||qe()[e]}_endDialogText(){if(this.getAttribute(`end-dialog`)===`false`)return null;let e=(this.getAttribute(`end-next-label`)??``).trim(),t=(this.getAttribute(`end-next-href`)??``).trim();return{title:this._label(`endTitle`),message:this._label(`endMessage`),button:this._label(`endButton`),nextLabel:e,nextHref:t}}_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=G(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&&!Y(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(!e)break;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),a=t instanceof HTMLElement||t instanceof SVGElement?t:null;if(Y(a))return this._progress.position(i),{index:i,target:a};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 t=`wui-tour-${++Xe}`,i=document.createElement(`div`);i.className=`wui-tour-layer`,i.innerHTML=` <div class="wui-tour-spot" aria-hidden="true"></div> <div class="wui-tour-card" role="dialog" tabindex="-1" aria-labelledby="${t}-title" aria-describedby="${t}-text"> <p class="wui-tour-position"></p> <h2 class="wui-tour-title" id="${t}-title"></h2> <p class="wui-tour-text" id="${t}-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="${n(`neutral`,`outline`,`sm`)} wui-tour-back" data-wui="${r}"></button> <button type="button" class="${n(`primary`,`solid`,`sm`)} wui-tour-next" data-wui="${r}"></button> </div> </div> </div> <div class="visually-hidden" role="status" aria-live="polite"></div>`;let o=i;this._shadow=null,this.isolated&&(o=document.createElement(Ke),this._shadow=o.attachShadow({mode:`open`}),Ze(this._shadow),this._shadow.appendChild(i)),o.setAttribute(`popover`,`manual`),a(document).appendChild(o),document.documentElement.setAttribute(p,``),this._outer=o,this._layer=i;let s=Z(i,`.wui-tour-spot`,HTMLDivElement),c=Z(i,`.wui-tour-card`,HTMLDivElement),l=Z(i,`[role=status]`,HTMLElement);this._spot=s,this._card=c,this._live=l,Z(c,`.wui-tour-skip`,HTMLElement).addEventListener(`click`,()=>this._close(`skipped`,`button`)),Z(c,`.wui-tour-back`,HTMLElement).addEventListener(`click`,()=>this._move(-1)),Z(c,`.wui-tour-next`,HTMLElement).addEventListener(`click`,()=>this._move(1));let u=e=>this._key(e);this._onKey=u;let d=e=>{let t=this._layer;if(!t||this._ending)return;let n=this._current,r=n?this._stepAt(n.index):null;if(!(e.target instanceof Node))throw Error(`<wui-tour> saw a focus change from a non-node target`);ce(t,r,n?.target??null,e.target)||c.focus()};this._onFocusIn=d,document.addEventListener(`keydown`,u,!0),this._shadow||document.addEventListener(`focusin`,d),e(o,()=>this._follow())}_active(){return this._shadow?this._shadow.activeElement:document.activeElement}_raise(){let e=this._outer;if(!e)throw Error(`<wui-tour> raises a step before its host is built`);let t=a(this.ownerDocument);e.parentElement!==t&&t.appendChild(e),o(e)}_show(e){this._current=e;let{index:t,target:n}=e,r=this._stepAt(t),i=this._layer,a=this._spot,o=this._card,s=this._live;if(!i||!a||!o||!s)throw Error(`<wui-tour> shows a step before its layer is built`);this._raise();let c=this._progress.position(t),l=this._progress.total(),u=c===l&&!this._endDialogText(),d=Ue(this,c,l);We(o,{text:d,position:c,total:l}),Ve(o,r,{pause:this._label(`mediaPause`),play:this._label(`mediaPlay`)}),o.toggleAttribute(`data-welcome`,!n);let f=C(this,{layer:i,spot:a,card:o},r,n),p=Z(o,`.wui-tour-title`,HTMLElement);p.textContent=r.title||``,p.hidden=!r.title,Z(o,`.wui-tour-text`,HTMLElement).textContent=r.description||``,Z(o,`.wui-tour-skip`,HTMLElement).textContent=this._label(`skip`);let m=Z(o,`.wui-tour-back`,HTMLElement);m.textContent=this._label(`back`),m.hidden=t<=this._firstIndex,Z(o,`.wui-tour-next`,HTMLElement).textContent=this._label(u?`done`:`next`);let h=[d,r.title,r.description].filter(Boolean).join(`. `);s.textContent=f?[h,f].join(/[.!?]$/.test(h)?` `:`. `):h,ye(o,n),a.removeAttribute(K),this._place(),k(o),this._unbindAdvance?.(),this._unbindAdvance=se(r,n,()=>this._move(1));let g=this._active();(g!==null&&o.contains(g)?!(g instanceof HTMLElement&&g.hidden):this._shadow!==null&&X(Q()))||o.focus(),this.dispatchEvent(new CustomEvent(`wui-tour:step`,{bubbles:!0,detail:{step:r,index:t,position:c,total:l}}))}_place(){if(!this._current||!this._layer)return;let e=this._spot,t=this._card;if(!e||!t)throw Error(`<wui-tour> places a step before its layer is built`);z(e,t,this._current.target)}_follow(){if(!this._current||!this._layer||this._ending)return;let e=this._spot;if(!e)throw Error(`<wui-tour> follows a step before its spot is built`);let t=e.style.cssText;this._place(),e.style.cssText!==t&&e.setAttribute(K,``)}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=this._card;if(!e)throw Error(`<wui-tour> moved with no card showing`);let t=A(e);if(t&&await t,n!==this._run)return;this._show(r)}else if(t>0){let e=this._endDialogText(),t=e?await this._showEnd(e):`done`;if(n!==this._run)return;let r=await this._close(t===`next`?`next`:`finished`);if(t===`next`&&r&&e){let t=this.ownerDocument.defaultView;if(!t)throw Error(`<wui-tour> has no window to follow its next link in`);t.location.assign(e.nextHref)}}}finally{this._moving=!1}}_showEnd(e){this._unbindAdvance?.(),this._unbindAdvance=null;let t=this._layer,n=this._spot,r=this._card;if(!t||!n||!r)throw Error(`<wui-tour> ends a tour before its layer is built`);return C(this,{layer:t,spot:n,card:r},null,null),n.removeAttribute(K),this._ending=new AbortController,this._seenMark=this._markSeen(`finished`),ke(t,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(X(e.composedPath?.()[0]??e.target))return;if(e.preventDefault(),e.key===`ArrowRight`)this._move(1);else{let e=this._current;if(!e)throw Error(`<wui-tour> moved back with no step showing`);e.index>this._firstIndex&&this._move(-1)}}else if(e.key===`Tab`&&!this._shadow){let t=this._current,n=this._card;if(!t||!n)throw Error(`<wui-tour> cycled focus with no step showing`);le(e,{card:n,active:this._active(),step:this._stepAt(t.index),target:t.target})}}}_teardown(){if(!this._layer)return;this._onKey&&document.removeEventListener(`keydown`,this._onKey,!0),this._onFocusIn&&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;let n=this._outer;if(t(n),!n)throw Error(`<wui-tour> has a layer with no host to remove`);he(n),document.documentElement.removeAttribute(p),this._outer=null,this._shadow=null,this._layer=null,this._current=null;let r=this._returnFocus;this._returnFocus=null,e&&r?.isConnected&&(r instanceof HTMLElement||r instanceof SVGElement)&&r.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()}:J,a=this._seenMark;this._teardown();let o=e===`next`?`finished`:e,s=!1;try{n===this._run&&await(a??this._markSeen(o)),s=n===this._run}finally{this._finish(e,i,t)}return s}_finish(e,t=J,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}}))}};export{Qe as t};
|