@simai-studio/ui 5.20261021.2249 → 5.20261022.1303
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/dropdown/js/dropdown.min.js +1 -1
- package/distr/core/contracts/packages/larena.package.json +1 -0
- package/distr/core/js/core-loader.js +133 -7
- package/distr/core/js/core-loader.min.js +1 -1
- package/distr/core/js/smart-base.js +134 -12
- package/distr/core/js/smart-base.min.js +1 -1
- package/distr/smart/buttons/js/buttons.min.js +1 -1
- package/distr/smart/buttons/smart.manifest.json +1 -1
- package/distr/smart/country-code/js/country-code.min.js +9 -7
- package/distr/smart/country-code/smart.manifest.json +6 -1
- package/distr/smart/country-code/template/default.js +12 -4
- package/distr/smart/datepicker/js/datepicker.min.js +12 -9
- package/distr/smart/datepicker/smart.manifest.json +13 -3
- package/distr/smart/datepicker/template/default.js +4 -1
- package/distr/smart/dropdown/js/dropdown.min.js +10 -10
- package/distr/smart/dropdown/smart.manifest.json +1 -1
- package/distr/smart/dropdown/template/default.js +10 -3
- package/distr/smart/field-renderers/js/field-renderers.min.js +17 -17
- package/distr/smart/icon-buttons/js/icon-buttons.min.js +1 -1
- package/distr/smart/icon-buttons/smart.manifest.json +1 -1
- package/distr/smart/icons/js/icons.min.js +1 -1
- package/distr/smart/icons/smart.manifest.json +1 -1
- package/distr/smart/inputs/js/inputs.min.js +33 -31
- package/distr/smart/inputs/smart.manifest.json +6 -1
- package/distr/smart/inputs/template/default.js +8 -0
- package/distr/smart/popover/js/popover.min.js +1 -1
- package/distr/smart/popover/smart.manifest.json +1 -1
- package/distr/smart/switch/js/switch.min.js +12 -11
- package/distr/smart/switch/smart.manifest.json +6 -1
- package/distr/smart/switch/template/default.js +2 -1
- package/package-manifest.json +33 -33
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{"use strict";var t={"98e26702f55a"(t,e,a){function s(){const t=globalThis.SF=globalThis.SF||{};return t.__deprecationNotes instanceof Map||Object.defineProperty(t,"__deprecationNotes",{value:new Map,configurable:!0}),t.__deprecationNotes}function n({component:t="",kind:e="attribute",attribute:a="",from:n,to:r=null}={}){if(!n)return;const i=[t,e,a,n].join("|"),o=s(),l=o.get(i);if(l)l.count+=1;else if(o.set(i,{component:t,kind:e,attribute:a,from:n,to:r,count:1}),function(){const t=globalThis.document?.documentElement;return"warn"===t?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const s=t?`${t}: `:"",i="value"===e?`${a}="${n}"`:`${e} ${n}`;globalThis.console?.warn?.(`[SIMAI Framework] ${s}${i} is a legacy name${r?`; write ${r}`:""}. See contracts/changes/journal.json.`)}}if(a.d(e,{id:()=>l}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const t=globalThis.SF.deprecations||{};t.list=function(){return[...s().values()].map(t=>({...t}))},t.clear=function(){s().clear()},t.note=n,globalThis.SF.deprecations=t}const r=Object.freeze(["1/2","1","2"]),i=Object.freeze({"1/3":"1/2",3:"2"}),o=new Set;function l(t,e="field",a="1"){const s=String(t??"").trim().toLowerCase();if(r.includes(s))return s;if(Object.hasOwn(i,s)){const t=i[s];n({component:e,kind:"value",attribute:"size",from:s,to:t});const a=`${e}:${s}`;return o.has(a)||"undefined"==typeof console||(o.add(a),console.warn(`[SIMAI Framework] ${e}: size ${s} is retired for form fields; rendering size ${t}.`)),t}return a}},b9b65955223a(t,e,a){a.a(t,async(t,e)=>{try{var s=a("fbe0570fcc69"),n=a("98e26702f55a"),r=a("77b2f4107e3b"),i=a("5c1dc214bb5e"),o=a("0d662e4d7d63"),l=t([s,r,i,o]);[s,r,i,o]=l.then?(await l)():l;var u=a.n(s),h=a.n(i);const c=/^(\d{4})-(\d{2})-(\d{2})$/,d=18;let p=0;function g(t){return String(t).padStart(2,"0")}function m(t){return`${t.getFullYear()}-${g(t.getMonth()+1)}-${g(t.getDate())}`}function f(t,e="YYYY.MM.DD"){if(!t)return"";const a={YYYY:String(t.getFullYear()),YY:String(t.getFullYear()).slice(-2),MM:g(t.getMonth()+1),DD:g(t.getDate())};return String(e||"YYYY.MM.DD").replace(/YYYY|YY|MM|DD/g,t=>a[t]||t)}function b(t){return t instanceof Date&&!Number.isNaN(t.getTime())}function y(t){if(!t)return null;const e=String(t).match(c);if(!e)return null;const[,a,s,n]=e,r=new Date(Number(a),Number(s)-1,Number(n));return r.getFullYear()!==Number(a)||r.getMonth()!==Number(s)-1||r.getDate()!==Number(n)?null:r}function D(t,e="DD.MM.YYYY"){if(!t)return null;if(t instanceof Date)return b(t)?new Date(t.getFullYear(),t.getMonth(),t.getDate()):null;const a=String(t).trim(),s=y(a);if(s)return s;const n=a.match(/\d+/g),r=String(e||"DD.MM.YYYY").match(/YYYY|YY|MM|DD/g);if(!n||!r||n.length<3||r.length<3)return null;const i={};r.slice(0,3).forEach((t,e)=>{i[t]=Number(n[e])});let o=i.YYYY;!o&&i.YY&&(o=i.YY+2e3);const l=i.MM,u=i.DD;if(!o||!l||!u)return null;const h=new Date(o,l-1,u);return h.getFullYear()!==o||h.getMonth()!==l-1||h.getDate()!==u?null:h}function v(t,e=0){const a=(0,s.toNumber)(t,e);return Number.isFinite(a)?Math.max(0,Math.min(11,a)):e}function k(t,e){return t&&e&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function w(t,e){if(!t||!e)return 0;return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function S(t,e){const a=new Date(t.getFullYear(),t.getMonth()+e,1),s=new Date(a.getFullYear(),a.getMonth()+1,0).getDate();return a.setDate(Math.min(t.getDate(),s)),a}function M(t,e,a){return!!(t&&e&&a)&&(w(t,e)>0&&w(t,a)<0)}function $(t="",e=null){const a=String(t||"").trim();return a||(0,o.pageLocale)(e??globalThis.document?.documentElement??null)}function x(t=""){const e=String(t||"");return e?`${e.charAt(0).toLocaleUpperCase()}${e.slice(1)}`:""}function P(t,e){try{return x(new Intl.DateTimeFormat(e,{month:"long"}).format(new Date(2026,t,1)))}catch{return String(t+1)}}function A(t,e){try{return new Intl.DateTimeFormat(e,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(t)}catch{return m(t)}}function Y(t,e=1){const a=new Date(2026,0,4);return Array.from({length:7},(s,n)=>{const r=new Date(a);r.setDate(a.getDate()+(e+n)%7);try{return new Intl.DateTimeFormat(t,{weekday:"short"}).format(r)}catch{return String((e+n)%7)}})}const V=["today","yesterday","last-7-days","last-30-days","this-week","this-month","last-month"];function _(t,e){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+e)}function F(t,e,a=1){const s=new Date(e.getFullYear(),e.getMonth(),e.getDate());switch(t){case"today":return[s,s];case"yesterday":return[_(s,-1),_(s,-1)];case"last-7-days":return[_(s,-6),s];case"last-30-days":return[_(s,-29),s];case"this-week":return[_(s,-(s.getDay()-a+7)%7),s];case"this-month":return[new Date(s.getFullYear(),s.getMonth(),1),s];case"last-month":return[new Date(s.getFullYear(),s.getMonth()-1,1),new Date(s.getFullYear(),s.getMonth(),0)];default:return null}}const T={en:{previousMonth:"Previous month",nextMonth:"Next month",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",presets:"Quick ranges",customRange:"Custom range",preset_today:"Today",preset_yesterday:"Yesterday",preset_last7Days:"Last 7 days",preset_last30Days:"Last 30 days",preset_thisWeek:"This week",preset_thisMonth:"This month",preset_lastMonth:"Last month"},ru:{previousMonth:"Предыдущий месяц",nextMonth:"Следующий месяц",previousYears:"Предыдущие годы",nextYears:"Следующие годы",chooseMonth:"Выберите месяц",chooseYear:"Выберите год",presets:"Быстрый выбор",customRange:"Свой период",preset_today:"Сегодня",preset_yesterday:"Вчера",preset_last7Days:"Последние 7 дней",preset_last30Days:"Последние 30 дней",preset_thisWeek:"Эта неделя",preset_thisMonth:"Этот месяц",preset_lastMonth:"Прошлый месяц"}};class C extends(u()){constructor(){super(),this._input=null,this._documentClickHandler=this.handleDocumentClick.bind(this),this._documentKeydownHandler=this.handleDocumentKeydown.bind(this),this._viewportHandler=this.positionPanel.bind(this),this._focusCalendarOnOpen=!1,this._focusDateAfterRender=!1,this._panelId="sf-datepicker-panel-"+ ++p,this.state={openAbove:!1,yearPageStart:null,activeDate:""},this.refs={input:this.createRef(),datePickerRoot:this.createRef(),datePickerPanel:this.createRef()}}static get props(){return{templateName:{attribute:"template",default:"default"},value:{default:""},date:{default:""},startValue:{attribute:"start-value",default:""},endValue:{attribute:"end-value",default:""},maxDate:{default:""},minDate:{default:""},range:{type:Boolean,default:!1},month:{type:Number,default:null},year:{type:Number,default:null},context:{default:""},weekStart:{type:Number,default:null},locale:{default:""},format:{default:"DD.MM.YYYY"},rootClass:{default:""},closeOnSelect:{type:Boolean,default:!0},input:{type:Boolean,default:!0},open:{type:Boolean,default:!1},portal:{type:Boolean,default:!0},inputType:{attribute:"input-type",default:"bordered"},size:{default:"1"},inputSize:{attribute:"input-size",default:"1"},inputName:{attribute:"input-name",default:""},name:{attribute:"name",default:""},placeholder:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},iconStart:{type:String,attribute:"icon-start",default:null},leftIcon:{attribute:"left-icon",default:"calendar_today"},inputRootClass:{attribute:"input-root-class",default:""},mask:{type:Boolean,default:!1},maskPattern:{attribute:"mask-pattern",default:""},maskLazy:{attribute:"mask-lazy",default:!1},maskPlaceholderChar:{attribute:"mask-placeholder-char",default:"_"},maskOptions:{attribute:"mask-options",default:""},presets:{default:""},preset:{default:""}}}connectedCallback(){this.upgradeProperty("value"),this.upgradeProperty("presets"),super.connectedCallback()}upgradeProperty(t){if(!Object.prototype.hasOwnProperty.call(this,t))return;const e=this[t];delete this[t],this[t]=e}get componentName(){return"datepicker"}get templateName(){return this.getAttribute("template")||"default"}get selectedDate(){return D(this.date,this.format)}get primaryDate(){const t=this.activePreset;return t?t.to:this.selectedDate||this.startDate}get presets(){return this._presetList??(this.getAttribute("presets")||"")}set presets(t){if(Array.isArray(t))return this._presetList=t,void this.requestComponentUpdate("presets");this._presetList=null,this.setState({presets:t?String(t):""})}get preset(){return this.getAttribute("preset")||""}set preset(t){this.setState({preset:t?String(t):""})}get presetItems(){if(!this.range)return[];const t=Array.isArray(this.presets)?this.presets:String(this.presets).split(/[\s,]+/).filter(Boolean),e=new Date,a=this.setMinDate(),s=this.setMaxDate();return t.map(t=>{const n="string"==typeof t?{id:t,relative:t}:{...t};if(!n?.id)return null;let r=null;if(n.relative)r=F(n.relative,e,this.weekStart);else if(Array.isArray(n.range)){const t=D(n.range[0],this.format),e=D(n.range[1],this.format);t&&e&&(r=w(t,e)<=0?[t,e]:[e,t])}if(!r)return null;let[i,l]=r;a&&w(i,a)<0&&(i=a),s&&w(l,s)>0&&(l=s);const u=w(i,l)>0,h=n.label||(V.includes(n.id)?(0,o.pageText)(T,(c=n.id,`preset_${String(c).replace(/-([a-z0-9])/g,(t,e)=>e.toUpperCase())}`),this,"sf-datepicker"):n.id);var c;return{id:String(n.id),label:h,relative:n.relative||null,from:i,to:l,disabled:u,pressed:this.preset===String(n.id)}}).filter(Boolean)}get activePreset(){const t=this.preset;if(!t||!this.range)return null;const e=this.presetItems.find(e=>e.id===t);return e&&!e.disabled?e:null}get startDate(){return D(this.startValue,this.format)}get endDate(){return D(this.endValue,this.format)}get date(){return this.getAttribute("date")||this.getAttribute("value")||""}get value(){return this.range?[this.startValue,this.endValue]:this.date}set value(t){if(Array.isArray(t)){const[e="",a=""]=t;return void this.setState({date:e||"",startValue:e||"",endValue:a||""})}if(t&&"object"==typeof t){const e=t.start||t.startValue||t.date||"",a=t.end||t.endValue||"";return void this.setState({date:t.date||e||"",startValue:e,endValue:a})}this.setState({date:t?String(t):"",startValue:"",endValue:""})}setMaxDate(){return D(this.maxDate,this.format)}setMinDate(){return D(this.minDate,this.format)}get maxDate(){return this.getAttribute("max-date")||""}get minDate(){return this.getAttribute("min-date")||""}set date(t){this.setState({date:t?String(t):""})}get startValue(){const t=this.activePreset;return t?m(t.from):this.getAttribute("start-value")||""}set startValue(t){this.setState({startValue:t?String(t):""})}get endValue(){const t=this.activePreset;return t?m(t.to):this.getAttribute("end-value")||""}set endValue(t){this.setState({endValue:t?String(t):""})}get range(){return this.getBooleanAttr("range",!1)}get input(){return this.getBooleanAttr("input",!0)}get open(){return this.getBooleanAttr("open",!1)}get portal(){return this.getBooleanAttr("portal",!0)}get inputType(){return this.getAttribute("input-type")||"bordered"}get size(){return(0,n.id)(this.getAttribute("size")||this.getAttribute("input-size")||"1","sf-datepicker")}get inputSize(){return this.size}get inputName(){return this.getAttribute("input-name")||this.getAttribute("name")||""}get placeholder(){return this.getAttribute("placeholder")||""}get label(){return this.getAttribute("label")||""}get disabled(){return this.getBooleanAttr("disabled",!1)}get required(){return this.getBooleanAttr("required",!1)}get closeOnSelect(){return this.getBooleanAttr("close-on-select",!0)}get leftIcon(){return this.hasAttribute("icon-start")?this.getAttribute("icon-start"):this.getAttribute("left-icon")||"calendar_today"}get iconStart(){return this.leftIcon}get inputRootClass(){return this.getAttribute("input-root-class")||""}get mask(){return this.getBooleanAttr("mask",!1)}get maskPattern(){return this.getAttribute("mask-pattern")||this.formatToMask(this.format)}get maskLazy(){return!!this.hasAttribute("mask-lazy")&&this.getBooleanAttr("mask-lazy",!1)}get maskPlaceholderChar(){return this.getAttribute("mask-placeholder-char")||"_"}get maskOptions(){return this.getAttribute("mask-options")||""}get year(){const t=this.primaryDate,e=t?t.getFullYear():(new Date).getFullYear();return this.hasAttribute("year")?this.getNumberAttr("year",e):e}set year(t){this.setState({year:null==t||""===t?"":String((0,s.toNumber)(t,(new Date).getFullYear()))})}get month(){const t=this.primaryDate,e=t?t.getMonth():(new Date).getMonth();return this.hasAttribute("month")?v(this.getAttribute("month"),e):e}set month(t){this.setState({month:null==t||""===t?"":String(v(t,(new Date).getMonth()))})}get contextMode(){return this.getEnumAttr("context",["month","year",""],"")}get weekStart(){if(this.hasAttribute("week-start")){const t=this.getNumberAttr("week-start",1);return Number.isInteger(t)&&t>=0&&t<=7?t%7:1}try{const t=new Intl.Locale(this.locale),e="function"==typeof t.getWeekInfo?t.getWeekInfo():t.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 1}get locale(){return $(this.getAttribute("locale"),this)}get format(){return this.getAttribute("format")||"DD.MM.YYYY"}get formattedValue(){return f(this.selectedDate,this.format)}get formattedStartValue(){return f(this.startDate,this.format)}get formattedEndValue(){return f(this.endDate,this.format)}get displayValue(){return this.range?this.formattedStartValue&&this.formattedEndValue?`${this.formattedStartValue} - ${this.formattedEndValue}`:this.formattedStartValue||this.formattedEndValue||"":this.formattedValue}get displayDate(){return new Date(this.year,this.month,1)}get isRtl(){return"rtl"===(this.closest("[dir]")?.getAttribute("dir")||document.documentElement?.dir)}get labels(){return t=this,Object.fromEntries(["previousMonth","nextMonth","previousYears","nextYears","chooseMonth","chooseYear","presets","customRange"].map(e=>[e,(0,o.pageText)(T,e,t,"sf-datepicker")]));var t}get weekdays(){return Y(this.locale,this.weekStart)}get calendarLabel(){try{return new Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(this.displayDate)}catch{return`${this.month+1}.${this.year}`}}get activeDate(){const t=y(this.state.activeDate)||this.primaryDate||this.displayDate,e=this.setMinDate(),a=this.setMaxDate();return e&&w(t,e)<0?e:a&&w(t,a)>0?a:t}get normalizedRange(){const t=this.startDate,e=this.endDate;return t&&e?w(t,e)<=0?{startDate:t,endDate:e}:{startDate:e,endDate:t}:{startDate:t,endDate:e}}get days(){const t=(new Date(this.year,this.month,1).getDay()-this.weekStart+7)%7,e=new Date(this.year,this.month,1-t),{startDate:a,endDate:s}=this.normalizedRange,n=Boolean(this.startValue&&this.endValue),r=this.setMinDate(),i=this.setMaxDate(),o=this.activeDate,l=new Date;return Array.from({length:42}).map((t,u)=>{const h=new Date(e.getFullYear(),e.getMonth(),e.getDate()+u),c=h.getTime(),d=Boolean(r&&c<r.getTime()||i&&c>i.getTime());return{date:h,value:m(h),formattedValue:f(h,this.format),label:A(h,this.locale),day:h.getDate(),today:k(h,l),currentMonth:h.getMonth()===this.month,weekend:[0,6].includes(h.getDay()),disabled:d,selected:this.range?k(h,a)||k(h,s):k(h,this.selectedDate),rangeStart:this.range&&n&&k(h,a),rangeEnd:this.range&&n&&k(h,s),rangeSelected:this.range&&n&&M(h,a,s),tabIndex:!d&&k(h,o)?0:-1}})}get months(){const t=this.setMinDate(),e=this.setMaxDate(),a=t?new Date(t.getFullYear(),t.getMonth(),1):null,s=e?new Date(e.getFullYear(),e.getMonth(),1):null;return Array.from({length:12}).map((t,e)=>{const n=new Date(this.year,e,1).getTime(),r=Boolean(a&&n<a.getTime()||s&&n>s.getTime());return{index:e,label:P(e,this.locale),selected:e===this.month,disabled:r}})}get years(){const t=this.setMinDate(),e=this.setMaxDate(),a=this.yearPageStart;return Array.from({length:d}).map((s,n)=>{const r=a+n;return{year:r,disabled:Boolean(t&&r<t.getFullYear()||e&&r>e.getFullYear()),selected:r===this.year}})}get yearPageStart(){return this.state.yearPageStart??this.getYearPageStart(this.year)}get yearPageEnd(){return this.yearPageStart+d-1}getYearPageStart(t=this.year){const e=(0,s.toNumber)(t,(new Date).getFullYear());return e-e%d}formatToMask=t=>{let e=String(t).replace(/[A-Za-z]/g,"0");return this.range&&(e+=` - ${e}`),e};setContext(t=""){return this.setState({context:t||""}),this}toggleContext(t){const e=this.contextMode===t?"":t,a={context:e};return"year"===e&&(a.yearPageStart=this.getYearPageStart(this.year)),this.setState(a),this}shiftYearPage(t=1){return this.set({yearPageStart:this.yearPageStart+d*t}),this}shiftMonth(t=1){const e=new Date(this.year,this.month+t,1),a=this.setMinDate(),s=this.setMaxDate();return a&&e<new Date(a.getFullYear(),a.getMonth(),1)||s&&e>new Date(s.getFullYear(),s.getMonth(),1)||(this.setState({year:e.getFullYear(),month:e.getMonth(),context:""}),this.set({activeDate:m(e)})),this}setActiveDate(t){const e=y(t);return e&&this.state.activeDate!==t?(this.set({activeDate:m(e)}),this):this}moveActiveDate(t){const e=new Date(this.activeDate);e.setDate(e.getDate()+t);const a=this.setMinDate(),s=this.setMaxDate();return a&&w(e,a)<0||s&&w(e,s)>0||(this._focusDateAfterRender=!0,this.setState({year:e.getFullYear(),month:e.getMonth(),context:""}),this.set({activeDate:m(e)})),this}openPanel({focusCalendar:t=!1}={}){return this.disabled?this:(this._focusCalendarOnOpen=t,this.state.activeDate||this.set({activeDate:m(this.activeDate)}),this.open?(this.positionPanel(),this):(this.setState({open:!0}),this))}closePanel({restoreFocus:t=!1}={}){return this.open?(this.setState({open:!1,context:""}),t&&requestAnimationFrame(()=>this._input?.focus?.()),this):this}togglePanel(){return this.open?this.closePanel():this.openPanel()}handleInputClick(t){t?.preventDefault?.(),t?.stopPropagation?.(),this.openPanel()}handleInputKeydown(t){["ArrowDown","Enter"," "].includes(t.key)&&(t.preventDefault(),this.openPanel({focusCalendar:!0}))}handleDayKeydown(t,e){const a=this.isRtl?-1:1,s={ArrowLeft:-a,ArrowRight:a,ArrowUp:-7,ArrowDown:7};if(Object.prototype.hasOwnProperty.call(s,t.key))return t.preventDefault(),void this.moveActiveDate(s[t.key]);if("Home"===t.key||"End"===t.key){t.preventDefault();const a=((e?.date||this.activeDate).getDay()-this.weekStart+7)%7;return void this.moveActiveDate("Home"===t.key?-a:6-a)}if("PageUp"===t.key||"PageDown"===t.key){t.preventDefault();const e="PageUp"===t.key?-1:1;let a=S(this.activeDate,e);const s=this.setMinDate(),n=this.setMaxDate();s&&w(a,s)<0&&(a=s),n&&w(a,n)>0&&(a=n),this._focusDateAfterRender=!0,this.setState({year:a.getFullYear(),month:a.getMonth()}),this.set({activeDate:m(a)})}}handlePanelClick(t){t?.stopPropagation?.()}handleDocumentClick(t){if(!this.open)return;const e=t.target;this.contains(e)||this.refs.datePickerPanel.value?.contains?.(e)||this.closePanel()}handleDocumentKeydown(t){this.open&&"Escape"===t.key&&(t.preventDefault(),this.contextMode?this.setContext(""):(this.closePanel(),requestAnimationFrame(()=>this._input?.focus?.())))}syncOverlayListeners(){if(this.input&&this.open)return document.addEventListener("click",this._documentClickHandler),void document.addEventListener("keydown",this._documentKeydownHandler);this.removeOverlayListeners()}removeOverlayListeners(){document.removeEventListener("click",this._documentClickHandler),document.removeEventListener("keydown",this._documentKeydownHandler),this.stopPanelPosition(),window.removeEventListener("resize",this._viewportHandler),document.removeEventListener("scroll",this._viewportHandler,!0),window.visualViewport?.removeEventListener("resize",this._viewportHandler),window.visualViewport?.removeEventListener("scroll",this._viewportHandler)}positionPanel(){const t=this.refs.datePickerPanel.value,e=this._input?.closest(".sf-input-field")||this._input||this.querySelector("sf-input");if(this.isConnected&&this.input&&this.portal&&this.open&&t?.isConnected&&e)return this._panelAnchor&&this._panelAnchorPanel===t&&this._panelAnchorTrigger===e?void this._panelAnchor.update():(this.stopPanelPosition(),Object.assign(t.style,{overflowY:"auto",zIndex:"var(--sf-z-index-9)"}),this._panelAnchorPanel=t,this._panelAnchorTrigger=e,void(this._panelAnchor=(globalThis.SF?.Position||h()).anchor(e,t,{side:"block-end",align:"start",onPosition:({side:t})=>{const e="block-start"===t;Boolean(this.state.openAbove)!==e&&this.set({openAbove:e})}})));this.stopPanelPosition()}stopPanelPosition(){this._panelAnchor?.stop(),this._panelAnchor=null,this._panelAnchorPanel=null,this._panelAnchorTrigger=null}selectDate(t){return!t?.date||t.disabled?this:this.range?(this.selectRangeDate(t),this):(this.setState({year:t.date.getFullYear(),month:t.date.getMonth(),date:t.value,context:""}),this.set({activeDate:t.value}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this)}selectRangeDate(t){if(!this.startValue||this.startValue&&this.endValue)return this.setState({year:t.date.getFullYear(),month:t.date.getMonth(),startValue:t.value,endValue:"",date:t.value,context:"",preset:""}),this.set({activeDate:t.value}),this.emitChange(),this;const e=this.startDate,a={year:t.date.getFullYear(),month:t.date.getMonth(),context:"",preset:""};return e&&w(t.date,e)<0?(a.startValue=t.value,a.endValue=this.startValue,a.date=t.value):(a.endValue=t.value,a.date=this.startValue),this.setState(a),this.set({activeDate:t.value}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this}choosePreset(t){if(!t||t.disabled)return this;const e=m(t.from),a=m(t.to);return this.setState({preset:t.id,startValue:e,endValue:a,date:e,year:t.to.getFullYear(),month:t.to.getMonth(),context:""}),this.set({activeDate:a}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this}chooseCustomRange(){return this.preset&&this.setState({preset:"",startValue:"",endValue:"",date:""}),this._focusDateAfterRender=!0,this.requestComponentUpdate("custom-range"),this}handlePresetKeydown(t){const e={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};if(!(t.key in e)&&"Home"!==t.key&&"End"!==t.key)return;const a=[...t.currentTarget.querySelectorAll("button:not(:disabled)")];if(!a.length)return;t.preventDefault();const s=a.indexOf(t.target);let n="Home"===t.key?0:"End"===t.key?a.length-1:s+e[t.key];!this.isRtl||"ArrowRight"!==t.key&&"ArrowLeft"!==t.key||(n=s-e[t.key]),n=(n+a.length)%a.length,a.forEach((t,e)=>t.setAttribute("tabindex",e===n?"0":"-1")),a[n].focus()}selectMonth(t){return!t||t.disabled||(this.setState({month:t.index,context:""}),this.set({activeDate:m(new Date(this.year,t.index,1))})),this}selectYear(t){if(!t||t.disabled)return this;const e={year:t.year,context:""},a=this.getClosestEnabledMonth(t.year,this.month);return a!==this.month&&(e.month=a),this.setState(e),this.set({activeDate:m(new Date(t.year,a,1))}),this}getClosestEnabledMonth(t,e){const a=this.setMinDate(),s=this.setMaxDate();return a&&t===a.getFullYear()&&e<a.getMonth()?a.getMonth():s&&t===s.getFullYear()&&e>s.getMonth()?s.getMonth():e}emitChange(){const t=this.startValue&&this.endValue?`${this.startValue}/${this.endValue}`:this.startValue||"",e=this.range?{value:[this.startValue,this.endValue],date:t,startValue:this.startValue,endValue:this.endValue,formattedValue:this.displayValue,formattedStartValue:this.formattedStartValue,formattedEndValue:this.formattedEndValue,isoValue:t,startIsoValue:this.startValue,endIsoValue:this.endValue,range:!0,format:this.format,preset:this.activePreset?this.activePreset.relative?{id:this.activePreset.id,relative:this.activePreset.relative}:{id:this.activePreset.id}:null}:{value:this.date,date:this.date,formattedValue:this.formattedValue,isoValue:this.date,range:!1,format:this.format};this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e})),this.dispatchEvent(new CustomEvent("sf-datepicker-change",{bubbles:!0,composed:!0,detail:e})),this.emitComponentEvent("change",e)}templateContext(){const t=this.getPropsContext();return this.createTemplateContext({...t,component:this,date:this.date,formattedValue:this.formattedValue,displayValue:this.displayValue,startValue:this.startValue,formattedStartValue:this.formattedStartValue,endValue:this.endValue,formattedEndValue:this.formattedEndValue,range:this.range,format:this.format,selectedDate:this.selectedDate,startDate:this.startDate,endDate:this.endDate,year:this.year,month:this.month,monthLabel:P(this.month,this.locale),calendarLabel:this.calendarLabel,labels:this.labels,weekdays:this.weekdays,panelId:this._panelId,previousIcon:this.isRtl?"chevron_right":"chevron_left",nextIcon:this.isRtl?"chevron_left":"chevron_right",context:this.contextMode,locale:this.locale,days:this.days,presetItems:this.presetItems,months:this.months,years:this.years,yearPageStart:this.yearPageStart,yearPageEnd:this.yearPageEnd,rootClass:this.getRootClass(),rootStyle:this.getRootStyle(),openAbove:Boolean(this.state.openAbove),input:this.input,open:this.open,portal:this.portal,inputType:this.inputType,inputSize:this.inputSize,inputName:this.inputName,placeholder:this.placeholder,label:this.label,disabled:this.disabled,required:this.required,leftIcon:this.leftIcon,iconStart:this.leftIcon,inputRootClass:this.inputRootClass,mask:this.mask,maskPattern:this.maskPattern,maskLazy:this.maskLazy,maskPlaceholderChar:this.maskPlaceholderChar,maskOptions:this.maskOptions})}template(){return(0,r.P)(this.templateContext())}afterRender(){this._input=this.refs.input?.value?.querySelector("input")||null,this._input&&(this._input.setAttribute("aria-haspopup","dialog"),this._input.setAttribute("aria-expanded",this.open?"true":"false"),this._input.setAttribute("aria-controls",this._panelId));const t=this.querySelector(".sf-datepicker-month-toggle button"),e=this.querySelector(".sf-datepicker-year-toggle button");t?.setAttribute("aria-expanded","month"===this.contextMode?"true":"false"),e?.setAttribute("aria-expanded","year"===this.contextMode?"true":"false"),this.syncOverlayListeners(),requestAnimationFrame(()=>{if(this.positionPanel(),this._focusCalendarOnOpen||this._focusDateAfterRender){const t=this.querySelector(`.sf-datepicker-day[data-date="${m(this.activeDate)}"]`);t?.focus?.(),this._focusCalendarOnOpen=!1,this._focusDateAfterRender=!1}})}onDisconnected(){this.removeOverlayListeners(),super.onDisconnected()}get data(){return{value:this.value,date:this.date,formattedValue:this.formattedValue,displayValue:this.displayValue,startValue:this.startValue,formattedStartValue:this.formattedStartValue,endValue:this.endValue,formattedEndValue:this.formattedEndValue,range:this.range,format:this.format,year:this.year,month:this.month,context:this.contextMode,maxDate:this.maxDate,minDate:this.minDate,locale:this.locale,input:this.input,open:this.open,portal:this.portal,mask:this.mask,maskPattern:this.maskPattern,maskOptions:this.maskOptions,presets:this.presetItems.map(({id:t,label:e,relative:a,disabled:s})=>({id:t,label:e,relative:a,disabled:s})),preset:this.preset}}}C.define("sf-datepicker"),e()}catch(E){e(E)}})},"77b2f4107e3b"(t,e,a){a.a(t,async(t,s)=>{try{a.d(e,{P:()=>b});var n=a("ddf1cdb42ecc"),r=a("5a8eddcd589d"),i=t([n,r]);[n,r]=i.then?(await i)():i;function o(...t){return t.flat().filter(Boolean).join(" ")}function l(t){return n.html`
|
|
1
|
+
(()=>{"use strict";var t={"98e26702f55a"(t,e,a){function s(){const t=globalThis.SF=globalThis.SF||{};return t.__deprecationNotes instanceof Map||Object.defineProperty(t,"__deprecationNotes",{value:new Map,configurable:!0}),t.__deprecationNotes}function n({component:t="",kind:e="attribute",attribute:a="",from:n,to:r=null}={}){if(!n)return;const i=[t,e,a,n].join("|"),o=s(),l=o.get(i);if(l)l.count+=1;else if(o.set(i,{component:t,kind:e,attribute:a,from:n,to:r,count:1}),function(){const t=globalThis.document?.documentElement;return"warn"===t?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const s=t?`${t}: `:"",i="value"===e?`${a}="${n}"`:`${e} ${n}`;globalThis.console?.warn?.(`[SIMAI Framework] ${s}${i} is a legacy name${r?`; write ${r}`:""}. See contracts/changes/journal.json.`)}}if(a.d(e,{id:()=>l}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const t=globalThis.SF.deprecations||{};t.list=function(){return[...s().values()].map(t=>({...t}))},t.clear=function(){s().clear()},t.note=n,globalThis.SF.deprecations=t}const r=Object.freeze(["1/2","1","2"]),i=Object.freeze({"1/3":"1/2",3:"2"}),o=new Set;function l(t,e="field",a="1"){const s=String(t??"").trim().toLowerCase();if(r.includes(s))return s;if(Object.hasOwn(i,s)){const t=i[s];n({component:e,kind:"value",attribute:"size",from:s,to:t});const a=`${e}:${s}`;return o.has(a)||"undefined"==typeof console||(o.add(a),console.warn(`[SIMAI Framework] ${e}: size ${s} is retired for form fields; rendering size ${t}.`)),t}return a}},b9b65955223a(t,e,a){a.a(t,async(t,e)=>{try{var s=a("fbe0570fcc69"),n=a("98e26702f55a"),r=a("77b2f4107e3b"),i=a("5c1dc214bb5e"),o=a("0d662e4d7d63"),l=t([s,r,i,o]);[s,r,i,o]=l.then?(await l)():l;var h=a.n(s),u=a.n(i);const d=/^(\d{4})-(\d{2})-(\d{2})$/,c=18;let p=0;function g(t){return String(t).padStart(2,"0")}function m(t){return`${t.getFullYear()}-${g(t.getMonth()+1)}-${g(t.getDate())}`}function f(t,e="YYYY.MM.DD"){if(!t)return"";const a={YYYY:String(t.getFullYear()),YY:String(t.getFullYear()).slice(-2),MM:g(t.getMonth()+1),DD:g(t.getDate())};return String(e||"YYYY.MM.DD").replace(/YYYY|YY|MM|DD/g,t=>a[t]||t)}function b(t){return t instanceof Date&&!Number.isNaN(t.getTime())}function y(t){if(!t)return null;const e=String(t).match(d);if(!e)return null;const[,a,s,n]=e,r=new Date(Number(a),Number(s)-1,Number(n));return r.getFullYear()!==Number(a)||r.getMonth()!==Number(s)-1||r.getDate()!==Number(n)?null:r}function v(t,e="DD.MM.YYYY"){if(!t)return null;if(t instanceof Date)return b(t)?new Date(t.getFullYear(),t.getMonth(),t.getDate()):null;const a=String(t).trim(),s=y(a);if(s)return s;const n=a.match(/\d+/g),r=String(e||"DD.MM.YYYY").match(/YYYY|YY|MM|DD/g);if(!n||!r||n.length<3||r.length<3)return null;const i={};r.slice(0,3).forEach((t,e)=>{i[t]=Number(n[e])});let o=i.YYYY;!o&&i.YY&&(o=i.YY+2e3);const l=i.MM,h=i.DD;if(!o||!l||!h)return null;const u=new Date(o,l-1,h);return u.getFullYear()!==o||u.getMonth()!==l-1||u.getDate()!==h?null:u}function D(t,e=0){const a=(0,s.toNumber)(t,e);return Number.isFinite(a)?Math.max(0,Math.min(11,a)):e}function k(t,e){return t&&e&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function S(t,e){if(!t||!e)return 0;return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function w(t,e){const a=new Date(t.getFullYear(),t.getMonth()+e,1),s=new Date(a.getFullYear(),a.getMonth()+1,0).getDate();return a.setDate(Math.min(t.getDate(),s)),a}function M(t,e,a){return!!(t&&e&&a)&&(S(t,e)>0&&S(t,a)<0)}function $(t="",e=null){const a=String(t||"").trim();return a||(0,o.pageLocale)(e??globalThis.document?.documentElement??null)}function x(t=""){const e=String(t||"");return e?`${e.charAt(0).toLocaleUpperCase()}${e.slice(1)}`:""}function P(t,e){try{return x(new Intl.DateTimeFormat(e,{month:"long"}).format(new Date(2026,t,1)))}catch{return String(t+1)}}function A(t,e){try{return new Intl.DateTimeFormat(e,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(t)}catch{return m(t)}}function Y(t,e=1){const a=new Date(2026,0,4);return Array.from({length:7},(s,n)=>{const r=new Date(a);r.setDate(a.getDate()+(e+n)%7);try{return new Intl.DateTimeFormat(t,{weekday:"short"}).format(r)}catch{return String((e+n)%7)}})}const V=["today","yesterday","last-7-days","last-30-days","this-week","this-month","last-month"];function _(t,e){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+e)}function F(t,e,a=1){const s=new Date(e.getFullYear(),e.getMonth(),e.getDate());switch(t){case"today":return[s,s];case"yesterday":return[_(s,-1),_(s,-1)];case"last-7-days":return[_(s,-6),s];case"last-30-days":return[_(s,-29),s];case"this-week":return[_(s,-(s.getDay()-a+7)%7),s];case"this-month":return[new Date(s.getFullYear(),s.getMonth(),1),s];case"last-month":return[new Date(s.getFullYear(),s.getMonth()-1,1),new Date(s.getFullYear(),s.getMonth(),0)];default:return null}}const C={en:{previousMonth:"Previous month",nextMonth:"Next month",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",presets:"Quick ranges",customRange:"Custom range",preset_today:"Today",preset_yesterday:"Yesterday",preset_last7Days:"Last 7 days",preset_last30Days:"Last 30 days",preset_thisWeek:"This week",preset_thisMonth:"This month",preset_lastMonth:"Last month"},ru:{previousMonth:"Предыдущий месяц",nextMonth:"Следующий месяц",previousYears:"Предыдущие годы",nextYears:"Следующие годы",chooseMonth:"Выберите месяц",chooseYear:"Выберите год",presets:"Быстрый выбор",customRange:"Свой период",preset_today:"Сегодня",preset_yesterday:"Вчера",preset_last7Days:"Последние 7 дней",preset_last30Days:"Последние 30 дней",preset_thisWeek:"Эта неделя",preset_thisMonth:"Этот месяц",preset_lastMonth:"Прошлый месяц"}};class T extends(h()){constructor(){super(),this._input=null,this._documentClickHandler=this.handleDocumentClick.bind(this),this._documentKeydownHandler=this.handleDocumentKeydown.bind(this),this._viewportHandler=this.positionPanel.bind(this),this._focusCalendarOnOpen=!1,this._focusDateAfterRender=!1,this._panelId="sf-datepicker-panel-"+ ++p,this.state={openAbove:!1,yearPageStart:null,activeDate:""},this.refs={input:this.createRef(),datePickerRoot:this.createRef(),datePickerPanel:this.createRef()}}static get props(){return{templateName:{attribute:"template",default:"default"},value:{default:""},date:{default:""},startValue:{attribute:"start-value",default:""},endValue:{attribute:"end-value",default:""},maxDate:{default:""},minDate:{default:""},range:{type:Boolean,default:!1},month:{type:Number,default:null},year:{type:Number,default:null},context:{default:""},weekStart:{type:Number,default:null},locale:{default:""},format:{default:"DD.MM.YYYY"},rootClass:{default:""},closeOnSelect:{type:Boolean,default:!0},input:{type:Boolean,default:!0},open:{type:Boolean,default:!1},portal:{type:Boolean,default:!0},inputType:{attribute:"input-type",default:"bordered"},size:{default:"1"},inputSize:{attribute:"input-size",default:"1"},inputName:{attribute:"input-name",default:""},name:{attribute:"name",default:""},placeholder:{default:""},label:{default:""},ariaLabel:{attribute:"aria-label",default:""},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},iconStart:{type:String,attribute:"icon-start",default:null},leftIcon:{attribute:"left-icon",default:"calendar_today"},inputRootClass:{attribute:"input-root-class",default:""},mask:{type:Boolean,default:!1},maskPattern:{attribute:"mask-pattern",default:""},maskLazy:{attribute:"mask-lazy",default:!1},maskPlaceholderChar:{attribute:"mask-placeholder-char",default:"_"},maskOptions:{attribute:"mask-options",default:""},presets:{default:""},preset:{default:""}}}connectedCallback(){this.upgradeProperty("value"),this.upgradeProperty("presets"),super.connectedCallback()}upgradeProperty(t){if(!Object.prototype.hasOwnProperty.call(this,t))return;const e=this[t];delete this[t],this[t]=e}get componentName(){return"datepicker"}get templateName(){return this.getAttribute("template")||"default"}get selectedDate(){return v(this.date,this.format)}get primaryDate(){const t=this.activePreset;return t?t.to:this.selectedDate||this.startDate}get presets(){return this._presetList??(this.getAttribute("presets")||"")}set presets(t){if(Array.isArray(t))return this._presetList=t,void this.requestComponentUpdate("presets");this._presetList=null,this.setState({presets:t?String(t):""})}get preset(){return this.getAttribute("preset")||""}set preset(t){this.setState({preset:t?String(t):""})}get presetItems(){if(!this.range)return[];const t=Array.isArray(this.presets)?this.presets:String(this.presets).split(/[\s,]+/).filter(Boolean),e=new Date,a=this.setMinDate(),s=this.setMaxDate();return t.map(t=>{const n="string"==typeof t?{id:t,relative:t}:{...t};if(!n?.id)return null;let r=null;if(n.relative)r=F(n.relative,e,this.weekStart);else if(Array.isArray(n.range)){const t=v(n.range[0],this.format),e=v(n.range[1],this.format);t&&e&&(r=S(t,e)<=0?[t,e]:[e,t])}if(!r)return null;let[i,l]=r;a&&S(i,a)<0&&(i=a),s&&S(l,s)>0&&(l=s);const h=S(i,l)>0,u=n.label||(V.includes(n.id)?(0,o.pageText)(C,(d=n.id,`preset_${String(d).replace(/-([a-z0-9])/g,(t,e)=>e.toUpperCase())}`),this,"sf-datepicker"):n.id);var d;return{id:String(n.id),label:u,relative:n.relative||null,from:i,to:l,disabled:h,pressed:this.preset===String(n.id)}}).filter(Boolean)}get activePreset(){const t=this.preset;if(!t||!this.range)return null;const e=this.presetItems.find(e=>e.id===t);return e&&!e.disabled?e:null}get startDate(){return v(this.startValue,this.format)}get endDate(){return v(this.endValue,this.format)}get date(){return this.getAttribute("date")||this.getAttribute("value")||""}get value(){return this.range?[this.startValue,this.endValue]:this.date}set value(t){if(Array.isArray(t)){const[e="",a=""]=t;return void this.setState({date:e||"",startValue:e||"",endValue:a||""})}if(t&&"object"==typeof t){const e=t.start||t.startValue||t.date||"",a=t.end||t.endValue||"";return void this.setState({date:t.date||e||"",startValue:e,endValue:a})}this.setState({date:t?String(t):"",startValue:"",endValue:""})}setMaxDate(){return v(this.maxDate,this.format)}setMinDate(){return v(this.minDate,this.format)}get maxDate(){return this.getAttribute("max-date")||""}get minDate(){return this.getAttribute("min-date")||""}set date(t){this.setState({date:t?String(t):""})}get startValue(){const t=this.activePreset;return t?m(t.from):this.getAttribute("start-value")||""}set startValue(t){this.setState({startValue:t?String(t):""})}get endValue(){const t=this.activePreset;return t?m(t.to):this.getAttribute("end-value")||""}set endValue(t){this.setState({endValue:t?String(t):""})}get range(){return this.getBooleanAttr("range",!1)}get input(){return this.getBooleanAttr("input",!0)}get open(){return this.getBooleanAttr("open",!1)}get portal(){return this.getBooleanAttr("portal",!0)}get inputType(){return this.getAttribute("input-type")||"bordered"}get size(){return(0,n.id)(this.getAttribute("size")||this.getAttribute("input-size")||"1","sf-datepicker")}get inputSize(){return this.size}get inputName(){return this.getAttribute("input-name")||this.getAttribute("name")||""}get placeholder(){return this.getAttribute("placeholder")||""}get label(){return this.getAttribute("label")||""}get disabled(){return this.getBooleanAttr("disabled",!1)}get required(){return this.getBooleanAttr("required",!1)}get closeOnSelect(){return this.getBooleanAttr("close-on-select",!0)}get leftIcon(){return this.hasAttribute("icon-start")?this.getAttribute("icon-start"):this.getAttribute("left-icon")||"calendar_today"}get iconStart(){return this.leftIcon}get inputRootClass(){return this.getAttribute("input-root-class")||""}get mask(){return this.getBooleanAttr("mask",!1)}get maskPattern(){return this.getAttribute("mask-pattern")||this.formatToMask(this.format)}get maskLazy(){return!!this.hasAttribute("mask-lazy")&&this.getBooleanAttr("mask-lazy",!1)}get maskPlaceholderChar(){return this.getAttribute("mask-placeholder-char")||"_"}get maskOptions(){return this.getAttribute("mask-options")||""}get year(){const t=this.primaryDate,e=t?t.getFullYear():(new Date).getFullYear();return this.hasAttribute("year")?this.getNumberAttr("year",e):e}set year(t){this.setState({year:null==t||""===t?"":String((0,s.toNumber)(t,(new Date).getFullYear()))})}get month(){const t=this.primaryDate,e=t?t.getMonth():(new Date).getMonth();return this.hasAttribute("month")?D(this.getAttribute("month"),e):e}set month(t){this.setState({month:null==t||""===t?"":String(D(t,(new Date).getMonth()))})}get contextMode(){return this.getEnumAttr("context",["month","year",""],"")}get weekStart(){if(this.hasAttribute("week-start")){const t=this.getNumberAttr("week-start",1);return Number.isInteger(t)&&t>=0&&t<=7?t%7:1}try{const t=new Intl.Locale(this.locale),e="function"==typeof t.getWeekInfo?t.getWeekInfo():t.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 1}get locale(){return $(this.getAttribute("locale"),this)}get format(){return this.getAttribute("format")||"DD.MM.YYYY"}get ariaLabel(){return this.getProp("ariaLabel")||""}get readonly(){return this.range||this.getBooleanAttr("readonly",!1)}get typed(){return!this.readonly&&!this.disabled}get formattedValue(){return f(this.selectedDate,this.format)}get formattedStartValue(){return f(this.startDate,this.format)}get formattedEndValue(){return f(this.endDate,this.format)}get displayValue(){return this.range?this.formattedStartValue&&this.formattedEndValue?`${this.formattedStartValue} - ${this.formattedEndValue}`:this.formattedStartValue||this.formattedEndValue||"":this.formattedValue}get displayDate(){return new Date(this.year,this.month,1)}get isRtl(){return"rtl"===(this.closest("[dir]")?.getAttribute("dir")||document.documentElement?.dir)}get labels(){return t=this,Object.fromEntries(["previousMonth","nextMonth","previousYears","nextYears","chooseMonth","chooseYear","presets","customRange"].map(e=>[e,(0,o.pageText)(C,e,t,"sf-datepicker")]));var t}get weekdays(){return Y(this.locale,this.weekStart)}get calendarLabel(){try{return new Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(this.displayDate)}catch{return`${this.month+1}.${this.year}`}}get activeDate(){const t=y(this.state.activeDate)||this.primaryDate||this.displayDate,e=this.setMinDate(),a=this.setMaxDate();return e&&S(t,e)<0?e:a&&S(t,a)>0?a:t}get normalizedRange(){const t=this.startDate,e=this.endDate;return t&&e?S(t,e)<=0?{startDate:t,endDate:e}:{startDate:e,endDate:t}:{startDate:t,endDate:e}}get days(){const t=(new Date(this.year,this.month,1).getDay()-this.weekStart+7)%7,e=new Date(this.year,this.month,1-t),{startDate:a,endDate:s}=this.normalizedRange,n=Boolean(this.startValue&&this.endValue),r=this.setMinDate(),i=this.setMaxDate(),o=this.activeDate,l=new Date;return Array.from({length:42}).map((t,h)=>{const u=new Date(e.getFullYear(),e.getMonth(),e.getDate()+h),d=u.getTime(),c=Boolean(r&&d<r.getTime()||i&&d>i.getTime());return{date:u,value:m(u),formattedValue:f(u,this.format),label:A(u,this.locale),day:u.getDate(),today:k(u,l),currentMonth:u.getMonth()===this.month,weekend:[0,6].includes(u.getDay()),disabled:c,selected:this.range?k(u,a)||k(u,s):k(u,this.selectedDate),rangeStart:this.range&&n&&k(u,a),rangeEnd:this.range&&n&&k(u,s),rangeSelected:this.range&&n&&M(u,a,s),tabIndex:!c&&k(u,o)?0:-1}})}get months(){const t=this.setMinDate(),e=this.setMaxDate(),a=t?new Date(t.getFullYear(),t.getMonth(),1):null,s=e?new Date(e.getFullYear(),e.getMonth(),1):null;return Array.from({length:12}).map((t,e)=>{const n=new Date(this.year,e,1).getTime(),r=Boolean(a&&n<a.getTime()||s&&n>s.getTime());return{index:e,label:P(e,this.locale),selected:e===this.month,disabled:r}})}get years(){const t=this.setMinDate(),e=this.setMaxDate(),a=this.yearPageStart;return Array.from({length:c}).map((s,n)=>{const r=a+n;return{year:r,disabled:Boolean(t&&r<t.getFullYear()||e&&r>e.getFullYear()),selected:r===this.year}})}get yearPageStart(){return this.state.yearPageStart??this.getYearPageStart(this.year)}get yearPageEnd(){return this.yearPageStart+c-1}getYearPageStart(t=this.year){const e=(0,s.toNumber)(t,(new Date).getFullYear());return e-e%c}formatToMask=t=>{let e=String(t).replace(/[A-Za-z]/g,"0");return this.range&&(e+=` - ${e}`),e};setContext(t=""){return this.setState({context:t||""}),this}toggleContext(t){const e=this.contextMode===t?"":t,a={context:e};return"year"===e&&(a.yearPageStart=this.getYearPageStart(this.year)),this.setState(a),this}shiftYearPage(t=1){return this.set({yearPageStart:this.yearPageStart+c*t}),this}shiftMonth(t=1){const e=new Date(this.year,this.month+t,1),a=this.setMinDate(),s=this.setMaxDate();return a&&e<new Date(a.getFullYear(),a.getMonth(),1)||s&&e>new Date(s.getFullYear(),s.getMonth(),1)||(this.setState({year:e.getFullYear(),month:e.getMonth(),context:""}),this.set({activeDate:m(e)})),this}setActiveDate(t){const e=y(t);return e&&this.state.activeDate!==t?(this.set({activeDate:m(e)}),this):this}moveActiveDate(t){const e=new Date(this.activeDate);e.setDate(e.getDate()+t);const a=this.setMinDate(),s=this.setMaxDate();return a&&S(e,a)<0||s&&S(e,s)>0||(this._focusDateAfterRender=!0,this.setState({year:e.getFullYear(),month:e.getMonth(),context:""}),this.set({activeDate:m(e)})),this}openPanel({focusCalendar:t=!1}={}){return this.disabled?this:(this._focusCalendarOnOpen=t,this.state.activeDate||this.set({activeDate:m(this.activeDate)}),this.open?(this.positionPanel(),this):(this.setState({open:!0}),this))}closePanel({restoreFocus:t=!1}={}){return this.open?(this.setState({open:!1,context:""}),t&&requestAnimationFrame(()=>this._input?.focus?.()),this):this}togglePanel(){return this.open?this.closePanel():this.openPanel()}handleInputChange(t){if(!this.typed)return;"change"===t?.type&&t.stopPropagation();const e=t?.target,a=String(e?.value??"").trim(),s=()=>{const t=e?.querySelector?.("input")||e;t&&"value"in t&&(t.value=this.displayValue)};if(!a){if(!this.date)return;return this.setState({date:"",context:""}),void this.emitChange()}const n=v(a,this.format),r=this.setMinDate(),i=this.setMaxDate(),o=Boolean(n)&&(r&&S(n,r)<0||i&&S(n,i)>0);if(!n||o)return void s();const l=m(n);l!==this.date?(this.setState({year:n.getFullYear(),month:n.getMonth(),date:l,context:""}),this.set({activeDate:l}),this.emitChange()):s()}handleInputInput(t){this.typed&&t?.stopPropagation?.()}handleInputClick(t){t?.preventDefault?.(),t?.stopPropagation?.(),this.openPanel()}handleInputKeydown(t){if(this.typed){if("ArrowDown"!==t.key&&"Enter"!==t.key)return;return t.preventDefault(),"Enter"===t.key?void this.handleInputChange(t):void this.openPanel({focusCalendar:!0})}["ArrowDown","Enter"," "].includes(t.key)&&(t.preventDefault(),this.openPanel({focusCalendar:!0}))}handleDayKeydown(t,e){const a=this.isRtl?-1:1,s={ArrowLeft:-a,ArrowRight:a,ArrowUp:-7,ArrowDown:7};if(Object.prototype.hasOwnProperty.call(s,t.key))return t.preventDefault(),void this.moveActiveDate(s[t.key]);if("Home"===t.key||"End"===t.key){t.preventDefault();const a=((e?.date||this.activeDate).getDay()-this.weekStart+7)%7;return void this.moveActiveDate("Home"===t.key?-a:6-a)}if("PageUp"===t.key||"PageDown"===t.key){t.preventDefault();const e="PageUp"===t.key?-1:1;let a=w(this.activeDate,e);const s=this.setMinDate(),n=this.setMaxDate();s&&S(a,s)<0&&(a=s),n&&S(a,n)>0&&(a=n),this._focusDateAfterRender=!0,this.setState({year:a.getFullYear(),month:a.getMonth()}),this.set({activeDate:m(a)})}}handlePanelClick(t){t?.stopPropagation?.()}handleDocumentClick(t){if(!this.open)return;const e=t.target;this.contains(e)||this.refs.datePickerPanel.value?.contains?.(e)||this.closePanel()}handleDocumentKeydown(t){this.open&&"Escape"===t.key&&(t.preventDefault(),this.contextMode?this.setContext(""):(this.closePanel(),requestAnimationFrame(()=>this._input?.focus?.())))}syncOverlayListeners(){if(this.input&&this.open)return document.addEventListener("click",this._documentClickHandler),void document.addEventListener("keydown",this._documentKeydownHandler);this.removeOverlayListeners()}removeOverlayListeners(){document.removeEventListener("click",this._documentClickHandler),document.removeEventListener("keydown",this._documentKeydownHandler),this.stopPanelPosition(),window.removeEventListener("resize",this._viewportHandler),document.removeEventListener("scroll",this._viewportHandler,!0),window.visualViewport?.removeEventListener("resize",this._viewportHandler),window.visualViewport?.removeEventListener("scroll",this._viewportHandler)}positionPanel(){const t=this.refs.datePickerPanel.value,e=this._input?.closest(".sf-input-field")||this._input||this.querySelector("sf-input");if(this.isConnected&&this.input&&this.portal&&this.open&&t?.isConnected&&e)return this._panelAnchor&&this._panelAnchorPanel===t&&this._panelAnchorTrigger===e?void this._panelAnchor.update():(this.stopPanelPosition(),Object.assign(t.style,{overflowY:"auto",zIndex:"var(--sf-z-index-9)"}),this._panelAnchorPanel=t,this._panelAnchorTrigger=e,void(this._panelAnchor=(globalThis.SF?.Position||u()).anchor(e,t,{side:"block-end",align:"start",onPosition:({side:t})=>{const e="block-start"===t;Boolean(this.state.openAbove)!==e&&this.set({openAbove:e})}})));this.stopPanelPosition()}stopPanelPosition(){this._panelAnchor?.stop(),this._panelAnchor=null,this._panelAnchorPanel=null,this._panelAnchorTrigger=null}selectDate(t){return!t?.date||t.disabled?this:this.range?(this.selectRangeDate(t),this):(this.setState({year:t.date.getFullYear(),month:t.date.getMonth(),date:t.value,context:""}),this.set({activeDate:t.value}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this)}selectRangeDate(t){if(!this.startValue||this.startValue&&this.endValue)return this.setState({year:t.date.getFullYear(),month:t.date.getMonth(),startValue:t.value,endValue:"",date:t.value,context:"",preset:""}),this.set({activeDate:t.value}),this.emitChange(),this;const e=this.startDate,a={year:t.date.getFullYear(),month:t.date.getMonth(),context:"",preset:""};return e&&S(t.date,e)<0?(a.startValue=t.value,a.endValue=this.startValue,a.date=t.value):(a.endValue=t.value,a.date=this.startValue),this.setState(a),this.set({activeDate:t.value}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this}choosePreset(t){if(!t||t.disabled)return this;const e=m(t.from),a=m(t.to);return this.setState({preset:t.id,startValue:e,endValue:a,date:e,year:t.to.getFullYear(),month:t.to.getMonth(),context:""}),this.set({activeDate:a}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this}chooseCustomRange(){return this.preset&&this.setState({preset:"",startValue:"",endValue:"",date:""}),this._focusDateAfterRender=!0,this.requestComponentUpdate("custom-range"),this}handlePresetKeydown(t){const e={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};if(!(t.key in e)&&"Home"!==t.key&&"End"!==t.key)return;const a=[...t.currentTarget.querySelectorAll("button:not(:disabled)")];if(!a.length)return;t.preventDefault();const s=a.indexOf(t.target);let n="Home"===t.key?0:"End"===t.key?a.length-1:s+e[t.key];!this.isRtl||"ArrowRight"!==t.key&&"ArrowLeft"!==t.key||(n=s-e[t.key]),n=(n+a.length)%a.length,a.forEach((t,e)=>t.setAttribute("tabindex",e===n?"0":"-1")),a[n].focus()}selectMonth(t){return!t||t.disabled||(this.setState({month:t.index,context:""}),this.set({activeDate:m(new Date(this.year,t.index,1))})),this}selectYear(t){if(!t||t.disabled)return this;const e={year:t.year,context:""},a=this.getClosestEnabledMonth(t.year,this.month);return a!==this.month&&(e.month=a),this.setState(e),this.set({activeDate:m(new Date(t.year,a,1))}),this}getClosestEnabledMonth(t,e){const a=this.setMinDate(),s=this.setMaxDate();return a&&t===a.getFullYear()&&e<a.getMonth()?a.getMonth():s&&t===s.getFullYear()&&e>s.getMonth()?s.getMonth():e}emitChange(){const t=this.startValue&&this.endValue?`${this.startValue}/${this.endValue}`:this.startValue||"",e=this.range?{value:[this.startValue,this.endValue],date:t,startValue:this.startValue,endValue:this.endValue,formattedValue:this.displayValue,formattedStartValue:this.formattedStartValue,formattedEndValue:this.formattedEndValue,isoValue:t,startIsoValue:this.startValue,endIsoValue:this.endValue,range:!0,format:this.format,preset:this.activePreset?this.activePreset.relative?{id:this.activePreset.id,relative:this.activePreset.relative}:{id:this.activePreset.id}:null}:{value:this.date,date:this.date,formattedValue:this.formattedValue,isoValue:this.date,range:!1,format:this.format};this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e})),this.dispatchEvent(new CustomEvent("sf-datepicker-change",{bubbles:!0,composed:!0,detail:e})),this.emitComponentEvent("change",e)}templateContext(){const t=this.getPropsContext();return this.createTemplateContext({...t,component:this,date:this.date,formattedValue:this.formattedValue,displayValue:this.displayValue,startValue:this.startValue,formattedStartValue:this.formattedStartValue,endValue:this.endValue,formattedEndValue:this.formattedEndValue,range:this.range,format:this.format,selectedDate:this.selectedDate,startDate:this.startDate,endDate:this.endDate,year:this.year,month:this.month,monthLabel:P(this.month,this.locale),calendarLabel:this.calendarLabel,labels:this.labels,weekdays:this.weekdays,panelId:this._panelId,previousIcon:this.isRtl?"chevron_right":"chevron_left",nextIcon:this.isRtl?"chevron_left":"chevron_right",context:this.contextMode,locale:this.locale,days:this.days,presetItems:this.presetItems,months:this.months,years:this.years,yearPageStart:this.yearPageStart,yearPageEnd:this.yearPageEnd,rootClass:this.getRootClass(),rootStyle:this.getRootStyle(),openAbove:Boolean(this.state.openAbove),input:this.input,open:this.open,portal:this.portal,inputType:this.inputType,inputSize:this.inputSize,inputName:this.inputName,placeholder:this.placeholder,label:this.label,ariaLabel:this.ariaLabel,readonly:this.readonly,disabled:this.disabled,required:this.required,leftIcon:this.leftIcon,iconStart:this.leftIcon,inputRootClass:this.inputRootClass,mask:this.mask,maskPattern:this.maskPattern,maskLazy:this.maskLazy,maskPlaceholderChar:this.maskPlaceholderChar,maskOptions:this.maskOptions})}template(){return(0,r.P)(this.templateContext())}afterRender(){this._input=this.refs.input?.value?.querySelector("input")||null,this._input&&(this._input.setAttribute("aria-haspopup","dialog"),this._input.setAttribute("aria-expanded",this.open?"true":"false"),this._input.setAttribute("aria-controls",this._panelId));const t=this.querySelector(".sf-datepicker-month-toggle button"),e=this.querySelector(".sf-datepicker-year-toggle button");t?.setAttribute("aria-expanded","month"===this.contextMode?"true":"false"),e?.setAttribute("aria-expanded","year"===this.contextMode?"true":"false"),this.syncOverlayListeners(),requestAnimationFrame(()=>{if(this.positionPanel(),this._focusCalendarOnOpen||this._focusDateAfterRender){const t=this.querySelector(`.sf-datepicker-day[data-date="${m(this.activeDate)}"]`);t?.focus?.(),this._focusCalendarOnOpen=!1,this._focusDateAfterRender=!1}})}onDisconnected(){this.removeOverlayListeners(),super.onDisconnected()}get data(){return{value:this.value,date:this.date,formattedValue:this.formattedValue,displayValue:this.displayValue,startValue:this.startValue,formattedStartValue:this.formattedStartValue,endValue:this.endValue,formattedEndValue:this.formattedEndValue,range:this.range,format:this.format,year:this.year,month:this.month,context:this.contextMode,maxDate:this.maxDate,minDate:this.minDate,locale:this.locale,input:this.input,open:this.open,portal:this.portal,mask:this.mask,maskPattern:this.maskPattern,maskOptions:this.maskOptions,presets:this.presetItems.map(({id:t,label:e,relative:a,disabled:s})=>({id:t,label:e,relative:a,disabled:s})),preset:this.preset}}}T.define("sf-datepicker"),e()}catch(E){e(E)}})},"77b2f4107e3b"(t,e,a){a.a(t,async(t,s)=>{try{a.d(e,{P:()=>b});var n=a("ddf1cdb42ecc"),r=a("5a8eddcd589d"),i=t([n,r]);[n,r]=i.then?(await i)():i;function o(...t){return t.flat().filter(Boolean).join(" ")}function l(t){return n.html`
|
|
2
2
|
<div class="sf-datepicker-top flex content-main-between items-cross-center">
|
|
3
3
|
<sf-icon-button appearance="link" scheme="on-surface" size="1"
|
|
4
4
|
icon=${t.previousIcon} aria-label=${t.labels.previousYears}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<sf-icon-button appearance="link" scheme="on-surface" size="1"
|
|
10
10
|
icon=${t.nextIcon} aria-label=${t.labels.nextYears}
|
|
11
11
|
@click=${()=>t.component.shiftYearPage(1)}></sf-icon-button>
|
|
12
|
-
</div>`}function
|
|
12
|
+
</div>`}function h(t){return"year"===t.context?l(t):n.html`
|
|
13
13
|
<div class="sf-datepicker-top grid items-cross-center">
|
|
14
14
|
<sf-icon-button appearance="link" scheme="on-surface" size="1"
|
|
15
15
|
icon=${t.previousIcon} aria-label=${t.labels.previousMonth}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<sf-icon-button appearance="link" scheme="on-surface" size="1"
|
|
28
28
|
icon=${t.nextIcon} aria-label=${t.labels.nextMonth}
|
|
29
29
|
@click=${()=>t.component.shiftMonth(1)}></sf-icon-button>
|
|
30
|
-
</div>`}function
|
|
30
|
+
</div>`}function u(t){return n.html`
|
|
31
31
|
<div class="sf-datepicker-context absolute top-0 bottom-0 inline-start-0 inline-end-0 grid grid-col-3 content-cross-start items-cross-start overflow-auto gap-1/4"
|
|
32
32
|
aria-label=${t.labels.chooseMonth}>
|
|
33
33
|
${t.months.map(e=>n.html`
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
type="button" @click=${()=>t.component.selectMonth(e)}>
|
|
37
37
|
<span class="sf-datepicker-text-date">${e.label}</span>
|
|
38
38
|
</button>`)}
|
|
39
|
-
</div>`}function
|
|
39
|
+
</div>`}function d(t){return n.html`
|
|
40
40
|
<div class="sf-datepicker-context absolute top-0 bottom-0 inline-start-0 inline-end-0 grid grid-col-3 content-cross-start items-cross-start overflow-auto gap-1/4"
|
|
41
41
|
aria-label=${t.labels.chooseYear}>
|
|
42
42
|
${t.years.map(e=>n.html`
|
|
@@ -45,17 +45,20 @@
|
|
|
45
45
|
@click=${()=>t.component.selectYear(e)}>
|
|
46
46
|
<span class="sf-datepicker-text-date">${e.year}</span>
|
|
47
47
|
</button>`)}
|
|
48
|
-
</div>`}function
|
|
48
|
+
</div>`}function c(t){return"month"===t.context?u(t):"year"===t.context?d(t):n.nothing}function p(t){return n.html`
|
|
49
49
|
<sf-input class="sf-datepicker-input" ${(0,r.ref)(t.component.refs.input)}
|
|
50
50
|
appearance=${t.inputType} size=${t.inputSize}
|
|
51
51
|
label=${t.label||n.nothing} name=${t.inputName||n.nothing}
|
|
52
|
+
aria-label=${t.label?n.nothing:t.ariaLabel||n.nothing}
|
|
52
53
|
placeholder=${t.placeholder||n.nothing} icon-start=${t.iconStart||n.nothing}
|
|
53
54
|
root-class=${t.inputRootClass||n.nothing} value=${t.displayValue||""}
|
|
54
55
|
?disabled=${t.disabled} ?required=${t.required} ?mask=${t.mask}
|
|
55
56
|
mask-pattern=${t.maskPattern||n.nothing} mask-lazy=${String(t.maskLazy)}
|
|
56
57
|
mask-placeholder-char=${t.maskPlaceholderChar||n.nothing}
|
|
57
|
-
mask-options=${t.maskOptions||n.nothing} readonly
|
|
58
|
+
mask-options=${t.maskOptions||n.nothing} ?readonly=${t.readonly}
|
|
58
59
|
@click=${e=>t.component.handleInputClick(e)}
|
|
60
|
+
@change=${e=>t.component.handleInputChange(e)}
|
|
61
|
+
@input=${e=>t.component.handleInputInput(e)}
|
|
59
62
|
@keydown=${e=>t.component.handleInputKeydown(e)}></sf-input>`}function g(t,e){const a=o("sf-datepicker-day",t.weekend?"sf-datepicker-day-off":"",t.selected?"active":"",t.rangeStart?"sf-datepicker-day-start":"",t.rangeSelected?"sf-datepicker-day-selected":"",t.rangeEnd?"sf-datepicker-day-end":"",t.currentMonth?"":"sf-datepicker-another-month",t.disabled?"disabled":"");return n.html`
|
|
60
63
|
<button class=${a} type="button" ?disabled=${t.disabled}
|
|
61
64
|
data-date=${t.value} aria-label=${t.label}
|
|
@@ -83,12 +86,12 @@
|
|
|
83
86
|
@click=${e=>t.component.handlePanelClick(e)}>
|
|
84
87
|
${m(t)}
|
|
85
88
|
<div class="sf-datepicker-container flex flex-col">
|
|
86
|
-
${
|
|
89
|
+
${h(t)}
|
|
87
90
|
<div class="sf-datepicker-weekdays grid grid-col-7" aria-hidden="true">
|
|
88
91
|
${t.weekdays.map(t=>n.html`<span class="sf-datepicker-weekday">${t}</span>`)}
|
|
89
92
|
</div>
|
|
90
93
|
<div class="sf-datepicker-main relative">
|
|
91
|
-
${
|
|
94
|
+
${c(t)}
|
|
92
95
|
<div class="sf-datepicker-grid grid grid-col-7">
|
|
93
96
|
${t.days.map(e=>g(e,t))}
|
|
94
97
|
</div>
|
|
@@ -99,4 +102,4 @@
|
|
|
99
102
|
${(0,r.ref)(t.component.refs.datePickerRoot)} data-portal=${t.portal?"true":"false"}>
|
|
100
103
|
${p(t)}
|
|
101
104
|
${t.open?f(t):n.nothing}
|
|
102
|
-
</div>`:f(t)}s()}catch(y){s(y)}})},"5a8eddcd589d"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit/directives/ref.js"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("lit/directives/ref.js")),{once:!0}))},ddf1cdb42ecc(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("lit")),{once:!0}))},"0d662e4d7d63"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("page-language"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("page-language")),{once:!0}))},"5c1dc214bb5e"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("position"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("position")),{once:!0}))},fbe0570fcc69(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("smart-base"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("smart-base")),{once:!0}))}};const e={};function a(s){const n=e[s];if(void 0!==n)return n.exports;const r=e[s]={exports:{}};return t[s](r,r.exports,a),r.exports}(()=>{const t="function"==typeof Symbol,e=t?Symbol("webpack queues"):"__webpack_queues__",s=t?Symbol("webpack exports"):"__webpack_exports__",n=t?Symbol("webpack error"):"__webpack_error__",r=t=>{t?.d<1&&(t.d=1,t.forEach(t=>t.r--),t.forEach(t=>t.r--?t.r++:t()))};a.a=(t,a,i)=>{let o;i&&((o=[]).d=-1);const l=new Set,
|
|
105
|
+
</div>`:f(t)}s()}catch(y){s(y)}})},"5a8eddcd589d"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit/directives/ref.js"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("lit/directives/ref.js")),{once:!0}))},ddf1cdb42ecc(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("lit")),{once:!0}))},"0d662e4d7d63"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("page-language"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("page-language")),{once:!0}))},"5c1dc214bb5e"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("position"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("position")),{once:!0}))},fbe0570fcc69(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("smart-base"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("smart-base")),{once:!0}))}};const e={};function a(s){const n=e[s];if(void 0!==n)return n.exports;const r=e[s]={exports:{}};return t[s](r,r.exports,a),r.exports}(()=>{const t="function"==typeof Symbol,e=t?Symbol("webpack queues"):"__webpack_queues__",s=t?Symbol("webpack exports"):"__webpack_exports__",n=t?Symbol("webpack error"):"__webpack_error__",r=t=>{t?.d<1&&(t.d=1,t.forEach(t=>t.r--),t.forEach(t=>t.r--?t.r++:t()))};a.a=(t,a,i)=>{let o;i&&((o=[]).d=-1);const l=new Set,h=t.exports;let u,d,c;const p=new Promise((t,e)=>{c=e,d=t});p[s]=h,p[e]=t=>(o&&t(o),l.forEach(t),p.catch(t=>{})),t.exports=p;a(t=>{let a;u=(t=>t.map(t=>{if(null!==t&&"object"==typeof t){if(t[e])return t;if(t.then){const a=[];a.d=0,t.then(t=>{i[s]=t,r(a)},t=>{i[n]=t,r(a)});const i={};return i[e]=t=>t(a),i}}const a={};return a[e]=t=>{},a[s]=t,a}))(t);const i=()=>u.map(t=>{if(t[n])throw t[n];return t[s]}),h=new Promise(t=>{a=()=>t(i),a.r=0;const s=t=>t!==o&&!l.has(t)&&(l.add(t),t&&!t.d&&(a.r++,t.push(a)));u.map(t=>t[e](s))});return a.r?h:i()},t=>(t?c(p[n]=t):d(h),r(o))),o?.d<0&&(o.d=0)}})(),a.n=t=>{const e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{if(Array.isArray(e))for(var s=0;s<e.length;){var n=e[s++],r=e[s++];a.o(t,n)?0===r&&s++:0===r?Object.defineProperty(t,n,{enumerable:!0,value:e[s++]}):Object.defineProperty(t,n,{enumerable:!0,get:r})}else for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);a("b9b65955223a")})();
|
|
@@ -248,6 +248,16 @@
|
|
|
248
248
|
"type": "string",
|
|
249
249
|
"default": "",
|
|
250
250
|
"description": "The chosen quick range's id. Set by a host it wins over start-value and end-value, and a relative one is resolved against today in the person's time zone when drawn; nothing is emitted for it."
|
|
251
|
+
},
|
|
252
|
+
"aria-label": {
|
|
253
|
+
"type": "string",
|
|
254
|
+
"default": "",
|
|
255
|
+
"description": "Accessible name for a date field rendered without a visible label."
|
|
256
|
+
},
|
|
257
|
+
"readonly": {
|
|
258
|
+
"type": "boolean",
|
|
259
|
+
"default": false,
|
|
260
|
+
"description": "Keeps the field read-only: the date is chosen on the grid only. A single date can be typed by default; a range is always chosen on the grid."
|
|
251
261
|
}
|
|
252
262
|
},
|
|
253
263
|
"additionalProperties": false
|
|
@@ -568,11 +578,11 @@
|
|
|
568
578
|
"source_artifacts": [
|
|
569
579
|
{
|
|
570
580
|
"path": "src/smart/datepicker/index.js",
|
|
571
|
-
"sha256": "
|
|
581
|
+
"sha256": "30dd094383fc895716752605ed199476f5259a6dbf363e38decf5c9b1e958499"
|
|
572
582
|
},
|
|
573
583
|
{
|
|
574
584
|
"path": "src/smart/datepicker/js/templates/default.js",
|
|
575
|
-
"sha256": "
|
|
585
|
+
"sha256": "27489e37090e6bb0f21cdb36de5777f7a05808159011e00187dd54678e7803a2"
|
|
576
586
|
},
|
|
577
587
|
{
|
|
578
588
|
"path": "src/smart/datepicker/rule.js",
|
|
@@ -580,7 +590,7 @@
|
|
|
580
590
|
},
|
|
581
591
|
{
|
|
582
592
|
"path": "src/smart/datepicker/docs/smart-datepicker-guide.md",
|
|
583
|
-
"sha256": "
|
|
593
|
+
"sha256": "d1158de65cf63c2d8d1851a490c7c6727c4e6383d0c5fda2d5d3a41b2dac8de1"
|
|
584
594
|
}
|
|
585
595
|
],
|
|
586
596
|
"generated_runtime": [
|
|
@@ -81,13 +81,16 @@ function renderDatepickerInput(context) {
|
|
|
81
81
|
<sf-input class="sf-datepicker-input" ${ref(context.component.refs.input)}
|
|
82
82
|
appearance=${context.inputType} size=${context.inputSize}
|
|
83
83
|
label=${context.label || nothing} name=${context.inputName || nothing}
|
|
84
|
+
aria-label=${context.label ? nothing : (context.ariaLabel || nothing)}
|
|
84
85
|
placeholder=${context.placeholder || nothing} icon-start=${context.iconStart || nothing}
|
|
85
86
|
root-class=${context.inputRootClass || nothing} value=${context.displayValue || ''}
|
|
86
87
|
?disabled=${context.disabled} ?required=${context.required} ?mask=${context.mask}
|
|
87
88
|
mask-pattern=${context.maskPattern || nothing} mask-lazy=${String(context.maskLazy)}
|
|
88
89
|
mask-placeholder-char=${context.maskPlaceholderChar || nothing}
|
|
89
|
-
mask-options=${context.maskOptions || nothing} readonly
|
|
90
|
+
mask-options=${context.maskOptions || nothing} ?readonly=${context.readonly}
|
|
90
91
|
@click=${(event) => context.component.handleInputClick(event)}
|
|
92
|
+
@change=${(event) => context.component.handleInputChange(event)}
|
|
93
|
+
@input=${(event) => context.component.handleInputInput(event)}
|
|
91
94
|
@keydown=${(event) => context.component.handleInputKeydown(event)}></sf-input>`;
|
|
92
95
|
}
|
|
93
96
|
|
|
@@ -1,6 +1,6 @@
|
|
|
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,r=!1;const a=new WeakMap,l=(e,t,i)=>{const s=a.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),a.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),r=i===d()||i===u()||i===c();let a=!1;if("Escape"===e.key&&t.isOpen())m(),a=!0;else{if("Tab"===e.key&&t.isOpen())return o&&b(d()),t.close(),void x();if(r&&["ArrowDown","ArrowUp","Enter"," "].includes(e.key))t.isOpen()&&["Enter"," "].includes(e.key)?m():(e=>{s=e,t.open(),x()})("ArrowUp"===e.key?"last":"search"),a=!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]),a=!0}else if(n&&o&&["Home","End"].includes(e.key)){const t=f();b("Home"===e.key?t[0]:t.at(-1)),a=!0}else n&&o&&["Enter"," "].includes(e.key)&&(f().includes(n)&&(s=t.isMultiple()?{value:n.dataset.value}:"trigger",t.select(n),x()),a=!0)}a&&(e.preventDefault(),e.stopImmediatePropagation())},y=()=>{null!==o&&cancelAnimationFrame(o),o=requestAnimationFrame(()=>{var i;o=null,r||!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(r)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"),$=t.owner||e,S=_?.textContent.trim()?n(_,"sf-dropdown-label"):"",A=$.getAttribute("aria-label")||e.getAttribute("aria-label"),k=$.getAttribute("aria-labelledby")||e.getAttribute("aria-labelledby"),C=n(m,"sf-dropdown-trigger"),L=m.hasAttribute("aria-label")&&a.get(m)?.["aria-label"]!==m.getAttribute("aria-label");l(m,"aria-labelledby",k||(!A&&S?L?`${C} ${S}`:S:"")),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||S||C);const z=p();z&&(z.setAttribute("role","searchbox"),z.setAttribute("aria-controls",x.id),l(z,"aria-labelledby",z.hasAttribute("aria-label")?"":k||S||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 V=t.selectedLabels?.()||h().filter(e=>e.classList.contains("selected")).map(g);w.textContent=V.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 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(){r=!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 r=i.n(n);const a=()=>globalThis.SF?.Position||r(),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],r=new Set(o);for(const e of t.contextProperties||[])r.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=a().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 r=[e,t,i,n].join("|"),a=s(),l=a.get(r);if(l)l.count+=1;else if(a.set(r,{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}: `:"",r="value"===t?`${i}="${n}"`:`${t} ${n}`;globalThis.console?.warn?.(`[SIMAI Framework] ${s}${r} 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"]),r=Object.freeze({"1/3":"1/2",3:"2"}),a=new Set;function l(e){const t=String(e??"").trim().toLowerCase();return o.includes(t)?t:Object.hasOwn(r,t)?r[t]:"1"}function c(e,t="field",i="1"){const s=String(e??"").trim().toLowerCase();if(o.includes(s))return s;if(Object.hasOwn(r,s)){const e=r[s];n({component:t,kind:"value",attribute:"size",from:s,to:e});const i=`${t}:${s}`;return a.has(i)||"undefined"==typeof console||(a.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)}},"50a1017ded91"(e,t,i){i.a(e,async(e,t)=>{try{var s=i("fbe0570fcc69"),n=i("0d662e4d7d63"),o=i("98e26702f55a"),r=i("5429d6e80991"),a=i("3a03d4610486"),l=i("67eed2647f47"),c=i("a0f23dca0b37"),d=e([s,n,r,c]);[s,n,r,c]=d.then?(await d)():d;var u=i.n(s);const p={en:{search:"Search"},ru:{search:"Поиск"}};function h(e){return(0,o.id)(e,"sf-dropdown")}function f(e){const t=String(e||"").toLowerCase();return["text","icon","checkbox","avatar","color"].includes(t)?t:"text"}function g(e,t="1"){return e instanceof HTMLElement?"sf-list-item"!==e.tagName.toLowerCase()?null:{type:f(e.getAttribute("kind")||e.getAttribute("type")),size:h(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 b(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:f(e.kind||e.type),size:h(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 m(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=>b("string"==typeof e||"number"==typeof e?{text:String(e),value:String(e)}:e,t)).filter(Boolean):[]}function v(e=""){return String(e||"").split(",").map(e=>e.trim()).filter(Boolean)}function y(e=[]){return e.map(e=>String(e)).join(",")}function w(e={}){return"avatar"===e.type?e.avatarTitle||e.text||e.value||"":e.text||e.avatarTitle||e.value||""}class x extends(u()){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=v(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 h(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)(p,"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")?v(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(w).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=>g(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=m(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:h(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=>w(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,r.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.positionPortalList(),e!==this._dropdownRoot&&(this._interaction?.release(),this._interaction=null),this._dropdownRoot&&!this._interaction&&(this._interaction=(0,a.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(w)})),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",y(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.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",y(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",y(i)),this.dispatchDropdownChange(null,i),this.requestComponentUpdate("remove-tag"),this}dispatchDropdownChange(e=null,t=this.selectedValues){const i={value:e?.value||"",label:e?w(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}))}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):v(null==e?"":String(e));this.setAttributeValue("value",y(t))}}x.define("sf-dropdown"),t()}catch(_){t(_)}})},"5429d6e80991"(e,t,i){i.a(e,async(e,s)=>{try{i.d(t,{g:()=>h});var n=i("ddf1cdb42ecc"),o=i("c22590307c6c"),r=e([n,o]);[n,o]=r.then?(await r)():r;function a(e={}){return"avatar"===e.type?e.avatarTitle||e.text||e.value||"":e.text||e.avatarTitle||e.value||""}function l(e=[]){const t=[];let i=null;for(const s of e){const e=s.group?String(s.group):"";e!==i&&(i=e,e&&t.push((0,o.aU)(e,s.size))),t.push((0,o.lN)(s))}return t}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=a(t),s=c[e.size]||c[1],o=s.size,r=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:()=>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 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"),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 E=t.selectedLabels?.()||h().filter(e=>e.classList.contains("selected")).map(g);w.textContent=E.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 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:()=>o});const s="sfPopoverOpen",n=new WeakSet;function o(e,t){if(!e)return;const i=Boolean(t);i!==n.has(e)&&(i?n.add(e):n.delete(e),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 S 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))}}S.define("sf-dropdown"),t()}catch(_){t(_)}})},"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`
|
|
2
2
|
<div
|
|
3
|
-
class="sf-tag transition sf-tag--${l} sf-tag--size-${o} sf-tag--inline${
|
|
3
|
+
class="sf-tag transition sf-tag--${l} sf-tag--size-${o} 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}
|
|
@@ -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 h(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,o=e.size,
|
|
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 h(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,o=e.size,a=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}
|
|
@@ -78,7 +78,7 @@
|
|
|
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">${a}</i>
|
|
82
82
|
</button>
|
|
83
83
|
</div>
|
|
84
84
|
`:n.html`
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
class="sf-icon-button sf-icon-button--icon sf-icon-button--on-surface sf-icon-button--link sf-icon-button--size-${s} absolute"
|
|
102
102
|
?disabled=${e.disabled}
|
|
103
103
|
>
|
|
104
|
-
<i class="sf-icon" aria-hidden="true">${
|
|
104
|
+
<i class="sf-icon" aria-hidden="true">${a}</i>
|
|
105
105
|
</button>
|
|
106
106
|
</label>
|
|
107
107
|
`})()}
|
|
@@ -136,14 +136,14 @@
|
|
|
136
136
|
@click=${t=>e.component.handleOptionClick(t)}
|
|
137
137
|
@keydown=${t=>e.component.handleOptionKeydown(t)}
|
|
138
138
|
>
|
|
139
|
-
${l(e.options)}
|
|
139
|
+
${l(e.options,e.multiple)}
|
|
140
140
|
</div>
|
|
141
141
|
</div>
|
|
142
142
|
</div>
|
|
143
143
|
</div>
|
|
144
|
-
`}s()}catch(f){s(f)}})},c22590307c6c(e,t,i){i.a(e,async(e,s)=>{try{i.d(t,{aU:()=>d,lN:()=>c});var n=i("ddf1cdb42ecc"),o=i("98e26702f55a"),
|
|
144
|
+
`}s()}catch(f){s(f)}})},c22590307c6c(e,t,i){i.a(e,async(e,s)=>{try{i.d(t,{aU:()=>d,lN:()=>c});var n=i("ddf1cdb42ecc"),o=i("98e26702f55a"),a=e([n]),r=a.then?(await a)():a;n=r[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,o=e.component?.hasSlotContent?.("trailing")?e.component.getSlotContent("trailing"):n.nothing,a=["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":"",e.rootClass].filter(Boolean),r=["sf-list-item-wrap","flex","flex-1"];["icon","checkbox","avatar","color"].includes(e.type)&&r.push("flex","flex-row","flex-nowrap","items-center","gap-2"),"avatar"!==e.type&&"color"!==e.type||(r.splice(r.indexOf("gap-2"),1),r.push("justify-between","gap-2"));return n.html`
|
|
145
145
|
<div
|
|
146
|
-
class=${
|
|
146
|
+
class=${a.join(" ")}
|
|
147
147
|
style=${e.rootStyle||n.nothing}
|
|
148
148
|
role=${t?"option":n.nothing}
|
|
149
149
|
tabindex=${t?"-1":n.nothing}
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
aria-disabled=${t&&e.disabled?"true":n.nothing}
|
|
154
154
|
aria-selected=${t?e.selected?"true":"false":n.nothing}
|
|
155
155
|
>
|
|
156
|
-
<div class=${
|
|
156
|
+
<div class=${r.join(" ")}>
|
|
157
157
|
${(()=>{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`
|
|
158
158
|
<label
|
|
159
159
|
class="sf-checkbox sf-checkbox--size-${e.sizeGroup.checkbox} flex"
|
|
@@ -211,4 +211,4 @@
|
|
|
211
211
|
<div class="sf-list-heading sf-list-heading--size-${t}" role="presentation">
|
|
212
212
|
<span class="sf-list-heading-container">${e}</span>
|
|
213
213
|
</div>
|
|
214
|
-
`}function u(e){const t=String(e||"1");return"1/3"===t||"1/2"===t?{item:t,checkbox:(0,o.kA)(t),avatarGroup:"1/2",colorTag:"1/2"}:{item:t,checkbox:(0,o.kA)(t),avatarGroup:t,colorTag:"1"}}s()}catch(p){s(p)}})},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 o=t[s]={exports:{}};return e[s](o,o.exports,i),o.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__",o=e=>{e?.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))};i.a=(e,i,
|
|
214
|
+
`}function u(e){const t=String(e||"1");return"1/3"===t||"1/2"===t?{item:t,checkbox:(0,o.kA)(t),avatarGroup:"1/2",colorTag:"1/2"}:{item:t,checkbox:(0,o.kA)(t),avatarGroup:t,colorTag:"1"}}s()}catch(p){s(p)}})},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 o=t[s]={exports:{}};return e[s](o,o.exports,i),o.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__",o=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 r;a&&((r=[]).d=-1);const l=new Set,c=e.exports;let d,u,p;const h=new Promise((e,t)=>{p=t,u=e});h[s]=c,h[t]=e=>(r&&e(r),l.forEach(e),h.catch(e=>{})),e.exports=h;i(e=>{let i;d=(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,o(i)},e=>{a[n]=e,o(i)});const a={};return a[t]=e=>e(i),a}}const i={};return i[t]=e=>{},i[s]=e,i}))(e);const a=()=>d.map(e=>{if(e[n])throw e[n];return e[s]}),c=new Promise(e=>{i=()=>e(a),i.r=0;const s=e=>e!==r&&!l.has(e)&&(l.add(e),e&&!e.d&&(i.r++,e.push(i)));d.map(e=>e[t](s))});return i.r?c:a()},e=>(e?p(h[n]=e):u(c),o(r))),r?.d<0&&(r.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++],o=t[s++];i.o(e,n)?0===o&&s++:0===o?Object.defineProperty(e,n,{enumerable:!0,value:t[s++]}):Object.defineProperty(e,n,{enumerable:!0,get:o})}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")})();
|
|
@@ -338,7 +338,7 @@
|
|
|
338
338
|
"source_artifacts": [
|
|
339
339
|
{
|
|
340
340
|
"path": "src/smart/dropdown/index.js",
|
|
341
|
-
"sha256": "
|
|
341
|
+
"sha256": "dcb91d5c602e62eea88a699b6658cca64fc44f001a267a7e8d3ec3e8b299ca84"
|
|
342
342
|
}
|
|
343
343
|
],
|
|
344
344
|
"generated_runtime": [
|
|
@@ -12,7 +12,7 @@ function getOptionLabel(option = {}) {
|
|
|
12
12
|
// Options may say where they come from. A list of a few dozen names is read by
|
|
13
13
|
// its stretches rather than line by line, and the name of a stretch belongs
|
|
14
14
|
// above it once instead of after every name in it.
|
|
15
|
-
function renderOptions(options = []) {
|
|
15
|
+
function renderOptions(options = [], multiple = false) {
|
|
16
16
|
const parts = [];
|
|
17
17
|
let group = null;
|
|
18
18
|
|
|
@@ -22,7 +22,14 @@ function renderOptions(options = []) {
|
|
|
22
22
|
group = next;
|
|
23
23
|
if (next) parts.push(renderListItemHeading(next, option.size));
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
// Where several options may be chosen, each one carries the box that says
|
|
26
|
+
// so: a plain row said it was chosen with a class and aria-selected alone,
|
|
27
|
+
// so on a long list nothing on screen told the person what they had picked
|
|
28
|
+
// (Larena storage QA, 2026-10-22). An option that draws a picture of its
|
|
29
|
+
// own -- an icon, a colour, an avatar -- keeps it, because that is the
|
|
30
|
+
// place the box would take.
|
|
31
|
+
const withBox = multiple && (!option.type || option.type === "text");
|
|
32
|
+
parts.push(renderListItemOption(withBox ? {...option, type: "checkbox"} : option));
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
return parts;
|
|
@@ -287,7 +294,7 @@ export function renderDropdownTemplate(context) {
|
|
|
287
294
|
@click=${(event) => context.component.handleOptionClick(event)}
|
|
288
295
|
@keydown=${(event) => context.component.handleOptionKeydown(event)}
|
|
289
296
|
>
|
|
290
|
-
${renderOptions(context.options)}
|
|
297
|
+
${renderOptions(context.options, context.multiple)}
|
|
291
298
|
</div>
|
|
292
299
|
</div>
|
|
293
300
|
</div>
|