@vonage/vivid 5.3.0 → 5.5.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/base-color-picker.cjs +18 -13
- package/bundled/base-color-picker.js +98 -81
- package/bundled/calendar-picker.template.cjs +7 -7
- package/bundled/calendar-picker.template.js +102 -102
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/definition10.cjs +1 -1
- package/bundled/definition10.js +2 -2
- package/bundled/definition11.cjs +12 -19
- package/bundled/definition11.js +87 -66
- package/bundled/definition12.cjs +19 -10
- package/bundled/definition12.js +217 -36
- package/bundled/definition13.cjs +10 -1
- package/bundled/definition13.js +38 -14
- package/bundled/definition14.cjs +1 -5
- package/bundled/definition14.js +15 -24
- package/bundled/definition15.cjs +5 -30
- package/bundled/definition15.js +22 -73
- package/bundled/definition16.cjs +30 -19
- package/bundled/definition16.js +74 -97
- package/bundled/definition17.cjs +19 -13
- package/bundled/definition17.js +83 -117
- package/bundled/definition18.cjs +13 -12
- package/bundled/definition18.js +114 -71
- package/bundled/definition19.cjs +26 -27
- package/bundled/definition19.js +171 -180
- package/bundled/definition2.cjs +9 -9
- package/bundled/definition2.js +84 -129
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +1 -1
- 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 +48 -31
- package/bundled/mixins.cjs +1 -1
- package/bundled/mixins.js +1 -1
- package/bundled/picker-field.template.cjs +14 -14
- package/bundled/picker-field.template.js +35 -56
- package/bundled/time-selection-picker.template.cjs +12 -12
- package/bundled/time-selection-picker.template.js +13 -12
- package/bundled/trapped-focus.cjs +1 -0
- package/bundled/trapped-focus.js +26 -0
- package/bundled/vivid-element.cjs +5 -1
- package/bundled/vivid-element.js +401 -358
- package/calendar/index.cjs +13 -13
- package/calendar/index.js +171 -143
- package/card/definition.cjs +1 -1
- package/card/definition.js +1 -1
- package/color-picker/definition.cjs +209 -113
- package/color-picker/definition.js +209 -113
- package/color-picker/index.cjs +104 -75
- package/color-picker/index.js +412 -326
- 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/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +354 -2
- package/data-grid/index.cjs +1 -1
- package/data-grid/index.js +1 -1
- package/date-picker/definition.cjs +1 -1
- package/date-picker/definition.js +1 -1
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +2 -2
- package/date-range-picker/definition.cjs +1 -1
- package/date-range-picker/definition.js +1 -1
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +2 -2
- package/date-time-picker/definition.cjs +1 -1
- package/date-time-picker/definition.js +1 -1
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +2 -2
- package/dial-pad/definition.cjs +139 -0
- package/dial-pad/definition.js +139 -0
- package/dial-pad/index.cjs +27 -20
- package/dial-pad/index.js +177 -100
- 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/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- 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/icon/definition.cjs +56 -22
- package/icon/definition.js +56 -22
- 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/color-picker/color-picker.d.ts +390 -12
- package/lib/color-picker/locale.d.ts +4 -0
- package/lib/combobox/combobox.d.ts +1 -0
- package/lib/combobox/combobox.options.d.ts +1 -1
- package/lib/date-picker/date-picker.d.ts +38 -38
- package/lib/date-range-picker/date-range-picker.d.ts +20 -20
- package/lib/date-time-picker/date-time-picker.d.ts +40 -40
- package/lib/dial-pad/dial-pad.d.ts +1 -0
- package/lib/divider/divider.d.ts +1 -1
- package/lib/icon/icon.d.ts +1 -0
- 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/simple-color-picker/simple-color-picker.d.ts +2 -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/lib/time-picker/time-picker.d.ts +20 -20
- package/locales/de-DE.cjs +20 -3
- package/locales/de-DE.js +20 -3
- package/locales/en-GB.cjs +21 -4
- package/locales/en-GB.js +21 -4
- package/locales/en-US.cjs +21 -4
- package/locales/en-US.js +21 -4
- package/locales/ja-JP.cjs +20 -3
- package/locales/ja-JP.js +20 -3
- package/locales/zh-CN.cjs +19 -2
- package/locales/zh-CN.js +19 -2
- 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/number-field/index.cjs +1 -1
- package/number-field/index.js +3 -3
- package/option/definition.cjs +6 -77
- package/option/definition.js +3 -78
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +31 -5
- package/popup/definition.cjs +2 -2
- package/popup/definition.js +2 -2
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- 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 +1209 -1199
- 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 +30 -44
- package/select/definition.js +30 -44
- 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 +2 -2
- package/shared/aria/aria-mixin.d.ts +1 -1
- package/shared/color-picker/base-color-picker.d.ts +2 -1
- package/shared/foundation/listbox/listbox.d.ts +4 -0
- package/shared/picker-field/mixins/calendar-picker.d.ts +10 -10
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +10 -10
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +20 -20
- package/shared/picker-field/mixins/single-date-picker.d.ts +28 -28
- package/shared/picker-field/mixins/single-value-picker.d.ts +8 -8
- package/shared/picker-field/mixins/time-selection-picker.d.ts +20 -20
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +20 -20
- package/simple-color-picker/definition.cjs +9 -7
- package/simple-color-picker/definition.js +9 -7
- package/simple-color-picker/index.cjs +6 -6
- package/simple-color-picker/index.js +41 -39
- 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.cjs +34 -14
- package/tag/definition.js +35 -15
- package/tag/index.cjs +25 -12
- package/tag/index.js +64 -47
- package/tag-group/definition.cjs +1 -2
- package/tag-group/definition.js +1 -2
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +11 -12
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +2 -2
- package/text-field/definition.js +1 -1
- package/time-picker/definition.cjs +1 -1
- package/time-picker/definition.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/definition.cjs +1 -1
- package/toggletip/definition.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/definition.cjs +3 -3
- package/tooltip/definition.js +3 -3
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.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/base-color-picker.cjs +36 -18
- package/unbundled/base-color-picker.js +36 -18
- package/unbundled/calendar-picker.template.cjs +2 -2
- package/unbundled/calendar-picker.template.js +2 -2
- 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 +3 -36
- package/unbundled/picker-field.template.js +3 -35
- package/unbundled/slider.template.cjs +1 -1
- package/unbundled/slider.template.js +1 -1
- package/unbundled/time-selection-picker.template.cjs +2 -1
- package/unbundled/time-selection-picker.template.js +2 -1
- package/unbundled/trapped-focus.cjs +37 -0
- package/unbundled/trapped-focus.js +34 -0
- 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/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +1 -1
- package/vivid.api.json +285 -38
- package/bundled/_has.cjs +0 -1
- package/bundled/_has.js +0 -34
- 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/unbundled/definition3.js
CHANGED
|
@@ -1,203 +1,284 @@
|
|
|
1
1
|
import { VwcIconElement as Icon, iconDefinition } from '../icon/definition.js';
|
|
2
2
|
import { V as VividElement, d as defineVividComponent, c as createRegisterFunction } from './vivid-element.js';
|
|
3
|
+
import { attr, observable, volatile, when, html } from '@microsoft/fast-element';
|
|
3
4
|
import { isHTMLElement, classNames } from '@microsoft/fast-web-utilities';
|
|
4
|
-
import {
|
|
5
|
-
import { b as AffixIcon, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
5
|
+
import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
6
6
|
import { H as HostSemantics, a as applyHostSemantics } from './host-semantics.js';
|
|
7
7
|
|
|
8
|
-
const styles = ":host(:focus-visible){outline:none}:host([disabled]){cursor:not-allowed}.control{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control.disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}@media (hover: hover){.control:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}}.control.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.control:active:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.control.active:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.control.selected:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: transparent}@media (hover: hover){.control.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary-increment);--_appearance-color-outline: transparent}}.control.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary-increment);--_appearance-color-outline: transparent}.control{--_connotation-color-primary: var(--vvd-tree-item-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-tree-item-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-tree-item-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-faint: var(--vvd-tree-item-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-tree-item-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-firm: var(--vvd-tree-item-accent-firm, var(--vvd-color-canvas-text))}.control{position:relative;display:inline-flex;box-sizing:border-box;align-items:center;border-radius:8px;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);gap:12px;hyphens:auto;inline-size:100%;min-block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-inline:16px;text-decoration:none;vertical-align:middle;word-break:break-word}@supports (user-select: none){.control{user-select:none}}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}:host(:focus-visible) .control{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))}:host(:focus-visible) .control:not(.selected){--focus-stroke-gap-color: transparent}.control .text{font:var(--vvd-typography-base)}.expandCollapseButton{display:flex;align-items:center;border-radius:8px;font-size:20px}.expandCollapseButton .expandCollapseIcon{margin:4px}@media (hover: hover){.expandCollapseButton:hover{background-color:var(--vvd-color-neutral-100)}.selected .expandCollapseButton:hover{background-color:var(--vvd-color-neutral-700)}}.items{display:flex;flex-direction:column;gap:4px;margin-block-start:4px;padding-inline-start:48px}slot[name=icon]{font-size:20px;line-height:1}.control:not(.disabled,.selected) slot[name=icon]{color:var(--vvd-color-neutral-600)}";
|
|
9
|
-
|
|
10
8
|
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
10
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
12
|
-
var result = void 0 ;
|
|
11
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
13
12
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
14
13
|
if (decorator = decorators[i])
|
|
15
|
-
result = (decorator(target, key, result) ) || result;
|
|
16
|
-
if (result) __defProp(target, key, result);
|
|
14
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
15
|
+
if (kind && result) __defProp(target, key, result);
|
|
17
16
|
return result;
|
|
18
17
|
};
|
|
19
|
-
function
|
|
20
|
-
return isHTMLElement(el) && (el.getAttribute("role") === "
|
|
18
|
+
function isListboxOption(el) {
|
|
19
|
+
return isHTMLElement(el) && (el.getAttribute("role") === "option" || el instanceof HTMLOptionElement || el instanceof ListboxOption);
|
|
21
20
|
}
|
|
22
|
-
class
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
this.focusable = false;
|
|
29
|
-
/**
|
|
30
|
-
* Whether the tree is nested
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
this.isNestedItem = () => {
|
|
35
|
-
return isTreeItemElement(this.parentElement);
|
|
36
|
-
};
|
|
21
|
+
class ListboxOption extends HostSemantics(
|
|
22
|
+
AffixIconWithTrailing(VividElement)
|
|
23
|
+
) {
|
|
24
|
+
constructor(text, value, defaultSelected, selected) {
|
|
25
|
+
super();
|
|
26
|
+
this.defaultSelected = false;
|
|
37
27
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
28
|
+
* Tracks whether the "selected" property has been changed.
|
|
40
29
|
* @internal
|
|
41
30
|
*/
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
this.dirtySelected = false;
|
|
32
|
+
// eslint-disable-next-line @repo/repo/no-attribute-default-value
|
|
33
|
+
this.value = "";
|
|
34
|
+
this._highlighted = false;
|
|
35
|
+
this._displayCheckmark = false;
|
|
36
|
+
this._vvdSearchText = "";
|
|
37
|
+
this._isNotMatching = false;
|
|
38
|
+
if (text) {
|
|
39
|
+
this.text = text;
|
|
40
|
+
}
|
|
41
|
+
if (value) {
|
|
42
|
+
this.value = value;
|
|
43
|
+
}
|
|
44
|
+
if (defaultSelected) {
|
|
45
|
+
this.defaultSelected = defaultSelected;
|
|
46
|
+
}
|
|
47
|
+
if (selected) {
|
|
48
|
+
this.selected = selected;
|
|
49
|
+
}
|
|
50
|
+
this.proxy = new Option(
|
|
51
|
+
this.text,
|
|
52
|
+
this.value,
|
|
53
|
+
this.defaultSelected,
|
|
54
|
+
this.selected
|
|
55
|
+
);
|
|
56
|
+
this.proxy.disabled = this.disabled;
|
|
57
|
+
}
|
|
58
|
+
defaultSelectedChanged() {
|
|
59
|
+
if (!this.dirtySelected) {
|
|
60
|
+
this.selected = this.defaultSelected;
|
|
61
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
62
|
+
this.proxy.selected = this.defaultSelected;
|
|
45
63
|
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* @internal
|
|
51
|
-
*/
|
|
52
|
-
this.handleFocus = (_e) => {
|
|
53
|
-
this.setAttribute("tabindex", "0");
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Handle blur events
|
|
57
|
-
*
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
this.handleBlur = (_e) => {
|
|
61
|
-
this.setAttribute("tabindex", "-1");
|
|
62
|
-
};
|
|
64
|
+
}
|
|
65
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
66
|
+
this.proxy.defaultSelected = this.defaultSelected;
|
|
67
|
+
}
|
|
63
68
|
}
|
|
64
|
-
|
|
65
|
-
if (this
|
|
66
|
-
this
|
|
69
|
+
disabledChanged() {
|
|
70
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
71
|
+
this.proxy.disabled = this.disabled;
|
|
67
72
|
}
|
|
68
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated Use `defaultSelected` instead.
|
|
76
|
+
*/
|
|
77
|
+
get selectedAttribute() {
|
|
78
|
+
return this.defaultSelected;
|
|
79
|
+
}
|
|
80
|
+
set selectedAttribute(value) {
|
|
81
|
+
this.defaultSelected = value;
|
|
82
|
+
}
|
|
69
83
|
selectedChanged() {
|
|
70
|
-
if (this
|
|
71
|
-
this
|
|
84
|
+
if (!this.dirtySelected) {
|
|
85
|
+
this.dirtySelected = true;
|
|
86
|
+
}
|
|
87
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
88
|
+
this.proxy.selected = this.selected;
|
|
72
89
|
}
|
|
73
90
|
}
|
|
74
|
-
|
|
75
|
-
if (this
|
|
76
|
-
this.
|
|
77
|
-
|
|
78
|
-
node.nested = true;
|
|
79
|
-
}
|
|
80
|
-
});
|
|
91
|
+
valueChanged() {
|
|
92
|
+
if (typeof this.value !== "string") {
|
|
93
|
+
this.value = "";
|
|
94
|
+
return;
|
|
81
95
|
}
|
|
96
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
97
|
+
this.proxy.value = this.value;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
get label() {
|
|
101
|
+
return this._label ?? this.text;
|
|
102
|
+
}
|
|
103
|
+
set label(value) {
|
|
104
|
+
this._label = value;
|
|
105
|
+
}
|
|
106
|
+
set text(value) {
|
|
107
|
+
this._text = value;
|
|
108
|
+
}
|
|
109
|
+
get text() {
|
|
110
|
+
return this._text ?? "";
|
|
82
111
|
}
|
|
83
112
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* @
|
|
87
|
-
* @param el - the element to focus
|
|
113
|
+
* Provides an accessible name for use by parent components.
|
|
114
|
+
* Note: Does not implement full accessible name computation, e.g. slotted content is missed.
|
|
115
|
+
* @internal
|
|
88
116
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
117
|
+
_getAccessibleName() {
|
|
118
|
+
return this.ariaLabel || `${this.text}${this.textSecondary ? ` ${this.textSecondary}` : ""}`;
|
|
119
|
+
}
|
|
120
|
+
get form() {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
get _hasMatchedText() {
|
|
124
|
+
return Boolean(this.matchedText ?? this._vvdSearchText);
|
|
125
|
+
}
|
|
126
|
+
get _matchedRange() {
|
|
127
|
+
const matchedText = this.matchedText ?? this._vvdSearchText;
|
|
128
|
+
if (matchedText) {
|
|
129
|
+
const matchIndex = this.text.toLowerCase().indexOf(matchedText.toLowerCase());
|
|
130
|
+
return matchIndex === -1 ? { from: 0, to: 0 } : {
|
|
131
|
+
from: matchIndex,
|
|
132
|
+
to: matchIndex + matchedText.length
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return { from: 0, to: 0 };
|
|
92
136
|
}
|
|
93
137
|
/**
|
|
94
|
-
* Gets number of children
|
|
95
|
-
*
|
|
96
138
|
* @internal
|
|
97
139
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return treeChildren.length;
|
|
140
|
+
connectedCallback() {
|
|
141
|
+
super.connectedCallback();
|
|
142
|
+
if (!this.dirtySelected) {
|
|
143
|
+
this.selected = this.defaultSelected;
|
|
144
|
+
this.dirtySelected = false;
|
|
145
|
+
}
|
|
105
146
|
}
|
|
106
147
|
}
|
|
107
148
|
__decorateClass([
|
|
108
|
-
attr
|
|
109
|
-
|
|
149
|
+
attr({
|
|
150
|
+
converter: {
|
|
151
|
+
fromView: (value) => {
|
|
152
|
+
if (value === true || value === "true") {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
if (value === false || value === "false") {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
return void 0;
|
|
159
|
+
},
|
|
160
|
+
toView: (value) => value
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
], ListboxOption.prototype, "checked", 2);
|
|
164
|
+
__decorateClass([
|
|
165
|
+
attr({ attribute: "selected", mode: "boolean" })
|
|
166
|
+
], ListboxOption.prototype, "defaultSelected", 2);
|
|
167
|
+
// @ts-expect-error Type is incorrectly non-optional
|
|
110
168
|
__decorateClass([
|
|
111
169
|
attr({ mode: "boolean" })
|
|
112
|
-
],
|
|
170
|
+
], ListboxOption.prototype, "disabled", 2);
|
|
171
|
+
__decorateClass([
|
|
172
|
+
attr({ attribute: "current-selected", mode: "boolean" })
|
|
173
|
+
], ListboxOption.prototype, "selected", 2);
|
|
174
|
+
__decorateClass([
|
|
175
|
+
attr({ attribute: "value" })
|
|
176
|
+
], ListboxOption.prototype, "value", 2);
|
|
113
177
|
__decorateClass([
|
|
114
178
|
attr({
|
|
115
|
-
|
|
179
|
+
attribute: "label"
|
|
116
180
|
})
|
|
117
|
-
],
|
|
181
|
+
], ListboxOption.prototype, "_label", 2);
|
|
118
182
|
__decorateClass([
|
|
119
|
-
attr({
|
|
120
|
-
|
|
183
|
+
attr({
|
|
184
|
+
attribute: "text"
|
|
185
|
+
})
|
|
186
|
+
], ListboxOption.prototype, "_text", 2);
|
|
121
187
|
__decorateClass([
|
|
122
|
-
|
|
123
|
-
],
|
|
124
|
-
// @ts-expect-error Type is incorrectly non-optional
|
|
188
|
+
attr({ attribute: "text-secondary" })
|
|
189
|
+
], ListboxOption.prototype, "textSecondary", 2);
|
|
125
190
|
__decorateClass([
|
|
126
191
|
observable
|
|
127
|
-
],
|
|
192
|
+
], ListboxOption.prototype, "_highlighted", 2);
|
|
128
193
|
__decorateClass([
|
|
129
194
|
observable
|
|
130
|
-
],
|
|
131
|
-
|
|
195
|
+
], ListboxOption.prototype, "_displayCheckmark", 2);
|
|
196
|
+
__decorateClass([
|
|
197
|
+
attr({ attribute: "matched-text" })
|
|
198
|
+
], ListboxOption.prototype, "matchedText", 2);
|
|
132
199
|
__decorateClass([
|
|
133
200
|
observable
|
|
134
|
-
],
|
|
135
|
-
|
|
201
|
+
], ListboxOption.prototype, "_vvdSearchText", 2);
|
|
202
|
+
__decorateClass([
|
|
203
|
+
volatile
|
|
204
|
+
], ListboxOption.prototype, "_hasMatchedText", 1);
|
|
136
205
|
__decorateClass([
|
|
137
206
|
observable
|
|
138
|
-
],
|
|
207
|
+
], ListboxOption.prototype, "_isNotMatching", 2);
|
|
208
|
+
__decorateClass([
|
|
209
|
+
volatile
|
|
210
|
+
], ListboxOption.prototype, "_matchedRange", 1);
|
|
211
|
+
__decorateClass([
|
|
212
|
+
attr({ attribute: "tag-connotation" })
|
|
213
|
+
], ListboxOption.prototype, "tagConnotation", 2);
|
|
139
214
|
|
|
140
|
-
const getClasses = (
|
|
141
|
-
"
|
|
142
|
-
["disabled", disabled],
|
|
143
|
-
["selected", Boolean(selected)]
|
|
215
|
+
const getClasses = (x) => classNames(
|
|
216
|
+
"base",
|
|
217
|
+
["disabled", x.disabled],
|
|
218
|
+
["selected", Boolean(x.selected)],
|
|
219
|
+
["hover", Boolean(x._highlighted)],
|
|
220
|
+
["active", Boolean(x.checked)],
|
|
221
|
+
["icon", Boolean(x.icon)],
|
|
222
|
+
["two-lines", Boolean(x.text?.length) && Boolean(x.textSecondary?.length)]
|
|
144
223
|
);
|
|
145
|
-
|
|
224
|
+
function text() {
|
|
225
|
+
return html`${when(
|
|
226
|
+
(x) => x.text || x.textSecondary,
|
|
227
|
+
html`<span class="text">
|
|
228
|
+
${when(
|
|
229
|
+
(x) => x.text,
|
|
230
|
+
html`<span class="text-primary">
|
|
231
|
+
${when(
|
|
232
|
+
(x) => x._hasMatchedText,
|
|
233
|
+
html`${(x) => x.text.slice(0, x._matchedRange.from)}<span class="match"
|
|
234
|
+
>${(x) => x.text.slice(x._matchedRange.from, x._matchedRange.to)}</span
|
|
235
|
+
>`
|
|
236
|
+
)}${(x) => x.text.slice(x._matchedRange.to)}
|
|
237
|
+
</span>`
|
|
238
|
+
)}
|
|
239
|
+
${when(
|
|
240
|
+
(x) => x.textSecondary,
|
|
241
|
+
html`<span class="text-secondary">${(x) => x.textSecondary}</span>`
|
|
242
|
+
)}
|
|
243
|
+
</span>`
|
|
244
|
+
)}`;
|
|
245
|
+
}
|
|
246
|
+
const ListboxOptionTemplate = (context) => {
|
|
247
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
146
248
|
const iconTag = context.tagFor(Icon);
|
|
147
249
|
return html`
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
>
|
|
153
|
-
<${iconTag} class="expandCollapseIcon" name="${(x) => x.expanded ? "chevron-down-line" : "chevron-right-line"}"></${iconTag}>
|
|
154
|
-
</div>`;
|
|
155
|
-
};
|
|
156
|
-
const TreeItemTemplate = (context) => {
|
|
157
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
158
|
-
const treeItemTagName = context.tagFor(TreeItem, true);
|
|
159
|
-
return html` <template
|
|
160
|
-
slot="${(x) => x.isNestedItem() ? "item" : void 0}"
|
|
161
|
-
tabindex="-1"
|
|
162
|
-
${applyHostSemantics({
|
|
163
|
-
role: "treeitem",
|
|
164
|
-
ariaExpanded: (x) => x.childItems && x.childItems.length > 0 ? x.expanded : void 0,
|
|
250
|
+
<template
|
|
251
|
+
${applyHostSemantics({
|
|
252
|
+
role: "option",
|
|
253
|
+
ariaChecked: (x) => x.checked,
|
|
165
254
|
ariaSelected: (x) => x.selected,
|
|
166
255
|
ariaDisabled: (x) => x.disabled
|
|
167
256
|
})}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
${when(
|
|
177
|
-
(x) => x.childItems && x.childItems.length > 0,
|
|
178
|
-
expandCollapseButton(context)
|
|
257
|
+
style="${(x) => x._isNotMatching ? "display: none" : ""}"
|
|
258
|
+
>
|
|
259
|
+
<div class="${getClasses}">
|
|
260
|
+
${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)} ${text()}
|
|
261
|
+
<slot name="trailing-meta"></slot>
|
|
262
|
+
${when(
|
|
263
|
+
(x) => x._displayCheckmark && x.selected,
|
|
264
|
+
html`<${iconTag} class="checkmark" name="check-line"></${iconTag}>`
|
|
179
265
|
)}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
${when(
|
|
184
|
-
(x) => x.childItems && x.childItems.length > 0 && x.expanded,
|
|
185
|
-
html` <div role="group" class="items">
|
|
186
|
-
<slot name="item" ${slotted("items")}></slot>
|
|
187
|
-
</div>`
|
|
188
|
-
)}
|
|
189
|
-
</template>`;
|
|
266
|
+
</div>
|
|
267
|
+
</template>
|
|
268
|
+
`;
|
|
190
269
|
};
|
|
191
270
|
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
271
|
+
const styles = ":host([disabled]){cursor:not-allowed}.base{--_connotation-color-primary: var(--vvd-option-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-option-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-option-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-option-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-option-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-option-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-option-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-option-accent-dim, var(--vvd-color-neutral-200))}.base{--_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(--_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(--_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: transparent;--_appearance-color-outline: transparent}.base.disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:active:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base.active:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base.selected:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}@media (hover: hover){.base.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}}.base.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base{display:flex;box-sizing:border-box;align-items:center;border-radius:8px;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_option-appearance-color-text, var(--_appearance-color-text));font:var(--vvd-typography-base);gap:var(--_option-gap);hyphens:auto;inline-size:100%;min-block-size:var(--_option-min-block-size);padding-inline:var(--_option-padding-inline);vertical-align:middle;word-break:break-word}.base{--_option-min-block-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_option-padding-inline: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;--_option-icon-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) }.base:not(.two-lines){--_option-gap: calc( calc(1px*(36 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) / 3);padding-block:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2))/4)}.base.two-lines{gap:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2))*.4);padding-block:calc(1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2))/2)}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){cursor:pointer}.base.disabled{pointer-events:none}:host([scale=condensed]) .base{--_option-min-block-size: calc(1px*(32 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_option-padding-inline: calc(1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;--_option-icon-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) }:host([scale=condensed]) .base:not(.two-lines){--_option-gap: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/5) ;padding-block:calc(calc(1px*(36 + 4*clamp(-1,var(--vvd-size-density, 0),2))) / 6)}:host([scale=condensed]) .base.two-lines{gap:calc(calc(1px*(36 + 4*clamp(-1,var(--vvd-size-density, 0),2))) / 3);padding-block:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2))/4)}.base.active{--focus-stroke-color: var(--vvd-color-cta-500);--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))}.base.hidden{display:none}.text{display:flex;flex-direction:column;font:var(--vvd-typography-base);gap:4px;margin-inline-end:auto}.text-primary,.text-secondary{display:block;font:var(--vvd-typography-base)}.text-primary{font:var(--vvd-typography-base)}.base:not(.disabled) .text-primary{color:var(--vvd-color-canvas-text)}.base.disabled .text-primary{color:var(--_appearance-color-text)}.base.two-lines .text-primary{font:var(--vvd-typography-base-bold)}.text-secondary{color:var(--vvd-color-neutral-800);font:var(--vvd-typography-base-condensed)}.base.two-lines .text-secondary{color:var(--vvd-color-neutral-600)}.base.disabled .text-secondary{color:var(--_appearance-color-text)}.base.selected:not(.disabled) .text-secondary{color:var(--vvd-color-neutral-800)}.match{color:var(--vvd-color-cta-600);font:var(--vvd-typography-base-bold)}slot[name=icon]{font-size:var(--_option-icon-size);line-height:1}.base:not(.disabled,.selected) slot[name=icon]{color:var(--vvd-color-neutral-600)}.checkmark{font-size:var(--_option-icon-size)}";
|
|
272
|
+
|
|
273
|
+
const listboxOptionDefinition = defineVividComponent(
|
|
274
|
+
"option",
|
|
275
|
+
ListboxOption,
|
|
276
|
+
ListboxOptionTemplate,
|
|
196
277
|
[iconDefinition],
|
|
197
278
|
{
|
|
198
279
|
styles
|
|
199
280
|
}
|
|
200
281
|
);
|
|
201
|
-
const
|
|
282
|
+
const registerOption = createRegisterFunction(listboxOptionDefinition);
|
|
202
283
|
|
|
203
|
-
export {
|
|
284
|
+
export { ListboxOption as L, isListboxOption as i, listboxOptionDefinition as l, registerOption as r };
|