@simai-studio/ui 5.20261023.212 → 5.20261025.207
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/distr/component/button-group/css/button-group.min.css +1 -1
- package/distr/core/contracts/public-variables.v1.json +88 -0
- package/distr/core/contracts/third-party-notices.v1.json +1 -1
- package/distr/core/css/core.css +3 -2
- package/distr/core/js/composition/overlay.mjs +472 -24
- package/distr/core/js/composition/sortable-inserter.mjs +534 -0
- package/distr/core/js/core-loader.js +1 -1
- package/distr/core/js/core-loader.min.js +1 -1
- package/distr/core/js/core-rules.js +242 -185
- package/distr/core/js/core-rules.min.js +1 -1
- package/distr/core/js/open-surface-mark.js +88 -0
- package/distr/core/js/template-utilities.generated.json +3 -0
- package/distr/rule/js/rule.min.js +1 -1
- package/distr/rule/rule.json +47 -1
- package/distr/smart/color/css/color.min.css +1 -0
- package/distr/smart/color/js/color.min.js +36 -17
- package/distr/smart/color/smart.manifest.json +45 -4
- package/distr/smart/color/template/default.js +13 -2
- package/distr/smart/composition-overlay/css/composition-overlay.min.css +1 -1
- package/distr/smart/composition-overlay/js/composition-overlay.min.js +1 -1
- package/distr/smart/composition-overlay/smart.manifest.json +178 -11
- package/distr/smart/dropdown/css/dropdown.min.css +1 -0
- package/distr/smart/dropdown/js/dropdown.min.js +41 -21
- package/distr/smart/dropdown/smart.manifest.json +62 -3
- package/distr/smart/dropdown/template/default.js +5 -1
- package/distr/smart/field-renderers/js/field-renderers.min.js +54 -42
- package/distr/smart/image-field/css/image-field.min.css +1 -0
- package/distr/smart/image-field/js/image-field.min.js +62 -0
- package/distr/smart/image-field/smart.manifest.json +519 -0
- package/distr/smart/image-field/studio.fixture.json +15 -0
- package/distr/smart/image-field/studio.scenario.json +22 -0
- package/distr/smart/image-field/template/default.js +125 -0
- package/distr/smart/inputs/css/inputs.min.css +1 -0
- package/distr/smart/inputs/js/inputs.min.js +93 -75
- package/distr/smart/inputs/smart.manifest.json +62 -3
- package/distr/smart/inputs/template/default.js +8 -2
- package/distr/smart/sortable/css/sortable.min.css +1 -1
- package/distr/smart/sortable/js/sortable.min.js +1 -1
- package/distr/smart/sortable/smart.manifest.json +101 -14
- package/distr/smart/switch/css/switch.min.css +1 -0
- package/distr/smart/switch/js/switch.min.js +31 -13
- package/distr/smart/switch/smart.manifest.json +62 -3
- package/distr/smart/switch/template/default.js +2 -0
- package/distr/smart/textarea/css/textarea.min.css +1 -0
- package/distr/smart/textarea/js/textarea.min.js +51 -32
- package/distr/smart/textarea/smart.manifest.json +62 -3
- package/distr/smart/textarea/template/default.js +8 -1
- package/package-manifest.json +50 -39
- package/package.json +4 -4
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
(()=>{"use strict";var e={"3a03d4610486"(e,t,i){i.d(t,{Q:()=>o});let s=0;function n(e,t){if(!e.id){let i;do{i=`${t}-${++s}`}while(document.getElementById(i));e.id=i}return e.id}function o(e,t){let i=null,s=null,o=null,a=!1;const r=new WeakMap,l=(e,t,i)=>{const s=r.get(e)||{};void 0!==s[t]&&e.getAttribute(t)===s[t]&&e.removeAttribute(t),delete s[t],!e.hasAttribute(t)&&i&&(e.setAttribute(t,i),s[t]=i),r.set(e,s)},c=()=>e.querySelector(".sf-dropdown-field, .sf-dropdown-trigger"),d=()=>c()?.querySelector(":scope > button")||c(),u=()=>c()?.querySelector('input:not([type="hidden"])'),p=()=>t.getList()?.querySelector(".sf-input input"),h=()=>[...t.getList()?.querySelectorAll(".sf-list-item")||[]],f=()=>h().filter(e=>!e.hidden&&!e.classList.contains("disabled")&&"true"!==e.getAttribute("aria-disabled")&&"true"!==e.getAttribute("aria-hidden")),g=e=>e.querySelector(".sf-list-item-container, .sf-avatar-label-group-title, .sf-tag-container")?.textContent?.trim()||e.dataset.value||"",b=e=>{e&&!e.disabled&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}))},m=()=>{s="trigger",b(d()),t.close(),x()},v=e=>{if(t.isDisabled()||e.altKey||e.ctrlKey||e.metaKey)return;const i=e.target,n=i.closest?.(".sf-list-item"),o=t.getList()?.contains(i),a=i===d()||i===u()||i===c();let r=!1;if("Escape"===e.key&&t.isOpen())m(),r=!0;else{if("Tab"===e.key&&t.isOpen())return o&&b(d()),t.close(),void x();if(a&&["ArrowDown","ArrowUp","Enter"," "].includes(e.key))t.isOpen()&&["Enter"," "].includes(e.key)?m():(e=>{s=e,t.open(),x()})("ArrowUp"===e.key?"last":"search"),r=!0;else if(o&&["ArrowDown","ArrowUp"].includes(e.key)){const t=f(),i=t.indexOf(n),s=i<0?"ArrowUp"===e.key?t.length-1:0:Math.max(0,Math.min(t.length-1,i+("ArrowUp"===e.key?-1:1)));b(t[s]),r=!0}else if(n&&o&&["Home","End"].includes(e.key)){const t=f();b("Home"===e.key?t[0]:t.at(-1)),r=!0}else n&&o&&["Enter"," "].includes(e.key)&&(f().includes(n)&&(s=t.isMultiple()?{value:n.dataset.value}:"trigger",t.select(n),x()),r=!0)}r&&(e.preventDefault(),e.stopImmediatePropagation())},y=()=>{null!==o&&cancelAnimationFrame(o),o=requestAnimationFrame(()=>{var i;o=null,a||!t.isOpen()||s||(i=document.activeElement)&&(e.contains(i)||t.getList()?.contains(i))||(t.close(),x())})};let w=document.createElement("span");w.className="sf-dropdown-value",e.append(w),n(w,"sf-dropdown-value");const x=()=>{if(a)return;const o=t.getList();i!==o&&(i?.removeEventListener("keydown",v,!0),i?.removeEventListener("focusout",y),i=o,i?.addEventListener("keydown",v,!0),i?.addEventListener("focusout",y));const m=d(),x=i?.querySelector(".sf-list-container");if(!m||!x)return;w.isConnected||e.append(w);const $=e.querySelector(".sf-dropdown-label .sf-dropdown-text"),S=t.owner||e,_=$?.textContent.trim()?n($,"sf-dropdown-label"):"",A=S.getAttribute("aria-label")||e.getAttribute("aria-label"),k=S.getAttribute("aria-labelledby")||e.getAttribute("aria-labelledby"),C=n(m,"sf-dropdown-trigger"),L=m.hasAttribute("aria-label")&&r.get(m)?.["aria-label"]!==m.getAttribute("aria-label");l(m,"aria-labelledby",k||(!A&&_?L?`${C} ${_}`:_:"")),l(m,"aria-label",A),"BUTTON"!==m.tagName&&m.setAttribute("role","button"),m.tabIndex=t.isDisabled()?-1:0,m.setAttribute("aria-expanded",String(t.isOpen())),m.setAttribute("aria-haspopup","listbox"),m.setAttribute("aria-controls",n(x,"sf-dropdown-listbox")),m.querySelectorAll(".sf-icon").forEach(e=>e.setAttribute("aria-hidden","true")),c()!==m&&(c().tabIndex=-1),u()&&(u().tabIndex=-1),x.setAttribute("role","listbox"),x.setAttribute("aria-multiselectable",String(t.isMultiple())),l(x,"aria-labelledby",k||_||C);const z=p();z&&(z.setAttribute("role","searchbox"),z.setAttribute("aria-controls",x.id),l(z,"aria-labelledby",z.hasAttribute("aria-label")?"":k||_||C)),h().forEach(e=>{e.setAttribute("role","option"),e.tabIndex=-1,e.setAttribute("aria-selected",String(e.classList.contains("selected"))),l(e,"aria-disabled",e.classList.contains("disabled")?"true":""),function(e,t){const i=e.querySelector('.sf-checkbox input[type="checkbox"]');if(!i)return;const s=e.querySelector(".sf-checkbox-box sf-icon, .sf-checkbox-box .sf-icon"),n="sf-icon"===s?.tagName?.toLowerCase()?s.getAttribute("icon")||"":s?.textContent;(i.checked!==t||i.indeterminate||s&&n!==(t?"check":""))&&(i.checked=t,i.indeterminate=!1,globalThis.SF?.Checkbox?.setState?.(i,{checked:t,indeterminate:!1}))}(e,e.classList.contains("selected")),e.querySelectorAll(".sf-checkbox").forEach(e=>{"true"!==e.getAttribute("aria-hidden")&&e.setAttribute("aria-hidden","true")}),e.querySelectorAll(".sf-icon, sf-icon").forEach(e=>{"true"!==e.getAttribute("aria-hidden")&&e.setAttribute("aria-hidden","true")}),e.querySelectorAll("input, button, a[href], [tabindex]").forEach(e=>{e.tabIndex=-1})});const T=t.selectedLabels?.()||h().filter(e=>e.classList.contains("selected")).map(g);w.textContent=T.join(", ")||u()?.value||u()?.placeholder||"";const E=new Set((m.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean));E.add(w.id),m.setAttribute("aria-describedby",[...E].join(" ")),(()=>{if(!s)return;if("trigger"===s)return s=null,void b(d());if(!t.isOpen()||t.getList()?.hidden)return;const e=f(),i="search"===s?p()||e[0]||d():"last"===s?e.at(-1):"object"==typeof s?e.find(e=>e.dataset.value===s.value):e[0];s=null,b(i)})()};return e.addEventListener("keydown",v,!0),e.addEventListener("focusout",y),x(),{refresh:x,beforeClose:()=>{t.getList()?.contains(document.activeElement)&&(s="trigger")},release(){a=!0,null!==o&&cancelAnimationFrame(o),e.removeEventListener("keydown",v,!0),e.removeEventListener("focusout",y),i?.removeEventListener("keydown",v,!0),i?.removeEventListener("focusout",y);const t=d();if(t){const e=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(e=>e&&e!==w.id);e.length?t.setAttribute("aria-describedby",e.join(" ")):t.removeAttribute("aria-describedby")}w.remove()}}}},a0f23dca0b37(e,t,i){i.a(e,async(e,s)=>{try{i.d(t,{AL:()=>g,GD:()=>f});var n=i("5c1dc214bb5e"),o=e([n]);n=(o.then?(await o)():o)[0];var a=i.n(n);const r=()=>globalThis.SF?.Position||a(),l=new WeakMap,c=["position","inset","margin","width","max-width","max-height","overflow","left","top","right","bottom","z-index"],d=["font-family","font-size","font-weight","font-style","font-stretch","font-variant","font-feature-settings","font-variation-settings","font-optical-sizing","font-kerning","line-height","letter-spacing","word-spacing","text-transform","text-indent","white-space","word-break","overflow-wrap","text-rendering","direction","writing-mode","text-orientation","color","color-scheme","text-align"];function u(e,t){if(!t.context)return;const i=t.context,s=getComputedStyle(e),n=["sf-dropdown",...Array.from(e.classList).filter(e=>e.startsWith("sf-dropdown--")&&!["sf-dropdown--open","sf-dropdown--drop-up","sf-dropdown--drop-down"].includes(e))].join(" ");i.className!==n&&(i.className=n);const o=[...Array.from(s).filter(e=>e.startsWith("--sf-")),...d],a=new Set(o);for(const e of t.contextProperties||[])a.has(e)||i.style.removeProperty(e);for(const e of o){const t=s.getPropertyValue(e);i.style.getPropertyValue(e)!==t&&i.style.setProperty(e,t)}t.contextProperties=o}function p(e){return e?.querySelector(".sf-dropdown-field, .sf-dropdown-trigger")??null}function h(e,t){const i=l.get(t);if(!i||!e.isConnected||t.hidden)return!1;const s=p(e);return!!s&&(e.closest('[hidden], [inert], [aria-hidden="true"], dialog:not([open])')||!s.getClientRects().length||["hidden","collapse"].includes(getComputedStyle(s).visibility)?(i.onUnavailable?.(),!1):(u(e,i),i.wrap&&(i.wrap.style.minHeight="0",i.wrap.style.overflowY="auto"),i.anchor||(i.anchor=r().anchor(s,t,{side:"block-end",align:"start",matchWidth:s.classList.contains("sf-dropdown-field"),fitHeight:!0,autoUpdate:!1,onPosition:({side:i})=>{const s="block-start"===i;t.dataset.placement=e.dataset.placement=s?"top":"bottom",e.classList.toggle("sf-dropdown--drop-up",s),e.classList.toggle("sf-dropdown--drop-down",!s)}})),i.anchor.update(),!0))}function f(e,t,i){if(!t?.isConnected||!p(e))return!1;const s=t.contains(document.activeElement)?document.activeElement:null;if(!l.has(t)){const s=c.map(e=>[e,t.style.getPropertyValue(e),t.style.getPropertyPriority(e)]),n={root:e,saved:s,onUnavailable:i,popover:t.getAttribute("popover"),frame:0,native:"function"==typeof t.showPopover};if(n.wrap=t.querySelector(".sf-list-container-wrap"),n.wrapStyles=n.wrap?["min-height","overflow-y"].map(e=>[e,n.wrap.style.getPropertyValue(e),n.wrap.style.getPropertyPriority(e)]):[],n.schedule=()=>{n.frame||(n.frame=requestAnimationFrame(()=>{n.frame=0,h(e,t)}))},l.set(t,n),e.__sfDropdownPortalList=t,n.native)t.setAttribute("popover","manual");else{n.parent=t.parentNode,n.next=t.nextSibling,n.context=document.createElement("div"),n.context.style.cssText="display:contents;position:static",u(e,n);(e.closest('dialog[open], [role="dialog"][aria-modal="true"]')||document.body).append(n.context),n.context.append(t),t.style.zIndex="var(--sf-z-index-9)"}n.inheritance=new MutationObserver(n.schedule);for(let t=e;t;t=t.parentElement)n.inheritance.observe(t,{attributes:!0,attributeFilter:["class","style","dir","hidden","inert","aria-hidden","open"]});Object.assign(t.style,{position:"fixed",inset:"auto",margin:"0",overflow:n.wrap?"hidden":"auto"}),"function"==typeof ResizeObserver&&(n.resize=new ResizeObserver(n.schedule),n.resize.observe(p(e)),n.resize.observe(t)),window.visualViewport?.addEventListener("resize",n.schedule),window.visualViewport?.addEventListener("scroll",n.schedule)}return t.hidden=!1,l.get(t).native&&!t.matches(":popover-open")&&t.showPopover(),!!h(e,t)&&(s&&document.activeElement!==s&&s.focus({preventScroll:!0}),!0)}function g(e){const t=l.get(e);if(!t)return!1;const i=e.contains(document.activeElement)?document.activeElement:null;t.anchor?.stop(),t.resize?.disconnect(),cancelAnimationFrame(t.frame),t.inheritance?.disconnect(),window.visualViewport?.removeEventListener("resize",t.schedule),window.visualViewport?.removeEventListener("scroll",t.schedule),t.native?(e.matches(":popover-open")&&e.hidePopover(),null===t.popover?e.removeAttribute("popover"):e.setAttribute("popover",t.popover)):(t.next?.parentNode===t.parent?t.parent.insertBefore(e,t.next):t.parent.append(e),t.context.remove());for(const[i,s,n]of t.saved)s?e.style.setProperty(i,s,n):e.style.removeProperty(i);for(const[e,i,s]of t.wrapStyles)i?t.wrap.style.setProperty(e,i,s):t.wrap.style.removeProperty(e);return delete e.dataset.placement,delete t.root.dataset.placement,t.root.classList.remove("sf-dropdown--drop-up","sf-dropdown--drop-down"),t.root.__sfDropdownPortalList===e&&delete t.root.__sfDropdownPortalList,l.delete(e),i&&!e.hidden&&t.root.isConnected&&document.activeElement!==i&&i.focus({preventScroll:!0}),!0}s()}catch(b){s(b)}})},"98e26702f55a"(e,t,i){function s(){const e=globalThis.SF=globalThis.SF||{};return e.__deprecationNotes instanceof Map||Object.defineProperty(e,"__deprecationNotes",{value:new Map,configurable:!0}),e.__deprecationNotes}function n({component:e="",kind:t="attribute",attribute:i="",from:n,to:o=null}={}){if(!n)return;const a=[e,t,i,n].join("|"),r=s(),l=r.get(a);if(l)l.count+=1;else if(r.set(a,{component:e,kind:t,attribute:i,from:n,to:o,count:1}),function(){const e=globalThis.document?.documentElement;return"warn"===e?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const s=e?`${e}: `:"",a="value"===t?`${i}="${n}"`:`${t} ${n}`;globalThis.console?.warn?.(`[SIMAI Framework] ${s}${a} is a legacy name${o?`; write ${o}`:""}. See contracts/changes/journal.json.`)}}if(i.d(t,{id:()=>c,kA:()=>l}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const e=globalThis.SF.deprecations||{};e.list=function(){return[...s().values()].map(e=>({...e}))},e.clear=function(){s().clear()},e.note=n,globalThis.SF.deprecations=e}const o=Object.freeze(["1/2","1","2"]),a=Object.freeze({"1/3":"1/2",3:"2"}),r=new Set;function l(e){const t=String(e??"").trim().toLowerCase();return o.includes(t)?t:Object.hasOwn(a,t)?a[t]:"1"}function c(e,t="field",i="1"){const s=String(e??"").trim().toLowerCase();if(o.includes(s))return s;if(Object.hasOwn(a,s)){const e=a[s];n({component:t,kind:"value",attribute:"size",from:s,to:e});const i=`${t}:${s}`;return r.has(i)||"undefined"==typeof console||(r.add(i),console.warn(`[SIMAI Framework] ${t}: size ${s} is retired for form fields; rendering size ${e}.`)),e}return i}},"67eed2647f47"(e,t,i){i.d(t,{z:()=>o});const s=new WeakMap,n=new WeakSet;function o(e,t){const i=e.ownerDocument;n.has(i)||(i.addEventListener("reset",e=>{const t=e.target;if("FORM"!==t?.tagName)return;const i=Array.from(t.elements);setTimeout(()=>{if(!e.defaultPrevented)for(const e of i)if(e.isConnected&&e.form===t)for(const t of s.get(e)||[])t()},0)},!0),n.add(i));let o=s.get(e);return o||s.set(e,o=new Set),o.add(t),()=>o.delete(t)}},"421676f72963"(e,t,i){i.d(t,{Ec:()=>r});const s="sfPopoverOpen",n=new WeakSet,o=Symbol.for("sf.openSurfaceLayers");function a(){const e=globalThis;return Array.isArray(e[o])||(e[o]=[]),e[o]}function r(e,t){if(!e)return;const i=Boolean(t);if(i===n.has(e))return;const o=a();if(i)n.add(e),o.push(e);else{n.delete(e);const t=o.lastIndexOf(e);t>=0&&o.splice(t,1)}!function(e){const t=globalThis.document?.documentElement;if(!t)return;const i=Math.max(0,Number(t.dataset[s]||0)+e);i?t.dataset[s]=String(i):delete t.dataset[s]}(i?1:-1)}},"50a1017ded91"(e,t,i){i.a(e,async(e,t)=>{try{var s=i("fbe0570fcc69"),n=i("0d662e4d7d63"),o=i("98e26702f55a"),a=i("5429d6e80991"),r=i("3a03d4610486"),l=i("67eed2647f47"),c=i("a0f23dca0b37"),d=i("421676f72963"),u=e([s,n,a,c]);[s,n,a,c]=u.then?(await u)():u;var p=i.n(s);const h={en:{search:"Search"},ru:{search:"Поиск"}};function f(e){return(0,o.id)(e,"sf-dropdown")}function g(e){const t=String(e||"").toLowerCase();return["text","icon","checkbox","avatar","color"].includes(t)?t:"text"}function b(e,t="1"){return e instanceof HTMLElement?"sf-list-item"!==e.tagName.toLowerCase()?null:{type:g(e.getAttribute("kind")||e.getAttribute("type")),size:f(e.getAttribute("size")||t),text:e.getAttribute("text")||"",icon:e.getAttribute("icon")||"person",checked:e.hasAttribute("checked")||(0,s.toBoolean)(e.getAttribute("checked")),selected:e.hasAttribute("selected")||(0,s.toBoolean)(e.getAttribute("selected")),disabled:e.hasAttribute("disabled")||(0,s.toBoolean)(e.getAttribute("disabled")),colorClass:e.getAttribute("color-class")||"bg-tertiary",avatarImageUrl:e.getAttribute("avatar-image-url")||"",avatarTitle:e.getAttribute("avatar-title")||e.getAttribute("text")||"",value:e.getAttribute("value")??e.getAttribute("text")??"",ariaLabel:e.getAttribute("aria-label")||"",group:e.getAttribute("group")||""}:null}function m(e,t="1"){if(!e||"object"!=typeof e)return null;const i=void 0===e.text||null===e.text?"":String(e.text),n=void 0===e.value||null===e.value?i:String(e.value);return""===i&&""===n?null:{type:g(e.kind||e.type),size:f(e.size||t),text:i,icon:e.icon?String(e.icon):"person",checked:(0,s.toBoolean)(e.checked),selected:(0,s.toBoolean)(e.selected),disabled:(0,s.toBoolean)(e.disabled),colorClass:e.colorClass?String(e.colorClass):"bg-tertiary",avatarImageUrl:e.avatarImageUrl?String(e.avatarImageUrl):"",avatarTitle:e.avatarTitle?String(e.avatarTitle):i,value:n,ariaLabel:e.ariaLabel?String(e.ariaLabel):"",group:e.group?String(e.group):""}}function v(e,t="1"){let i=e;if("string"==typeof i){const e=i.trim();if(""===e)return[];try{i=JSON.parse(e)}catch{return[]}}return Array.isArray(i)?i.map(e=>m("string"==typeof e||"number"==typeof e?{text:String(e),value:String(e)}:e,t)).filter(Boolean):[]}function y(e=""){return String(e||"").split(",").map(e=>e.trim()).filter(Boolean)}function w(e=[]){return e.map(e=>String(e)).join(",")}function x(e={}){return"avatar"===e.type?e.avatarTitle||e.text||e.value||"":e.text||e.avatarTitle||e.value||""}class $ extends(p()){constructor(){super(),this._options=[],this._optionsCaptured=!1,this._optionsFromData=!1,this._open=!1,this._searchValue="",this._selectedValues=[],this._dropdownRoot=null,this._list=null,this._documentClickHandler=this.handleDocumentClick.bind(this),this._viewportHandler=this.positionPortalList.bind(this)}static get props(){return{templateName:{attribute:"template",default:"default"},size:{default:"1"},appearance:{default:"outlined",values:["filled","outlined"],aliases:["type"]},mode:{default:"select",values:["tag","select"]},multiple:{type:Boolean,default:!1},portal:{type:Boolean,default:!0},value:{default:""},name:{default:""},label:{default:""},required:{type:Boolean,default:!1},placeholder:{default:""},searchPlaceholder:{default:""},search:{type:Boolean,default:!0},layout:{default:"list",values:["list","grid"]},columns:{default:"6"},disabled:{type:Boolean,default:!1},ariaLabel:{default:""}}}connectedCallback(){this.captureOptions(),Object.prototype.hasOwnProperty.call(this,"_resetValues")||(this._resetValues=[...this.selectedValues]),super.connectedCallback()}attributeChangedCallback(e,t,i){t!==i&&("value"===e&&(this._selectedValues=y(i)),"disabled"===e&&this.disabled&&(this._open=!1,this._searchValue="")),super.attributeChangedCallback(e,t,i)}get componentName(){return"dropdown"}get templateName(){return this.getAttribute("template")||"default"}get size(){return f(this.getAttribute("size"))}get appearance(){return this.getProp("appearance")}get type(){return this.appearance}get mode(){return this.getEnumAttr("mode",["tag","select"],"select")}get multiple(){return this.hasAttribute("multiple")?this.getBooleanAttr("multiple",!0):"tag"===this.mode}get portal(){return this.getBooleanAttr("portal",!0)}get name(){return this.getAttribute("name")||""}get selectedValue(){return this.getAttribute("value")||""}get label(){return this.getAttribute("label")||""}get required(){return this.getBooleanAttr("required",!1)}get placeholder(){return this.getAttribute("placeholder")||""}get searchPlaceholder(){return this.getAttribute("search-placeholder")||(0,n.pageText)(h,"search",this)}get layout(){return this.getEnumAttr("layout",["list","grid"],"list")}get columns(){const e=Number.parseInt(this.getAttribute("columns")??"",10);return Number.isFinite(e)&&e>0?String(e):"6"}get search(){return this.getBooleanAttr("search",!0)}get disabled(){return this.getBooleanAttr("disabled",!1)}get ariaLabel(){return this.getAttribute("aria-label")||""}get selectedValues(){return this.hasAttribute("value")?y(this.selectedValue):this._selectedValues}get selectedOptions(){const e=this.options;return[...new Set(this.selectedValues)].map(t=>e.find(e=>String(e.value)===t)).filter(Boolean)}get triggerText(){if("tag"===this.mode)return"";return(this.multiple?this.selectedOptions:this.selectedOptions.slice(0,1)).map(x).join(", ")}get hiddenValue(){return this.selectedValues.join(",")}captureOptions(){if(this._optionsFromData)return;const e=Array.from(this.children).filter(e=>e instanceof HTMLElement&&"sf-list-item"===e.tagName.toLowerCase());e.length&&(this._options=e.map(e=>b(e,this.size)).filter(Boolean),this._optionsCaptured=!0,this.selectedValue||this._selectedValues.length||(this._selectedValues=this._options.filter(e=>e.selected).map(e=>String(e.value))),e.forEach(e=>e.remove()))}set options(e){const t=v(e,this.size);this._optionsFromData=!0,this._options=t,this._optionsCaptured=!0,this.selectedValue||this._selectedValues.length||(this._selectedValues=t.filter(e=>e.selected).map(e=>String(e.value))),this.requestComponentUpdate("options")}get options(){if(!Array.isArray(this._options)||!this._options.length)return[];const e=new Set(this.selectedValues);return this._options.map(t=>({...t,size:f(t.size||this.size),selected:e.has(String(t.value))}))}get visibleOptions(){const e=String(this._searchValue||"").trim().toLowerCase();return e?this.options.filter(t=>x(t).toLowerCase().includes(e)):this.options}templateContext(){const e=this.getPropsContext();return this.createTemplateContext({...e,component:this,open:this._open,multiple:this.multiple,value:this.hiddenValue,triggerText:this.triggerText,searchValue:this._searchValue,searchPlaceholder:this.searchPlaceholder,selectedValues:this.selectedValues,selectedOptions:this.selectedOptions,options:this.visibleOptions})}template(){return(0,a.g)(this.templateContext())}beforeRender(){this.captureOptions()}afterRender(){const e=this._dropdownRoot,t=this._list;this._dropdownRoot=this.querySelector(".sf-dropdown"),this._list=this.querySelector(".sf-list")||(e===this._dropdownRoot?t:null),t!==this._list&&(0,c.AL)(t),this.syncDocumentListeners(),this.syncPortalListeners(),this.syncOpenSurfaceMark(),this.positionPortalList(),e!==this._dropdownRoot&&(this._interaction?.release(),this._interaction=null),this._dropdownRoot&&!this._interaction&&(this._interaction=(0,r.Q)(this._dropdownRoot,{owner:this,getList:()=>this._list,isOpen:()=>this._open,isDisabled:()=>this.disabled,isMultiple:()=>this.multiple,open:()=>this.openDropdown(),close:()=>this.closeDropdown(),select:e=>this.selectValue(e.dataset.value||""),selectedLabels:()=>this.selectedOptions.map(x)})),this._interaction?.refresh();const i=this.querySelector(".sf-dropdown-hidden-input")||this.querySelector(".sf-dropdown-field > button");this._resetControl!==i&&(this._releaseReset?.(),this._resetControl=i,this._releaseReset=i?(0,l.z)(i,()=>{this._interaction?.beforeClose(),this._selectedValues=[...this._resetValues],this.setAttributeValue("value",w(this._selectedValues)),this._open=!1,this._searchValue="";const e=this.querySelector('.sf-dropdown-field input:not([type="hidden"])');e&&(e.value=this.triggerText),this.requestComponentUpdate("reset")}):null)}onDisconnected(){(0,d.Ec)(this,!1),(0,c.AL)(this._list),this._releaseReset?.(),this._releaseReset=null,this._resetControl=null,this._interaction?.release(),this._interaction=null,this.removeDocumentListeners(),this.removePortalListeners(),super.onDisconnected()}openDropdown(){return this.disabled||this._open||(this._open=!0,this.requestComponentUpdate("open")),this}closeDropdown(){return this._open?(this._interaction?.beforeClose(),this._open=!1,this._searchValue="",this.requestComponentUpdate("close"),this):this}toggleDropdown(){return this._open?this.closeDropdown():this.openDropdown()}handleTriggerClick(e){this.disabled||(e?.preventDefault?.(),this.toggleDropdown())}handleSearchInput(e){this._searchValue=e?.target?.value||"",this.requestComponentUpdate("search")}handleOptionClick(e){if(this.disabled)return;const t=e.target?.closest?.(".sf-list-item");t&&(this.contains(t)||this._list?.contains(t))&&!t.classList.contains("disabled")&&(e.preventDefault(),this.selectValue(t.dataset.value||""))}handleOptionKeydown(e){"Enter"!==e.key&&" "!==e.key||this.handleOptionClick(e)}handleDocumentClick(e){!this._open||this.contains(e.target)||this._list?.contains(e.target)||this.closeDropdown()}selectValue(e=""){if(this.disabled)return this;const t=this.options.find(t=>String(t.value)===String(e));if(!t||t.disabled)return this;const i=!this.multiple&&1===this.selectedValues.length&&this.selectedValues[0]===String(t.value);if(this.multiple){const e=new Set(this.selectedValues);e.has(String(t.value))?e.delete(String(t.value)):e.add(String(t.value)),this._selectedValues=Array.from(e)}else this._selectedValues=[String(t.value)];const s=[...this._selectedValues];return this.setAttributeValue("value",w(s)),i||this.dispatchDropdownChange(t,s),this.multiple||(this._interaction?.beforeClose(),this._open=!1,this._searchValue=""),this.requestComponentUpdate("select"),this}removeSelectedValue(e=""){if(this.disabled)return this;const t=new Set(this.selectedValues);t.delete(String(e)),this._selectedValues=Array.from(t);const i=[...this._selectedValues];return this.setAttributeValue("value",w(i)),this.dispatchDropdownChange(null,i),this.requestComponentUpdate("remove-tag"),this}dispatchDropdownChange(e=null,t=this.selectedValues){const i={value:e?.value||"",label:e?x(e):"",values:t,item:e,root:this,multiple:this.multiple};this.dispatchEvent(new CustomEvent("sf-dropdown:change",{bubbles:!0,composed:!0,detail:i})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:i}))}syncOpenSurfaceMark(){(0,d.Ec)(this,this._open)}syncDocumentListeners(){this._open?document.addEventListener("click",this._documentClickHandler):this.removeDocumentListeners()}removeDocumentListeners(){document.removeEventListener("click",this._documentClickHandler)}syncPortalListeners(){if(this._open&&this.portal)return window.addEventListener("resize",this._viewportHandler),void document.addEventListener("scroll",this._viewportHandler,!0);this.removePortalListeners()}removePortalListeners(){window.removeEventListener("resize",this._viewportHandler),document.removeEventListener("scroll",this._viewportHandler,!0)}positionPortalList(){this._list&&this._dropdownRoot&&this.portal&&this._open?(0,c.GD)(this._dropdownRoot,this._list,()=>this.closeDropdown()):(0,c.AL)(this._list)}get value(){return this.hiddenValue}set value(e){if(e&&"object"==typeof e&&!Array.isArray(e))return void this.setValueAttributes(e);const t=Array.isArray(e)?e.map(String):y(null==e?"":String(e));this.setAttributeValue("value",w(t))}}$.define("sf-dropdown"),t()}catch(S){t(S)}})},"5429d6e80991"(e,t,i){i.a(e,async(e,s)=>{try{i.d(t,{g:()=>h});var n=i("ddf1cdb42ecc"),o=i("c22590307c6c"),a=e([n,o]);[n,o]=a.then?(await a)():a;function r(e={}){return"avatar"===e.type?e.avatarTitle||e.text||e.value||"":e.text||e.avatarTitle||e.value||""}function l(e=[],t=!1){const i=[];let s=null;for(const n of e){const e=n.group?String(n.group):"";e!==s&&(s=e,e&&i.push((0,o.aU)(e,n.size)));const a=t&&(!n.type||"text"===n.type);i.push((0,o.lN)(a?{...n,type:"checkbox"}:n))}return i}const c=Object.freeze({"1/2":{size:"1/3",spacing:""},1:{size:"1",spacing:"compact"},2:{size:"2",spacing:"compact"}});function d(e){if(e.multiple||1!==e.selectedOptions?.length)return n.nothing;const t=e.selectedOptions[0];return"icon"===t.type&&t.icon?n.html`<i class="sf-icon sf-dropdown-field-visual" aria-hidden="true">${t.icon}</i>`:"color"===t.type&&t.colorClass?n.html`<span class="sf-tag-color-icon sf-dropdown-field-visual ${t.colorClass}" aria-hidden="true"></span>`:"avatar"===t.type&&t.avatarImageUrl?n.html`<span class="sf-avatar sf-avatar--size-1/2 bg-cover sf-dropdown-field-visual" aria-hidden="true" style=${`background-image: url(${t.avatarImageUrl});`}></span>`:n.nothing}function u(e,t){const i=r(t),s=c[e.size]||c[1],o=s.size,a=s.spacing?` spacing-${s.spacing}`:"",l="color"===t.type?"color":"avatar"===t.type?"avatar":"icon";return n.html`
|
|
1
|
+
(()=>{"use strict";var e={"3a03d4610486"(e,t,i){i.d(t,{Q:()=>r});let s=0;function n(e,t){if(!e.id){let i;do{i=`${t}-${++s}`}while(document.getElementById(i));e.id=i}return e.id}function r(e,t){let i=null,s=null,r=null,a=!1;const o=new WeakMap,l=(e,t,i)=>{const s=o.get(e)||{};void 0!==s[t]&&e.getAttribute(t)===s[t]&&e.removeAttribute(t),delete s[t],!e.hasAttribute(t)&&i&&(e.setAttribute(t,i),s[t]=i),o.set(e,s)},d=()=>e.querySelector(".sf-dropdown-field, .sf-dropdown-trigger"),c=()=>d()?.querySelector(":scope > button")||d(),u=()=>d()?.querySelector('input:not([type="hidden"])'),h=()=>t.getList()?.querySelector(".sf-input input"),p=()=>[...t.getList()?.querySelectorAll(".sf-list-item")||[]],f=()=>p().filter(e=>!e.hidden&&!e.classList.contains("disabled")&&"true"!==e.getAttribute("aria-disabled")&&"true"!==e.getAttribute("aria-hidden")),b=e=>e.querySelector(".sf-list-item-container, .sf-avatar-label-group-title, .sf-tag-container")?.textContent?.trim()||e.dataset.value||"",g=e=>{e&&!e.disabled&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}))},m=()=>{s="trigger",g(c()),t.close(),x()},v=e=>{if(t.isDisabled()||e.altKey||e.ctrlKey||e.metaKey)return;const i=e.target,n=i.closest?.(".sf-list-item"),r=t.getList()?.contains(i),a=i===c()||i===u()||i===d();let o=!1;if("Escape"===e.key&&t.isOpen())m(),o=!0;else{if("Tab"===e.key&&t.isOpen())return r&&g(c()),t.close(),void x();if(a&&["ArrowDown","ArrowUp","Enter"," "].includes(e.key))t.isOpen()&&["Enter"," "].includes(e.key)?m():(e=>{s=e,t.open(),x()})("ArrowUp"===e.key?"last":"search"),o=!0;else if(r&&["ArrowDown","ArrowUp"].includes(e.key)){const t=f(),i=t.indexOf(n),s=i<0?"ArrowUp"===e.key?t.length-1:0:Math.max(0,Math.min(t.length-1,i+("ArrowUp"===e.key?-1:1)));g(t[s]),o=!0}else if(n&&r&&["Home","End"].includes(e.key)){const t=f();g("Home"===e.key?t[0]:t.at(-1)),o=!0}else n&&r&&["Enter"," "].includes(e.key)&&(f().includes(n)&&(s=t.isMultiple()?{value:n.dataset.value}:"trigger",t.select(n),x()),o=!0)}o&&(e.preventDefault(),e.stopImmediatePropagation())},y=()=>{null!==r&&cancelAnimationFrame(r),r=requestAnimationFrame(()=>{var i;r=null,a||!t.isOpen()||s||(i=document.activeElement)&&(e.contains(i)||t.getList()?.contains(i))||(t.close(),x())})};let w=document.createElement("span");w.className="sf-dropdown-value",e.append(w),n(w,"sf-dropdown-value");const x=()=>{if(a)return;const r=t.getList();i!==r&&(i?.removeEventListener("keydown",v,!0),i?.removeEventListener("focusout",y),i=r,i?.addEventListener("keydown",v,!0),i?.addEventListener("focusout",y));const m=c(),x=i?.querySelector(".sf-list-container");if(!m||!x)return;w.isConnected||e.append(w);const S=e.querySelector(".sf-dropdown-label .sf-dropdown-text"),$=t.owner||e,_=S?.textContent.trim()?n(S,"sf-dropdown-label"):"",A=$.getAttribute("aria-label")||e.getAttribute("aria-label"),k=$.getAttribute("aria-labelledby")||e.getAttribute("aria-labelledby"),V=n(m,"sf-dropdown-trigger"),C=m.hasAttribute("aria-label")&&o.get(m)?.["aria-label"]!==m.getAttribute("aria-label");l(m,"aria-labelledby",k||(!A&&_?C?`${V} ${_}`:_:"")),l(m,"aria-label",A),"BUTTON"!==m.tagName&&m.setAttribute("role","button"),m.tabIndex=t.isDisabled()?-1:0,m.setAttribute("aria-expanded",String(t.isOpen())),m.setAttribute("aria-haspopup","listbox"),m.setAttribute("aria-controls",n(x,"sf-dropdown-listbox")),m.querySelectorAll(".sf-icon").forEach(e=>e.setAttribute("aria-hidden","true")),d()!==m&&(d().tabIndex=-1),u()&&(u().tabIndex=-1),x.setAttribute("role","listbox"),x.setAttribute("aria-multiselectable",String(t.isMultiple())),l(x,"aria-labelledby",k||_||V);const L=h();L&&(L.setAttribute("role","searchbox"),L.setAttribute("aria-controls",x.id),l(L,"aria-labelledby",L.hasAttribute("aria-label")?"":k||_||V)),p().forEach(e=>{e.setAttribute("role","option"),e.tabIndex=-1,e.setAttribute("aria-selected",String(e.classList.contains("selected"))),l(e,"aria-disabled",e.classList.contains("disabled")?"true":""),function(e,t){const i=e.querySelector('.sf-checkbox input[type="checkbox"]');if(!i)return;const s=e.querySelector(".sf-checkbox-box sf-icon, .sf-checkbox-box .sf-icon"),n="sf-icon"===s?.tagName?.toLowerCase()?s.getAttribute("icon")||"":s?.textContent;(i.checked!==t||i.indeterminate||s&&n!==(t?"check":""))&&(i.checked=t,i.indeterminate=!1,globalThis.SF?.Checkbox?.setState?.(i,{checked:t,indeterminate:!1}))}(e,e.classList.contains("selected")),e.querySelectorAll(".sf-checkbox").forEach(e=>{"true"!==e.getAttribute("aria-hidden")&&e.setAttribute("aria-hidden","true")}),e.querySelectorAll(".sf-icon, sf-icon").forEach(e=>{"true"!==e.getAttribute("aria-hidden")&&e.setAttribute("aria-hidden","true")}),e.querySelectorAll("input, button, a[href], [tabindex]").forEach(e=>{e.tabIndex=-1})});const z=t.selectedLabels?.()||p().filter(e=>e.classList.contains("selected")).map(b);w.textContent=z.join(", ")||u()?.value||u()?.placeholder||"";const T=new Set((m.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean));T.add(w.id),m.setAttribute("aria-describedby",[...T].join(" ")),(()=>{if(!s)return;if("trigger"===s)return s=null,void g(c());if(!t.isOpen()||t.getList()?.hidden)return;const e=f(),i="search"===s?h()||e[0]||c():"last"===s?e.at(-1):"object"==typeof s?e.find(e=>e.dataset.value===s.value):e[0];s=null,g(i)})()};return e.addEventListener("keydown",v,!0),e.addEventListener("focusout",y),x(),{refresh:x,beforeClose:()=>{t.getList()?.contains(document.activeElement)&&(s="trigger")},release(){a=!0,null!==r&&cancelAnimationFrame(r),e.removeEventListener("keydown",v,!0),e.removeEventListener("focusout",y),i?.removeEventListener("keydown",v,!0),i?.removeEventListener("focusout",y);const t=c();if(t){const e=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(e=>e&&e!==w.id);e.length?t.setAttribute("aria-describedby",e.join(" ")):t.removeAttribute("aria-describedby")}w.remove()}}}},a0f23dca0b37(e,t,i){i.a(e,async(e,s)=>{try{i.d(t,{AL:()=>b,GD:()=>f});var n=i("5c1dc214bb5e"),r=e([n]);n=(r.then?(await r)():r)[0];var a=i.n(n);const o=()=>globalThis.SF?.Position||a(),l=new WeakMap,d=["position","inset","margin","width","max-width","max-height","overflow","left","top","right","bottom","z-index"],c=["font-family","font-size","font-weight","font-style","font-stretch","font-variant","font-feature-settings","font-variation-settings","font-optical-sizing","font-kerning","line-height","letter-spacing","word-spacing","text-transform","text-indent","white-space","word-break","overflow-wrap","text-rendering","direction","writing-mode","text-orientation","color","color-scheme","text-align"];function u(e,t){if(!t.context)return;const i=t.context,s=getComputedStyle(e),n=["sf-dropdown",...Array.from(e.classList).filter(e=>e.startsWith("sf-dropdown--")&&!["sf-dropdown--open","sf-dropdown--drop-up","sf-dropdown--drop-down"].includes(e))].join(" ");i.className!==n&&(i.className=n);const r=[...Array.from(s).filter(e=>e.startsWith("--sf-")),...c],a=new Set(r);for(const e of t.contextProperties||[])a.has(e)||i.style.removeProperty(e);for(const e of r){const t=s.getPropertyValue(e);i.style.getPropertyValue(e)!==t&&i.style.setProperty(e,t)}t.contextProperties=r}function h(e){return e?.querySelector(".sf-dropdown-field, .sf-dropdown-trigger")??null}function p(e,t){const i=l.get(t);if(!i||!e.isConnected||t.hidden)return!1;const s=h(e);return!!s&&(e.closest('[hidden], [inert], [aria-hidden="true"], dialog:not([open])')||!s.getClientRects().length||["hidden","collapse"].includes(getComputedStyle(s).visibility)?(i.onUnavailable?.(),!1):(u(e,i),i.wrap&&(i.wrap.style.minHeight="0",i.wrap.style.overflowY="auto"),i.anchor||(i.anchor=o().anchor(s,t,{side:"block-end",align:"start",matchWidth:s.classList.contains("sf-dropdown-field"),fitHeight:!0,autoUpdate:!1,onPosition:({side:i})=>{const s="block-start"===i;t.dataset.placement=e.dataset.placement=s?"top":"bottom",e.classList.toggle("sf-dropdown--drop-up",s),e.classList.toggle("sf-dropdown--drop-down",!s)}})),i.anchor.update(),!0))}function f(e,t,i){if(!t?.isConnected||!h(e))return!1;const s=t.contains(document.activeElement)?document.activeElement:null;if(!l.has(t)){const s=d.map(e=>[e,t.style.getPropertyValue(e),t.style.getPropertyPriority(e)]),n={root:e,saved:s,onUnavailable:i,popover:t.getAttribute("popover"),frame:0,native:"function"==typeof t.showPopover};if(n.wrap=t.querySelector(".sf-list-container-wrap"),n.wrapStyles=n.wrap?["min-height","overflow-y"].map(e=>[e,n.wrap.style.getPropertyValue(e),n.wrap.style.getPropertyPriority(e)]):[],n.schedule=()=>{n.frame||(n.frame=requestAnimationFrame(()=>{n.frame=0,p(e,t)}))},l.set(t,n),e.__sfDropdownPortalList=t,n.native)t.setAttribute("popover","manual");else{n.parent=t.parentNode,n.next=t.nextSibling,n.context=document.createElement("div"),n.context.style.cssText="display:contents;position:static",u(e,n);(e.closest('dialog[open], [role="dialog"][aria-modal="true"]')||document.body).append(n.context),n.context.append(t),t.style.zIndex="var(--sf-z-index-9)"}n.inheritance=new MutationObserver(n.schedule);for(let t=e;t;t=t.parentElement)n.inheritance.observe(t,{attributes:!0,attributeFilter:["class","style","dir","hidden","inert","aria-hidden","open"]});Object.assign(t.style,{position:"fixed",inset:"auto",margin:"0",overflow:n.wrap?"hidden":"auto"}),"function"==typeof ResizeObserver&&(n.resize=new ResizeObserver(n.schedule),n.resize.observe(h(e)),n.resize.observe(t)),window.visualViewport?.addEventListener("resize",n.schedule),window.visualViewport?.addEventListener("scroll",n.schedule)}return t.hidden=!1,l.get(t).native&&!t.matches(":popover-open")&&t.showPopover(),!!p(e,t)&&(s&&document.activeElement!==s&&s.focus({preventScroll:!0}),!0)}function b(e){const t=l.get(e);if(!t)return!1;const i=e.contains(document.activeElement)?document.activeElement:null;t.anchor?.stop(),t.resize?.disconnect(),cancelAnimationFrame(t.frame),t.inheritance?.disconnect(),window.visualViewport?.removeEventListener("resize",t.schedule),window.visualViewport?.removeEventListener("scroll",t.schedule),t.native?(e.matches(":popover-open")&&e.hidePopover(),null===t.popover?e.removeAttribute("popover"):e.setAttribute("popover",t.popover)):(t.next?.parentNode===t.parent?t.parent.insertBefore(e,t.next):t.parent.append(e),t.context.remove());for(const[i,s,n]of t.saved)s?e.style.setProperty(i,s,n):e.style.removeProperty(i);for(const[e,i,s]of t.wrapStyles)i?t.wrap.style.setProperty(e,i,s):t.wrap.style.removeProperty(e);return delete e.dataset.placement,delete t.root.dataset.placement,t.root.classList.remove("sf-dropdown--drop-up","sf-dropdown--drop-down"),t.root.__sfDropdownPortalList===e&&delete t.root.__sfDropdownPortalList,l.delete(e),i&&!e.hidden&&t.root.isConnected&&document.activeElement!==i&&i.focus({preventScroll:!0}),!0}s()}catch(g){s(g)}})},"98e26702f55a"(e,t,i){function s(){const e=globalThis.SF=globalThis.SF||{};return e.__deprecationNotes instanceof Map||Object.defineProperty(e,"__deprecationNotes",{value:new Map,configurable:!0}),e.__deprecationNotes}function n({component:e="",kind:t="attribute",attribute:i="",from:n,to:r=null}={}){if(!n)return;const a=[e,t,i,n].join("|"),o=s(),l=o.get(a);if(l)l.count+=1;else if(o.set(a,{component:e,kind:t,attribute:i,from:n,to:r,count:1}),function(){const e=globalThis.document?.documentElement;return"warn"===e?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const s=e?`${e}: `:"",a="value"===t?`${i}="${n}"`:`${t} ${n}`;globalThis.console?.warn?.(`[SIMAI Framework] ${s}${a} is a legacy name${r?`; write ${r}`:""}. See contracts/changes/journal.json.`)}}if(i.d(t,{id:()=>d,kA:()=>l}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const e=globalThis.SF.deprecations||{};e.list=function(){return[...s().values()].map(e=>({...e}))},e.clear=function(){s().clear()},e.note=n,globalThis.SF.deprecations=e}const r=Object.freeze(["1/2","1","2"]),a=Object.freeze({"1/3":"1/2",3:"2"}),o=new Set;function l(e){const t=String(e??"").trim().toLowerCase();return r.includes(t)?t:Object.hasOwn(a,t)?a[t]:"1"}function d(e,t="field",i="1"){const s=String(e??"").trim().toLowerCase();if(r.includes(s))return s;if(Object.hasOwn(a,s)){const e=a[s];n({component:t,kind:"value",attribute:"size",from:s,to:e});const i=`${t}:${s}`;return o.has(i)||"undefined"==typeof console||(o.add(i),console.warn(`[SIMAI Framework] ${t}: size ${s} is retired for form fields; rendering size ${e}.`)),e}return i}},"67eed2647f47"(e,t,i){i.d(t,{z:()=>r});const s=new WeakMap,n=new WeakSet;function r(e,t){const i=e.ownerDocument;n.has(i)||(i.addEventListener("reset",e=>{const t=e.target;if("FORM"!==t?.tagName)return;const i=Array.from(t.elements);setTimeout(()=>{if(!e.defaultPrevented)for(const e of i)if(e.isConnected&&e.form===t)for(const t of s.get(e)||[])t()},0)},!0),n.add(i));let r=s.get(e);return r||s.set(e,r=new Set),r.add(t),()=>r.delete(t)}},"421676f72963"(e,t,i){i.d(t,{Ec:()=>o});const s="sfPopoverOpen",n=new WeakSet,r=Symbol.for("sf.openSurfaceLayers");function a(){const e=globalThis;return Array.isArray(e[r])||(e[r]=[]),e[r]}function o(e,t){if(!e)return;const i=Boolean(t);if(i===n.has(e))return;const r=a();if(i)n.add(e),r.push(e);else{n.delete(e);const t=r.lastIndexOf(e);t>=0&&r.splice(t,1)}!function(e){const t=globalThis.document?.documentElement;if(!t)return;const i=Math.max(0,Number(t.dataset[s]||0)+e);i?t.dataset[s]=String(i):delete t.dataset[s]}(i?1:-1)}},"50a1017ded91"(e,t,i){i.a(e,async(e,t)=>{try{var s=i("fbe0570fcc69"),n=i("0d662e4d7d63"),r=i("98e26702f55a"),a=i("5429d6e80991"),o=i("3a03d4610486"),l=i("67eed2647f47"),d=i("a0f23dca0b37"),c=i("421676f72963"),u=i("778671c79fa6"),h=e([s,n,a,d,u]);[s,n,a,d,u]=h.then?(await h)():h;var p=i.n(s);const f={en:{search:"Search"},ru:{search:"Поиск"}};function b(e){return(0,r.id)(e,"sf-dropdown")}function g(e){const t=String(e||"").toLowerCase();return["text","icon","checkbox","avatar","color"].includes(t)?t:"text"}function m(e,t="1"){return e instanceof HTMLElement?"sf-list-item"!==e.tagName.toLowerCase()?null:{type:g(e.getAttribute("kind")||e.getAttribute("type")),size:b(e.getAttribute("size")||t),text:e.getAttribute("text")||"",icon:e.getAttribute("icon")||"person",checked:e.hasAttribute("checked")||(0,s.toBoolean)(e.getAttribute("checked")),selected:e.hasAttribute("selected")||(0,s.toBoolean)(e.getAttribute("selected")),disabled:e.hasAttribute("disabled")||(0,s.toBoolean)(e.getAttribute("disabled")),colorClass:e.getAttribute("color-class")||"bg-tertiary",avatarImageUrl:e.getAttribute("avatar-image-url")||"",avatarTitle:e.getAttribute("avatar-title")||e.getAttribute("text")||"",value:e.getAttribute("value")??e.getAttribute("text")??"",ariaLabel:e.getAttribute("aria-label")||"",group:e.getAttribute("group")||""}:null}function v(e,t="1"){if(!e||"object"!=typeof e)return null;const i=void 0===e.text||null===e.text?"":String(e.text),n=void 0===e.value||null===e.value?i:String(e.value);return""===i&&""===n?null:{type:g(e.kind||e.type),size:b(e.size||t),text:i,icon:e.icon?String(e.icon):"person",checked:(0,s.toBoolean)(e.checked),selected:(0,s.toBoolean)(e.selected),disabled:(0,s.toBoolean)(e.disabled),colorClass:e.colorClass?String(e.colorClass):"bg-tertiary",avatarImageUrl:e.avatarImageUrl?String(e.avatarImageUrl):"",avatarTitle:e.avatarTitle?String(e.avatarTitle):i,value:n,ariaLabel:e.ariaLabel?String(e.ariaLabel):"",group:e.group?String(e.group):""}}function y(e,t="1"){let i=e;if("string"==typeof i){const e=i.trim();if(""===e)return[];try{i=JSON.parse(e)}catch{return[]}}return Array.isArray(i)?i.map(e=>v("string"==typeof e||"number"==typeof e?{text:String(e),value:String(e)}:e,t)).filter(Boolean):[]}function w(e=""){return String(e||"").split(",").map(e=>e.trim()).filter(Boolean)}function x(e=[]){return e.map(e=>String(e)).join(",")}function S(e={}){return"avatar"===e.type?e.avatarTitle||e.text||e.value||"":e.text||e.avatarTitle||e.value||""}class $ extends((0,u.kU)(p())){constructor(){super(),this._options=[],this._optionsCaptured=!1,this._optionsFromData=!1,this._open=!1,this._searchValue="",this._selectedValues=[],this._dropdownRoot=null,this._list=null,this._documentClickHandler=this.handleDocumentClick.bind(this),this._viewportHandler=this.positionPortalList.bind(this)}static get props(){return{templateName:{attribute:"template",default:"default"},size:{default:"1"},appearance:{default:"outlined",values:["filled","outlined"],aliases:["type"]},mode:{default:"select",values:["tag","select"]},multiple:{type:Boolean,default:!1},portal:{type:Boolean,default:!0},value:{default:""},name:{default:""},label:{default:""},required:{type:Boolean,default:!1},placeholder:{default:""},searchPlaceholder:{default:""},search:{type:Boolean,default:!0},layout:{default:"list",values:["list","grid"]},columns:{default:"6"},disabled:{type:Boolean,default:!1},ariaLabel:{default:""},inheritedValue:{attribute:"inherited-value",default:""},inheritedText:{attribute:"inherited-text",default:""},resetLabel:{attribute:"reset-label",default:""}}}connectedCallback(){this.captureOptions(),Object.prototype.hasOwnProperty.call(this,"_resetValues")||(this._resetValues=[...this.selectedValues]),super.connectedCallback()}attributeChangedCallback(e,t,i){t!==i&&("value"===e&&(this._selectedValues=w(i)),"disabled"===e&&this.disabled&&(this._open=!1,this._searchValue="")),super.attributeChangedCallback(e,t,i)}get componentName(){return"dropdown"}get templateName(){return this.getAttribute("template")||"default"}get size(){return b(this.getAttribute("size"))}get appearance(){return this.getProp("appearance")}get type(){return this.appearance}get mode(){return this.getEnumAttr("mode",["tag","select"],"select")}get multiple(){return this.hasAttribute("multiple")?this.getBooleanAttr("multiple",!0):"tag"===this.mode}get portal(){return this.getBooleanAttr("portal",!0)}get name(){return this.getAttribute("name")||""}get selectedValue(){return this.getAttribute("value")||""}get label(){return this.getAttribute("label")||""}get required(){return this.getBooleanAttr("required",!1)}get placeholder(){return this.getAttribute("placeholder")||""}accessibleName(){if(this.getProp("label"))return this.getProp("label");const e=this.getAttribute("aria-label");if(e)return e;const t=(this.getAttribute("aria-labelledby")||"").split(/\s+/u).filter(Boolean).map(e=>this.ownerDocument?.getElementById(e)?.textContent?.trim()||"").filter(Boolean).join(" ");if(t)return t;return(this.id&&this.ownerDocument?[...this.ownerDocument.querySelectorAll("label[for]")].filter(e=>e.htmlFor===this.id):[]).map(e=>e.textContent.trim()).filter(Boolean).join(" ")}get searchPlaceholder(){return this.getAttribute("search-placeholder")||(0,n.pageText)(f,"search",this)}get layout(){return this.getEnumAttr("layout",["list","grid"],"list")}get columns(){const e=Number.parseInt(this.getAttribute("columns")??"",10);return Number.isFinite(e)&&e>0?String(e):"6"}get search(){return this.getBooleanAttr("search",!0)}get disabled(){return this.getBooleanAttr("disabled",!1)}get ariaLabel(){return this.getAttribute("aria-label")||""}get selectedValues(){return this.hasAttribute("value")?w(this.selectedValue):this._selectedValues}get selectedOptions(){const e=this.options;return[...new Set(this.selectedValues)].map(t=>e.find(e=>String(e.value)===t)).filter(Boolean)}get triggerText(){if("tag"===this.mode)return"";return(this.multiple?this.selectedOptions:this.selectedOptions.slice(0,1)).map(S).join(", ")}get hiddenValue(){return this.selectedValues.join(",")}captureOptions(){if(this._optionsFromData)return;const e=Array.from(this.children).filter(e=>e instanceof HTMLElement&&"sf-list-item"===e.tagName.toLowerCase());e.length&&(this._options=e.map(e=>m(e,this.size)).filter(Boolean),this._optionsCaptured=!0,this.selectedValue||this._selectedValues.length||(this._selectedValues=this._options.filter(e=>e.selected).map(e=>String(e.value))),e.forEach(e=>e.remove()))}set options(e){const t=y(e,this.size);this._optionsFromData=!0,this._options=t,this._optionsCaptured=!0,this.selectedValue||this._selectedValues.length||(this._selectedValues=t.filter(e=>e.selected).map(e=>String(e.value))),this.requestComponentUpdate("options")}get options(){if(!Array.isArray(this._options)||!this._options.length)return[];const e=new Set(this.selectedValues);return this._options.map(t=>({...t,size:b(t.size||this.size),selected:e.has(String(t.value))}))}get visibleOptions(){const e=String(this._searchValue||"").trim().toLowerCase();return e?this.options.filter(t=>S(t).toLowerCase().includes(e)):this.options}templateContext(){const e=this.getPropsContext();return this.createTemplateContext({...e,component:this,open:this._open,multiple:this.multiple,value:this.hiddenValue,triggerText:this.triggerText,searchValue:this._searchValue,searchPlaceholder:this.searchPlaceholder,accessibleName:this.accessibleName(),selectedValues:this.selectedValues,selectedOptions:this.selectedOptions,options:this.visibleOptions,inheritedValue:this.inheritedValue,inheritedLabel:this.hasInheritedValue?this.inheritedDisplayValue():""})}inheritedOwnValue(){return this.hiddenValue}inheritedDisplayValue(){const e=this.options;return w(this.inheritedValue).map(t=>{const i=e.find(e=>String(e.value)===t);return i?S(i):t}).join(", ")}inheritedFocusTarget(){return this.querySelector(".sf-dropdown-field > button")}clearOwnValue(){this._selectedValues=[],this.setAttributeValue("value",""),this.dispatchDropdownChange(null,[]),this.requestComponentUpdate("reset-to-inherited")}template(){return(0,a.g)(this.templateContext())}beforeRender(){this.captureOptions()}afterRender(){const e=this._dropdownRoot,t=this._list;this._dropdownRoot=this.querySelector(".sf-dropdown"),this._list=this.querySelector(".sf-list")||(e===this._dropdownRoot?t:null),t!==this._list&&(0,d.AL)(t),this.syncDocumentListeners(),this.syncPortalListeners(),this.syncOpenSurfaceMark(),this.positionPortalList(),e!==this._dropdownRoot&&(this._interaction?.release(),this._interaction=null),this._dropdownRoot&&!this._interaction&&(this._interaction=(0,o.Q)(this._dropdownRoot,{owner:this,getList:()=>this._list,isOpen:()=>this._open,isDisabled:()=>this.disabled,isMultiple:()=>this.multiple,open:()=>this.openDropdown(),close:()=>this.closeDropdown(),select:e=>this.selectValue(e.dataset.value||""),selectedLabels:()=>this.selectedOptions.map(S)})),this._interaction?.refresh(),this.syncInheritedState();const i=this.querySelector(".sf-dropdown-hidden-input")||this.querySelector(".sf-dropdown-field > button");this._resetControl!==i&&(this._releaseReset?.(),this._resetControl=i,this._releaseReset=i?(0,l.z)(i,()=>{this._interaction?.beforeClose(),this._selectedValues=[...this._resetValues],this.setAttributeValue("value",x(this._selectedValues)),this._open=!1,this._searchValue="";const e=this.querySelector('.sf-dropdown-field input:not([type="hidden"])');e&&(e.value=this.triggerText),this.requestComponentUpdate("reset")}):null)}onDisconnected(){(0,c.Ec)(this,!1),(0,d.AL)(this._list),this._releaseReset?.(),this._releaseReset=null,this._resetControl=null,this._interaction?.release(),this._interaction=null,this.removeDocumentListeners(),this.removePortalListeners(),super.onDisconnected()}openDropdown(){return this.disabled||this._open||(this._open=!0,this.requestComponentUpdate("open")),this}closeDropdown(){return this._open?(this._interaction?.beforeClose(),this._open=!1,this._searchValue="",this.requestComponentUpdate("close"),this):this}toggleDropdown(){return this._open?this.closeDropdown():this.openDropdown()}handleTriggerClick(e){this.disabled||(e?.preventDefault?.(),this.toggleDropdown())}handleSearchInput(e){this._searchValue=e?.target?.value||"",this.requestComponentUpdate("search")}handleOptionClick(e){if(this.disabled)return;const t=e.target?.closest?.(".sf-list-item");t&&(this.contains(t)||this._list?.contains(t))&&!t.classList.contains("disabled")&&(e.preventDefault(),this.selectValue(t.dataset.value||""))}handleOptionKeydown(e){"Enter"!==e.key&&" "!==e.key||this.handleOptionClick(e)}handleDocumentClick(e){!this._open||this.contains(e.target)||this._list?.contains(e.target)||this.closeDropdown()}selectValue(e=""){if(this.disabled)return this;const t=this.options.find(t=>String(t.value)===String(e));if(!t||t.disabled)return this;const i=!this.multiple&&1===this.selectedValues.length&&this.selectedValues[0]===String(t.value);if(this.multiple){const e=new Set(this.selectedValues);e.has(String(t.value))?e.delete(String(t.value)):e.add(String(t.value)),this._selectedValues=Array.from(e)}else this._selectedValues=[String(t.value)];const s=[...this._selectedValues];return this.setAttributeValue("value",x(s)),i||this.dispatchDropdownChange(t,s),this.multiple||(this._interaction?.beforeClose(),this._open=!1,this._searchValue=""),this.requestComponentUpdate("select"),this}removeSelectedValue(e=""){if(this.disabled)return this;const t=new Set(this.selectedValues);t.delete(String(e)),this._selectedValues=Array.from(t);const i=[...this._selectedValues];return this.setAttributeValue("value",x(i)),this.dispatchDropdownChange(null,i),this.requestComponentUpdate("remove-tag"),this}dispatchDropdownChange(e=null,t=this.selectedValues){const i={value:e?.value||"",label:e?S(e):"",values:t,item:e,root:this,multiple:this.multiple};this.dispatchEvent(new CustomEvent("sf-dropdown:change",{bubbles:!0,composed:!0,detail:i})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:i}))}syncOpenSurfaceMark(){(0,c.Ec)(this,this._open)}syncDocumentListeners(){this._open?document.addEventListener("click",this._documentClickHandler):this.removeDocumentListeners()}removeDocumentListeners(){document.removeEventListener("click",this._documentClickHandler)}syncPortalListeners(){if(this._open&&this.portal)return window.addEventListener("resize",this._viewportHandler),void document.addEventListener("scroll",this._viewportHandler,!0);this.removePortalListeners()}removePortalListeners(){window.removeEventListener("resize",this._viewportHandler),document.removeEventListener("scroll",this._viewportHandler,!0)}positionPortalList(){this._list&&this._dropdownRoot&&this.portal&&this._open?(0,d.GD)(this._dropdownRoot,this._list,()=>this.closeDropdown()):(0,d.AL)(this._list)}get value(){return this.hiddenValue}set value(e){if(e&&"object"==typeof e&&!Array.isArray(e))return void this.setValueAttributes(e);const t=Array.isArray(e)?e.map(String):w(null==e?"":String(e));this.setAttributeValue("value",x(t))}}$.define("sf-dropdown"),t()}catch(_){t(_)}})},"5429d6e80991"(e,t,i){i.a(e,async(e,s)=>{try{i.d(t,{g:()=>f});var n=i("ddf1cdb42ecc"),r=i("778671c79fa6"),a=i("c22590307c6c"),o=e([n,r,a]);[n,r,a]=o.then?(await o)():o;function l(e={}){return"avatar"===e.type?e.avatarTitle||e.text||e.value||"":e.text||e.avatarTitle||e.value||""}function d(e=[],t=!1){const i=[];let s=null;for(const n of e){const e=n.group?String(n.group):"";e!==s&&(s=e,e&&i.push((0,a.aU)(e,n.size)));const r=t&&(!n.type||"text"===n.type);i.push((0,a.lN)(r?{...n,type:"checkbox"}:n))}return i}const c=Object.freeze({"1/2":{size:"1/3",spacing:""},1:{size:"1",spacing:"compact"},2:{size:"2",spacing:"compact"}});function u(e){if(e.multiple||1!==e.selectedOptions?.length)return n.nothing;const t=e.selectedOptions[0];return"icon"===t.type&&t.icon?n.html`<i class="sf-icon sf-dropdown-field-visual" aria-hidden="true">${t.icon}</i>`:"color"===t.type&&t.colorClass?n.html`<span class="sf-tag-color-icon sf-dropdown-field-visual ${t.colorClass}" aria-hidden="true"></span>`:"avatar"===t.type&&t.avatarImageUrl?n.html`<span class="sf-avatar sf-avatar--size-1/2 bg-cover sf-dropdown-field-visual" aria-hidden="true" style=${`background-image: url(${t.avatarImageUrl});`}></span>`:n.nothing}function h(e,t){const i=l(t),s=c[e.size]||c[1],r=s.size,a=s.spacing?` spacing-${s.spacing}`:"",o="color"===t.type?"color":"avatar"===t.type?"avatar":"icon";return n.html`
|
|
2
2
|
<div
|
|
3
|
-
class="sf-tag transition sf-tag--${
|
|
3
|
+
class="sf-tag transition sf-tag--${o} sf-tag--size-${r} sf-tag--inline${a} flex flex-row flex-nowrap items-center active"
|
|
4
4
|
data-value=${t.value}
|
|
5
5
|
>
|
|
6
6
|
${"color"===t.type?n.html`<span class="sf-tag-color-icon ${t.colorClass}" aria-hidden="true"></span>`:n.nothing}
|
|
7
7
|
${"icon"===t.type?n.html`<i class="sf-icon sf-tag-icon" aria-hidden="true">${t.icon}</i>`:n.nothing}
|
|
8
8
|
${"avatar"===t.type?n.html`
|
|
9
9
|
<span
|
|
10
|
-
class="sf-avatar sf-avatar--size-${
|
|
10
|
+
class="sf-avatar sf-avatar--size-${r} bg-cover"
|
|
11
11
|
aria-hidden="true"
|
|
12
12
|
style=${t.avatarImageUrl?`background-image: url(${t.avatarImageUrl});`:n.nothing}
|
|
13
13
|
></span>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
</div>
|
|
26
26
|
</button>
|
|
27
27
|
</div>
|
|
28
|
-
`}const p={"1/2":"var(--sf-ui-1\\/2--control-height)",1:"var(--sf-ui-1--control-height)",2:"var(--sf-ui-2--control-height)"};function
|
|
28
|
+
`}const p={"1/2":"var(--sf-ui-1\\/2--control-height)",1:"var(--sf-ui-1--control-height)",2:"var(--sf-ui-2--control-height)"};function f(e){const t=["sf-dropdown",e.rootClass,e.open?"open":"",e.open?"sf-dropdown--open":"",`sf-dropdown--size-${e.size}`,`sf-dropdown--${e.appearance??e.type}`,"tag"===e.mode?"sf-dropdown--tag":"","grid"===e.layout?"sf-dropdown--grid":"","tag"!==e.mode?"sf-dropdown--text":"",e.disabled?"disabled":"","flex","flex-col"].filter(Boolean),i=["sf-dropdown-field",e.disabled?"":"cursor-pointer","items-cross-center","relative","transition","flex"].filter(Boolean),s="1"===e.size||"1/2"===e.size?"1/2":e.size,a=e.size,o=e.open?"keyboard_arrow_up":"keyboard_arrow_down";return n.html`
|
|
29
29
|
<div
|
|
30
30
|
class=${t.join(" ")}
|
|
31
31
|
style=${e.rootStyle||n.nothing}
|
|
@@ -71,14 +71,14 @@
|
|
|
71
71
|
>
|
|
72
72
|
${t}
|
|
73
73
|
<div class="sf-dropdown-tag-container flex flex-wrap flex-1">
|
|
74
|
-
${e.selectedOptions.map(t=>
|
|
74
|
+
${e.selectedOptions.map(t=>h(e,t))}
|
|
75
75
|
</div>
|
|
76
76
|
<button
|
|
77
77
|
type="button"
|
|
78
78
|
class="sf-icon-button sf-icon-button--icon sf-icon-button--on-surface sf-icon-button--link sf-icon-button--size-${s}"
|
|
79
79
|
?disabled=${e.disabled}
|
|
80
80
|
>
|
|
81
|
-
<i class="sf-icon" aria-hidden="true">${
|
|
81
|
+
<i class="sf-icon" aria-hidden="true">${o}</i>
|
|
82
82
|
</button>
|
|
83
83
|
</div>
|
|
84
84
|
`:n.html`
|
|
@@ -87,21 +87,23 @@
|
|
|
87
87
|
@click=${t=>e.component.handleTriggerClick(t)}
|
|
88
88
|
>
|
|
89
89
|
${t}
|
|
90
|
-
${
|
|
90
|
+
${u(e)}
|
|
91
91
|
<input
|
|
92
|
-
placeholder=${e.placeholder}
|
|
92
|
+
placeholder=${e.inheritedLabel||e.placeholder}
|
|
93
93
|
type="text"
|
|
94
94
|
class="cursor-pointer"
|
|
95
|
+
aria-label=${e.accessibleName||n.nothing}
|
|
95
96
|
.value=${e.triggerText||""}
|
|
96
97
|
readonly
|
|
97
98
|
?disabled=${e.disabled}
|
|
98
99
|
/>
|
|
100
|
+
${(0,r.vZ)(e.component,{size:e.size,disabled:e.disabled})}
|
|
99
101
|
<button
|
|
100
102
|
type="button"
|
|
101
103
|
class="sf-icon-button sf-icon-button--icon sf-icon-button--on-surface sf-icon-button--link sf-icon-button--size-${s} absolute"
|
|
102
104
|
?disabled=${e.disabled}
|
|
103
105
|
>
|
|
104
|
-
<i class="sf-icon" aria-hidden="true">${
|
|
106
|
+
<i class="sf-icon" aria-hidden="true">${o}</i>
|
|
105
107
|
</button>
|
|
106
108
|
</label>
|
|
107
109
|
`})()}
|
|
@@ -113,11 +115,12 @@
|
|
|
113
115
|
>
|
|
114
116
|
${e.search?n.html`
|
|
115
117
|
<label
|
|
116
|
-
class="sf-input sf-input--size-${
|
|
118
|
+
class="sf-input sf-input--size-${a} sf-input--filled flex flex-col"
|
|
117
119
|
>
|
|
118
120
|
<span class="sf-input-field items-cross-center transition flex">
|
|
119
121
|
<input
|
|
120
122
|
placeholder=${e.searchPlaceholder}
|
|
123
|
+
aria-label=${e.searchPlaceholder||n.nothing}
|
|
121
124
|
type="text"
|
|
122
125
|
.value=${e.searchValue||""}
|
|
123
126
|
?disabled=${e.disabled}
|
|
@@ -136,28 +139,45 @@
|
|
|
136
139
|
@click=${t=>e.component.handleOptionClick(t)}
|
|
137
140
|
@keydown=${t=>e.component.handleOptionKeydown(t)}
|
|
138
141
|
>
|
|
139
|
-
${
|
|
142
|
+
${d(e.options,e.multiple)}
|
|
140
143
|
</div>
|
|
141
144
|
</div>
|
|
142
145
|
</div>
|
|
143
146
|
</div>
|
|
144
|
-
`}s()}catch(
|
|
147
|
+
`}s()}catch(b){s(b)}})},"778671c79fa6"(e,t,i){i.a(e,async(e,s)=>{try{i.d(t,{vZ:()=>h});var n=i("ddf1cdb42ecc"),r=i("0d662e4d7d63"),a=e([n,r]);[n,r]=a.then?(await a)():a;const o="sf-field:reset",l={en:{inherited:"inherited",reset:"Reset to inherited",described:"Inherited: {value}"},ru:{inherited:"наследуется",reset:"Сбросить к наследуемому",described:"Наследуется: {value}"}},d=Object.freeze({"1/2":"1/3",1:"1/2",2:"1"}),c=e=>d[String(e)]||"1/2",u=e=>class extends e{constructor(){super(),this.__sfInheritedSync=()=>this.syncInheritedState(),this.addEventListener("input",this.__sfInheritedSync),this.addEventListener("change",this.__sfInheritedSync)}get inheritedValue(){return this.getAttribute("inherited-value")||""}set inheritedValue(e){null==e||""===e?this.removeAttribute("inherited-value"):this.setAttribute("inherited-value",String(e))}get inheritedText(){return this.getAttribute("inherited-text")||(0,r.pageText)(l,"inherited",this)}get resetLabel(){return this.getAttribute("reset-label")||(0,r.pageText)(l,"reset",this)}get hasInheritedValue(){return""!==this.inheritedValue}get isInherited(){return this.hasInheritedValue&&""===this.inheritedOwnValue()}inheritedOwnValue(){return String(this.value??"")}inheritedDisplayValue(){return this.inheritedValue}inheritedFocusTarget(){return null}clearOwnValue(){this.value=""}inheritedDescription(){return(0,r.pageText)(l,"described",this).replace("{value}",this.inheritedDisplayValue())}resetToInherited(){if(!this.hasInheritedValue||""===this.inheritedOwnValue())return!1;if(this.hasAttribute("disabled")||this.hasAttribute("readonly"))return!1;const e=new CustomEvent(o,{bubbles:!0,composed:!0,cancelable:!0,detail:{value:this.inheritedOwnValue(),inheritedValue:this.inheritedValue,name:this.getAttribute("name")||""}});if(!this.dispatchEvent(e))return!1;this.clearOwnValue(),this.syncInheritedState();const t=()=>this.inheritedFocusTarget()?.focus?.({preventScroll:!0});return t(),this.contains(document.activeElement)||requestAnimationFrame(t),!0}syncInheritedState(){if(!this.hasInheritedValue&&!this.__sfInheritedDescribed)return void this.removeAttribute("data-inherited");const e=this.isInherited,t=this.hasInheritedValue&&!e;e?this.setAttribute("data-inherited","true"):this.removeAttribute("data-inherited"),this.querySelectorAll(":scope [data-inherited-marker]").forEach(t=>{t.hidden=!e}),this.querySelectorAll(":scope [data-inherited-reset]").forEach(e=>{e.hidden=!t});const i=this.inheritedFocusTarget();i&&(e?(i.setAttribute("aria-description",this.inheritedDescription()),this.__sfInheritedDescribed=i):this.__sfInheritedDescribed===i&&(i.removeAttribute("aria-description"),this.__sfInheritedDescribed=null))}};function h(e,{size:t="1",disabled:i=!1,className:s=""}={}){if(!e?.hasInheritedValue)return n.nothing;const r=c(t),a=e.isInherited;return n.html`
|
|
148
|
+
<span class="sf-field-inherited-slot sf-field-inherited-slot--size-${t} flex items-cross-center ${s}">
|
|
149
|
+
<span class="sf-field-inherited sf-field-inherited--size-${r}"
|
|
150
|
+
data-inherited-marker
|
|
151
|
+
aria-hidden="true"
|
|
152
|
+
?hidden=${!a}>${e.inheritedText}</span>
|
|
153
|
+
<button
|
|
154
|
+
type="button"
|
|
155
|
+
class="sf-field-reset sf-icon-button sf-icon-button--icon sf-icon-button--on-surface sf-icon-button--link sf-icon-button--size-${r}"
|
|
156
|
+
data-inherited-reset
|
|
157
|
+
aria-label=${e.resetLabel}
|
|
158
|
+
title=${e.resetLabel}
|
|
159
|
+
?hidden=${a}
|
|
160
|
+
?disabled=${i}
|
|
161
|
+
@click=${t=>{t.preventDefault(),t.stopPropagation(),e.resetToInherited()}}
|
|
162
|
+
><i class="sf-icon" aria-hidden="true">restart_alt</i></button>
|
|
163
|
+
</span>
|
|
164
|
+
`}i.d(t,["kU",0,u]),s()}catch(p){s(p)}})},c22590307c6c(e,t,i){i.a(e,async(e,s)=>{try{i.d(t,{aU:()=>c,lN:()=>d});var n=i("ddf1cdb42ecc"),r=i("98e26702f55a"),a=e([n]),o=a.then?(await a)():a;n=o[0];function l(e){const t=!0===e.option,i=e.component?.hasSlotContent?.("text")?e.component.getSlotContent("text"):e.text,s=e.component?.hasSlotContent?.("leading")?e.component.getSlotContent("leading"):n.nothing,r=e.component?.hasSlotContent?.("trailing")?e.component.getSlotContent("trailing"):n.nothing,a=!t&&e.component?.hasSlotContent?.("supporting")?e.component.getSlotContent("supporting"):!t&&e.supporting||n.nothing,o=a!==n.nothing,l=t||e.pinned?"":e.sortableItem||"",d=!t&&Boolean(e.sortableItem||e.pinned),c=!t&&Boolean(e.interactive||l),u=["sf-list-item","flex","items-cross-center",`sf-list-item--${e.kind??e.type}`,`sf-list-item--size-${e.size}`,t?"cursor-pointer":"",e.selected?"selected":"",e.disabled?"disabled":"",o?"sf-list-item--two-line":"",!t&&e.interactive?"sf-list-item--interactive":"",d?"sf-list-item--sortable":"",!t&&e.pinned?"sf-list-item--pinned":"",e.rootClass].filter(Boolean),h=["sf-list-item-wrap","flex","flex-1"];["icon","checkbox","avatar","color"].includes(e.type)&&h.push("flex","flex-row","flex-nowrap","items-center","gap-2"),"avatar"!==e.type&&"color"!==e.type||(h.splice(h.indexOf("gap-2"),1),h.push("justify-between","gap-2"));return n.html`
|
|
145
165
|
<div
|
|
146
166
|
class=${u.join(" ")}
|
|
147
167
|
style=${e.rootStyle||n.nothing}
|
|
148
168
|
role=${t?"option":n.nothing}
|
|
149
169
|
tabindex=${t?"-1":n.nothing}
|
|
150
170
|
data-value=${t&&e.value||n.nothing}
|
|
151
|
-
aria-label=${(t||
|
|
171
|
+
aria-label=${(t||c)&&e.ariaLabel||n.nothing}
|
|
152
172
|
title=${t&&e.ariaLabel||n.nothing}
|
|
153
|
-
aria-disabled=${(t||
|
|
173
|
+
aria-disabled=${(t||c)&&e.disabled?"true":n.nothing}
|
|
154
174
|
aria-selected=${t?e.selected?"true":"false":n.nothing}
|
|
155
175
|
data-sf-sortable-item=${l||n.nothing}
|
|
156
|
-
?data-sf-list-roving=${
|
|
157
|
-
aria-current=${
|
|
176
|
+
?data-sf-list-roving=${c}
|
|
177
|
+
aria-current=${c&&e.selected?"true":n.nothing}
|
|
158
178
|
>
|
|
159
|
-
${
|
|
160
|
-
<div class=${
|
|
179
|
+
${d?n.html`<span class="sf-list-item-handle" ?data-sf-sortable-handle=${Boolean(l)} aria-hidden="true">${l?n.html`<i class="sf-icon">drag_indicator</i>`:n.nothing}</span>`:n.nothing}
|
|
180
|
+
<div class=${h.join(" ")}>
|
|
161
181
|
${(()=>{if(s!==n.nothing)return s;if("icon"===e.type)return n.html`<i class="sf-icon" aria-hidden="true">${e.icon}</i>`;if("checkbox"===e.type)return n.html`
|
|
162
182
|
<label
|
|
163
183
|
class="sf-checkbox sf-checkbox--size-${e.sizeGroup.checkbox} flex"
|
|
@@ -193,7 +213,7 @@
|
|
|
193
213
|
<span class="sf-tag-color-icon ${e.colorClass}" aria-hidden="true"></span>
|
|
194
214
|
<span class="sf-tag-container">${i}</span>
|
|
195
215
|
</div>
|
|
196
|
-
`}return n.nothing})()} ${"color"===e.type||"avatar"===e.type?n.nothing:
|
|
216
|
+
`}return n.nothing})()} ${"color"===e.type||"avatar"===e.type?n.nothing:o?n.html`<div class="sf-list-item-container"><span class="sf-list-item-title">${i}</span><span class="sf-list-item-supporting">${a}</span></div>`:n.html`<div class="sf-list-item-container">${i}</div>`} ${r!==n.nothing?r:"avatar"===e.type||"color"===e.type?n.html`
|
|
197
217
|
<label
|
|
198
218
|
class="sf-checkbox sf-checkbox--size-${e.sizeGroup.checkbox} flex"
|
|
199
219
|
aria-hidden="true"
|
|
@@ -211,8 +231,8 @@
|
|
|
211
231
|
`:n.nothing}
|
|
212
232
|
</div>
|
|
213
233
|
</div>
|
|
214
|
-
`}function
|
|
234
|
+
`}function d(e={}){const t=String(e.size||"1");return l({component:{hasSlotContent:()=>!1,getSlotContent:()=>n.nothing},templateName:"default",type:e.type||"text",kind:e.kind||e.type||"text",size:t,sizeGroup:u(t),text:e.text,icon:e.icon,checked:e.checked||e.selected,selected:e.selected,disabled:e.disabled,value:e.value,colorClass:e.colorClass,avatarImageUrl:e.avatarImageUrl,avatarTitle:e.avatarTitle,ariaLabel:e.ariaLabel,option:!0})}function c(e,t="1"){return n.html`
|
|
215
235
|
<div class="sf-list-heading sf-list-heading--size-${t}" role="presentation">
|
|
216
236
|
<span class="sf-list-heading-container">${e}</span>
|
|
217
237
|
</div>
|
|
218
|
-
`}function u(e){const t=String(e||"1");return"1/3"===t||"1/2"===t?{item:t,checkbox:(0,
|
|
238
|
+
`}function u(e){const t=String(e||"1");return"1/3"===t||"1/2"===t?{item:t,checkbox:(0,r.kA)(t),avatarGroup:"1/2",colorTag:"1/2"}:{item:t,checkbox:(0,r.kA)(t),avatarGroup:t,colorTag:"1"}}s()}catch(h){s(h)}})},ddf1cdb42ecc(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit"):new Promise(e=>globalThis.addEventListener("sf-runtime-ready",()=>e(globalThis.SF.runtimeModule("lit")),{once:!0}))},"0d662e4d7d63"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("page-language"):new Promise(e=>globalThis.addEventListener("sf-runtime-ready",()=>e(globalThis.SF.runtimeModule("page-language")),{once:!0}))},"5c1dc214bb5e"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("position"):new Promise(e=>globalThis.addEventListener("sf-runtime-ready",()=>e(globalThis.SF.runtimeModule("position")),{once:!0}))},fbe0570fcc69(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("smart-base"):new Promise(e=>globalThis.addEventListener("sf-runtime-ready",()=>e(globalThis.SF.runtimeModule("smart-base")),{once:!0}))}};const t={};function i(s){const n=t[s];if(void 0!==n)return n.exports;const r=t[s]={exports:{}};return e[s](r,r.exports,i),r.exports}(()=>{const e="function"==typeof Symbol,t=e?Symbol("webpack queues"):"__webpack_queues__",s=e?Symbol("webpack exports"):"__webpack_exports__",n=e?Symbol("webpack error"):"__webpack_error__",r=e=>{e?.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))};i.a=(e,i,a)=>{let o;a&&((o=[]).d=-1);const l=new Set,d=e.exports;let c,u,h;const p=new Promise((e,t)=>{h=t,u=e});p[s]=d,p[t]=e=>(o&&e(o),l.forEach(e),p.catch(e=>{})),e.exports=p;i(e=>{let i;c=(e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[t])return e;if(e.then){const i=[];i.d=0,e.then(e=>{a[s]=e,r(i)},e=>{a[n]=e,r(i)});const a={};return a[t]=e=>e(i),a}}const i={};return i[t]=e=>{},i[s]=e,i}))(e);const a=()=>c.map(e=>{if(e[n])throw e[n];return e[s]}),d=new Promise(e=>{i=()=>e(a),i.r=0;const s=e=>e!==o&&!l.has(e)&&(l.add(e),e&&!e.d&&(i.r++,e.push(i)));c.map(e=>e[t](s))});return i.r?d:a()},e=>(e?h(p[n]=e):u(d),r(o))),o?.d<0&&(o.d=0)}})(),i.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{if(Array.isArray(t))for(var s=0;s<t.length;){var n=t[s++],r=t[s++];i.o(e,n)?0===r&&s++:0===r?Object.defineProperty(e,n,{enumerable:!0,value:t[s++]}):Object.defineProperty(e,n,{enumerable:!0,get:r})}else for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);i("50a1017ded91")})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": 2,
|
|
3
3
|
"id": "smart.dropdown",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"title": "Dropdown",
|
|
6
6
|
"summary": "Accessible single or multiple selection control with searchable options and optional portal projection.",
|
|
7
7
|
"kind": "smart",
|
|
@@ -138,6 +138,21 @@
|
|
|
138
138
|
"type": "string",
|
|
139
139
|
"default": "",
|
|
140
140
|
"description": "Selected machine value, or a comma-separated list of values for multiple selection."
|
|
141
|
+
},
|
|
142
|
+
"inherited-value": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"default": "",
|
|
145
|
+
"description": "The option value (values joined by commas when several may be chosen) the field falls back to while nothing is chosen. Its options' labels are shown as inherited, in the placeholder's ink with an «inherited» marker, never as a choice: the form value stays empty. Once something is chosen, a reset button returns it here. Select mode; a tag-mode field does not draw it."
|
|
146
|
+
},
|
|
147
|
+
"inherited-text": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"default": "",
|
|
150
|
+
"description": "The words of the marker shown while the inherited value applies. Unset, it follows the page's language («inherited», «наследуется»)."
|
|
151
|
+
},
|
|
152
|
+
"reset-label": {
|
|
153
|
+
"type": "string",
|
|
154
|
+
"default": "",
|
|
155
|
+
"description": "The accessible name of the button that returns the field to the inherited value. Unset, it follows the page's language («Reset to inherited», «Сбросить к наследуемому»)."
|
|
141
156
|
}
|
|
142
157
|
},
|
|
143
158
|
"additionalProperties": false
|
|
@@ -204,6 +219,14 @@
|
|
|
204
219
|
"type": "object",
|
|
205
220
|
"description": "The element, for chaining."
|
|
206
221
|
}
|
|
222
|
+
},
|
|
223
|
+
"resetToInherited": {
|
|
224
|
+
"summary": "Returns the field to its inherited value, as the reset button does: fires the cancellable sf-field:reset, then empties the own value and focuses the control. Returns whether it was reset (false without an inherited value, without an own value, while disabled or readonly, or when the event was prevented).",
|
|
225
|
+
"arguments": [],
|
|
226
|
+
"returns": {
|
|
227
|
+
"type": "boolean",
|
|
228
|
+
"description": "Whether the field was reset."
|
|
229
|
+
}
|
|
207
230
|
}
|
|
208
231
|
},
|
|
209
232
|
"events": {
|
|
@@ -220,6 +243,26 @@
|
|
|
220
243
|
"$ref": "#/contracts/change_detail"
|
|
221
244
|
},
|
|
222
245
|
"alias_of": "change"
|
|
246
|
+
},
|
|
247
|
+
"sf-field:reset": {
|
|
248
|
+
"summary": "The person pressed the reset back to the inherited value. Fired before the field is emptied and cancellable: preventDefault keeps the value. When it is not prevented the field empties, says so with its ordinary change, shows the inherited value again and takes focus back.",
|
|
249
|
+
"payload": {
|
|
250
|
+
"type": "object",
|
|
251
|
+
"properties": {
|
|
252
|
+
"value": {
|
|
253
|
+
"type": "string",
|
|
254
|
+
"description": "The field's own value before the reset."
|
|
255
|
+
},
|
|
256
|
+
"inheritedValue": {
|
|
257
|
+
"type": "string",
|
|
258
|
+
"description": "The inherited value it returns to."
|
|
259
|
+
},
|
|
260
|
+
"name": {
|
|
261
|
+
"type": "string",
|
|
262
|
+
"description": "The form name, empty when the field has none."
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
223
266
|
}
|
|
224
267
|
},
|
|
225
268
|
"state": {
|
|
@@ -267,7 +310,7 @@
|
|
|
267
310
|
"Space",
|
|
268
311
|
"Escape"
|
|
269
312
|
],
|
|
270
|
-
"focus": "The toggle is the primary Tab stop. Arrow keys open and move through available options; Home and End move within the list; Enter or Space selects; Escape closes and restores the toggle; Tab closes and continues native traversal. The searchbox keeps native text-editing Home and End behavior."
|
|
313
|
+
"focus": "The toggle is the primary Tab stop. Arrow keys open and move through available options; Home and End move within the list; Enter or Space selects; Escape closes and restores the toggle; Tab closes and continues native traversal. The searchbox keeps native text-editing Home and End behavior. After a reset back to the inherited value, focus returns to the control; while the value is inherited, the control carries it as aria-description and the visible marker is aria-hidden."
|
|
271
314
|
},
|
|
272
315
|
"presentation": {
|
|
273
316
|
"themes": [
|
|
@@ -338,7 +381,23 @@
|
|
|
338
381
|
"source_artifacts": [
|
|
339
382
|
{
|
|
340
383
|
"path": "src/smart/dropdown/index.js",
|
|
341
|
-
"sha256": "
|
|
384
|
+
"sha256": "7b3829bc4629876f64afa707b38f138968848c6dd9e7ae6bcec93a194e21f7f5"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
"path": "src/smart/dropdown/rule.js",
|
|
388
|
+
"sha256": "1bbda528d6b9cd99d7c29a1a1c83c2cb67e1bdd3bdb31664a2a215b1d6db1b29"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"path": "src/smart/dropdown/js/templates/default.js",
|
|
392
|
+
"sha256": "a3a4777eb96859fee1cf55e3dee478954c4a8bddab1f4c1fa3898f1b04996297"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"path": "src/smart/helpers/inherited-value.js",
|
|
396
|
+
"sha256": "0c8658ab61678cd5f89badea902be244b92ba96240fb802c60438227f8f9faa9"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"path": "src/smart/helpers/inherited-value.css",
|
|
400
|
+
"sha256": "2a10b6d5c8e26c7d1541511c99257e9474b16d30c6e8352e96ed9b47f70b6a2a"
|
|
342
401
|
}
|
|
343
402
|
],
|
|
344
403
|
"generated_runtime": [
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { html, nothing } from "lit";
|
|
2
|
+
import { renderInheritedSlot } from "../../../helpers/inherited-value";
|
|
2
3
|
import {
|
|
3
4
|
renderListItemHeading,
|
|
4
5
|
renderListItemOption,
|
|
@@ -219,13 +220,15 @@ export function renderDropdownTemplate(context) {
|
|
|
219
220
|
${hiddenInput}
|
|
220
221
|
${renderFieldVisual(context)}
|
|
221
222
|
<input
|
|
222
|
-
placeholder=${context.placeholder}
|
|
223
|
+
placeholder=${context.inheritedLabel || context.placeholder}
|
|
223
224
|
type="text"
|
|
224
225
|
class="cursor-pointer"
|
|
226
|
+
aria-label=${context.accessibleName || nothing}
|
|
225
227
|
.value=${context.triggerText || ""}
|
|
226
228
|
readonly
|
|
227
229
|
?disabled=${context.disabled}
|
|
228
230
|
/>
|
|
231
|
+
${renderInheritedSlot(context.component, {size: context.size, disabled: context.disabled})}
|
|
229
232
|
<button
|
|
230
233
|
type="button"
|
|
231
234
|
class="sf-icon-button sf-icon-button--icon sf-icon-button--on-surface sf-icon-button--link sf-icon-button--size-${iconButtonSize} absolute"
|
|
@@ -273,6 +276,7 @@ export function renderDropdownTemplate(context) {
|
|
|
273
276
|
<span class="sf-input-field items-cross-center transition flex">
|
|
274
277
|
<input
|
|
275
278
|
placeholder=${context.searchPlaceholder}
|
|
279
|
+
aria-label=${context.searchPlaceholder || nothing}
|
|
276
280
|
type="text"
|
|
277
281
|
.value=${context.searchValue || ""}
|
|
278
282
|
?disabled=${context.disabled}
|