@webority/ui-elements 0.156.0 → 0.158.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/WuiCarousel-BdhJLo1m.js +1 -0
- package/dist/{WuiCommentThread-BmRsl0K1.js → WuiCommentThread-CnwvJUDn.js} +1 -1
- package/dist/{WuiContextMenu-sPTmEEVn.js → WuiContextMenu-Re2CG8yT.js} +1 -1
- package/dist/{WuiMentionInput-8Xjkzdqg.js → WuiMentionInput-HwsLGhyr.js} +1 -1
- package/dist/{WuiPhone-BVNVerap.js → WuiPhone-NdIYg_Gb.js} +1 -1
- package/dist/{WuiSelect-BPWPI07i.js → WuiSelect-CWul-aM1.js} +2 -2
- package/dist/{WuiTree-0Yqu199O.js → WuiTree-JK4JqcBr.js} +1 -1
- package/dist/chips-DD_C4G0w.js +2 -0
- package/dist/elements/carousel.js +1 -1
- package/dist/elements/comment-thread.js +1 -1
- package/dist/elements/context-menu.js +1 -1
- package/dist/elements/mention-input.js +1 -1
- package/dist/elements/phone.js +1 -1
- package/dist/elements/select.js +1 -1
- package/dist/elements/tree.js +1 -1
- package/dist/listboxKeyNav-Bxkq7dvu.js +1 -0
- package/dist/search-DMniXhEK.js +1 -0
- package/dist/ui-chart.global.js +2 -2
- package/dist/ui-chart.js +2 -2
- 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/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/resizable.global.js +1 -1
- package/dist/ui-elements/saved-views.global.js +1 -1
- package/dist/ui-elements/select-chips.global.js +2 -2
- package/dist/ui-elements/select-recents.global.js +1 -1
- package/dist/ui-elements/select-search.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 +1 -1
- package/dist/ui-elements/tour.global.js +1 -1
- package/dist/ui-elements/tree.global.js +1 -1
- package/dist/ui-elements/wizard.global.js +1 -1
- package/dist/ui-elements.global.js +3 -3
- package/dist/ui-elements.js +1 -1
- package/package.json +4 -4
- package/dist/WuiCarousel-DthhDxH-.js +0 -1
- package/dist/chips-Dr_W3avk.js +0 -2
- package/dist/listboxKeyNav-4LeEjKq6.js +0 -1
- package/dist/search-PZCXpBAn.js +0 -1
package/dist/ui-elements.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./elementBase-Cxeyx0tU.js";import{n as t}from"./filterPopover-CaHWe9V0.js";import{t as n}from"./kanban-CDaks135.js";import{n as r}from"./statusIcons-CRtqA_1C.js";import{t as i}from"./WuiCarousel-
|
|
1
|
+
import{n as e}from"./elementBase-Cxeyx0tU.js";import{n as t}from"./filterPopover-CaHWe9V0.js";import{t as n}from"./kanban-CDaks135.js";import{n as r}from"./statusIcons-CRtqA_1C.js";import{t as i}from"./WuiCarousel-BdhJLo1m.js";import{t as a}from"./WuiCodeBlock-cLLbSBK4.js";import{t as o}from"./WuiCommandPalette-Dpz0DXKJ.js";import{t as s}from"./WuiCommentThread-CnwvJUDn.js";import{t as c}from"./WuiConsentBanner-Bm7tT3_5.js";import{t as l}from"./WuiContextMenu-Re2CG8yT.js";import{t as u}from"./WuiDataTable-8nQDiTHE.js";import{t as d}from"./WuiDatePicker-DLEsnzqG.js";import{t as f}from"./WuiDateRange-9Xqs5nvv.js";import{t as p}from"./WuiDock-d5abaLkL.js";import{t as m}from"./WuiDrawer-B3YFmxl2.js";import{t as h}from"./WuiHoverCard-CE3dHKaM.js";import{t as g}from"./WuiImageCrop-ChvH8GKb.js";import{t as _}from"./WuiInlineEdit-BlBuWkHG.js";import{t as v}from"./WuiLeadPopup-BmZG0Fk_.js";import{t as y}from"./WuiLightbox-C2A14vHx.js";import{t as b}from"./WuiMarkdown-BXY0QKaO.js";import{i as x}from"./WuiMentionInput-HwsLGhyr.js";import{t as S}from"./WuiNavigationMenu-CZ3XhFam.js";import{t as C}from"./WuiNotificationCenter-ClkCTUnp.js";import{t as w}from"./WuiOnboardingChecklist-C-nllg2h.js";import{t as T}from"./WuiOrgTree-DzeLFQxy.js";import{t as E}from"./WuiOtp-DonxSwVn.js";import{t as D}from"./WuiOverflow-B0wA6aDe.js";import{t as O}from"./WuiPhone-NdIYg_Gb.js";import{t as k}from"./WuiRating-DLVduJZ_.js";import{t as A}from"./WuiRecordPager-7HVGoFlP.js";import{t as j}from"./WuiRelativeTime-DyeUQOQ8.js";import{t as M}from"./WuiResizable-KvfLtbCw.js";import{t as N}from"./WuiRollingNumber-sfgNzaP0.js";import{t as P}from"./WuiSavedViews-Br9YKOVU.js";import{t as F}from"./WuiSelect-CWul-aM1.js";import{t as I}from"./WuiShortcuts-D3rWkaOm.js";import{t as L}from"./WuiShowMore-CvdNQXrA.js";import{t as R}from"./WuiSlider-D33Y3_t9.js";import{t as z}from"./WuiSortable-CBLMNRuZ.js";import{t as B}from"./WuiTimePicker-DOodgU2O.js";import{t as V}from"./WuiTour-Cx61ijsm.js";import{t as H}from"./WuiTree-JK4JqcBr.js";import{t as U}from"./WuiTruncate-C2WV1-NN.js";import{n as W,t as ee}from"./WuiWhatsNew-dLGyA4g1.js";import{n as G,t as K}from"./WuiWizardStep-Cencr-mT.js";import{c as q,f as J,l as Y,m as X,p as Z,s as Q,u as te}from"./formatters-ljfITOZ3.js";import{_ as ne,r as re}from"./themeTransition-CfrJtERx.js";import{t as ie}from"./drawerDiscard-Cra-QhD5.js";import{i as ae}from"./shortcutKeys-COVLox98.js";function $(){t(),e(`wui-select`,F),e(`wui-saved-views`,P),e(`wui-phone`,O),e(`wui-datepicker`,d),e(`wui-date-range`,f),e(`wui-dock`,p),e(`wui-image-crop`,g),e(`wui-kanban`,n),e(`wui-lead-popup`,v),e(`wui-inline-edit`,_),e(`wui-consent-banner`,c),e(`wui-slider`,R),e(`wui-sortable`,z),e(`wui-timepicker`,B),e(`wui-tour`,V),e(`wui-tree`,H),e(`wui-org-tree`,T),e(`wui-command-palette`,o),e(`wui-context-menu`,l),e(`wui-otp`,E),e(`wui-status-icon`,r),e(`wui-shortcuts`,I),e(`wui-record-pager`,A),e(`wui-carousel`,i),e(`wui-code-block`,a),e(`wui-markdown`,b),e(`wui-data-table`,u),e(`wui-drawer`,m),e(`wui-hover-card`,h),e(`wui-lightbox`,y),e(`wui-navigation-menu`,S),e(`wui-notification-center`,C),e(`wui-onboarding-checklist`,w),e(`wui-overflow`,D),e(`wui-rating`,k),e(`wui-relative-time`,j),e(`wui-resizable`,M),e(`wui-rolling-number`,N),e(`wui-show-more`,L),e(`wui-truncate`,U),e(`wui-whats-new`,W),e(`wui-mention-input`,x),e(`wui-comment-thread`,s),e(`wui-wizard-step`,K),e(`wui-wizard`,G)}$();export{ie as DISCARD_EVENT,ne as ROW_DROP_EVENT,ae as SHORTCUT_EVENT,re as THEME_CHANGE_EVENT,ee as WHATS_NEW_READ_EVENT,i as WuiCarousel,a as WuiCodeBlock,o as WuiCommandPalette,s as WuiCommentThread,c as WuiConsentBanner,l as WuiContextMenu,u as WuiDataTable,d as WuiDatePicker,f as WuiDateRange,p as WuiDock,m as WuiDrawer,h as WuiHoverCard,g as WuiImageCrop,_ as WuiInlineEdit,n as WuiKanban,v as WuiLeadPopup,y as WuiLightbox,b as WuiMarkdown,x as WuiMentionInput,S as WuiNavigationMenu,C as WuiNotificationCenter,w as WuiOnboardingChecklist,T as WuiOrgTree,E as WuiOtp,D as WuiOverflow,O as WuiPhone,k as WuiRating,A as WuiRecordPager,j as WuiRelativeTime,M as WuiResizable,N as WuiRollingNumber,P as WuiSavedViews,F as WuiSelect,I as WuiShortcuts,L as WuiShowMore,R as WuiSlider,z as WuiSortable,r as WuiStatusIcon,B as WuiTimePicker,V as WuiTour,H as WuiTree,U as WuiTruncate,W as WuiWhatsNew,G as WuiWizard,K as WuiWizardStep,$ as defineWeborityElements,Q as formatCompact,q as formatCurrency,Y as formatDate,te as formatDateTime,J as formatNumber,Z as formatPercent,X as formatValue};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/ui-elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.158.0",
|
|
4
4
|
"description": "Webority framework-agnostic UI custom elements (<wui-*>) — the single implementation of the interactive components, styled by @webority/theme. Used natively in Razor and wrapped by @webority/ui-react.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -250,9 +250,9 @@
|
|
|
250
250
|
"@tiptap/starter-kit": "3.31.4",
|
|
251
251
|
"@types/node": "25.6.0",
|
|
252
252
|
"@vitest/coverage-v8": "5.1.0",
|
|
253
|
-
"@webority/biome-config": "0.
|
|
254
|
-
"@webority/markdown-core": "0.
|
|
255
|
-
"@webority/theme": "0.
|
|
253
|
+
"@webority/biome-config": "0.158.0",
|
|
254
|
+
"@webority/markdown-core": "0.158.0",
|
|
255
|
+
"@webority/theme": "0.158.0",
|
|
256
256
|
"echarts": "6.1.0",
|
|
257
257
|
"jsdom": "30.1.1",
|
|
258
258
|
"libphonenumber-js": "^1.13.9",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./elementBase-Cxeyx0tU.js";var t=Object.freeze({slide:(e,t)=>`${e} of ${t}`,status:(e,t,n)=>e===t?`Slide ${e} of ${n}`:`Slides ${e} to ${t} of ${n}`,dot:`Go to slide`,pause:`Pause`,play:`Play`}),n=120,r=class extends e{_page;_pages;_perView;_paused;_hover;_focus;_timer;_settleTimer;_status;_ready;_motion;_mutations;_resizer;_doc;_track;_onClick;_onKeyDown;_onScroll;_onEnter;_onLeave;_onFocusIn;_onFocusOut;_onVisibility;_onMotion;_tick;static get observedAttributes(){return[`autoplay`]}constructor(){super(),this._page=0,this._pages=1,this._perView=1,this._paused=!1,this._hover=!1,this._focus=!1,this._timer=null,this._settleTimer=null,this._status=``,this._ready=!1,this._motion=null,this._mutations=null,this._resizer=null,this._doc=null,this._track=null,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onScroll=()=>{this._settleTimer!==null&&clearTimeout(this._settleTimer),this._settleTimer=setTimeout(()=>this._settle(),n)},this._onEnter=()=>this._hold({hover:!0}),this._onLeave=()=>this._hold({hover:!1}),this._onFocusIn=()=>this._hold({focus:!0}),this._onFocusOut=e=>this._hold({focus:e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)}),this._onVisibility=()=>this._sync(),this._onMotion=()=>this._sync(),this._tick=()=>{this._timer=null,this._go(this._page+1<this._pages?this._page+1:0)}}connectedCallback(){let e=this.querySelector(`.wui-carousel-track`);if(this._track=e instanceof HTMLElement?e:null,!this._track){this.ownerDocument.readyState===`loading`&&this.ownerDocument.addEventListener(`DOMContentLoaded`,()=>this.isConnected&&this.connectedCallback(),{once:!0});return}this._doc=this.ownerDocument;let t=this.getAttribute(`data-wui-style`);if(t){for(let e of t.split(`;`)){let t=e.indexOf(`:`);t>0&&this.style.setProperty(e.slice(0,t).trim(),e.slice(t+1).trim())}this.removeAttribute(`data-wui-style`)}this._motion=typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(prefers-reduced-motion: reduce)`):null,this._motion?.addEventListener(`change`,this._onMotion),this.addEventListener(`click`,this._onClick),this.addEventListener(`mouseenter`,this._onEnter),this.addEventListener(`mouseleave`,this._onLeave),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._track.addEventListener(`keydown`,this._onKeyDown),this._track.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._doc.addEventListener(`visibilitychange`,this._onVisibility),typeof MutationObserver<`u`&&(this._mutations=new MutationObserver(()=>this._refresh()),this._mutations.observe(this._track,{childList:!0})),typeof ResizeObserver<`u`&&(this._resizer=new ResizeObserver(()=>this._refresh()),this._resizer.observe(this._track)),this._ready=!0,this._refresh()}disconnectedCallback(){this._ready=!1,this._timer!==null&&clearTimeout(this._timer),this._settleTimer!==null&&clearTimeout(this._settleTimer),this._timer=null,this._motion?.removeEventListener(`change`,this._onMotion),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mouseenter`,this._onEnter),this.removeEventListener(`mouseleave`,this._onLeave),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._track?.removeEventListener(`keydown`,this._onKeyDown),this._track?.removeEventListener(`scroll`,this._onScroll),this._doc?.removeEventListener(`visibilitychange`,this._onVisibility),this._mutations?.disconnect(),this._resizer?.disconnect(),this._mutations=this._resizer=this._motion=this._doc=null}attributeChangedCallback(){this._ready&&this._sync()}get paused(){return this._paused}set paused(e){this._paused=!!e,this._ready&&this._sync()}next(){this._page+1<this._pages?this._go(this._page+1):this.hasAttribute(`loop`)&&this._go(0)}prev(){this._page>0?this._go(this._page-1):this.hasAttribute(`loop`)&&this._go(this._pages-1)}goTo(e){this._go(Number(e))}_interval(){let e=Number.parseInt(this.getAttribute(`autoplay`)??``,10);return e>0?e:0}_slides(){let e=this._track;if(!e)throw Error(`WuiCarousel used before it was connected`);return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.classList.contains(`wui-carousel-slide`))}_playing(){return this._interval()>0&&this._pages>1&&!this._paused&&!this._hover&&!this._focus&&!this._motion?.matches&&!this._doc?.hidden}_hold({hover:e=this._hover,focus:t=this._focus}){this._hover=e,this._focus=t,this._sync()}_click(e){let t=(e.target instanceof Element?e.target:null)?.closest(`.wui-carousel-pause, .wui-carousel-prev, .wui-carousel-next, .wui-carousel-dot`),n=t instanceof HTMLElement?t:null;if(!n||!this.contains(n))return;let r=this._track;if(!r)throw Error(`WuiCarousel used before it was connected`);r.contains(n)||(n.classList.contains(`wui-carousel-pause`)?(this._paused=!this._paused,this._hover=!1,this._focus=!1,this._sync()):n.getAttribute(`aria-disabled`)===`true`?e.preventDefault():n.classList.contains(`wui-carousel-prev`)?this.prev():n.classList.contains(`wui-carousel-next`)?this.next():this._go(Number(n.dataset.page)))}_key(e){if(e.target!==this._track||e.altKey||e.ctrlKey||e.metaKey)return;let t={ArrowRight:()=>this.next(),ArrowLeft:()=>this.prev(),Home:()=>this._go(0),End:()=>this._go(this._pages-1)}[e.key];t&&(e.preventDefault(),t())}_perViewNow(){let e=``;if(typeof window<`u`){let t=this._track;if(!t)throw Error(`WuiCarousel used before it was connected`);e=window.getComputedStyle(t).getPropertyValue(`--wui-carousel-view`)}let t=Number.parseInt(e,10);return t>=1?t:1}_start(e){return Math.min(e*this._perView,Math.max(0,this._slides().length-this._perView))}_label(){let e=this._slides();return e.forEach((n,r)=>{let i=t.slide(r+1,e.length);n.getAttribute(`aria-label`)!==i&&n.setAttribute(`aria-label`,i)}),e.length}_refresh(){let e=this._label();this._perView=this._perViewNow();let n=Math.max(1,Math.ceil(e/this._perView)),r=this.querySelector(`.wui-carousel-dots`);if(r&&r.children.length!==n){let e=this.getAttribute(`dot-label`)||t.dot;r.replaceChildren(...Array.from({length:n},(t,n)=>{let r=this.ownerDocument.createElement(`button`);return r.type=`button`,r.className=`wui-carousel-dot`,r.dataset.page=String(n),r.setAttribute(`aria-label`,`${e} ${this._start(n)+1}`),r}))}this._pages=n,this._page=Math.min(this._page,n-1),this.toggleAttribute(`data-single`,n<=1),this._render(!1),this._sync()}_settle(){let e=this._track;if(!e)throw Error(`WuiCarousel used before it was connected`);let t=this._slides();if(!t.length)return;let n;if(e.scrollWidth>e.clientWidth&&e.scrollLeft+e.clientWidth>=e.scrollWidth-2)n=this._pages-1;else{let r=0,i=1/0;t.forEach((t,n)=>{let a=Math.abs(t.offsetLeft-e.scrollLeft);a<i&&(i=a,r=n)}),n=Math.min(this._pages-1,Math.round(r/this._perView))}n!==this._page&&(this._page=n,this._render(!0),this._sync())}_go(e){if(!Number.isInteger(e))return;this._page=Math.max(0,Math.min(this._pages-1,e));let t=this._track;if(!t)throw Error(`WuiCarousel used before it was connected`);let n=this._slides()[this._start(this._page)];if(n){let e=this._motion?.matches?`auto`:`smooth`;typeof t.scrollTo==`function`?t.scrollTo({left:n.offsetLeft,behavior:e}):t.scrollLeft=n.offsetLeft}this._render(!0),this._sync()}_render(e){let n=this.hasAttribute(`loop`);for(let e of this.querySelectorAll(`.wui-carousel-dot`))e instanceof HTMLElement&&(Number(e.dataset.page)===this._page?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`));this.querySelector(`.wui-carousel-prev`)?.setAttribute(`aria-disabled`,String(!n&&this._page===0)),this.querySelector(`.wui-carousel-next`)?.setAttribute(`aria-disabled`,String(!n&&this._page===this._pages-1));let r=this._slides().length,i=this._start(this._page)+1,a=Math.min(r,i+this._perView-1),o=t.status(i,a,r);if(o===this._status||(this._status=o,!e))return;let s=this.querySelector(`[data-wui-status]`);s&&!this._playing()&&(s.textContent=o),this.dispatchEvent(new CustomEvent(`wui:carousel:change`,{bubbles:!0,detail:{page:this._page,pages:this._pages}}))}_sync(){this._timer!==null&&clearTimeout(this._timer),this._timer=null;let e=this._interval(),n=this.querySelector(`.wui-carousel-pause`);if(n instanceof HTMLElement){n.hidden=e===0||this._pages<=1||!!this._motion?.matches;let r=this._paused?this.getAttribute(`play-label`)||t.play:this.getAttribute(`pause-label`)||t.pause,i=n.querySelector(`.wui-carousel-pause-text`);i&&i.textContent!==r&&(i.textContent=r),this.toggleAttribute(`data-paused`,this._paused)}this._playing()&&(this._timer=setTimeout(this._tick,e))}};export{r as t};
|
package/dist/chips-Dr_W3avk.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./fieldState-D-zQcXUS.js";import{t as n}from"./iconGlyphs.g-DPqoOoXy.js";import{a as r,i,n as a,r as o}from"./optionLabel-4xjXWy74.js";import{t as s}from"./customRule-Chp7YwFb.js";import{r as c}from"./WuiSelect-BPWPI07i.js";var l={enter:`Enter`,comma:`,`,space:` `,tab:`Tab`},u={enter:`
|
|
2
|
-
`,comma:`,`,space:` `,tab:` `},d=e=>l[e],ee=e=>u[e];function te(e,t){let n=[String(e??``)];for(let e of t)n=n.flatMap(t=>t.split(e));return n.map(e=>e.trim()).filter(Boolean)}var ne=(e,t)=>t.some(t=>String(e??``).includes(t));function f(e,t){if(e===null)throw TypeError(`The chip row needs ${t}, and it is not mounted.`);return e}var p=(e,t)=>{let n=document.createElement(e);return n.className=t,n};function m(){let l,u,m=null,h=null,g=null,_=null,v=null,y=null,b=null,x=null,S=!1,C=()=>f(h,`the draft input`),w=()=>l.mode===`tag`,T=()=>Array.isArray(l.value)?l.value.slice():[],E=()=>(l.getAttribute(`separators`)||`enter,comma`).split(`,`).map(e=>e.trim()).filter(Boolean),re=()=>new Set(E().map(d).filter(Boolean)),D=()=>{let e=parseInt(l.getAttribute(`max-tags`)??``,10);return e>0?e:0},O=()=>{let e=D();return e>0&&T().length>=e},k=(e,t)=>!l.hasAttribute(`allow-duplicates`)&&e.some(e=>e.toLowerCase()===t.toLowerCase()),A=e=>(l.options||[]).find(t=>String(t.value)===String(e)),j=e=>{let t=e.trim().toLowerCase();return(l.options||[]).find(e=>String(e.value??``).toLowerCase()===t||i(e).trim().toLowerCase()===t)},ie=e=>{for(let t of E()){let n=ee(t)??t;if(ne(e,[n]))return te(e,[n])}return[e.trim()]},M=()=>h?h.value:l._query||``,ae=()=>w()||l.hasAttribute(`allow-custom`),N=()=>l.getAttribute(`placeholder`)||(w()?`Add…`:`Select…`),P=()=>{let e=l.getAttribute(`aria-label`);if(e)return e;let t=l.closest(`label`)?.textContent?.trim();if(t)return t;let n=l.id;return(n?[...document.querySelectorAll(`label[for]`)].find(e=>e instanceof HTMLLabelElement&&e.htmlFor===n):void 0)?.textContent?.trim()||(w()?`Add tags`:`Select`)},F=()=>{h&&(h.setAttribute(`aria-expanded`,String(!u.menu.hidden)),u.list.id&&h.setAttribute(`aria-controls`,u.list.id),h.setAttribute(`aria-label`,P()))},oe=()=>!e(l)&&!l.hasAttribute(`loading`),se=e=>{S=!0,C().setAttribute(`aria-invalid`,`true`),l.setError(e)},I=()=>{S&&(S=!1,C().removeAttribute(`aria-invalid`),l.setError(null))},L=(e,{quiet:t=!1,strip:n=!1}={})=>{let r=T(),i=r.slice(),a=D(),o=[],c=``,u=!1;for(let t of e){let e=(n?t.trim().replace(/,+$/,``):t).trim();if(!e)continue;if(a&&i.length>=a)break;let r=j(e);if(r){if(r.disabled){o.push(e),c||=r.disabledHint||l.getAttribute(`invalid-message`)||`That option is not available.`;continue}k(i,String(r.value))||i.push(String(r.value));continue}let d=s(l,e);d?(o.push(e),c||=d):k(i,e)||(i.push(e),u=!0)}i.length!==r.length&&(u?l.commit(i,{isCustom:!0}):l.commit(i)),C().value=o.join(`, `),c?t||se(c):I()},R=e=>{t(l)||L([C().value],e)},z=e=>l.commit(T().filter(t=>t!==e)),ce=()=>{let e=p(`span`,`wui-select-placeholder`);return e.textContent=l.getAttribute(`placeholder`)||`Select…`,e},B=e=>{let t=A(e),s=p(`span`,`chip chip-sm`),c=p(`span`,`chip-label`);if(c.innerHTML=t?o(t):a(e),s.append(c),oe()){let a=p(`button`,`chip-remove`);a.type=`button`,a.dataset.remove=e;let o=t?i(t):r(e);a.setAttribute(`aria-label`,`Remove ${o}`),a.innerHTML=n(`x`),s.append(a)}return s};function V(){if(!m)return;m.querySelector(`:scope > .chip-more`)?.remove();let e=[...m.querySelectorAll(`:scope > .chip`)].map(e=>{if(!(e instanceof HTMLElement))throw Error(`The chip row holds a node that is not an element.`);return e});for(let t of e)t.style.display=``;let t=e.at(-1);if(!l.hasAttribute(`collapse-chips`)||!t)return;let n=m.clientWidth,r=e=>e.offsetLeft+e.offsetWidth;if(r(t)<=n)return;let i=p(`span`,`chip chip-sm chip-more`);i.textContent=`+${e.length}`,t.after(i);let a=i.offsetWidth+6,o=0;for(let t of e)if(r(t)<=n-a)o+=1;else break;o<1&&(o=1);for(let t of e.slice(o))t.style.display=`none`;i.textContent=`+${e.length-o}`}function H(){if(!m)return!1;m.parentNode!==u.value&&u.value.append(m);for(let e of m.querySelectorAll(`:scope > .chip, :scope > .wui-select-placeholder`))e.remove();let e=T(),n=m,r=e=>{h?n.insertBefore(e,h):n.append(e)};w()||h||e.length||r(ce());for(let t of e)r(B(t));return h&&(h.placeholder=w()||!e.length?N():``,h.disabled=l.hasAttribute(`disabled`),h.readOnly=t(l),F()),w()||(f(_,`the footer text`).textContent=(l.getAttribute(`selected-text`)||`{n} selected`).replace(`{n}`,()=>String(e.length)),f(v,`the clear-all button`).textContent=l.getAttribute(`clear-all-label`)||`Clear all`),V(),!0}function U(e){if(e.key===`Backspace`){let t=h?!M():!M()&&!u.menu.hidden,n=T().at(-1);return!t||n===void 0?!1:(e.preventDefault(),z(n),!0)}if(!h)return!1;let t=h.value;if(e.key===`Escape`){if(!w())return!1;let n=!u.menu.hidden;return!n&&!t?!1:(n&&(e.preventDefault(),e.stopPropagation()),h.value=``,I(),l.closeMenu({focusControl:!1}),!0)}let n=!w()&&!t.trim(),r=re();return e.key===`Enter`&&r.has(`Enter`)?n||u.list.querySelector(`.is-active`)?!1:(e.preventDefault(),R(),!0):e.key===`,`&&r.has(`,`)?!n&&(e.preventDefault(),R({strip:!0}),!0):e.key===` `&&r.has(` `)&&t.trim()||e.key===`Tab`&&r.has(`Tab`)&&!n?(e.preventDefault(),R(),!0):!1}function W(e){let t=String(e.value);if(w()||h&&!A(t))return L([t]),!0;let n=T();return n.includes(t)?l.commit(n.filter(e=>e!==t)):h?L([t]):l.commit([...n,t]),h?.value&&(h.value=``,I()),!0}function G(e){if(!h)return null;let t=String(e??``).trim().replace(/,+$/,``).trim();if(!t||O()||j(t)||k(T(),t))return null;let n=l.getAttribute(`create-label`)||`Create '{text}'`;return{position:w()?`top`:`bottom`,label:n.replace(`{text}`,()=>t),value:t}}function K(e){let n=e.target,r=n instanceof Element?n.closest(`[data-remove]`):null;if(r instanceof HTMLElement){if(t(l))return;e.stopPropagation(),z(r.dataset.remove??``),h?.focus()}else h&&!t(l)&&h.focus()}function q(){I();let e=C().value.trim();!w()&&e&&u.menu.hidden&&(G(e)||c(l.options||[],e).length)&&l.openMenu()}function J(e){e.preventDefault(),t(l)||L(ie(e.clipboardData?.getData(`text/plain`)??``))}function Y(){C().value.trim()&&R({quiet:!0,strip:!0}),l.closeMenu({focusControl:!1})}function X(e){e.relatedTarget instanceof Node&&l.contains(e.relatedTarget)||Y()}function le(){return h?(Y(),!0):!1}function Z(){C().value.trim()&&R({strip:!0})}function Q(){t(l)||l.commit([])}function $(e){e.target!==h&&e.preventDefault()}function ue(e,t,n={}){l=e,u=t,m=p(`div`,`wui-select-chips`),m.addEventListener(`click`,K),u.value.append(m),ae()&&(h=p(`input`,`wui-select-draft`),h.type=`text`,h.setAttribute(`autocomplete`,`off`),h.setAttribute(`role`,`combobox`),h.setAttribute(`aria-autocomplete`,`list`),l.hasAttribute(`required`)&&h.setAttribute(`aria-required`,`true`),x=new MutationObserver(F),x.observe(u.menu,{attributes:!0,attributeFilter:[`hidden`]}),m.append(h),h.value=n.carry?.draft??``,u.input=h,h.addEventListener(`input`,q),h.addEventListener(`paste`,J),h.addEventListener(`blur`,X),m.addEventListener(`mousedown`,$),y=l.closest(`form`),y?.addEventListener(`submit`,Z,!0)),w()||(g=p(`div`,`wui-select-footer`),_=document.createElement(`span`),v=p(`button`,`wui-select-clear-all`),v.type=`button`,v.addEventListener(`click`,Q),g.append(_,v),u.menu.append(g)),typeof ResizeObserver<`u`&&(b=new ResizeObserver(V),b.observe(m)),H()}function de(){m?.removeEventListener(`click`,K),m?.removeEventListener(`mousedown`,$),h&&(h.removeEventListener(`input`,q),h.removeEventListener(`paste`,J),h.removeEventListener(`blur`,X),u.input=null),v&&v.removeEventListener(`click`,Q),y?.removeEventListener(`submit`,Z,!0),y=null,b?.disconnect(),b=null,x?.disconnect(),x=null,g?.remove(),m?.remove(),m=null,h=null,g=null,S=!1}return{mount:ue,onKey:U,onPick:W,renderValue:H,actionRow:G,onQuery:()=>!1,onBlur:le,teardown:de}}export{m as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=e=>e.target instanceof Element?e.target.tagName:void 0;function t(t){let{getVisibleOptions:n,getActive:r,setActive:i,onEnter:a,onEscape:o,onTypeahead:s,typeaheadMs:c=500}=t,l=``,u=null,d=()=>{clearTimeout(u??void 0),u=null,l=``};return{handler:t=>{let f=n(),p=r(),m=e(t)===`INPUT`||e(t)===`TEXTAREA`;if(t.key===`ArrowDown`)t.preventDefault(),i(Math.min(p+1,f.length-1));else if(t.key===`ArrowUp`)t.preventDefault(),i(Math.max(p-1,0));else if(t.key===`Home`&&!m)t.preventDefault(),f.length&&i(0);else if(t.key===`End`&&!m)t.preventDefault(),f.length&&i(f.length-1);else if(t.key===`PageDown`&&!m){if(t.preventDefault(),!f.length)return;i(Math.min((p<0?0:p)+8,f.length-1))}else if(t.key===`PageUp`&&!m){if(t.preventDefault(),!f.length)return;i(Math.max((p<0?0:p)-8,0))}else if(t.key===`Enter`)a&&(t.preventDefault(),a(f[p],f));else if(t.key===`Escape`)o&&o();else if(t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&e(t)!==`INPUT`&&e(t)!==`TEXTAREA`){t.preventDefault(),clearTimeout(u??void 0),l+=t.key.toLowerCase(),u=setTimeout(d,c);let e=f.findIndex(e=>e.textContent.trim().toLowerCase().startsWith(l));e>=0&&(i(e),s&&s(t.key,e,f))}},clearTypeahead:d,teardown:d}}function n(e,t){let n=e.querySelector(`.is-active`);n!==t&&(n?.classList.remove(`is-active`),t?.classList.add(`is-active`))}export{n,t};
|
package/dist/search-PZCXpBAn.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./devWarn-DXdRWZs3.js";import{i as t}from"./optionLabel-4xjXWy74.js";import{t as n}from"./customRule-Chp7YwFb.js";import{n as r}from"./WuiSelect-BPWPI07i.js";var i=(e,n)=>{let r=n.toLowerCase(),i=e.getAttribute(`value-label`);return i&&String(e.value??``)!==``&&i.toLowerCase()===r?!0:e.options.some(e=>t(e).toLowerCase()===r||String(e.value??``).toLowerCase()===r)};function a(){let t,a,o=0,s,c=null,l=null,u=``,d=null,f=!1,p=()=>r(t),m=()=>typeof t.loadOptions!=`function`&&!t.getAttribute(`source`),h=(e,n,r)=>{let i=t.getAttribute(e);if(i==null||i.trim()===``)return n;let a=Number(i);return r(a)?a:n},g=()=>h(`min-chars`,1,e=>Number.isInteger(e)&&e>=0),_=()=>h(`debounce`,250,e=>Number.isFinite(e)&&e>=0),v=()=>{c?.abort(),c=null};function y(e,n){if(typeof t.loadOptions==`function`)return t.loadOptions(e,{signal:n});let r=t.getAttribute(`source`);if(r===null)throw Error(`search source attribute missing`);let i=`${r}${r.includes(`?`)?`&`:`?`}q=${encodeURIComponent(e)}`;return fetch(i,{signal:n,credentials:`same-origin`,headers:{Accept:`application/json`}}).then(e=>{if(!e.ok)throw Error(`search request failed with status ${e.status}`);return e.json()})}function b(n,r,i){r?(e(`wui-select: search failed`,i),t.setPartOptions([]),t.setStatus(`empty`)):(t.setPartOptions(n),t.setStatus(n.length?`idle`:`empty`))}async function x(e,t,n){let r=[],i=!1,a=null;try{if(r=await y(e,n),!Array.isArray(r))throw TypeError(`search results must be an array`)}catch(e){i=!0,a=e??/* @__PURE__ */ Error(`search failed`)}finally{t===o&&(c=null,b(r,i,a))}}function S(e){let n=o;v(),m()?(f=!0,t.setStatus(`loading`)):(c=new AbortController,t.setStatus(`loading`),x(e,n,c.signal))}let C=(e,n)=>t.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:n}}));function w(e){o+=1,v(),clearTimeout(s),s=void 0,e.trim().length<g()?(t.setPartOptions([]),t.setStatus(`hint`)):(C(e,o),S(e))}return{mount(e,n,r={}){t=e,a=n;let i=a.search?.value??``;a.search&&r.carry?.query&&i===``&&(a.search.value=r.carry.query),i.trim()!==``&&t._onQueryChange(i)},onQuery(e){if(o+=1,v(),clearTimeout(s),s=void 0,u=e,d=null,f=!1,!p())return!1;if(e.trim().length<g())return t.setPartOptions([]),t.setStatus(`hint`),!0;let n=o;return s=setTimeout(()=>{s=void 0,C(e,n),S(e)},_()),!0},onOpen(){if(p()){if(d!==null){let e=d;d=null,w(e)}else g()===0&&t._query.trim()===``&&w(``)}},onOptions(){f&&(f=!1,t.setStatus(t.options.length?`idle`:`empty`))},onBlur(){if(t.mode!==`search`||!t.hasAttribute(`allow-custom`))return!1;let e=(a.search?.value??``).trim();if(!e||e===String(t.value)||i(t,e))return!1;let r=n(t,e);return r?(t.setError(r),!1):(t.commit(e,{isCustom:!0}),!0)},actionRow(e){if(l=null,t.mode===`tag`||!t.hasAttribute(`allow-custom`))return null;let n=e.trim();return!n||i(t,n)?null:(l={position:`bottom`,label:(t.getAttribute(`add-label`)??`Add '{query}'`).replaceAll(`{query}`,n),value:n},l)},onPick(e){if(!l||e.value!==l.value||e.label!==l.label)return!1;let n=l.value;return l=null,t.commit(n,{isCustom:!0}),!0},renderValue(){let e=t.value;if(!e||t.options.some(t=>String(t.value)===String(e)))return!1;let n=t.getAttribute(`value-label`);return n?(a.value.classList.remove(`wui-select-placeholder`),a.value.textContent=n,!0):!1},teardown(){(s!==void 0||c!==null||f)&&(d=u),f=!1,o+=1,clearTimeout(s),s=void 0,v(),l=null}}}export{a as default};
|