@vonage/vivid 5.3.0 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion-item/definition.js +1 -1
- package/alert/definition.cjs +1 -1
- package/alert/definition.js +2 -2
- package/badge/definition.js +1 -1
- package/banner/definition.js +1 -1
- package/bundled/calendar-picker.template.cjs +7 -7
- package/bundled/calendar-picker.template.js +101 -101
- package/bundled/definition11.cjs +13 -13
- package/bundled/definition11.js +202 -50
- package/bundled/definition19.cjs +24 -25
- package/bundled/definition19.js +152 -164
- package/bundled/definition6.cjs +3 -3
- package/bundled/definition6.js +19 -19
- package/bundled/definition9.cjs +5 -5
- package/bundled/definition9.js +394 -392
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +82 -102
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +18 -14
- package/bundled/vivid-element.cjs +5 -1
- package/bundled/vivid-element.js +401 -358
- package/calendar/index.cjs +1 -1
- package/calendar/index.js +14 -14
- package/card/definition.cjs +1 -1
- package/card/definition.js +1 -1
- package/color-picker/definition.cjs +1 -1
- package/color-picker/definition.js +1 -1
- package/combobox/definition.cjs +7 -27
- package/combobox/definition.js +8 -28
- package/combobox/index.cjs +6 -6
- package/combobox/index.js +57 -71
- package/custom-elements.json +305 -2
- package/date-picker/definition.cjs +1 -1
- package/date-picker/definition.js +1 -1
- package/date-range-picker/definition.cjs +1 -1
- package/date-range-picker/definition.js +1 -1
- package/date-time-picker/definition.cjs +1 -1
- package/date-time-picker/definition.js +1 -1
- package/dialog/definition.cjs +2 -2
- package/dialog/definition.js +2 -2
- package/dialog/index.cjs +7 -7
- package/dialog/index.js +6 -6
- package/elevation/definition.cjs +1 -1
- package/elevation/definition.js +1 -1
- package/fab/definition.js +1 -1
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/index.cjs +3 -4
- package/index.js +2 -3
- package/lib/accordion/accordion.d.ts +1 -1
- package/lib/accordion/definition.d.ts +1 -1
- package/lib/audio-player/audio-player.d.ts +1 -1
- package/lib/combobox/combobox.d.ts +1 -0
- package/lib/combobox/combobox.options.d.ts +1 -1
- package/lib/divider/divider.d.ts +1 -1
- package/lib/menu-item/menu-item-role.d.ts +1 -1
- package/lib/popup/popup.d.ts +1 -1
- package/lib/searchable-select/locale.d.ts +4 -0
- package/lib/searchable-select/searchable-select.d.ts +3 -0
- package/lib/select/select.d.ts +3 -1
- package/lib/slider/slider.d.ts +1 -1
- package/lib/tabs/tabs.d.ts +2 -2
- package/lib/text-area/text-area.d.ts +1 -1
- package/lib/text-field/text-field.d.ts +1 -1
- package/locales/de-DE.cjs +4 -0
- package/locales/de-DE.js +4 -0
- package/locales/en-GB.cjs +4 -0
- package/locales/en-GB.js +4 -0
- package/locales/en-US.cjs +4 -0
- package/locales/en-US.js +4 -0
- package/locales/ja-JP.cjs +4 -0
- package/locales/ja-JP.js +4 -0
- package/locales/zh-CN.cjs +4 -0
- package/locales/zh-CN.js +4 -0
- package/menu/definition.cjs +4 -4
- package/menu/definition.js +4 -4
- package/nav-disclosure/definition.js +1 -1
- package/nav-item/definition.js +1 -1
- package/note/definition.js +1 -1
- package/number-field/definition.js +1 -1
- package/option/definition.cjs +6 -77
- package/option/definition.js +3 -78
- package/package.json +31 -5
- package/popup/definition.cjs +2 -2
- package/popup/definition.js +2 -2
- package/range-slider/definition.cjs +1 -1
- package/range-slider/definition.js +1 -1
- package/rich-text-editor/definition.cjs +2 -3
- package/rich-text-editor/definition.js +1 -2
- package/rich-text-editor/index.cjs +27 -27
- package/rich-text-editor/index.js +1208 -1198
- package/searchable-select/definition.cjs +103 -11
- package/searchable-select/definition.js +103 -11
- package/searchable-select/index.cjs +81 -69
- package/searchable-select/index.js +359 -273
- package/select/definition.cjs +24 -41
- package/select/definition.js +24 -41
- package/selectable-box/definition.cjs +1 -1
- package/selectable-box/definition.js +1 -1
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/aria/aria-mixin.d.ts +1 -1
- package/shared/foundation/listbox/listbox.d.ts +4 -0
- package/simple-color-picker/definition.cjs +1 -1
- package/simple-color-picker/definition.js +1 -1
- package/slider/definition.cjs +1 -1
- package/slider/definition.js +1 -1
- package/split-button/definition.js +1 -1
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/tab/definition.js +1 -1
- package/tag/definition.js +1 -1
- package/text-field/definition.js +1 -1
- package/time-picker/definition.cjs +1 -1
- package/time-picker/definition.js +1 -1
- package/toggletip/definition.cjs +1 -1
- package/toggletip/definition.js +1 -1
- package/tooltip/definition.cjs +1 -1
- package/tooltip/definition.js +1 -1
- package/tree-item/definition.cjs +1 -1
- package/tree-item/definition.js +1 -1
- package/tree-view/definition.cjs +1 -1
- package/tree-view/definition.js +1 -1
- package/unbundled/affix.js +1 -1
- package/unbundled/calendar-picker.template.cjs +1 -1
- package/unbundled/calendar-picker.template.js +1 -1
- package/unbundled/definition.js +1 -1
- package/unbundled/definition2.js +1 -1
- package/unbundled/definition3.cjs +222 -141
- package/unbundled/definition3.js +220 -139
- package/unbundled/definition4.cjs +145 -235
- package/unbundled/definition4.js +143 -233
- package/unbundled/definition5.cjs +269 -27
- package/unbundled/definition5.js +267 -26
- package/unbundled/definition6.cjs +56 -0
- package/unbundled/definition6.js +52 -0
- package/unbundled/listbox.cjs +41 -63
- package/unbundled/listbox.js +39 -61
- package/unbundled/picker-field.template.cjs +1 -1
- package/unbundled/picker-field.template.js +1 -1
- package/unbundled/slider.template.cjs +1 -1
- package/unbundled/slider.template.js +1 -1
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.cjs +56 -16
- package/video-player/definition.js +56 -16
- package/video-player/index.cjs +36 -36
- package/video-player/index.js +2461 -2445
- package/vivid.api.json +285 -38
- package/bundled/option.cjs +0 -1
- package/bundled/option.js +0 -158
- package/unbundled/option.cjs +0 -217
- package/unbundled/option.js +0 -214
package/calendar/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const l=require("../bundled/vivid-element.cjs"),q=require("../bundled/enums.cjs"),x=require("../bundled/calendar-event.cjs"),a=require("../bundled/_has.cjs"),m=require("../bundled/repeat.cjs"),I=require("../bundled/class-names.cjs"),$=Array.isArray||function(e){return e!=null&&e.length>=0&&Object.prototype.toString.call(e)==="[object Array]"};function v(t){for(var e=[],r;!(r=t.next()).done;)e.push(r.value);return e}function w(t,e,r){for(var n=0,o=r.length;n<o;){if(t(e,r[n]))return!0;n+=1}return!1}function z(t){var e=String(t).match(/^function (\w*)/);return e==null?"":e[1]}function H(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}const g=typeof Object.is=="function"?Object.is:H;var b=Object.prototype.toString,D=function(){return b.call(arguments)==="[object Arguments]"?function(e){return b.call(e)==="[object Arguments]"}:function(e){return a._has("callee",e)}}(),R=!{toString:null}.propertyIsEnumerable("toString"),A=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],k=function(){return arguments.propertyIsEnumerable("length")}(),T=function(e,r){for(var n=0;n<e.length;){if(e[n]===r)return!0;n+=1}return!1},_=typeof Object.keys=="function"&&!k?a._curry1(function(e){return Object(e)!==e?[]:Object.keys(e)}):a._curry1(function(e){if(Object(e)!==e)return[];var r,n,o=[],i=k&&D(e);for(r in e)a._has(r,e)&&(!i||r!=="length")&&(o[o.length]=r);if(R)for(n=A.length-1;n>=0;)r=A[n],a._has(r,e)&&!T(o,r)&&(o[o.length]=r),n-=1;return o}),O=a._curry1(function(e){return e===null?"Null":e===void 0?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function E(t,e,r,n){var o=v(t),i=v(e);function s(c,d){return y(c,d,r.slice(),n.slice())}return!w(function(c,d){return!w(s,d,c)},i,o)}function y(t,e,r,n){if(g(t,e))return!0;var o=O(t);if(o!==O(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(o){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&z(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&g(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!g(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var i=r.length-1;i>=0;){if(r[i]===t)return n[i]===e;i-=1}switch(o){case"Map":return t.size!==e.size?!1:E(t.entries(),e.entries(),r.concat([t]),n.concat([e]));case"Set":return t.size!==e.size?!1:E(t.values(),e.values(),r.concat([t]),n.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var s=_(t);if(s.length!==_(e).length)return!1;var c=r.concat([t]),d=n.concat([e]);for(i=s.length-1;i>=0;){var f=s[i];if(!(a._has(f,e)&&y(e[f],t[f],c,d)))return!1;i-=1}return!0}var F=a._curry2(function(e,r){return y(e,r,[],[])});function N(t){return Object.prototype.toString.call(t)==="[object Object]"}function M(t){return Object.prototype.toString.call(t)==="[object String]"}var U=a._curry1(function(e){return!e});function P(t){var e=Object.prototype.toString.call(t);return e==="[object Uint8ClampedArray]"||e==="[object Int8Array]"||e==="[object Uint8Array]"||e==="[object Int16Array]"||e==="[object Uint16Array]"||e==="[object Int32Array]"||e==="[object Uint32Array]"||e==="[object Float32Array]"||e==="[object Float64Array]"||e==="[object BigInt64Array]"||e==="[object BigUint64Array]"}var L=a._curry1(function(e){return e!=null&&typeof e["fantasy-land/empty"]=="function"?e["fantasy-land/empty"]():e!=null&&e.constructor!=null&&typeof e.constructor["fantasy-land/empty"]=="function"?e.constructor["fantasy-land/empty"]():e!=null&&typeof e.empty=="function"?e.empty():e!=null&&e.constructor!=null&&typeof e.constructor.empty=="function"?e.constructor.empty():$(e)?[]:M(e)?"":N(e)?{}:D(e)?function(){return arguments}():P(e)?e.constructor.from(""):void 0}),W=a._curry1(function(e){return e!=null&&F(e,L(e))});const B=':host{display:block;overflow:auto;block-size:inherit;max-block-size:inherit}ol{padding:0;margin:0;list-style:none}[role=grid i]{position:relative;z-index:0;display:grid;margin:auto;grid-template-areas:"filler column-headers" "row-headers calendar";grid-template-columns:min-content auto;inline-size:max(100%,500px);min-inline-size:880px}.row-headers{display:grid;grid-area:row-headers;grid-template-rows:repeat(24,1fr);margin-inline-end:2px}.row-headers>[role=rowheader i]{display:flex;align-items:flex-end;justify-content:flex-end}.row-headers>[role=rowheader i]>time{font:var(--vvd-typography-base-condensed);font-size:small;line-height:1;text-transform:uppercase;white-space:nowrap}.sticky-column .row-headers,.sticky-all .row-headers{position:sticky;z-index:1;background-color:var(--calendar-column-background-color, var(--vvd-color-canvas));inset-inline-start:0;margin-inline-end:3px}.calendar-row{display:contents}.calendar-grid-presentation{display:grid;overflow:hidden;border-radius:8px;background:var(--vvd-color-surface-2dp);counter-reset:listing;filter:var(--vvd-shadow-surface-2dp);gap:1px;grid-area:calendar;grid-auto-flow:column;grid-template:repeat(24,1fr)/repeat(7,1fr)}.hours{display:contents}.hours>[role=listitem i]{position:relative;grid-column:1/8;grid-row:var(--row);min-block-size:calc(1px*(48 + 4*clamp(-1,var(--vvd-size-density, 0),2)));pointer-events:none}.hours>[role=listitem i]:not(:first-child):after{position:absolute;border-block-end:var(--vvd-color-neutral-100) 1px solid;content:"";inline-size:100%;margin-block-start:-1px}.hours>[role=listitem i]:nth-child(24n+1){--row: 1}.hours>[role=listitem i]:nth-child(24n+2){--row: 2}.hours>[role=listitem i]:nth-child(24n+3){--row: 3}.hours>[role=listitem i]:nth-child(24n+4){--row: 4}.hours>[role=listitem i]:nth-child(24n+5){--row: 5}.hours>[role=listitem i]:nth-child(24n+6){--row: 6}.hours>[role=listitem i]:nth-child(24n+7){--row: 7}.hours>[role=listitem i]:nth-child(24n+8){--row: 8}.hours>[role=listitem i]:nth-child(24n+9){--row: 9}.hours>[role=listitem i]:nth-child(24n+10){--row: 10}.hours>[role=listitem i]:nth-child(24n+11){--row: 11}.hours>[role=listitem i]:nth-child(24n+12){--row: 12}.hours>[role=listitem i]:nth-child(24n+13){--row: 13}.hours>[role=listitem i]:nth-child(24n+14){--row: 14}.hours>[role=listitem i]:nth-child(24n+15){--row: 15}.hours>[role=listitem i]:nth-child(24n+16){--row: 16}.hours>[role=listitem i]:nth-child(24n+17){--row: 17}.hours>[role=listitem i]:nth-child(24n+18){--row: 18}.hours>[role=listitem i]:nth-child(24n+19){--row: 19}.hours>[role=listitem i]:nth-child(24n+20){--row: 20}.hours>[role=listitem i]:nth-child(24n+21){--row: 21}.hours>[role=listitem i]:nth-child(24n+22){--row: 22}.hours>[role=listitem i]:nth-child(24n+23){--row: 23}.hours>[role=listitem i]:nth-child(24n+24){--row: 24}[role=gridcell i]{display:grid;gap:1px;grid-auto-flow:column}[role=gridcell i],[role=columnheader i],[role=columnheader i] [role=button i]{position:relative}[role=gridcell i]:before,[role=columnheader i]:before,[role=columnheader i] [role=button i]:before{position:absolute;z-index:-1;background-color:var(--vvd-color-information-400);content:"";inset:0}[role=gridcell i]:focus,[role=columnheader i]:focus,[role=columnheader i] [role=button i]:focus{outline:none}[role=gridcell i]:not(:focus-visible):before,[role=columnheader i]:not(:focus-visible):before,[role=columnheader i] [role=button i]:not(:focus-visible):before{display:none}.columns{display:contents}.columns>[role=gridcell i]{position:relative;grid-column:var(--column);grid-row:1/25}.columns>[role=gridcell i]:nth-child(1){--column: 1}.columns>[role=gridcell i]:nth-child(2){--column: 2}.columns>[role=gridcell i]:nth-child(3){--column: 3}.columns>[role=gridcell i]:nth-child(4){--column: 4}.columns>[role=gridcell i]:nth-child(5){--column: 5}.columns>[role=gridcell i]:nth-child(6){--column: 6}.columns>[role=gridcell i]:nth-child(7){--column: 7}.columns>[role=gridcell i]:not(:first-child):after{position:absolute;block-size:100%;border-inline-end:var(--vvd-color-neutral-100) 1px solid;content:"";margin-inline-start:-1px}.column-headers{display:grid;grid-area:column-headers;grid-template-columns:repeat(7,1fr)}.column-headers [role=columnheader i] h2{display:grid;align-items:baseline;margin:0;font:var(--vvd-typography-heading-4);grid-template-columns:1fr auto 1fr}.column-headers [role=columnheader i] h2>em{font:inherit;inline-size:min-content;inset-inline-start:0}.column-headers [role=columnheader i] h2>small{font:var(--vvd-typography-base-condensed);text-transform:uppercase}.sticky-header .column-headers,.sticky-all .column-headers{position:sticky;z-index:1;background-color:var(--calendar-header-background-color, var(--vvd-color-canvas));inset-block-start:0;margin-block-end:3px}.filler{background-color:transparent;grid-area:filler}.sticky-header .filler,.sticky-all .filler,.sticky-column .filler{position:sticky;z-index:2;background-color:var(--calendar-header-background-color, var(--vvd-color-canvas));margin-block-end:3px}.sticky-column .filler{inset-inline-start:0}.sticky-header .filler{inset-block-start:0}.sticky-all .filler{inset-block-start:0;inset-inline-start:0}',S="ArrowUp",C="ArrowRight",p="ArrowDown",j="ArrowLeft";function K(t){return t instanceof HTMLElement&&(t.matches('[role="gridcell"i]')||t.matches('[role="columnheader"i]'))}const Y=t=>t.matches('[role="columnheader"i]')?'[role="gridcell"i]':'[role="columnheader"i]';function V(t,e){if(e.parentNode instanceof HTMLElement)switch(t){case C:return e.nextElementSibling||e.parentNode.firstElementChild;case j:return e.previousElementSibling||e.parentNode.lastElementChild;case S:case p:{const{children:r}=e.parentNode,n=Array.from(r).indexOf(e);return this.shadowRoot.querySelector(`${Y(e)}:nth-child(${n+1})`)}}}function G(t,e){if(t!==p)return;const r=e.closest('[role="columnheader"i]'),n=this.shadowRoot.querySelectorAll('[role="columnheader"i]'),o=Array.from(n).indexOf(r);return this.shadowRoot.querySelector(`[role="gridcell"i]:nth-child(${o+1})`)}function X(t){const e=t.closest('[role="gridcell"i], [role="columnheader"i]');if(e){const{parentElement:r}=e;if(r)return r.children&&Array.from(r.children).indexOf(e)}}function J(t,e,r){const n=e.closest('[role="rowheader"], [role="gridcell"i]');if(n){const o=n.getBoundingClientRect(),i=t.clientY-o.y,s=o.height/r,c=i/s;return Math.round((c+Number.EPSILON)*100)/100}}const Q=function(t){if(!(t instanceof KeyboardEvent||t instanceof MouseEvent))throw new Error("Invalid event. Event must be instance of KeyboardEvent or MouseEvent");const[e]=t.composedPath();if(!(e&&e instanceof HTMLElement&&this.shadowRoot.contains(e)))throw new Error("Invalid event. Event must contain a target object which is a direct descendant of calendar");const r=X(e);let n;t instanceof MouseEvent&&(n=J(t,e,this._hours));const o={...r!=null&&{day:r},...n!=null&&{hour:n}};return U(W(o))?o:null};var Z=Object.defineProperty,h=(t,e,r,n)=>{for(var o=void 0,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(e,r,o)||o);return o&&Z(e,r,o),o};const ee=t=>{const e=window.getComputedStyle(t).overflowY,r=window.getComputedStyle(t).overflowX;return{vertical:(e==="auto"||e==="scroll")&&t.scrollHeight>t.clientHeight,horizontal:(r==="auto"||r==="scroll")&&t.scrollWidth>t.clientWidth}};class u extends l.VividElement{constructor(){super(...arguments),this.hour12=!1,this.stickyMode=q.Sticky.All,this._hours=24,this._days=7,this.hoursAsDatetime=Array.from({length:this._hours-1}).fill(new Date(new Date().setHours(0,0,0))).map((e,r)=>new Date(e.setHours(++r))),this._generateDaysArr=e=>{if(e.length==this._days)return e;const r=new Date(e[e.length-1]);return r.setDate(r.getDate()+1),this._generateDaysArr([...e,r])},this.getEventContext=Q}get#e(){const{activeElement:e}=document;return e instanceof x.CalendarEvent?e:null}getCalendarEventContainingCell(e){const r=e.getAttribute("slot");return this.shadowRoot.querySelector(`slot[name="${r}"i]`).parentElement}arrowKeysInteractions(e){const{activeElement:r}=this.shadowRoot;let n;K(r)?n=V.call(this,e,r):this.#e?n=this.getCalendarEventContainingCell(this.#e):r?.matches('em[role="button"i]')?n=G.call(this,e,r):n=this.shadowRoot.querySelector('[role="columnheader"i]'),this.activateElement(n)}activateElement(e){const r=({target:n})=>n.setAttribute("tabindex","-1");e?.addEventListener("blur",r,{once:!0}),e?.setAttribute("tabindex","0"),e?.focus()}onKeydown({key:e}){const r=[S,C,p,j].some(n=>n==e);return r&&this.arrowKeysInteractions(e),!r}connectedCallback(){super.connectedCallback(),this.initializeScrollPosition()}initializeScrollPosition(){if(!ee(this).vertical)return;const n=this.scrollHeight/this._hours*(8-1);l.Updates.enqueue(()=>{this.scrollTo({top:n})})}}h([l.attr],u.prototype,"datetime");h([l.attr({attribute:"start-day"})],u.prototype,"startDay");h([l.attr],u.prototype,"locales");h([l.attr({mode:"boolean"})],u.prototype,"hour12");h([l.attr({attribute:"sticky-mode",mode:"fromView"})],u.prototype,"stickyMode");function te(t){const e=r=>`0${r}`.slice(-2);return`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())}`}const re=new Map([["sunday",0],["monday",1]]);function ne(t=new Date,e){t=new Date(t);let r=re.get(e);r??=1;const n=t.getDate()-(t.getDay()+7-r)%7;return new Date(t.setDate(n))}const oe=({stickyMode:t})=>I.classNames([`sticky-${t}`,!!t]),ie=()=>l.html` <div class="row-headers" role="row">
|
|
1
|
+
"use strict";const l=require("../bundled/vivid-element.cjs"),q=require("../bundled/enums.cjs"),x=require("../bundled/calendar-event.cjs"),a=require("../bundled/_has.cjs"),m=require("../bundled/repeat.cjs"),I=require("../bundled/class-names.cjs"),$=Array.isArray||function(e){return e!=null&&e.length>=0&&Object.prototype.toString.call(e)==="[object Array]"};function v(t){for(var e=[],r;!(r=t.next()).done;)e.push(r.value);return e}function w(t,e,r){for(var n=0,o=r.length;n<o;){if(t(e,r[n]))return!0;n+=1}return!1}function z(t){var e=String(t).match(/^function (\w*)/);return e==null?"":e[1]}function H(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}const g=typeof Object.is=="function"?Object.is:H;var b=Object.prototype.toString,D=function(){return b.call(arguments)==="[object Arguments]"?function(e){return b.call(e)==="[object Arguments]"}:function(e){return a._has("callee",e)}}(),R=!{toString:null}.propertyIsEnumerable("toString"),A=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],k=function(){return arguments.propertyIsEnumerable("length")}(),T=function(e,r){for(var n=0;n<e.length;){if(e[n]===r)return!0;n+=1}return!1},_=typeof Object.keys=="function"&&!k?a._curry1(function(e){return Object(e)!==e?[]:Object.keys(e)}):a._curry1(function(e){if(Object(e)!==e)return[];var r,n,o=[],i=k&&D(e);for(r in e)a._has(r,e)&&(!i||r!=="length")&&(o[o.length]=r);if(R)for(n=A.length-1;n>=0;)r=A[n],a._has(r,e)&&!T(o,r)&&(o[o.length]=r),n-=1;return o}),O=a._curry1(function(e){return e===null?"Null":e===void 0?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function E(t,e,r,n){var o=v(t),i=v(e);function s(c,d){return y(c,d,r.slice(),n.slice())}return!w(function(c,d){return!w(s,d,c)},i,o)}function y(t,e,r,n){if(g(t,e))return!0;var o=O(t);if(o!==O(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(o){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&z(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&g(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!g(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var i=r.length-1;i>=0;){if(r[i]===t)return n[i]===e;i-=1}switch(o){case"Map":return t.size!==e.size?!1:E(t.entries(),e.entries(),r.concat([t]),n.concat([e]));case"Set":return t.size!==e.size?!1:E(t.values(),e.values(),r.concat([t]),n.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var s=_(t);if(s.length!==_(e).length)return!1;var c=r.concat([t]),d=n.concat([e]);for(i=s.length-1;i>=0;){var f=s[i];if(!(a._has(f,e)&&y(e[f],t[f],c,d)))return!1;i-=1}return!0}var M=a._curry2(function(e,r){return y(e,r,[],[])});function F(t){return Object.prototype.toString.call(t)==="[object Object]"}function N(t){return Object.prototype.toString.call(t)==="[object String]"}var U=a._curry1(function(e){return!e});function P(t){var e=Object.prototype.toString.call(t);return e==="[object Uint8ClampedArray]"||e==="[object Int8Array]"||e==="[object Uint8Array]"||e==="[object Int16Array]"||e==="[object Uint16Array]"||e==="[object Int32Array]"||e==="[object Uint32Array]"||e==="[object Float32Array]"||e==="[object Float64Array]"||e==="[object BigInt64Array]"||e==="[object BigUint64Array]"}var L=a._curry1(function(e){return e!=null&&typeof e["fantasy-land/empty"]=="function"?e["fantasy-land/empty"]():e!=null&&e.constructor!=null&&typeof e.constructor["fantasy-land/empty"]=="function"?e.constructor["fantasy-land/empty"]():e!=null&&typeof e.empty=="function"?e.empty():e!=null&&e.constructor!=null&&typeof e.constructor.empty=="function"?e.constructor.empty():e==Set||e instanceof Set?new Set:e==Map||e instanceof Map?new Map:$(e)?[]:N(e)?"":F(e)?{}:D(e)?function(){return arguments}():P(e)?e.constructor.from(""):void 0}),W=a._curry1(function(e){return e!=null&&M(e,L(e))});const B=':host{display:block;overflow:auto;block-size:inherit;max-block-size:inherit}ol{padding:0;margin:0;list-style:none}[role=grid i]{position:relative;z-index:0;display:grid;margin:auto;grid-template-areas:"filler column-headers" "row-headers calendar";grid-template-columns:min-content auto;inline-size:max(100%,500px);min-inline-size:880px}.row-headers{display:grid;grid-area:row-headers;grid-template-rows:repeat(24,1fr);margin-inline-end:2px}.row-headers>[role=rowheader i]{display:flex;align-items:flex-end;justify-content:flex-end}.row-headers>[role=rowheader i]>time{font:var(--vvd-typography-base-condensed);font-size:small;line-height:1;text-transform:uppercase;white-space:nowrap}.sticky-column .row-headers,.sticky-all .row-headers{position:sticky;z-index:1;background-color:var(--calendar-column-background-color, var(--vvd-color-canvas));inset-inline-start:0;margin-inline-end:3px}.calendar-row{display:contents}.calendar-grid-presentation{display:grid;overflow:hidden;border-radius:8px;background:var(--vvd-color-surface-2dp);counter-reset:listing;filter:var(--vvd-shadow-surface-2dp);gap:1px;grid-area:calendar;grid-auto-flow:column;grid-template:repeat(24,1fr)/repeat(7,1fr)}.hours{display:contents}.hours>[role=listitem i]{position:relative;grid-column:1/8;grid-row:var(--row);min-block-size:calc(1px*(48 + 4*clamp(-1,var(--vvd-size-density, 0),2)));pointer-events:none}.hours>[role=listitem i]:not(:first-child):after{position:absolute;border-block-end:var(--vvd-color-neutral-100) 1px solid;content:"";inline-size:100%;margin-block-start:-1px}.hours>[role=listitem i]:nth-child(24n+1){--row: 1}.hours>[role=listitem i]:nth-child(24n+2){--row: 2}.hours>[role=listitem i]:nth-child(24n+3){--row: 3}.hours>[role=listitem i]:nth-child(24n+4){--row: 4}.hours>[role=listitem i]:nth-child(24n+5){--row: 5}.hours>[role=listitem i]:nth-child(24n+6){--row: 6}.hours>[role=listitem i]:nth-child(24n+7){--row: 7}.hours>[role=listitem i]:nth-child(24n+8){--row: 8}.hours>[role=listitem i]:nth-child(24n+9){--row: 9}.hours>[role=listitem i]:nth-child(24n+10){--row: 10}.hours>[role=listitem i]:nth-child(24n+11){--row: 11}.hours>[role=listitem i]:nth-child(24n+12){--row: 12}.hours>[role=listitem i]:nth-child(24n+13){--row: 13}.hours>[role=listitem i]:nth-child(24n+14){--row: 14}.hours>[role=listitem i]:nth-child(24n+15){--row: 15}.hours>[role=listitem i]:nth-child(24n+16){--row: 16}.hours>[role=listitem i]:nth-child(24n+17){--row: 17}.hours>[role=listitem i]:nth-child(24n+18){--row: 18}.hours>[role=listitem i]:nth-child(24n+19){--row: 19}.hours>[role=listitem i]:nth-child(24n+20){--row: 20}.hours>[role=listitem i]:nth-child(24n+21){--row: 21}.hours>[role=listitem i]:nth-child(24n+22){--row: 22}.hours>[role=listitem i]:nth-child(24n+23){--row: 23}.hours>[role=listitem i]:nth-child(24n+24){--row: 24}[role=gridcell i]{display:grid;gap:1px;grid-auto-flow:column}[role=gridcell i],[role=columnheader i],[role=columnheader i] [role=button i]{position:relative}[role=gridcell i]:before,[role=columnheader i]:before,[role=columnheader i] [role=button i]:before{position:absolute;z-index:-1;background-color:var(--vvd-color-information-400);content:"";inset:0}[role=gridcell i]:focus,[role=columnheader i]:focus,[role=columnheader i] [role=button i]:focus{outline:none}[role=gridcell i]:not(:focus-visible):before,[role=columnheader i]:not(:focus-visible):before,[role=columnheader i] [role=button i]:not(:focus-visible):before{display:none}.columns{display:contents}.columns>[role=gridcell i]{position:relative;grid-column:var(--column);grid-row:1/25}.columns>[role=gridcell i]:nth-child(1){--column: 1}.columns>[role=gridcell i]:nth-child(2){--column: 2}.columns>[role=gridcell i]:nth-child(3){--column: 3}.columns>[role=gridcell i]:nth-child(4){--column: 4}.columns>[role=gridcell i]:nth-child(5){--column: 5}.columns>[role=gridcell i]:nth-child(6){--column: 6}.columns>[role=gridcell i]:nth-child(7){--column: 7}.columns>[role=gridcell i]:not(:first-child):after{position:absolute;block-size:100%;border-inline-end:var(--vvd-color-neutral-100) 1px solid;content:"";margin-inline-start:-1px}.column-headers{display:grid;grid-area:column-headers;grid-template-columns:repeat(7,1fr)}.column-headers [role=columnheader i] h2{display:grid;align-items:baseline;margin:0;font:var(--vvd-typography-heading-4);grid-template-columns:1fr auto 1fr}.column-headers [role=columnheader i] h2>em{font:inherit;inline-size:min-content;inset-inline-start:0}.column-headers [role=columnheader i] h2>small{font:var(--vvd-typography-base-condensed);text-transform:uppercase}.sticky-header .column-headers,.sticky-all .column-headers{position:sticky;z-index:1;background-color:var(--calendar-header-background-color, var(--vvd-color-canvas));inset-block-start:0;margin-block-end:3px}.filler{background-color:transparent;grid-area:filler}.sticky-header .filler,.sticky-all .filler,.sticky-column .filler{position:sticky;z-index:2;background-color:var(--calendar-header-background-color, var(--vvd-color-canvas));margin-block-end:3px}.sticky-column .filler{inset-inline-start:0}.sticky-header .filler{inset-block-start:0}.sticky-all .filler{inset-block-start:0;inset-inline-start:0}',S="ArrowUp",C="ArrowRight",p="ArrowDown",j="ArrowLeft";function K(t){return t instanceof HTMLElement&&(t.matches('[role="gridcell"i]')||t.matches('[role="columnheader"i]'))}const Y=t=>t.matches('[role="columnheader"i]')?'[role="gridcell"i]':'[role="columnheader"i]';function V(t,e){if(e.parentNode instanceof HTMLElement)switch(t){case C:return e.nextElementSibling||e.parentNode.firstElementChild;case j:return e.previousElementSibling||e.parentNode.lastElementChild;case S:case p:{const{children:r}=e.parentNode,n=Array.from(r).indexOf(e);return this.shadowRoot.querySelector(`${Y(e)}:nth-child(${n+1})`)}}}function G(t,e){if(t!==p)return;const r=e.closest('[role="columnheader"i]'),n=this.shadowRoot.querySelectorAll('[role="columnheader"i]'),o=Array.from(n).indexOf(r);return this.shadowRoot.querySelector(`[role="gridcell"i]:nth-child(${o+1})`)}function X(t){const e=t.closest('[role="gridcell"i], [role="columnheader"i]');if(e){const{parentElement:r}=e;if(r)return r.children&&Array.from(r.children).indexOf(e)}}function J(t,e,r){const n=e.closest('[role="rowheader"], [role="gridcell"i]');if(n){const o=n.getBoundingClientRect(),i=t.clientY-o.y,s=o.height/r,c=i/s;return Math.round((c+Number.EPSILON)*100)/100}}const Q=function(t){if(!(t instanceof KeyboardEvent||t instanceof MouseEvent))throw new Error("Invalid event. Event must be instance of KeyboardEvent or MouseEvent");const[e]=t.composedPath();if(!(e&&e instanceof HTMLElement&&this.shadowRoot.contains(e)))throw new Error("Invalid event. Event must contain a target object which is a direct descendant of calendar");const r=X(e);let n;t instanceof MouseEvent&&(n=J(t,e,this._hours));const o={...r!=null&&{day:r},...n!=null&&{hour:n}};return U(W(o))?o:null};var Z=Object.defineProperty,h=(t,e,r,n)=>{for(var o=void 0,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(e,r,o)||o);return o&&Z(e,r,o),o};const ee=t=>{const e=window.getComputedStyle(t).overflowY,r=window.getComputedStyle(t).overflowX;return{vertical:(e==="auto"||e==="scroll")&&t.scrollHeight>t.clientHeight,horizontal:(r==="auto"||r==="scroll")&&t.scrollWidth>t.clientWidth}};class u extends l.VividElement{constructor(){super(...arguments),this.hour12=!1,this.stickyMode=q.Sticky.All,this._hours=24,this._days=7,this.hoursAsDatetime=Array.from({length:this._hours-1}).fill(new Date(new Date().setHours(0,0,0))).map((e,r)=>new Date(e.setHours(++r))),this._generateDaysArr=e=>{if(e.length==this._days)return e;const r=new Date(e[e.length-1]);return r.setDate(r.getDate()+1),this._generateDaysArr([...e,r])},this.getEventContext=Q}get#e(){const{activeElement:e}=document;return e instanceof x.CalendarEvent?e:null}getCalendarEventContainingCell(e){const r=e.getAttribute("slot");return this.shadowRoot.querySelector(`slot[name="${r}"i]`).parentElement}arrowKeysInteractions(e){const{activeElement:r}=this.shadowRoot;let n;K(r)?n=V.call(this,e,r):this.#e?n=this.getCalendarEventContainingCell(this.#e):r?.matches('em[role="button"i]')?n=G.call(this,e,r):n=this.shadowRoot.querySelector('[role="columnheader"i]'),this.activateElement(n)}activateElement(e){const r=({target:n})=>n.setAttribute("tabindex","-1");e?.addEventListener("blur",r,{once:!0}),e?.setAttribute("tabindex","0"),e?.focus()}onKeydown({key:e}){const r=[S,C,p,j].some(n=>n==e);return r&&this.arrowKeysInteractions(e),!r}connectedCallback(){super.connectedCallback(),this.initializeScrollPosition()}initializeScrollPosition(){if(!ee(this).vertical)return;const n=this.scrollHeight/this._hours*(8-1);l.Updates.enqueue(()=>{this.scrollTo({top:n})})}}h([l.attr],u.prototype,"datetime");h([l.attr({attribute:"start-day"})],u.prototype,"startDay");h([l.attr],u.prototype,"locales");h([l.attr({mode:"boolean"})],u.prototype,"hour12");h([l.attr({attribute:"sticky-mode",mode:"fromView"})],u.prototype,"stickyMode");function te(t){const e=r=>`0${r}`.slice(-2);return`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())}`}const re=new Map([["sunday",0],["monday",1]]);function ne(t=new Date,e){t=new Date(t);let r=re.get(e);r??=1;const n=t.getDate()-(t.getDay()+7-r)%7;return new Date(t.setDate(n))}const oe=({stickyMode:t})=>I.classNames([`sticky-${t}`,!!t]),ie=()=>l.html` <div class="row-headers" role="row">
|
|
2
2
|
${m.repeat(t=>t.hoursAsDatetime,l.html`<span role="rowheader">
|
|
3
3
|
<time
|
|
4
4
|
datetime="${(t,e)=>new Intl.DateTimeFormat(e.parent.locales,{hour:"numeric",minute:"numeric",hour12:!1}).format(t)}"
|
package/calendar/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { V as $, U as q, a as h, h as s, c as z, d as H } from "../bundled/vivid-element.js";
|
|
2
2
|
import { S as R } from "../bundled/enums.js";
|
|
3
3
|
import { C as T } from "../bundled/calendar-event.js";
|
|
4
|
-
import { _ as f, a as c, b as
|
|
4
|
+
import { _ as f, a as c, b as M } from "../bundled/_has.js";
|
|
5
5
|
import { r as g } from "../bundled/repeat.js";
|
|
6
|
-
import { c as
|
|
7
|
-
const
|
|
6
|
+
import { c as F } from "../bundled/class-names.js";
|
|
7
|
+
const N = Array.isArray || function(e) {
|
|
8
8
|
return e != null && e.length >= 0 && Object.prototype.toString.call(e) === "[object Array]";
|
|
9
9
|
};
|
|
10
10
|
function b(t) {
|
|
@@ -36,7 +36,7 @@ var k = Object.prototype.toString, C = /* @__PURE__ */ function() {
|
|
|
36
36
|
};
|
|
37
37
|
}(), L = !/* @__PURE__ */ {
|
|
38
38
|
toString: null
|
|
39
|
-
}.propertyIsEnumerable("toString"), O = ["constructor", "valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"],
|
|
39
|
+
}.propertyIsEnumerable("toString"), O = ["constructor", "valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"], S = /* @__PURE__ */ function() {
|
|
40
40
|
return arguments.propertyIsEnumerable("length");
|
|
41
41
|
}(), W = function(e, r) {
|
|
42
42
|
for (var n = 0; n < e.length; ) {
|
|
@@ -45,19 +45,19 @@ var k = Object.prototype.toString, C = /* @__PURE__ */ function() {
|
|
|
45
45
|
n += 1;
|
|
46
46
|
}
|
|
47
47
|
return !1;
|
|
48
|
-
},
|
|
48
|
+
}, D = typeof Object.keys == "function" && !S ? /* @__PURE__ */ c(function(e) {
|
|
49
49
|
return Object(e) !== e ? [] : Object.keys(e);
|
|
50
50
|
}) : /* @__PURE__ */ c(function(e) {
|
|
51
51
|
if (Object(e) !== e)
|
|
52
52
|
return [];
|
|
53
|
-
var r, n, o = [], i =
|
|
53
|
+
var r, n, o = [], i = S && C(e);
|
|
54
54
|
for (r in e)
|
|
55
55
|
f(r, e) && (!i || r !== "length") && (o[o.length] = r);
|
|
56
56
|
if (L)
|
|
57
57
|
for (n = O.length - 1; n >= 0; )
|
|
58
58
|
r = O[n], f(r, e) && !W(o, r) && (o[o.length] = r), n -= 1;
|
|
59
59
|
return o;
|
|
60
|
-
}),
|
|
60
|
+
}), E = /* @__PURE__ */ c(function(e) {
|
|
61
61
|
return e === null ? "Null" : e === void 0 ? "Undefined" : Object.prototype.toString.call(e).slice(8, -1);
|
|
62
62
|
});
|
|
63
63
|
function _(t, e, r, n) {
|
|
@@ -72,8 +72,8 @@ function _(t, e, r, n) {
|
|
|
72
72
|
function v(t, e, r, n) {
|
|
73
73
|
if (y(t, e))
|
|
74
74
|
return !0;
|
|
75
|
-
var o =
|
|
76
|
-
if (o !==
|
|
75
|
+
var o = E(t);
|
|
76
|
+
if (o !== E(e))
|
|
77
77
|
return !1;
|
|
78
78
|
if (typeof t["fantasy-land/equals"] == "function" || typeof e["fantasy-land/equals"] == "function")
|
|
79
79
|
return typeof t["fantasy-land/equals"] == "function" && t["fantasy-land/equals"](e) && typeof e["fantasy-land/equals"] == "function" && e["fantasy-land/equals"](t);
|
|
@@ -136,8 +136,8 @@ function v(t, e, r, n) {
|
|
|
136
136
|
default:
|
|
137
137
|
return !1;
|
|
138
138
|
}
|
|
139
|
-
var l =
|
|
140
|
-
if (l.length !==
|
|
139
|
+
var l = D(t);
|
|
140
|
+
if (l.length !== D(e).length)
|
|
141
141
|
return !1;
|
|
142
142
|
var a = r.concat([t]), d = n.concat([e]);
|
|
143
143
|
for (i = l.length - 1; i >= 0; ) {
|
|
@@ -148,7 +148,7 @@ function v(t, e, r, n) {
|
|
|
148
148
|
}
|
|
149
149
|
return !0;
|
|
150
150
|
}
|
|
151
|
-
var B = /* @__PURE__ */
|
|
151
|
+
var B = /* @__PURE__ */ M(function(e, r) {
|
|
152
152
|
return v(e, r, [], []);
|
|
153
153
|
});
|
|
154
154
|
function K(t) {
|
|
@@ -165,7 +165,7 @@ function G(t) {
|
|
|
165
165
|
return e === "[object Uint8ClampedArray]" || e === "[object Int8Array]" || e === "[object Uint8Array]" || e === "[object Int16Array]" || e === "[object Uint16Array]" || e === "[object Int32Array]" || e === "[object Uint32Array]" || e === "[object Float32Array]" || e === "[object Float64Array]" || e === "[object BigInt64Array]" || e === "[object BigUint64Array]";
|
|
166
166
|
}
|
|
167
167
|
var X = /* @__PURE__ */ c(function(e) {
|
|
168
|
-
return e != null && typeof e["fantasy-land/empty"] == "function" ? e["fantasy-land/empty"]() : e != null && e.constructor != null && typeof e.constructor["fantasy-land/empty"] == "function" ? e.constructor["fantasy-land/empty"]() : e != null && typeof e.empty == "function" ? e.empty() : e != null && e.constructor != null && typeof e.constructor.empty == "function" ? e.constructor.empty() :
|
|
168
|
+
return e != null && typeof e["fantasy-land/empty"] == "function" ? e["fantasy-land/empty"]() : e != null && e.constructor != null && typeof e.constructor["fantasy-land/empty"] == "function" ? e.constructor["fantasy-land/empty"]() : e != null && typeof e.empty == "function" ? e.empty() : e != null && e.constructor != null && typeof e.constructor.empty == "function" ? e.constructor.empty() : e == Set || e instanceof Set ? /* @__PURE__ */ new Set() : e == Map || e instanceof Map ? /* @__PURE__ */ new Map() : N(e) ? [] : V(e) ? "" : K(e) ? {} : C(e) ? /* @__PURE__ */ function() {
|
|
169
169
|
return arguments;
|
|
170
170
|
}() : G(e) ? e.constructor.from("") : void 0;
|
|
171
171
|
}), J = /* @__PURE__ */ c(function(e) {
|
|
@@ -338,7 +338,7 @@ function ue(t = /* @__PURE__ */ new Date(), e) {
|
|
|
338
338
|
const n = t.getDate() - (t.getDay() + 7 - r) % 7;
|
|
339
339
|
return new Date(t.setDate(n));
|
|
340
340
|
}
|
|
341
|
-
const de = ({ stickyMode: t }) =>
|
|
341
|
+
const de = ({ stickyMode: t }) => F([`sticky-${t}`, !!t]), he = () => s` <div class="row-headers" role="row">
|
|
342
342
|
${g(
|
|
343
343
|
(t) => t.hoursAsDatetime,
|
|
344
344
|
s`<span role="rowheader">
|
package/card/definition.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const icon_definition = require('../icon/definition.cjs');
|
|
6
|
-
const elevation_definition = require('../unbundled/
|
|
6
|
+
const elevation_definition = require('../unbundled/definition6.cjs');
|
|
7
7
|
const vividElement = require('../unbundled/vivid-element.cjs');
|
|
8
8
|
const fastElement = require('@microsoft/fast-element');
|
|
9
9
|
const linkable = require('../unbundled/linkable.cjs');
|
package/card/definition.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VwcIconElement as Icon, iconDefinition } from '../icon/definition.js';
|
|
2
|
-
import { E as Elevation, e as elevationDefinition } from '../unbundled/
|
|
2
|
+
import { E as Elevation, e as elevationDefinition } from '../unbundled/definition6.js';
|
|
3
3
|
import { V as VividElement, d as defineVividComponent, c as createRegisterFunction } from '../unbundled/vivid-element.js';
|
|
4
4
|
import { attr, observable, when, html, slotted } from '@microsoft/fast-element';
|
|
5
5
|
import { L as Linkable } from '../unbundled/linkable.js';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const vividElement = require('../unbundled/vivid-element.cjs');
|
|
6
|
-
const popup_definition = require('../unbundled/
|
|
6
|
+
const popup_definition = require('../unbundled/definition5.cjs');
|
|
7
7
|
const icon_definition = require('../icon/definition.cjs');
|
|
8
8
|
const mixins = require('../unbundled/mixins.cjs');
|
|
9
9
|
const fastElement = require('@microsoft/fast-element');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { V as VividElement, d as defineVividComponent, c as createRegisterFunction } from '../unbundled/vivid-element.js';
|
|
2
|
-
import { P as Popup, p as popupDefinition } from '../unbundled/
|
|
2
|
+
import { P as Popup, p as popupDefinition } from '../unbundled/definition5.js';
|
|
3
3
|
import { VwcIconElement as Icon, iconDefinition } from '../icon/definition.js';
|
|
4
4
|
import { a as WithFeedback, f as feedbackMessageDefinition } from '../unbundled/mixins.js';
|
|
5
5
|
import { attr, observable, nullableNumberConverter, ref, when, html, slotted, repeat } from '@microsoft/fast-element';
|
package/combobox/definition.cjs
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const icon_definition = require('../icon/definition.cjs');
|
|
6
|
-
const popup_definition = require('../unbundled/
|
|
7
|
-
const option_definition = require('../
|
|
6
|
+
const popup_definition = require('../unbundled/definition5.cjs');
|
|
7
|
+
const option_definition = require('../unbundled/definition3.cjs');
|
|
8
8
|
const textField = require('../unbundled/text-field.cjs');
|
|
9
9
|
const vividElement = require('../unbundled/vivid-element.cjs');
|
|
10
10
|
const mixins = require('../unbundled/mixins.cjs');
|
|
@@ -74,14 +74,12 @@ class Combobox extends withContextualHelp.WithContextualHelp(
|
|
|
74
74
|
this.proxy = document.createElement("input");
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
|
-
* Reset the element to its first selectable option when its parent form is reset.
|
|
78
|
-
*
|
|
79
77
|
* @internal
|
|
80
78
|
*/
|
|
81
79
|
formResetCallback() {
|
|
82
80
|
super.formResetCallback();
|
|
83
|
-
this.
|
|
84
|
-
this.
|
|
81
|
+
this.selectedIndex = this._newDefaultSelectedIndex([], this.options, -1) ?? -1;
|
|
82
|
+
this.value = this.firstSelectedOption?.text || "";
|
|
85
83
|
}
|
|
86
84
|
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
87
85
|
validate() {
|
|
@@ -123,8 +121,7 @@ class Combobox extends withContextualHelp.WithContextualHelp(
|
|
|
123
121
|
return this.filteredOptions.length ? this.filteredOptions : this._options;
|
|
124
122
|
}
|
|
125
123
|
set options(value) {
|
|
126
|
-
|
|
127
|
-
fastElement.Observable.notify(this, "options");
|
|
124
|
+
super.options = value;
|
|
128
125
|
}
|
|
129
126
|
/**
|
|
130
127
|
* Updates the placeholder on the proxy element.
|
|
@@ -372,24 +369,8 @@ class Combobox extends withContextualHelp.WithContextualHelp(
|
|
|
372
369
|
this.selectedIndex = this.selectedIndex - 1;
|
|
373
370
|
}
|
|
374
371
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
*
|
|
378
|
-
* @internal
|
|
379
|
-
* @remarks
|
|
380
|
-
* Overrides `Listbox.setDefaultSelectedOption`
|
|
381
|
-
*/
|
|
382
|
-
setDefaultSelectedOption() {
|
|
383
|
-
if (this.$fastController.isConnected && this.options) {
|
|
384
|
-
const selectedIndex = this.options.findIndex(
|
|
385
|
-
(el) => el.getAttribute("selected") !== null || el.selected
|
|
386
|
-
);
|
|
387
|
-
this.selectedIndex = selectedIndex;
|
|
388
|
-
if (!this.dirtyValue && this.firstSelectedOption) {
|
|
389
|
-
this.value = this.firstSelectedOption.text;
|
|
390
|
-
}
|
|
391
|
-
this.setSelectedOptions();
|
|
392
|
-
}
|
|
372
|
+
_isDefaultSelected(option) {
|
|
373
|
+
return super._isDefaultSelected(option) || option.text !== "" && option.text === this.initialValue;
|
|
393
374
|
}
|
|
394
375
|
/**
|
|
395
376
|
* Focus and set the content of the control based on the first selected option.
|
|
@@ -472,7 +453,6 @@ class Combobox extends withContextualHelp.WithContextualHelp(
|
|
|
472
453
|
updateValue(shouldEmit) {
|
|
473
454
|
if (this.$fastController.isConnected) {
|
|
474
455
|
this.value = this.firstSelectedOption?.text || this.control.value;
|
|
475
|
-
this.control.value = this.value;
|
|
476
456
|
}
|
|
477
457
|
if (shouldEmit) {
|
|
478
458
|
this.$emit("change");
|
package/combobox/definition.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { iconDefinition } from '../icon/definition.js';
|
|
2
|
-
import { P as Popup, p as popupDefinition } from '../unbundled/
|
|
3
|
-
import { listboxOptionDefinition } from '../
|
|
2
|
+
import { P as Popup, p as popupDefinition } from '../unbundled/definition5.js';
|
|
3
|
+
import { l as listboxOptionDefinition } from '../unbundled/definition3.js';
|
|
4
4
|
import { s as styles$1 } from '../unbundled/text-field.js';
|
|
5
5
|
import { d as defineVividComponent, c as createRegisterFunction } from '../unbundled/vivid-element.js';
|
|
6
6
|
import { a as WithFeedback, f as feedbackMessageDefinition } from '../unbundled/mixins.js';
|
|
@@ -12,7 +12,7 @@ import { W as WithContextualHelp } from '../unbundled/with-contextual-help.js';
|
|
|
12
12
|
import { W as WithErrorText } from '../unbundled/with-error-text.js';
|
|
13
13
|
import { W as WithSuccessText } from '../unbundled/with-success-text.js';
|
|
14
14
|
import { F as FormElement } from '../unbundled/form-element.js';
|
|
15
|
-
import {
|
|
15
|
+
import { A as AffixIcon, a as affixIconTemplateFactory, I as IconWrapper } from '../unbundled/affix.js';
|
|
16
16
|
import { h as handleEscapeKeyAndStopPropogation } from '../unbundled/index.js';
|
|
17
17
|
import { c as chevronTemplateFactory } from '../unbundled/definition.js';
|
|
18
18
|
|
|
@@ -70,14 +70,12 @@ class Combobox extends WithContextualHelp(
|
|
|
70
70
|
this.proxy = document.createElement("input");
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
-
* Reset the element to its first selectable option when its parent form is reset.
|
|
74
|
-
*
|
|
75
73
|
* @internal
|
|
76
74
|
*/
|
|
77
75
|
formResetCallback() {
|
|
78
76
|
super.formResetCallback();
|
|
79
|
-
this.
|
|
80
|
-
this.
|
|
77
|
+
this.selectedIndex = this._newDefaultSelectedIndex([], this.options, -1) ?? -1;
|
|
78
|
+
this.value = this.firstSelectedOption?.text || "";
|
|
81
79
|
}
|
|
82
80
|
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
83
81
|
validate() {
|
|
@@ -119,8 +117,7 @@ class Combobox extends WithContextualHelp(
|
|
|
119
117
|
return this.filteredOptions.length ? this.filteredOptions : this._options;
|
|
120
118
|
}
|
|
121
119
|
set options(value) {
|
|
122
|
-
|
|
123
|
-
Observable.notify(this, "options");
|
|
120
|
+
super.options = value;
|
|
124
121
|
}
|
|
125
122
|
/**
|
|
126
123
|
* Updates the placeholder on the proxy element.
|
|
@@ -368,24 +365,8 @@ class Combobox extends WithContextualHelp(
|
|
|
368
365
|
this.selectedIndex = this.selectedIndex - 1;
|
|
369
366
|
}
|
|
370
367
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
*
|
|
374
|
-
* @internal
|
|
375
|
-
* @remarks
|
|
376
|
-
* Overrides `Listbox.setDefaultSelectedOption`
|
|
377
|
-
*/
|
|
378
|
-
setDefaultSelectedOption() {
|
|
379
|
-
if (this.$fastController.isConnected && this.options) {
|
|
380
|
-
const selectedIndex = this.options.findIndex(
|
|
381
|
-
(el) => el.getAttribute("selected") !== null || el.selected
|
|
382
|
-
);
|
|
383
|
-
this.selectedIndex = selectedIndex;
|
|
384
|
-
if (!this.dirtyValue && this.firstSelectedOption) {
|
|
385
|
-
this.value = this.firstSelectedOption.text;
|
|
386
|
-
}
|
|
387
|
-
this.setSelectedOptions();
|
|
388
|
-
}
|
|
368
|
+
_isDefaultSelected(option) {
|
|
369
|
+
return super._isDefaultSelected(option) || option.text !== "" && option.text === this.initialValue;
|
|
389
370
|
}
|
|
390
371
|
/**
|
|
391
372
|
* Focus and set the content of the control based on the first selected option.
|
|
@@ -468,7 +449,6 @@ class Combobox extends WithContextualHelp(
|
|
|
468
449
|
updateValue(shouldEmit) {
|
|
469
450
|
if (this.$fastController.isConnected) {
|
|
470
451
|
this.value = this.firstSelectedOption?.text || this.control.value;
|
|
471
|
-
this.control.value = this.value;
|
|
472
452
|
}
|
|
473
453
|
if (shouldEmit) {
|
|
474
454
|
this.$emit("change");
|
package/combobox/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";const $=require("../bundled/definition2.cjs"),v=require("../bundled/definition9.cjs"),k=require("../bundled/definition11.cjs"),C=require("../bundled/text-field.cjs"),r=require("../bundled/vivid-element.cjs"),b=require("../bundled/mixins.cjs"),x=require("../bundled/listbox.cjs"),I=require("../bundled/form-associated.cjs"),O=require("../bundled/with-contextual-help.cjs"),S=require("../bundled/with-error-text.cjs"),A=require("../bundled/with-success-text.cjs"),q=require("../bundled/form-element.cjs"),u=require("../bundled/affix.cjs"),V=require("../bundled/strings.cjs"),T=require("../bundled/numbers.cjs"),H=require("../bundled/index.cjs"),D=require("../bundled/definition3.cjs"),d=require("../bundled/ref.cjs"),h=require("../bundled/slotted.cjs"),E=require("../bundled/when.cjs"),F=require("../bundled/class-names.cjs"),B='.chevron{display:flex;flex-shrink:0;font:var(--vvd-typography-base-extended);transform:rotate(0);transition:transform .2s}:host([data-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:not(.disabled) .chevron{cursor:pointer}.disabled .chevron{color:var(--_low-ink-color);cursor:not-allowed}:host{position:relative;display:inline-flex;flex-direction:column;gap:4px;--_low-ink-color: var(--vvd-color-neutral-600)}:host([disabled]){--_low-ink-color: var(--vvd-color-neutral-400);cursor:not-allowed}.base{--_text-field-gutter-end: 8px}.base{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--vvd-color-neutral-500)}.base.appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}@media (hover: hover){.base:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--vvd-color-neutral-700)}.base:hover:where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}}.base.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--vvd-color-neutral-700)}.base.hover:where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.base:disabled.appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base.disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.base.disabled.appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base.readonly:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.base.readonly:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base.error:where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.base.error:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.base.success:where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.base.success:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.base:not(.shape-pill) .base{border-radius:var(--_text-field-border-radius)}.base.shape-pill .base{border-radius:var(--_text-field-pill-border-radius)}.base slot[name=icon]{position:absolute;z-index:1;display:inline-block;color:var(--_low-ink-color);font-size:var(--_text-field-icon-size);inset-block-start:50%;inset-inline-start:var(--_text-field-gutter-start);line-height:1;pointer-events:none;transform:translateY(-50%)}.base.has-meta{padding-inline-end:16px}.control{text-overflow:ellipsis;white-space:nowrap}.fieldset .leading-items-wrapper{position:relative;display:flex;flex-shrink:0;align-items:center;gap:8px;padding-inline-end:16px}.listbox{display:flex;max-height:var(--combobox-height, 408px);flex-direction:column;padding:4px;border-radius:8px;contain:paint;gap:2px;overflow-y:auto}::part(popup-base){inline-size:max-content;min-inline-size:var(--_combobox-fixed-width, 100%)}@supports selector(:has(*)){.base:not(.has-activedescendant) .fieldset:has(.control:focus-within):after{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}}@supports not selector(:has(*)){.base:not(.has-activedescendant) .fieldset:focus-within:after{box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;position:absolute;z-index:1;display:block;border-radius:inherit;content:"";inset:0;pointer-events:none}}::slotted([data-vvd-component=option][current-selected]){border-radius:8px;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent}.label-suffix{display:flex;align-items:center;gap:var(--label-suffix-gap, 8px);grid-column-end:-1;grid-row:1}.label-suffix[hidden]{display:none}slot[name=contextual-help]::slotted([data-vvd-component=contextual-help]){grid-column-end:-1;grid-row:1}',p={inline:"inline",list:"list",both:"both",none:"none"};var L=Object.defineProperty,s=(a,t,e,o)=>{for(var n=void 0,l=a.length-1,c;l>=0;l--)(c=a[l])&&(n=c(t,e,n)||n);return n&&L(t,e,n),n};class i extends O.WithContextualHelp(b.WithFeedback(S.WithErrorText(A.WithSuccessText(q.FormElement(u.AffixIcon(I.FormAssociated(x.Listbox))))))){constructor(){super(...arguments),this.filteredOptions=[],this.filter="",this.fixedDropdown=!1,this.listboxId=V.uniqueId("listbox-"),this.maxHeight=0,this.open=!1,this.proxy=document.createElement("input")}formResetCallback(){super.formResetCallback(),this.setDefaultSelectedOption(),this.updateValue()}validate(){super.validate(this.control)}get isAutocompleteInline(){return this.autocomplete===p.inline||this.isAutocompleteBoth}get isAutocompleteList(){return this.autocomplete===p.list||this.isAutocompleteBoth}get isAutocompleteBoth(){return this.autocomplete===p.both}openChanged(){if(this.open){this.focusAndScrollOptionIntoView(),r.Updates.enqueue(()=>this.control.focus());return}}get options(){return r.Observable.track(this,"options"),this.filteredOptions.length?this.filteredOptions:this._options}set options(t){this._options=t,r.Observable.notify(this,"options")}placeholderChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.placeholder=this.placeholder)}valueChanged(t,e){if(this.$fastController.isConnected&&this.options){const o=this.options.findIndex(c=>c.text.toLowerCase()===e.toLowerCase()),n=this.options[this.selectedIndex]?.text,l=this.options[o]?.text;this.selectedIndex=n!==l?o:this.selectedIndex}super.valueChanged(t,e)}clickHandler(t){if(!(this.disabled||this._isFromContextualHelp(t))){if(this.open){const e=t.target.closest("option,[role=option],[data-vvd-component=option]");if(!e||e.disabled)return;this.selectedOptions=[e],this.control.value=e.text,this.clearSelectionRange(),this.updateValue(!0)}return this.open=!this.open,this.open&&this.control.focus(),!0}}_chevronIconClickHandler(t){this.open&&(t.stopPropagation(),this.open=!1)}connectedCallback(){super.connectedCallback(),this.value&&(this.initialValue=this.value),this._popup.anchor=this._anchor}filterOptions(){(!this.autocomplete||this.autocomplete===p.none)&&(this.filter=""),this.filteredOptions=this._options.filter(t=>t.text.toLowerCase().startsWith(this.filter.toLowerCase())),this.isAutocompleteList&&this._options.forEach(t=>{t.hidden=!this.filteredOptions.includes(t)})}focusAndScrollOptionIntoView(){if(this.contains(document.activeElement)){this.control.focus();const t=this.firstSelectedOption;t&&requestAnimationFrame(()=>{t.scrollIntoView({block:"nearest"})})}}focusoutHandler(t){if(this.syncValue(),!this.open)return!0;const e=t.relatedTarget;if(this.isSameNode(e)){this.focus();return}this.open=!1}inputHandler(t){if(this.filter=this.control.value,this.filterOptions(),this.isAutocompleteInline||(this.selectedIndex=this.options.map(e=>e.text).indexOf(this.control.value)),t.inputType.includes("deleteContent")||!this.filter.length)return!0;this.isAutocompleteList&&!this.open&&(this.open=!0),this.isAutocompleteInline&&(this.filteredOptions.length?(this.selectedOptions=[this.filteredOptions[0]],this.selectedIndex=this.options.indexOf(this.firstSelectedOption),this.setInlineSelection()):this.selectedIndex=-1)}keydownHandler(t){const e=t.key;if(t.ctrlKey||t.shiftKey)return!0;switch(e){case"Enter":{this.syncValue(),this.isAutocompleteInline&&(this.filter=this.value),this.open=!1,this.clearSelectionRange();break}case"Escape":{if(this.isAutocompleteInline||(this.selectedIndex=-1),this.open){this.open=!1;break}this.value="",this.control.value="",this.filter="",this.filterOptions();break}case"Tab":{if(this.setInputToSelection(),!this.open)return!0;t.preventDefault(),this.open=!1;break}case"ArrowUp":case"ArrowDown":{if(this.filterOptions(),!this.open){this.open=!0;break}this.filteredOptions.length>0&&super.keydownHandler(t),this.isAutocompleteInline&&this.setInlineSelection();break}default:return!0}}selectedIndexChanged(t,e){if(this.$fastController.isConnected){if(e=T.limit(-1,this.options.length-1,e),e!==this.selectedIndex){this.selectedIndex=e;return}super.selectedIndexChanged(t,e)}}selectPreviousOption(){!this.disabled&&this.selectedIndex>=0&&(this.selectedIndex=this.selectedIndex-1)}setDefaultSelectedOption(){if(this.$fastController.isConnected&&this.options){const t=this.options.findIndex(e=>e.getAttribute("selected")!==null||e.selected);this.selectedIndex=t,!this.dirtyValue&&this.firstSelectedOption&&(this.value=this.firstSelectedOption.text),this.setSelectedOptions()}}setInputToSelection(){this.firstSelectedOption&&(this.control.value=this.firstSelectedOption.text,this.control.focus())}setInlineSelection(){this.firstSelectedOption&&(this.setInputToSelection(),this.control.setSelectionRange(this.filter.length,this.control.value.length,"backward"))}syncValue(){const t=this.firstSelectedOption?.text??this.control.value;this.updateValue(this.value!==t)}selectedOptionsChanged(t,e){this.$fastController.isConnected&&this._options.forEach(o=>{o.selected=e.includes(o)})}slottedOptionsChanged(t,e){super.slottedOptionsChanged(t,e),this.updateValue();const o=this.getAttribute("scale")||this.scale;e.forEach(n=>{o&&(n.setAttribute("scale",o),n.scale=o)})}updateValue(t){this.$fastController.isConnected&&(this.value=this.firstSelectedOption?.text||this.control.value,this.control.value=this.value),t&&this.$emit("change")}clearSelectionRange(){const t=this.control.value.length;this.control.setSelectionRange(t,t)}}s([r.attr({attribute:"autocomplete",mode:"fromView"})],i.prototype,"autocomplete");s([r.attr],i.prototype,"appearance");s([r.attr],i.prototype,"shape");s([r.attr()],i.prototype,"scale");s([r.attr],i.prototype,"placement");s([r.attr({mode:"boolean",attribute:"fixed-dropdown"})],i.prototype,"fixedDropdown");s([r.observable],i.prototype,"metaSlottedContent");s([r.observable],i.prototype,"maxHeight");s([r.attr({attribute:"open",mode:"boolean"})],i.prototype,"open");s([r.attr],i.prototype,"placeholder");const R=({icon:a,iconSlottedContent:t,metaSlottedContent:e,errorValidationMessage:o,successText:n,shape:l,scale:c,disabled:m,placeholder:g,label:_,appearance:f,open:w,_activeDescendant:y})=>F.classNames("base",["disabled",m],[`shape-${l}`,!!l],[`size-${c}`,!!c],["placeholder",!!g],[`appearance-${f}`,!!f],["no-label",!_],["has-icon",!!a||!!t?.length],["has-meta",!!e?.length],["has-activedescendant",!!y&&w],["error",!!o],["success",!!n]);function z(){return r.html` <label for="control" class="label">
|
|
1
|
+
"use strict";const k=require("../bundled/definition2.cjs"),v=require("../bundled/definition9.cjs"),$=require("../bundled/definition11.cjs"),I=require("../bundled/text-field.cjs"),n=require("../bundled/vivid-element.cjs"),b=require("../bundled/mixins.cjs"),x=require("../bundled/listbox.cjs"),C=require("../bundled/form-associated.cjs"),S=require("../bundled/with-contextual-help.cjs"),O=require("../bundled/with-error-text.cjs"),q=require("../bundled/with-success-text.cjs"),A=require("../bundled/form-element.cjs"),u=require("../bundled/affix.cjs"),T=require("../bundled/strings.cjs"),V=require("../bundled/numbers.cjs"),H=require("../bundled/index.cjs"),D=require("../bundled/definition3.cjs"),d=require("../bundled/ref.cjs"),h=require("../bundled/slotted.cjs"),E=require("../bundled/when.cjs"),F=require("../bundled/class-names.cjs"),B='.chevron{display:flex;flex-shrink:0;font:var(--vvd-typography-base-extended);transform:rotate(0);transition:transform .2s}:host([data-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:not(.disabled) .chevron{cursor:pointer}.disabled .chevron{color:var(--_low-ink-color);cursor:not-allowed}:host{position:relative;display:inline-flex;flex-direction:column;gap:4px;--_low-ink-color: var(--vvd-color-neutral-600)}:host([disabled]){--_low-ink-color: var(--vvd-color-neutral-400);cursor:not-allowed}.base{--_text-field-gutter-end: 8px}.base{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--vvd-color-neutral-500)}.base.appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}@media (hover: hover){.base:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--vvd-color-neutral-700)}.base:hover:where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}}.base.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--vvd-color-neutral-700)}.base.hover:where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.base:disabled.appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base.disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.base.disabled.appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base.readonly:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.base.readonly:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base.error:where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.base.error:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.base.success:where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.base.success:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.base:not(.shape-pill) .base{border-radius:var(--_text-field-border-radius)}.base.shape-pill .base{border-radius:var(--_text-field-pill-border-radius)}.base slot[name=icon]{position:absolute;z-index:1;display:inline-block;color:var(--_low-ink-color);font-size:var(--_text-field-icon-size);inset-block-start:50%;inset-inline-start:var(--_text-field-gutter-start);line-height:1;pointer-events:none;transform:translateY(-50%)}.base.has-meta{padding-inline-end:16px}.control{text-overflow:ellipsis;white-space:nowrap}.fieldset .leading-items-wrapper{position:relative;display:flex;flex-shrink:0;align-items:center;gap:8px;padding-inline-end:16px}.listbox{display:flex;max-height:var(--combobox-height, 408px);flex-direction:column;padding:4px;border-radius:8px;contain:paint;gap:2px;overflow-y:auto}::part(popup-base){inline-size:max-content;min-inline-size:var(--_combobox-fixed-width, 100%)}@supports selector(:has(*)){.base:not(.has-activedescendant) .fieldset:has(.control:focus-within):after{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}}@supports not selector(:has(*)){.base:not(.has-activedescendant) .fieldset:focus-within:after{box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;position:absolute;z-index:1;display:block;border-radius:inherit;content:"";inset:0;pointer-events:none}}::slotted([data-vvd-component=option][current-selected]){border-radius:8px;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent}.label-suffix{display:flex;align-items:center;gap:var(--label-suffix-gap, 8px);grid-column-end:-1;grid-row:1}.label-suffix[hidden]{display:none}slot[name=contextual-help]::slotted([data-vvd-component=contextual-help]){grid-column-end:-1;grid-row:1}',p={inline:"inline",list:"list",both:"both",none:"none"};var L=Object.defineProperty,s=(a,t,e,o)=>{for(var r=void 0,l=a.length-1,c;l>=0;l--)(c=a[l])&&(r=c(t,e,r)||r);return r&&L(t,e,r),r};class i extends S.WithContextualHelp(b.WithFeedback(O.WithErrorText(q.WithSuccessText(A.FormElement(u.AffixIcon(C.FormAssociated(x.Listbox))))))){constructor(){super(...arguments),this.filteredOptions=[],this.filter="",this.fixedDropdown=!1,this.listboxId=T.uniqueId("listbox-"),this.maxHeight=0,this.open=!1,this.proxy=document.createElement("input")}formResetCallback(){super.formResetCallback(),this.selectedIndex=this._newDefaultSelectedIndex([],this.options,-1)??-1,this.value=this.firstSelectedOption?.text||""}validate(){super.validate(this.control)}get isAutocompleteInline(){return this.autocomplete===p.inline||this.isAutocompleteBoth}get isAutocompleteList(){return this.autocomplete===p.list||this.isAutocompleteBoth}get isAutocompleteBoth(){return this.autocomplete===p.both}openChanged(){if(this.open){this.focusAndScrollOptionIntoView(),n.Updates.enqueue(()=>this.control.focus());return}}get options(){return n.Observable.track(this,"options"),this.filteredOptions.length?this.filteredOptions:this._options}set options(t){super.options=t}placeholderChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.placeholder=this.placeholder)}valueChanged(t,e){if(this.$fastController.isConnected&&this.options){const o=this.options.findIndex(c=>c.text.toLowerCase()===e.toLowerCase()),r=this.options[this.selectedIndex]?.text,l=this.options[o]?.text;this.selectedIndex=r!==l?o:this.selectedIndex}super.valueChanged(t,e)}clickHandler(t){if(!(this.disabled||this._isFromContextualHelp(t))){if(this.open){const e=t.target.closest("option,[role=option],[data-vvd-component=option]");if(!e||e.disabled)return;this.selectedOptions=[e],this.control.value=e.text,this.clearSelectionRange(),this.updateValue(!0)}return this.open=!this.open,this.open&&this.control.focus(),!0}}_chevronIconClickHandler(t){this.open&&(t.stopPropagation(),this.open=!1)}connectedCallback(){super.connectedCallback(),this.value&&(this.initialValue=this.value),this._popup.anchor=this._anchor}filterOptions(){(!this.autocomplete||this.autocomplete===p.none)&&(this.filter=""),this.filteredOptions=this._options.filter(t=>t.text.toLowerCase().startsWith(this.filter.toLowerCase())),this.isAutocompleteList&&this._options.forEach(t=>{t.hidden=!this.filteredOptions.includes(t)})}focusAndScrollOptionIntoView(){if(this.contains(document.activeElement)){this.control.focus();const t=this.firstSelectedOption;t&&requestAnimationFrame(()=>{t.scrollIntoView({block:"nearest"})})}}focusoutHandler(t){if(this.syncValue(),!this.open)return!0;const e=t.relatedTarget;if(this.isSameNode(e)){this.focus();return}this.open=!1}inputHandler(t){if(this.filter=this.control.value,this.filterOptions(),this.isAutocompleteInline||(this.selectedIndex=this.options.map(e=>e.text).indexOf(this.control.value)),t.inputType.includes("deleteContent")||!this.filter.length)return!0;this.isAutocompleteList&&!this.open&&(this.open=!0),this.isAutocompleteInline&&(this.filteredOptions.length?(this.selectedOptions=[this.filteredOptions[0]],this.selectedIndex=this.options.indexOf(this.firstSelectedOption),this.setInlineSelection()):this.selectedIndex=-1)}keydownHandler(t){const e=t.key;if(t.ctrlKey||t.shiftKey)return!0;switch(e){case"Enter":{this.syncValue(),this.isAutocompleteInline&&(this.filter=this.value),this.open=!1,this.clearSelectionRange();break}case"Escape":{if(this.isAutocompleteInline||(this.selectedIndex=-1),this.open){this.open=!1;break}this.value="",this.control.value="",this.filter="",this.filterOptions();break}case"Tab":{if(this.setInputToSelection(),!this.open)return!0;t.preventDefault(),this.open=!1;break}case"ArrowUp":case"ArrowDown":{if(this.filterOptions(),!this.open){this.open=!0;break}this.filteredOptions.length>0&&super.keydownHandler(t),this.isAutocompleteInline&&this.setInlineSelection();break}default:return!0}}selectedIndexChanged(t,e){if(this.$fastController.isConnected){if(e=V.limit(-1,this.options.length-1,e),e!==this.selectedIndex){this.selectedIndex=e;return}super.selectedIndexChanged(t,e)}}selectPreviousOption(){!this.disabled&&this.selectedIndex>=0&&(this.selectedIndex=this.selectedIndex-1)}_isDefaultSelected(t){return super._isDefaultSelected(t)||t.text!==""&&t.text===this.initialValue}setInputToSelection(){this.firstSelectedOption&&(this.control.value=this.firstSelectedOption.text,this.control.focus())}setInlineSelection(){this.firstSelectedOption&&(this.setInputToSelection(),this.control.setSelectionRange(this.filter.length,this.control.value.length,"backward"))}syncValue(){const t=this.firstSelectedOption?.text??this.control.value;this.updateValue(this.value!==t)}selectedOptionsChanged(t,e){this.$fastController.isConnected&&this._options.forEach(o=>{o.selected=e.includes(o)})}slottedOptionsChanged(t,e){super.slottedOptionsChanged(t,e),this.updateValue();const o=this.getAttribute("scale")||this.scale;e.forEach(r=>{o&&(r.setAttribute("scale",o),r.scale=o)})}updateValue(t){this.$fastController.isConnected&&(this.value=this.firstSelectedOption?.text||this.control.value),t&&this.$emit("change")}clearSelectionRange(){const t=this.control.value.length;this.control.setSelectionRange(t,t)}}s([n.attr({attribute:"autocomplete",mode:"fromView"})],i.prototype,"autocomplete");s([n.attr],i.prototype,"appearance");s([n.attr],i.prototype,"shape");s([n.attr()],i.prototype,"scale");s([n.attr],i.prototype,"placement");s([n.attr({mode:"boolean",attribute:"fixed-dropdown"})],i.prototype,"fixedDropdown");s([n.observable],i.prototype,"metaSlottedContent");s([n.observable],i.prototype,"maxHeight");s([n.attr({attribute:"open",mode:"boolean"})],i.prototype,"open");s([n.attr],i.prototype,"placeholder");const R=({icon:a,iconSlottedContent:t,metaSlottedContent:e,errorValidationMessage:o,successText:r,shape:l,scale:c,disabled:m,placeholder:g,label:_,appearance:f,open:w,_activeDescendant:y})=>F.classNames("base",["disabled",m],[`shape-${l}`,!!l],[`size-${c}`,!!c],["placeholder",!!g],[`appearance-${f}`,!!f],["no-label",!_],["has-icon",!!a||!!t?.length],["has-meta",!!e?.length],["has-activedescendant",!!y&&w],["error",!!o],["success",!!r]);function z(){return n.html` <label for="control" class="label">
|
|
2
2
|
${a=>a.label}
|
|
3
|
-
</label>`}function P(a){return a.open&&a.fixedDropdown?`--_combobox-fixed-width: ${Math.round(a.getBoundingClientRect().width)}px`:null}function W(a){const t=u.affixIconTemplateFactory(a),e=D.chevronTemplateFactory(a);return
|
|
3
|
+
</label>`}function P(a){return a.open&&a.fixedDropdown?`--_combobox-fixed-width: ${Math.round(a.getBoundingClientRect().width)}px`:null}function W(a){const t=u.affixIconTemplateFactory(a),e=D.chevronTemplateFactory(a);return n.html` <div class="${R}" ${d.ref("_anchor")}>
|
|
4
4
|
${E.when(o=>o.label,z())}
|
|
5
5
|
<slot
|
|
6
6
|
name="contextual-help"
|
|
@@ -24,20 +24,20 @@
|
|
|
24
24
|
type="text"
|
|
25
25
|
?disabled="${o=>o.disabled}"
|
|
26
26
|
:value="${o=>o.value}"
|
|
27
|
-
@input="${(o,
|
|
27
|
+
@input="${(o,r)=>o.inputHandler(r.event)}"
|
|
28
28
|
${d.ref("control")}
|
|
29
29
|
/>
|
|
30
30
|
</div>
|
|
31
31
|
<div class="leading-items-wrapper">
|
|
32
32
|
<slot name="meta" ${h.slotted("metaSlottedContent")}></slot>
|
|
33
33
|
<div
|
|
34
|
-
@click="${(o,
|
|
34
|
+
@click="${(o,r)=>o._chevronIconClickHandler(r.event)}"
|
|
35
35
|
>
|
|
36
36
|
${e}
|
|
37
37
|
</div>
|
|
38
38
|
</div>
|
|
39
39
|
</div>
|
|
40
|
-
</div>`}const K=a=>{const t=a.tagFor(v.Popup);return
|
|
40
|
+
</div>`}const K=a=>{const t=a.tagFor(v.Popup);return n.html`
|
|
41
41
|
<template
|
|
42
42
|
tabindex="${e=>e.disabled?null:"0"}"
|
|
43
43
|
@click="${(e,o)=>e.clickHandler(o.event)}"
|
|
@@ -66,4 +66,4 @@
|
|
|
66
66
|
${e=>e._getFeedbackTemplate(a)}
|
|
67
67
|
</div>
|
|
68
68
|
</template>
|
|
69
|
-
`},M=
|
|
69
|
+
`},M=n.defineVividComponent("combobox",i,K,[k.iconDefinition,v.popupDefinition,$.listboxOptionDefinition,b.feedbackMessageDefinition],{styles:[I.styles,B],shadowOptions:{delegatesFocus:!0}}),N=n.createRegisterFunction(M);N();
|