@vonage/vivid 5.7.0 → 5.9.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/bundled/data-grid.options.cjs +1 -0
- package/bundled/data-grid.options.js +29 -0
- package/bundled/definition19.cjs +3 -4
- package/bundled/definition19.js +35 -52
- package/bundled/definition2.cjs +1 -1
- package/bundled/definition2.js +1 -1
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +1 -1
- package/bundled/definition8.cjs +1 -1
- package/bundled/definition8.js +1 -1
- package/bundled/definition9.cjs +9 -9
- package/bundled/definition9.js +113 -1342
- package/bundled/feature.cjs +4 -0
- package/bundled/feature.js +2886 -0
- package/bundled/floating-ui.dom.cjs +1 -0
- package/bundled/floating-ui.dom.js +1242 -0
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +49 -22
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +15 -13
- package/bundled/vivid-element.cjs +3 -3
- package/bundled/vivid-element.js +89 -69
- package/checkbox/definition.cjs +1 -1
- package/checkbox/definition.js +1 -1
- package/combobox/definition.cjs +14 -15
- package/combobox/definition.js +15 -16
- package/combobox/index.cjs +4 -4
- package/combobox/index.js +82 -87
- package/contextual-help/definition.cjs +1 -0
- package/contextual-help/definition.js +1 -1
- package/custom-elements.json +5145 -3781
- package/data-grid/definition.cjs +23 -49
- package/data-grid/definition.js +1 -27
- package/data-grid/index.cjs +27 -27
- package/data-grid/index.js +44 -64
- package/data-table/definition.cjs +204 -0
- package/data-table/definition.js +188 -0
- package/data-table/index.cjs +37 -0
- package/data-table/index.js +143 -0
- package/file-picker/definition.cjs +10 -8
- package/file-picker/definition.js +10 -8
- package/file-picker/index.cjs +5 -5
- package/file-picker/index.js +12 -12
- package/icon/definition.cjs +1 -1
- package/icon/definition.js +1 -1
- package/index.cjs +26 -0
- package/index.js +4 -0
- package/lib/components.d.ts +4 -0
- package/lib/contextual-help/definition.d.ts +2 -0
- package/lib/data-table/definition.d.ts +8 -0
- package/lib/data-table/table-body.d.ts +3 -0
- package/lib/data-table/table-body.template.d.ts +3 -0
- package/lib/data-table/table-cell.d.ts +381 -0
- package/lib/data-table/table-cell.template.d.ts +3 -0
- package/lib/data-table/table-head.d.ts +3 -0
- package/lib/data-table/table-head.template.d.ts +3 -0
- package/lib/data-table/table-header-cell.d.ts +381 -0
- package/lib/data-table/table-header-cell.template.d.ts +3 -0
- package/lib/data-table/table-row.d.ts +381 -0
- package/lib/data-table/table-row.template.d.ts +3 -0
- package/lib/data-table/table.d.ts +3 -0
- package/lib/data-table/table.template.d.ts +3 -0
- package/lib/popover/definition.d.ts +4 -0
- package/lib/popover/locale.d.ts +3 -0
- package/lib/popover/popover.d.ts +781 -0
- package/lib/popover/popover.template.d.ts +3 -0
- package/lib/rich-text-editor/locale.d.ts +0 -1
- package/lib/rich-text-editor/rte/config.d.ts +3 -0
- package/lib/rich-text-editor/rte/document.d.ts +2 -0
- package/lib/rich-text-editor/rte/exports.d.ts +1 -0
- package/lib/rich-text-editor/rte/view.d.ts +30 -0
- package/lib/rich-text-view/definition.d.ts +4 -0
- package/lib/rich-text-view/rich-text-view.d.ts +15 -0
- package/lib/rich-text-view/rich-text-view.template.d.ts +3 -0
- package/lib/tag-name-map.d.ts +10 -1
- package/locales/de-DE.cjs +3 -1
- package/locales/de-DE.js +3 -1
- package/locales/en-GB.cjs +3 -1
- package/locales/en-GB.js +3 -1
- package/locales/en-US.cjs +3 -1
- package/locales/en-US.js +3 -1
- package/locales/ja-JP.cjs +3 -1
- package/locales/ja-JP.js +3 -1
- package/locales/zh-CN.cjs +3 -1
- package/locales/zh-CN.js +3 -1
- package/package.json +8 -12
- package/popover/definition.cjs +363 -0
- package/popover/definition.js +357 -0
- package/popover/index.cjs +27 -0
- package/popover/index.js +263 -0
- package/rich-text-editor/definition.cjs +328 -3882
- package/rich-text-editor/definition.js +143 -3697
- package/rich-text-editor/index.cjs +12 -15
- package/rich-text-editor/index.js +3489 -6291
- package/rich-text-view/definition.cjs +159 -0
- package/rich-text-view/definition.js +153 -0
- package/rich-text-view/index.cjs +1 -0
- package/rich-text-view/index.js +95 -0
- package/select/definition.cjs +27 -15
- package/select/definition.js +27 -15
- package/shared/foundation/listbox/listbox.d.ts +0 -1
- package/shared/localization/Locale.d.ts +2 -0
- package/tag/definition.cjs +1 -1
- package/tag/definition.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/unbundled/_commonjsHelpers.cjs +26 -0
- package/unbundled/_commonjsHelpers.js +26 -1
- package/unbundled/data-grid.options.cjs +34 -0
- package/unbundled/data-grid.options.js +28 -0
- package/unbundled/definition.cjs +1 -1
- package/unbundled/definition.js +1 -1
- package/unbundled/feature.cjs +3678 -0
- package/unbundled/feature.js +3662 -0
- package/unbundled/listbox.cjs +29 -2
- package/unbundled/listbox.js +29 -2
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.cjs +11 -1
- package/video-player/definition.js +12 -2
- package/video-player/index.cjs +30 -30
- package/video-player/index.js +705 -702
- package/vivid.api.json +1478 -39
package/combobox/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const k=require("../bundled/definition2.cjs"),f=require("../bundled/definition9.cjs"),$=require("../bundled/definition12.cjs"),C=require("../bundled/text-field.cjs"),n=require("../bundled/vivid-element.cjs"),b=require("../bundled/mixins.cjs"),x=require("../bundled/listbox.cjs"),I=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"),H=require("../bundled/strings.cjs"),T=require("../bundled/numbers.cjs"),V=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='.label-wrapper{display:flex;flex-direction:row;align-items:center;gap:var(--label-wrapper-gap, 4px)}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 1 auto}.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(--focus-stroke-color, 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(--focus-stroke-color, 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(--focus-stroke-color, 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}',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(I.FormAssociated(x.Listbox))))))){constructor(){super(...arguments),this.filteredOptions=[],this.filter="",this.fixedDropdown=!1,this.listboxId=H.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(){/* v8 ignore if -- @preserve */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;/* v8 ignore else -- @preserve */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();/* v8 ignore else -- @preserve */this.isAutocompleteInline&&(this.filter=this.value),this.open=!1,this.clearSelectionRange();break}case"Escape":{/* v8 ignore else -- @preserve */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}/* v8 ignore else -- @preserve */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)}_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(){/* v8 ignore else -- @preserve */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:_,label:g,appearance:v,open:w,_activeDescendant:y})=>F.classNames("base",["disabled",m],[`shape-${l}`,!!l],[`size-${c}`,!!c],["placeholder",!!_],[`appearance-${v}`,!!v],["no-label",!g],["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">
|
|
1
|
+
"use strict";const k=require("../bundled/definition2.cjs"),f=require("../bundled/definition9.cjs"),I=require("../bundled/definition12.cjs"),$=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"),V=require("../bundled/strings.cjs"),H=require("../bundled/numbers.cjs"),T=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='.label-wrapper{display:flex;flex-direction:row;align-items:center;gap:var(--label-wrapper-gap, 4px)}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 1 auto}.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(--focus-stroke-color, 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(--focus-stroke-color, 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(--focus-stroke-color, 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}',p={inline:"inline",list:"list",both:"both",none:"none"};var L=Object.defineProperty,l=(a,t,e,o)=>{for(var r=void 0,s=a.length-1,c;s>=0;s--)(c=a[s])&&(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=V.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(){this.open&&this.enqueueScrollSelectedOptionIntoViewIfNeeded()}get options(){return n.Observable.track(this,"options"),this.filteredOptions.length?this.filteredOptions:this._options}set options(t){super.options=t}placeholderChanged(){/* v8 ignore if -- @preserve */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,s=this.options[o]?.text;this.selectedIndex=r!==s?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(){this.contains(document.activeElement)&&(this.control.focus(),this.enqueueScrollSelectedOptionIntoViewIfNeeded())}enqueueScrollSelectedOptionIntoViewIfNeeded(){const t=this.firstSelectedOption;/* v8 ignore else -- @preserve */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();/* v8 ignore else -- @preserve */this.isAutocompleteInline&&(this.filter=this.value),this.open=!1,this.clearSelectionRange();break}case"Escape":{/* v8 ignore else -- @preserve */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}/* v8 ignore else -- @preserve */this.filteredOptions.length>0&&super.keydownHandler(t),this.isAutocompleteInline&&this.setInlineSelection();break}default:return!0}}selectedIndexChanged(t,e){if(this.$fastController.isConnected){if(e=H.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(){/* v8 ignore else -- @preserve */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)}}l([n.attr({attribute:"autocomplete",mode:"fromView"})],i.prototype,"autocomplete");l([n.attr],i.prototype,"appearance");l([n.attr],i.prototype,"shape");l([n.attr()],i.prototype,"scale");l([n.attr],i.prototype,"placement");l([n.attr({mode:"boolean",attribute:"fixed-dropdown"})],i.prototype,"fixedDropdown");l([n.observable],i.prototype,"metaSlottedContent");l([n.observable],i.prototype,"maxHeight");l([n.attr({attribute:"open",mode:"boolean"})],i.prototype,"open");l([n.attr],i.prototype,"placeholder");const R=({icon:a,iconSlottedContent:t,metaSlottedContent:e,errorValidationMessage:o,successText:r,shape:s,scale:c,disabled:m,placeholder:_,label:g,appearance:v,open:w,_activeDescendant:y})=>F.classNames("base",["disabled",m],[`shape-${s}`,!!s],[`size-${c}`,!!c],["placeholder",!!_],[`appearance-${v}`,!!v],["no-label",!g],["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
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
|
<div
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
</div>
|
|
43
43
|
</div>
|
|
44
44
|
</div>
|
|
45
|
-
</div>`}const
|
|
45
|
+
</div>`}const N=a=>{const t=a.tagFor(f.Popup);return n.html`
|
|
46
46
|
<template
|
|
47
47
|
tabindex="${e=>e.disabled?null:"0"}"
|
|
48
48
|
@click="${(e,o)=>e.clickHandler(o.event)}"
|
|
49
49
|
@focusout="${(e,o)=>e.focusoutHandler(o.event)}"
|
|
50
|
-
@keydown="${(e,{event:o})=>(e.open&&
|
|
50
|
+
@keydown="${(e,{event:o})=>(e.open&&T.handleEscapeKeyAndStopPropogation(o),e.keydownHandler(o))}"
|
|
51
51
|
>
|
|
52
52
|
<div class="control-wrapper">
|
|
53
53
|
${()=>W(a)}
|
|
@@ -71,4 +71,4 @@
|
|
|
71
71
|
${e=>e._getFeedbackTemplate(a)}
|
|
72
72
|
</div>
|
|
73
73
|
</template>
|
|
74
|
-
`},
|
|
74
|
+
`},K=n.defineVividComponent("combobox",i,N,[k.iconDefinition,f.popupDefinition,I.listboxOptionDefinition,b.feedbackMessageDefinition],{styles:[$.styles,B],shadowOptions:{delegatesFocus:!0}}),M=n.createRegisterFunction(K);M();
|
package/combobox/index.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { i as y } from "../bundled/definition2.js";
|
|
2
|
-
import { P as k, p as
|
|
3
|
-
import { l as
|
|
2
|
+
import { P as k, p as I } from "../bundled/definition9.js";
|
|
3
|
+
import { l as $ } from "../bundled/definition12.js";
|
|
4
4
|
import { s as C } from "../bundled/text-field.js";
|
|
5
|
-
import {
|
|
6
|
-
import { W as
|
|
5
|
+
import { O as S, a as l, o as v, h as u, c as O, d as A } from "../bundled/vivid-element.js";
|
|
6
|
+
import { W as V, f as H } from "../bundled/mixins.js";
|
|
7
7
|
import { L as b } from "../bundled/listbox.js";
|
|
8
|
-
import { F as
|
|
9
|
-
import { W as
|
|
10
|
-
import { W as
|
|
11
|
-
import { W as
|
|
12
|
-
import { F as
|
|
13
|
-
import { b as
|
|
14
|
-
import { u as
|
|
15
|
-
import { l as
|
|
16
|
-
import { h as
|
|
17
|
-
import { c as
|
|
8
|
+
import { F as D } from "../bundled/form-associated.js";
|
|
9
|
+
import { W as T } from "../bundled/with-contextual-help.js";
|
|
10
|
+
import { W as F } from "../bundled/with-error-text.js";
|
|
11
|
+
import { W as B } from "../bundled/with-success-text.js";
|
|
12
|
+
import { F as L } from "../bundled/form-element.js";
|
|
13
|
+
import { b as E, a as W, I as R } from "../bundled/affix.js";
|
|
14
|
+
import { u as P } from "../bundled/strings.js";
|
|
15
|
+
import { l as z } from "../bundled/numbers.js";
|
|
16
|
+
import { h as q } from "../bundled/index.js";
|
|
17
|
+
import { c as N } from "../bundled/definition3.js";
|
|
18
18
|
import { r as d } from "../bundled/ref.js";
|
|
19
19
|
import { s as h } from "../bundled/slotted.js";
|
|
20
|
-
import { w as
|
|
21
|
-
import { c as
|
|
20
|
+
import { w as K } from "../bundled/when.js";
|
|
21
|
+
import { c as M } from "../bundled/class-names.js";
|
|
22
22
|
const j = '.label-wrapper{display:flex;flex-direction:row;align-items:center;gap:var(--label-wrapper-gap, 4px)}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 1 auto}.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(--focus-stroke-color, 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(--focus-stroke-color, 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(--focus-stroke-color, 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}', p = {
|
|
23
23
|
inline: "inline",
|
|
24
24
|
list: "list",
|
|
25
25
|
both: "both",
|
|
26
26
|
none: "none"
|
|
27
27
|
};
|
|
28
|
-
var
|
|
29
|
-
for (var r = void 0,
|
|
30
|
-
(c = a[
|
|
31
|
-
return r &&
|
|
28
|
+
var U = Object.defineProperty, n = (a, t, e, o) => {
|
|
29
|
+
for (var r = void 0, s = a.length - 1, c; s >= 0; s--)
|
|
30
|
+
(c = a[s]) && (r = c(t, e, r) || r);
|
|
31
|
+
return r && U(t, e, r), r;
|
|
32
32
|
};
|
|
33
|
-
class
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
L(E(
|
|
33
|
+
class i extends T(
|
|
34
|
+
V(
|
|
35
|
+
F(
|
|
36
|
+
B(L(E(D(b))))
|
|
37
37
|
)
|
|
38
38
|
)
|
|
39
39
|
) {
|
|
40
40
|
constructor() {
|
|
41
|
-
super(...arguments), this.filteredOptions = [], this.filter = "", this.fixedDropdown = !1, this.listboxId =
|
|
41
|
+
super(...arguments), this.filteredOptions = [], this.filter = "", this.fixedDropdown = !1, this.listboxId = P("listbox-"), this.maxHeight = 0, this.open = !1, this.proxy = document.createElement("input");
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* @internal
|
|
@@ -60,18 +60,10 @@ class s extends F(
|
|
|
60
60
|
return this.autocomplete === p.both;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* Sets focus when the open property changes.
|
|
64
|
-
*
|
|
65
|
-
* @param prev - the previous open value
|
|
66
|
-
* @param next - the current open value
|
|
67
|
-
*
|
|
68
63
|
* @internal
|
|
69
64
|
*/
|
|
70
65
|
openChanged() {
|
|
71
|
-
|
|
72
|
-
this.focusAndScrollOptionIntoView(), O.enqueue(() => this.control.focus());
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
66
|
+
this.open && this.enqueueScrollSelectedOptionIntoViewIfNeeded();
|
|
75
67
|
}
|
|
76
68
|
/**
|
|
77
69
|
* The list of options.
|
|
@@ -101,8 +93,8 @@ class s extends F(
|
|
|
101
93
|
if (this.$fastController.isConnected && this.options) {
|
|
102
94
|
const o = this.options.findIndex(
|
|
103
95
|
(c) => c.text.toLowerCase() === e.toLowerCase()
|
|
104
|
-
), r = this.options[this.selectedIndex]?.text,
|
|
105
|
-
this.selectedIndex = r !==
|
|
96
|
+
), r = this.options[this.selectedIndex]?.text, s = this.options[o]?.text;
|
|
97
|
+
this.selectedIndex = r !== s ? o : this.selectedIndex;
|
|
106
98
|
}
|
|
107
99
|
super.valueChanged(t, e);
|
|
108
100
|
}
|
|
@@ -157,14 +149,17 @@ class s extends F(
|
|
|
157
149
|
* Overrides: `Listbox.focusAndScrollOptionIntoView`
|
|
158
150
|
*/
|
|
159
151
|
focusAndScrollOptionIntoView() {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
152
|
+
this.contains(document.activeElement) && (this.control.focus(), this.enqueueScrollSelectedOptionIntoViewIfNeeded());
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* @internal
|
|
156
|
+
*/
|
|
157
|
+
enqueueScrollSelectedOptionIntoViewIfNeeded() {
|
|
158
|
+
const t = this.firstSelectedOption;
|
|
159
|
+
/* v8 ignore else -- @preserve */
|
|
160
|
+
t && requestAnimationFrame(() => {
|
|
161
|
+
t.scrollIntoView({ block: "nearest" });
|
|
162
|
+
});
|
|
168
163
|
}
|
|
169
164
|
/**
|
|
170
165
|
* Handle focus state when the element or its children lose focus.
|
|
@@ -249,7 +244,7 @@ class s extends F(
|
|
|
249
244
|
*/
|
|
250
245
|
selectedIndexChanged(t, e) {
|
|
251
246
|
if (this.$fastController.isConnected) {
|
|
252
|
-
if (e =
|
|
247
|
+
if (e = z(-1, this.options.length - 1, e), e !== this.selectedIndex) {
|
|
253
248
|
this.selectedIndex = e;
|
|
254
249
|
return;
|
|
255
250
|
}
|
|
@@ -347,43 +342,43 @@ class s extends F(
|
|
|
347
342
|
this.control.setSelectionRange(t, t);
|
|
348
343
|
}
|
|
349
344
|
}
|
|
350
|
-
|
|
345
|
+
n([
|
|
351
346
|
l({ attribute: "autocomplete", mode: "fromView" })
|
|
352
|
-
],
|
|
353
|
-
|
|
347
|
+
], i.prototype, "autocomplete");
|
|
348
|
+
n([
|
|
354
349
|
l
|
|
355
|
-
],
|
|
356
|
-
|
|
350
|
+
], i.prototype, "appearance");
|
|
351
|
+
n([
|
|
357
352
|
l
|
|
358
|
-
],
|
|
359
|
-
|
|
353
|
+
], i.prototype, "shape");
|
|
354
|
+
n([
|
|
360
355
|
l()
|
|
361
|
-
],
|
|
362
|
-
|
|
356
|
+
], i.prototype, "scale");
|
|
357
|
+
n([
|
|
363
358
|
l
|
|
364
|
-
],
|
|
365
|
-
|
|
359
|
+
], i.prototype, "placement");
|
|
360
|
+
n([
|
|
366
361
|
l({ mode: "boolean", attribute: "fixed-dropdown" })
|
|
367
|
-
],
|
|
368
|
-
|
|
362
|
+
], i.prototype, "fixedDropdown");
|
|
363
|
+
n([
|
|
369
364
|
v
|
|
370
|
-
],
|
|
371
|
-
|
|
365
|
+
], i.prototype, "metaSlottedContent");
|
|
366
|
+
n([
|
|
372
367
|
v
|
|
373
|
-
],
|
|
374
|
-
|
|
368
|
+
], i.prototype, "maxHeight");
|
|
369
|
+
n([
|
|
375
370
|
l({ attribute: "open", mode: "boolean" })
|
|
376
|
-
],
|
|
377
|
-
|
|
371
|
+
], i.prototype, "open");
|
|
372
|
+
n([
|
|
378
373
|
l
|
|
379
|
-
],
|
|
380
|
-
const
|
|
374
|
+
], i.prototype, "placeholder");
|
|
375
|
+
const Y = ({
|
|
381
376
|
icon: a,
|
|
382
377
|
iconSlottedContent: t,
|
|
383
378
|
metaSlottedContent: e,
|
|
384
379
|
errorValidationMessage: o,
|
|
385
380
|
successText: r,
|
|
386
|
-
shape:
|
|
381
|
+
shape: s,
|
|
387
382
|
scale: c,
|
|
388
383
|
disabled: x,
|
|
389
384
|
placeholder: m,
|
|
@@ -391,10 +386,10 @@ const G = ({
|
|
|
391
386
|
appearance: f,
|
|
392
387
|
open: g,
|
|
393
388
|
_activeDescendant: w
|
|
394
|
-
}) =>
|
|
389
|
+
}) => M(
|
|
395
390
|
"base",
|
|
396
391
|
["disabled", x],
|
|
397
|
-
[`shape-${
|
|
392
|
+
[`shape-${s}`, !!s],
|
|
398
393
|
[`size-${c}`, !!c],
|
|
399
394
|
["placeholder", !!m],
|
|
400
395
|
[`appearance-${f}`, !!f],
|
|
@@ -405,31 +400,31 @@ const G = ({
|
|
|
405
400
|
["error", !!o],
|
|
406
401
|
["success", !!r]
|
|
407
402
|
);
|
|
408
|
-
function
|
|
403
|
+
function G() {
|
|
409
404
|
return u` <label for="control" class="label">
|
|
410
405
|
${(a) => a.label}
|
|
411
406
|
</label>`;
|
|
412
407
|
}
|
|
413
|
-
function
|
|
408
|
+
function J(a) {
|
|
414
409
|
return a.open && a.fixedDropdown ? `--_combobox-fixed-width: ${Math.round(
|
|
415
410
|
a.getBoundingClientRect().width
|
|
416
411
|
)}px` : null;
|
|
417
412
|
}
|
|
418
|
-
function
|
|
419
|
-
const t =
|
|
420
|
-
return u` <div class="${
|
|
413
|
+
function Q(a) {
|
|
414
|
+
const t = W(a), e = N(a);
|
|
415
|
+
return u` <div class="${Y}" ${d("_anchor")}>
|
|
421
416
|
<div
|
|
422
417
|
class="label-wrapper"
|
|
423
418
|
?hidden=${(o) => !o.label && !o._hasContextualHelp}
|
|
424
419
|
>
|
|
425
|
-
${
|
|
420
|
+
${K((o) => o.label, G())}
|
|
426
421
|
<slot
|
|
427
422
|
name="contextual-help"
|
|
428
423
|
${h("_contextualHelpSlottedContent")}
|
|
429
424
|
></slot>
|
|
430
425
|
</div>
|
|
431
426
|
<div class="fieldset">
|
|
432
|
-
${(o) => t(o.icon,
|
|
427
|
+
${(o) => t(o.icon, R.Slot)}
|
|
433
428
|
<div class="wrapper">
|
|
434
429
|
<input
|
|
435
430
|
id="control"
|
|
@@ -461,19 +456,19 @@ function X(a) {
|
|
|
461
456
|
</div>
|
|
462
457
|
</div>`;
|
|
463
458
|
}
|
|
464
|
-
const
|
|
459
|
+
const X = (a) => {
|
|
465
460
|
const t = a.tagFor(k);
|
|
466
461
|
return u`
|
|
467
462
|
<template
|
|
468
463
|
tabindex="${(e) => e.disabled ? null : "0"}"
|
|
469
464
|
@click="${(e, o) => e.clickHandler(o.event)}"
|
|
470
465
|
@focusout="${(e, o) => e.focusoutHandler(o.event)}"
|
|
471
|
-
@keydown="${(e, { event: o }) => (e.open &&
|
|
466
|
+
@keydown="${(e, { event: o }) => (e.open && q(o), e.keydownHandler(o))}"
|
|
472
467
|
>
|
|
473
468
|
<div class="control-wrapper">
|
|
474
|
-
${() =>
|
|
469
|
+
${() => Q(a)}
|
|
475
470
|
<${t} class="popup"
|
|
476
|
-
style="${
|
|
471
|
+
style="${J}"
|
|
477
472
|
?open="${(e) => e.open}"
|
|
478
473
|
placement="${(e) => e.placement ?? "bottom-start"}"
|
|
479
474
|
strategy="${(e) => e.fixedDropdown ? "fixed" : "absolute"}"
|
|
@@ -497,15 +492,15 @@ const Z = (a) => {
|
|
|
497
492
|
</div>
|
|
498
493
|
</template>
|
|
499
494
|
`;
|
|
500
|
-
},
|
|
495
|
+
}, Z = A(
|
|
501
496
|
"combobox",
|
|
502
|
-
|
|
503
|
-
|
|
497
|
+
i,
|
|
498
|
+
X,
|
|
504
499
|
[
|
|
505
500
|
y,
|
|
506
|
-
$,
|
|
507
501
|
I,
|
|
508
|
-
|
|
502
|
+
$,
|
|
503
|
+
H
|
|
509
504
|
],
|
|
510
505
|
{
|
|
511
506
|
styles: [C, j],
|
|
@@ -513,5 +508,5 @@ const Z = (a) => {
|
|
|
513
508
|
delegatesFocus: !0
|
|
514
509
|
}
|
|
515
510
|
}
|
|
516
|
-
),
|
|
517
|
-
|
|
511
|
+
), ee = O(Z);
|
|
512
|
+
ee();
|
|
@@ -58,5 +58,6 @@ const registerContextualHelp = vividElement.createRegisterFunction(
|
|
|
58
58
|
contextualHelpDefinition
|
|
59
59
|
);
|
|
60
60
|
|
|
61
|
+
exports.VwcContextualHelpElement = ContextualHelp;
|
|
61
62
|
exports.contextualHelpDefinition = contextualHelpDefinition;
|
|
62
63
|
exports.registerContextualHelp = registerContextualHelp;
|