@vonage/vivid 3.51.0 → 3.53.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/README.md +1 -1
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +1 -1
- package/accordion-item/index.cjs +1 -1
- package/accordion-item/index.js +1 -1
- package/alert/index.cjs +3 -3
- package/alert/index.js +3 -3
- package/appearance-ui/index.cjs +19 -11
- package/appearance-ui/index.js +19 -11
- package/audio-player/index.cjs +4 -3
- package/audio-player/index.js +4 -3
- package/avatar/index.cjs +1 -1
- package/avatar/index.js +1 -1
- package/badge/index.cjs +1 -1
- package/badge/index.js +1 -1
- package/banner/index.cjs +2 -2
- package/banner/index.js +2 -2
- package/breadcrumb-item/index.cjs +1 -1
- package/breadcrumb-item/index.js +1 -1
- package/button/index.cjs +2 -2
- package/button/index.js +2 -2
- package/card/index.cjs +2 -2
- package/card/index.js +2 -2
- package/checkbox/index.cjs +3 -2
- package/checkbox/index.js +3 -2
- package/combobox/index.cjs +5 -8
- package/combobox/index.js +5 -8
- package/custom-elements.json +2310 -769
- package/data-grid/index.cjs +1 -1
- package/data-grid/index.js +1 -1
- package/date-picker/index.cjs +7 -9
- package/date-picker/index.js +7 -9
- package/date-range-picker/index.cjs +7 -9
- package/date-range-picker/index.js +7 -9
- package/dial-pad/index.cjs +33 -0
- package/dial-pad/index.js +31 -0
- package/dialog/index.cjs +4 -4
- package/dialog/index.js +4 -4
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.cjs +2 -2
- package/empty-state/index.js +2 -2
- package/fab/index.cjs +2 -2
- package/fab/index.js +2 -2
- package/file-picker/index.cjs +4 -5
- package/file-picker/index.js +4 -5
- package/header/index.cjs +2 -2
- package/header/index.js +2 -2
- package/icon/index.cjs +1 -1
- package/icon/index.js +1 -1
- package/index.cjs +135 -123
- package/index.js +48 -46
- package/layout/index.cjs +1 -1
- package/layout/index.js +1 -1
- package/lib/avatar/definition.d.ts +1 -1
- package/lib/button/button.d.ts +1 -0
- package/lib/button/definition.d.ts +1 -1
- package/lib/calendar-event/definition.d.ts +1 -1
- package/lib/components.d.ts +3 -0
- package/lib/dial-pad/definition.d.ts +3 -0
- package/lib/dial-pad/dial-pad.d.ts +14 -0
- package/lib/dial-pad/dial-pad.template.d.ts +4 -0
- package/lib/dial-pad/locale.d.ts +18 -0
- package/lib/enums.d.ts +6 -0
- package/lib/layout/definition.d.ts +1 -1
- package/lib/menu-item/menu-item.d.ts +3 -0
- package/lib/range-slider/definition.d.ts +3 -0
- package/lib/range-slider/locale.d.ts +4 -0
- package/lib/range-slider/range-slider.d.ts +32 -0
- package/lib/range-slider/range-slider.form-associated.d.ts +10 -0
- package/lib/range-slider/range-slider.template.d.ts +4 -0
- package/lib/range-slider/utils/lerp.d.ts +2 -0
- package/lib/range-slider/utils/roundToStepValue.d.ts +1 -0
- package/lib/slider/slider.template.d.ts +1 -0
- package/lib/split-button/definition.d.ts +1 -1
- package/lib/text-anchor/definition.d.ts +1 -0
- package/lib/text-anchor/text-anchor.d.ts +5 -0
- package/lib/video-player/definition.d.ts +3 -0
- package/lib/video-player/locale.d.ts +1 -0
- package/lib/video-player/video-player.d.ts +17 -0
- package/lib/video-player/video-player.template.d.ts +4 -0
- package/listbox/index.cjs +25 -24
- package/listbox/index.js +25 -24
- package/locales/en-GB.cjs +34 -0
- package/locales/en-GB.js +34 -0
- package/locales/en-US.cjs +202 -0
- package/locales/en-US.js +202 -0
- package/locales/ja-JP.cjs +202 -1
- package/locales/ja-JP.js +202 -1
- package/locales/zh-CN.cjs +203 -0
- package/locales/zh-CN.js +203 -0
- package/menu/index.cjs +7 -7
- package/menu/index.js +7 -7
- package/menu-item/index.cjs +4 -4
- package/menu-item/index.js +4 -4
- package/nav/index.cjs +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.cjs +2 -2
- package/nav-disclosure/index.js +2 -2
- package/nav-item/index.cjs +2 -2
- package/nav-item/index.js +2 -2
- package/note/index.cjs +2 -2
- package/note/index.js +2 -2
- package/number-field/index.cjs +5 -6
- package/number-field/index.js +5 -6
- package/option/index.cjs +2 -2
- package/option/index.js +2 -2
- package/package.json +34 -34
- package/pagination/index.cjs +3 -3
- package/pagination/index.js +3 -3
- package/popup/index.cjs +4 -4
- package/popup/index.js +4 -4
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- 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/index.cjs +22 -0
- package/range-slider/index.js +20 -0
- package/select/index.cjs +7 -6
- package/select/index.js +7 -6
- package/selectable-box/index.cjs +5 -4
- package/selectable-box/index.js +5 -4
- package/shared/Reflector.cjs +5 -1
- package/shared/Reflector.js +5 -1
- package/shared/affix.cjs +11 -4
- package/shared/affix.js +12 -4
- package/shared/anchored.cjs +8 -2
- package/shared/anchored.js +8 -2
- package/shared/applyMixinsWithObservables.cjs +15 -0
- package/shared/applyMixinsWithObservables.js +13 -0
- package/shared/definition.cjs +9 -4
- package/shared/definition.js +9 -4
- package/shared/definition10.cjs +5 -5
- package/shared/definition10.js +5 -5
- package/shared/definition11.cjs +77 -49
- package/shared/definition11.js +78 -50
- package/shared/definition12.cjs +12 -14
- package/shared/definition12.js +12 -14
- package/shared/definition13.cjs +118 -75
- package/shared/definition13.js +118 -75
- package/shared/definition14.cjs +34 -33
- package/shared/definition14.js +34 -33
- package/shared/definition15.cjs +24 -12
- package/shared/definition15.js +24 -12
- package/shared/definition16.cjs +38 -43
- package/shared/definition16.js +38 -43
- package/shared/definition17.cjs +126 -66
- package/shared/definition17.js +127 -67
- package/shared/definition18.cjs +31 -15
- package/shared/definition18.js +31 -15
- package/shared/definition19.cjs +117 -81
- package/shared/definition19.js +117 -81
- package/shared/definition2.cjs +10 -5
- package/shared/definition2.js +10 -5
- package/shared/definition20.cjs +187 -227
- package/shared/definition20.js +183 -223
- package/shared/definition21.cjs +262 -69
- package/shared/definition21.js +261 -67
- package/shared/definition22.cjs +66 -61
- package/shared/definition22.js +64 -60
- package/shared/definition23.cjs +42 -77
- package/shared/definition23.js +41 -76
- package/shared/definition24.cjs +65 -2350
- package/shared/definition24.js +64 -2349
- package/shared/definition25.cjs +2402 -48
- package/shared/definition25.js +2401 -47
- package/shared/definition26.cjs +62 -28
- package/shared/definition26.js +61 -27
- package/shared/definition27.cjs +28 -54
- package/shared/definition27.js +27 -53
- package/shared/definition28.cjs +39 -819
- package/shared/definition28.js +38 -817
- package/shared/definition29.cjs +893 -54
- package/shared/definition29.js +893 -55
- package/shared/definition3.cjs +7 -10
- package/shared/definition3.js +7 -10
- package/shared/definition30.cjs +69 -85
- package/shared/definition30.js +68 -84
- package/shared/definition31.cjs +86 -23
- package/shared/definition31.js +86 -23
- package/shared/definition32.cjs +24 -14
- package/shared/definition32.js +23 -13
- package/shared/definition33.cjs +11 -53
- package/shared/definition33.js +10 -52
- package/shared/definition34.cjs +28 -500
- package/shared/definition34.js +28 -500
- package/shared/definition35.cjs +447 -194
- package/shared/definition35.js +447 -192
- package/shared/definition36.cjs +258 -188
- package/shared/definition36.js +255 -187
- package/shared/definition37.cjs +204 -78
- package/shared/definition37.js +203 -76
- package/shared/definition38.cjs +55 -51
- package/shared/definition38.js +52 -49
- package/shared/definition39.cjs +65 -423
- package/shared/definition39.js +64 -422
- package/shared/definition4.cjs +24 -12
- package/shared/definition4.js +24 -12
- package/shared/definition40.cjs +447 -35
- package/shared/definition40.js +444 -32
- package/shared/definition41.cjs +35 -678
- package/shared/definition41.js +34 -677
- package/shared/definition42.cjs +544 -99
- package/shared/definition42.js +543 -98
- package/shared/definition43.cjs +696 -77
- package/shared/definition43.js +695 -76
- package/shared/definition44.cjs +113 -563
- package/shared/definition44.js +112 -561
- package/shared/definition45.cjs +77 -117
- package/shared/definition45.js +75 -115
- package/shared/definition46.cjs +474 -86
- package/shared/definition46.js +474 -87
- package/shared/definition47.cjs +140 -23
- package/shared/definition47.js +139 -22
- package/shared/definition48.cjs +132 -57
- package/shared/definition48.js +131 -56
- package/shared/definition49.cjs +18 -524
- package/shared/definition49.js +17 -523
- package/shared/definition5.cjs +20 -17
- package/shared/definition5.js +20 -17
- package/shared/definition50.cjs +73 -25
- package/shared/definition50.js +72 -24
- package/shared/definition51.cjs +506 -99
- package/shared/definition51.js +505 -99
- package/shared/definition52.cjs +29 -277
- package/shared/definition52.js +28 -276
- package/shared/definition53.cjs +97 -256
- package/shared/definition53.js +97 -255
- package/shared/definition54.cjs +287 -769
- package/shared/definition54.js +287 -769
- package/shared/definition55.cjs +305 -105
- package/shared/definition55.js +304 -104
- package/shared/definition56.cjs +841 -81
- package/shared/definition56.js +840 -80
- package/shared/definition57.cjs +153 -69
- package/shared/definition57.js +152 -68
- package/shared/definition58.cjs +138 -299
- package/shared/definition58.js +137 -298
- package/shared/definition59.cjs +72 -27
- package/shared/definition59.js +71 -26
- package/shared/definition6.cjs +4 -5
- package/shared/definition6.js +4 -5
- package/shared/definition60.cjs +279 -1780
- package/shared/definition60.js +278 -1779
- package/shared/definition61.cjs +65870 -11
- package/shared/definition61.js +65869 -11
- package/shared/definition62.cjs +50 -0
- package/shared/definition62.js +46 -0
- package/shared/definition63.cjs +1828 -0
- package/shared/definition63.js +1824 -0
- package/shared/definition7.cjs +8 -6
- package/shared/definition7.js +8 -6
- package/shared/definition8.cjs +27 -20
- package/shared/definition8.js +27 -20
- package/shared/definition9.cjs +7 -10
- package/shared/definition9.js +7 -10
- package/shared/enums.cjs +8 -0
- package/shared/enums.js +8 -1
- package/shared/icon.cjs +7 -2
- package/shared/icon.js +7 -2
- package/shared/index2.cjs +67 -38
- package/shared/index2.js +67 -38
- package/shared/key-codes2.cjs +8 -0
- package/shared/key-codes2.js +5 -1
- package/shared/listbox.cjs +1 -1
- package/shared/listbox.js +1 -1
- package/shared/localization/Locale.d.ts +6 -0
- package/shared/patterns/form-elements/form-elements.d.ts +2 -3
- package/shared/patterns/index.d.ts +0 -1
- package/shared/presentationDate.cjs +140 -81
- package/shared/presentationDate.js +140 -81
- package/shared/slider.template.cjs +71 -0
- package/shared/slider.template.js +67 -0
- package/shared/text-anchor.cjs +6 -0
- package/shared/text-anchor.js +6 -0
- package/shared/text-anchor.template.cjs +33 -33
- package/shared/text-anchor.template.js +33 -33
- package/shared/text-field.cjs +1 -1
- package/shared/text-field.js +1 -1
- package/shared/utils/applyMixinsWithObservables.d.ts +1 -0
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.cjs +2 -1
- package/slider/index.js +2 -1
- package/split-button/index.cjs +2 -2
- package/split-button/index.js +2 -2
- package/style.css +1 -0
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/fonts/spezia-variable.css +39 -13
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +4 -2
- package/switch/index.cjs +2 -2
- package/switch/index.js +2 -2
- package/tab/index.cjs +2 -2
- package/tab/index.js +2 -2
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.cjs +4 -4
- package/tabs/index.js +4 -4
- package/tag/index.cjs +2 -2
- package/tag/index.js +2 -2
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +1 -1
- package/text-area/index.cjs +4 -3
- package/text-area/index.js +4 -3
- package/text-field/index.cjs +4 -6
- package/text-field/index.js +4 -6
- package/time-picker/index.cjs +8 -10
- package/time-picker/index.js +8 -10
- package/toggletip/index.cjs +5 -5
- package/toggletip/index.js +5 -5
- package/tooltip/index.cjs +5 -5
- package/tooltip/index.js +5 -5
- package/tree-item/index.cjs +2 -2
- package/tree-item/index.js +2 -2
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/video-player/index.cjs +17 -0
- package/video-player/index.js +15 -0
- package/vivid.api.json +428 -1
- package/focus/index.cjs +0 -7
- package/focus/index.js +0 -5
- package/lib/focus/definition.d.ts +0 -3
- package/lib/focus/focus.d.ts +0 -3
- package/lib/focus/focus.template.d.ts +0 -4
- package/lib/popup/popup.d.ts +0 -21
- package/shared/focus.cjs +0 -8
- package/shared/focus.js +0 -6
- package/shared/focus2.cjs +0 -11
- package/shared/focus2.js +0 -9
- package/shared/patterns/focus.d.ts +0 -3
package/shared/definition41.js
CHANGED
|
@@ -1,689 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as iconRegistries } from './definition26.js';
|
|
4
|
-
import { L as ListboxOption, a as listboxOptionRegistries } from './definition35.js';
|
|
5
|
-
import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
6
|
-
import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, g as getFeedbackTemplate } from './index2.js';
|
|
7
|
-
import { L as ListboxElement, b as Listbox, D as DelegatesARIAListbox, a as Listbox$1 } from './listbox.js';
|
|
8
|
-
import { S as StartEnd } from './start-end.js';
|
|
9
|
-
import { a as applyMixins } from './apply-mixins.js';
|
|
10
|
-
import { F as FormAssociated } from './form-associated.js';
|
|
11
|
-
import { S as SelectPosition } from './select.options.js';
|
|
12
|
-
import { u as uniqueId } from './strings.js';
|
|
13
|
-
import { c as keyTab, b as keyEscape, k as keyEnter, d as keyEnd, g as keyHome, a as keySpace, f as keyArrowDown, e as keyArrowUp } from './key-codes.js';
|
|
1
|
+
import { h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { R as Radio } from './radio.js';
|
|
14
3
|
import { w as when } from './when.js';
|
|
15
|
-
import { r as ref } from './ref.js';
|
|
16
|
-
import { s as slotted } from './slotted.js';
|
|
17
4
|
import { c as classNames } from './class-names.js';
|
|
18
5
|
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* A form-associated base class for the {@link @microsoft/fast-foundation#(Select:class)} component.
|
|
23
|
-
*
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
class FormAssociatedSelect extends FormAssociated(_Select) {
|
|
27
|
-
constructor() {
|
|
28
|
-
super(...arguments);
|
|
29
|
-
this.proxy = document.createElement("select");
|
|
30
|
-
}
|
|
31
|
-
}
|
|
6
|
+
const styles = ":host(:focus-visible){outline:none}:host([disabled]){cursor:not-allowed}.base{display:inline-flex;align-items:center;cursor:pointer;gap:8px}.base.connotation-cta{--_connotation-color-primary: var(--vvd-radio-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-radio-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-radio-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-intermediate: var(--vvd-radio-cta-intermediate, var(--vvd-color-cta-500));--_connotation-color-firm: var(--vvd-radio-cta-firm, var(--vvd-color-cta-600));--_connotation-color-fierce: var(--vvd-radio-cta-fierce, var(--vvd-color-cta-700))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-radio-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-radio-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-radio-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-radio-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-firm: var(--vvd-radio-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-radio-accent-fierce, var(--vvd-color-neutral-700))}.base{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.base:where(.hover,: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(--_connotation-color-fierce)}.base:where(.checked,:checked):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: var(--_connotation-color-primary)}.base:where(.checked,:checked):where(.hover,: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: var(--_connotation-color-primary-increment)}.base:where(.disabled,: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:where(.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)}@supports (user-select: none){.base{user-select:none}}.base.disabled{pointer-events:none}.control{position:relative;flex-shrink:0;border-radius:50%;block-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2)));box-shadow:inset 0 0 0 2px var(--_appearance-color-outline);inline-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}.base:not(.checked) .control{background-color:var(--_appearance-color-fill)}.control:after{position:absolute;border-radius:inherit;background-color:var(--_appearance-color-outline);content:\"\";inset:5px;opacity:1;transition:opacity .2s}.base:not(.checked) .control:after{opacity:0}:host(:focus-visible) .control{--focus-inset: -3px;--focus-stroke-gap-color: transparent}:host(:focus-visible) .control:before{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));position:absolute;display:block;border-radius:inherit;block-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2)));content:\"\";inline-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}label{color:var(--vvd-color-canvas-text);cursor:pointer;font:var(--vvd-typography-base)}.focus-indicator{--focus-inset: -3px;--focus-stroke-gap-color: transparent;border-radius:50%}:host(:not(:focus-visible)) .focus-indicator{display:none}\n";
|
|
32
7
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
* @slot button-container - The element representing the select button
|
|
40
|
-
* @slot selected-value - The selected value
|
|
41
|
-
* @slot indicator - The visual indicator for the expand/collapse state of the button
|
|
42
|
-
* @slot - The default slot for slotted options
|
|
43
|
-
* @csspart control - The element representing the select invoking element
|
|
44
|
-
* @csspart selected-value - The element wrapping the selected value
|
|
45
|
-
* @csspart indicator - The element wrapping the visual indicator
|
|
46
|
-
* @csspart listbox - The listbox element
|
|
47
|
-
* @fires input - Fires a custom 'input' event when the value updates
|
|
48
|
-
* @fires change - Fires a custom 'change' event when the value updates
|
|
49
|
-
*
|
|
50
|
-
* @public
|
|
51
|
-
*/
|
|
52
|
-
let Select$1 = class Select extends FormAssociatedSelect {
|
|
53
|
-
constructor() {
|
|
54
|
-
super(...arguments);
|
|
55
|
-
/**
|
|
56
|
-
* The open attribute.
|
|
57
|
-
*
|
|
58
|
-
* @public
|
|
59
|
-
* @remarks
|
|
60
|
-
* HTML Attribute: open
|
|
61
|
-
*/
|
|
62
|
-
this.open = false;
|
|
63
|
-
/**
|
|
64
|
-
* Indicates the initial state of the position attribute.
|
|
65
|
-
*
|
|
66
|
-
* @internal
|
|
67
|
-
*/
|
|
68
|
-
this.forcedPosition = false;
|
|
69
|
-
/**
|
|
70
|
-
* The unique id for the internal listbox element.
|
|
71
|
-
*
|
|
72
|
-
* @internal
|
|
73
|
-
*/
|
|
74
|
-
this.listboxId = uniqueId("listbox-");
|
|
75
|
-
/**
|
|
76
|
-
* The max height for the listbox when opened.
|
|
77
|
-
*
|
|
78
|
-
* @internal
|
|
79
|
-
*/
|
|
80
|
-
this.maxHeight = 0;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Sets focus and synchronizes ARIA attributes when the open property changes.
|
|
84
|
-
*
|
|
85
|
-
* @param prev - the previous open value
|
|
86
|
-
* @param next - the current open value
|
|
87
|
-
*
|
|
88
|
-
* @internal
|
|
89
|
-
*/
|
|
90
|
-
openChanged(prev, next) {
|
|
91
|
-
if (!this.collapsible) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (this.open) {
|
|
95
|
-
this.ariaControls = this.listboxId;
|
|
96
|
-
this.ariaExpanded = "true";
|
|
97
|
-
this.setPositioning();
|
|
98
|
-
this.focusAndScrollOptionIntoView();
|
|
99
|
-
this.indexWhenOpened = this.selectedIndex;
|
|
100
|
-
// focus is directed to the element when `open` is changed programmatically
|
|
101
|
-
DOM.queueUpdate(() => this.focus());
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
this.ariaControls = "";
|
|
105
|
-
this.ariaExpanded = "false";
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* The component is collapsible when in single-selection mode with no size attribute.
|
|
109
|
-
*
|
|
110
|
-
* @internal
|
|
111
|
-
*/
|
|
112
|
-
get collapsible() {
|
|
113
|
-
return !(this.multiple || typeof this.size === "number");
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* The value property.
|
|
117
|
-
*
|
|
118
|
-
* @public
|
|
119
|
-
*/
|
|
120
|
-
get value() {
|
|
121
|
-
Observable.track(this, "value");
|
|
122
|
-
return this._value;
|
|
123
|
-
}
|
|
124
|
-
set value(next) {
|
|
125
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
126
|
-
const prev = `${this._value}`;
|
|
127
|
-
if ((_a = this._options) === null || _a === void 0 ? void 0 : _a.length) {
|
|
128
|
-
const selectedIndex = this._options.findIndex(el => el.value === next);
|
|
129
|
-
const prevSelectedValue = (_c = (_b = this._options[this.selectedIndex]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null;
|
|
130
|
-
const nextSelectedValue = (_e = (_d = this._options[selectedIndex]) === null || _d === void 0 ? void 0 : _d.value) !== null && _e !== void 0 ? _e : null;
|
|
131
|
-
if (selectedIndex === -1 || prevSelectedValue !== nextSelectedValue) {
|
|
132
|
-
next = "";
|
|
133
|
-
this.selectedIndex = selectedIndex;
|
|
134
|
-
}
|
|
135
|
-
next = (_g = (_f = this.firstSelectedOption) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : next;
|
|
136
|
-
}
|
|
137
|
-
if (prev !== next) {
|
|
138
|
-
this._value = next;
|
|
139
|
-
super.valueChanged(prev, next);
|
|
140
|
-
Observable.notify(this, "value");
|
|
141
|
-
this.updateDisplayValue();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Sets the value and display value to match the first selected option.
|
|
146
|
-
*
|
|
147
|
-
* @param shouldEmit - if true, the input and change events will be emitted
|
|
148
|
-
*
|
|
149
|
-
* @internal
|
|
150
|
-
*/
|
|
151
|
-
updateValue(shouldEmit) {
|
|
152
|
-
var _a, _b;
|
|
153
|
-
if (this.$fastController.isConnected) {
|
|
154
|
-
this.value = (_b = (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
|
|
155
|
-
}
|
|
156
|
-
if (shouldEmit) {
|
|
157
|
-
this.$emit("input");
|
|
158
|
-
this.$emit("change", this, {
|
|
159
|
-
bubbles: true,
|
|
160
|
-
composed: undefined,
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Updates the proxy value when the selected index changes.
|
|
166
|
-
*
|
|
167
|
-
* @param prev - the previous selected index
|
|
168
|
-
* @param next - the next selected index
|
|
169
|
-
*
|
|
170
|
-
* @internal
|
|
171
|
-
*/
|
|
172
|
-
selectedIndexChanged(prev, next) {
|
|
173
|
-
super.selectedIndexChanged(prev, next);
|
|
174
|
-
this.updateValue();
|
|
175
|
-
}
|
|
176
|
-
positionChanged(prev, next) {
|
|
177
|
-
this.positionAttribute = next;
|
|
178
|
-
this.setPositioning();
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Calculate and apply listbox positioning based on available viewport space.
|
|
182
|
-
*
|
|
183
|
-
* @public
|
|
184
|
-
*/
|
|
185
|
-
setPositioning() {
|
|
186
|
-
const currentBox = this.getBoundingClientRect();
|
|
187
|
-
const viewportHeight = window.innerHeight;
|
|
188
|
-
const availableBottom = viewportHeight - currentBox.bottom;
|
|
189
|
-
this.position = this.forcedPosition
|
|
190
|
-
? this.positionAttribute
|
|
191
|
-
: currentBox.top > availableBottom
|
|
192
|
-
? SelectPosition.above
|
|
193
|
-
: SelectPosition.below;
|
|
194
|
-
this.positionAttribute = this.forcedPosition
|
|
195
|
-
? this.positionAttribute
|
|
196
|
-
: this.position;
|
|
197
|
-
this.maxHeight =
|
|
198
|
-
this.position === SelectPosition.above ? ~~currentBox.top : ~~availableBottom;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* The value displayed on the button.
|
|
202
|
-
*
|
|
203
|
-
* @public
|
|
204
|
-
*/
|
|
205
|
-
get displayValue() {
|
|
206
|
-
var _a, _b;
|
|
207
|
-
Observable.track(this, "displayValue");
|
|
208
|
-
return (_b = (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : "";
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Synchronize the `aria-disabled` property when the `disabled` property changes.
|
|
212
|
-
*
|
|
213
|
-
* @param prev - The previous disabled value
|
|
214
|
-
* @param next - The next disabled value
|
|
215
|
-
*
|
|
216
|
-
* @internal
|
|
217
|
-
*/
|
|
218
|
-
disabledChanged(prev, next) {
|
|
219
|
-
if (super.disabledChanged) {
|
|
220
|
-
super.disabledChanged(prev, next);
|
|
221
|
-
}
|
|
222
|
-
this.ariaDisabled = this.disabled ? "true" : "false";
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Reset the element to its first selectable option when its parent form is reset.
|
|
226
|
-
*
|
|
227
|
-
* @internal
|
|
228
|
-
*/
|
|
229
|
-
formResetCallback() {
|
|
230
|
-
this.setProxyOptions();
|
|
231
|
-
// Call the base class's implementation setDefaultSelectedOption instead of the select's
|
|
232
|
-
// override, in order to reset the selectedIndex without using the value property.
|
|
233
|
-
super.setDefaultSelectedOption();
|
|
234
|
-
if (this.selectedIndex === -1) {
|
|
235
|
-
this.selectedIndex = 0;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Handle opening and closing the listbox when the select is clicked.
|
|
240
|
-
*
|
|
241
|
-
* @param e - the mouse event
|
|
242
|
-
* @internal
|
|
243
|
-
*/
|
|
244
|
-
clickHandler(e) {
|
|
245
|
-
// do nothing if the select is disabled
|
|
246
|
-
if (this.disabled) {
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
if (this.open) {
|
|
250
|
-
const captured = e.target.closest(`option,[role=option]`);
|
|
251
|
-
if (captured && captured.disabled) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
super.clickHandler(e);
|
|
256
|
-
this.open = this.collapsible && !this.open;
|
|
257
|
-
if (!this.open && this.indexWhenOpened !== this.selectedIndex) {
|
|
258
|
-
this.updateValue(true);
|
|
259
|
-
}
|
|
260
|
-
return true;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Handles focus state when the element or its children lose focus.
|
|
264
|
-
*
|
|
265
|
-
* @param e - The focus event
|
|
266
|
-
* @internal
|
|
267
|
-
*/
|
|
268
|
-
focusoutHandler(e) {
|
|
269
|
-
var _a;
|
|
270
|
-
super.focusoutHandler(e);
|
|
271
|
-
if (!this.open) {
|
|
272
|
-
return true;
|
|
273
|
-
}
|
|
274
|
-
const focusTarget = e.relatedTarget;
|
|
275
|
-
if (this.isSameNode(focusTarget)) {
|
|
276
|
-
this.focus();
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.includes(focusTarget))) {
|
|
280
|
-
this.open = false;
|
|
281
|
-
if (this.indexWhenOpened !== this.selectedIndex) {
|
|
282
|
-
this.updateValue(true);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Updates the value when an option's value changes.
|
|
288
|
-
*
|
|
289
|
-
* @param source - the source object
|
|
290
|
-
* @param propertyName - the property to evaluate
|
|
291
|
-
*
|
|
292
|
-
* @internal
|
|
293
|
-
* @override
|
|
294
|
-
*/
|
|
295
|
-
handleChange(source, propertyName) {
|
|
296
|
-
super.handleChange(source, propertyName);
|
|
297
|
-
if (propertyName === "value") {
|
|
298
|
-
this.updateValue();
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Synchronize the form-associated proxy and updates the value property of the element.
|
|
303
|
-
*
|
|
304
|
-
* @param prev - the previous collection of slotted option elements
|
|
305
|
-
* @param next - the next collection of slotted option elements
|
|
306
|
-
*
|
|
307
|
-
* @internal
|
|
308
|
-
*/
|
|
309
|
-
slottedOptionsChanged(prev, next) {
|
|
310
|
-
this.options.forEach(o => {
|
|
311
|
-
const notifier = Observable.getNotifier(o);
|
|
312
|
-
notifier.unsubscribe(this, "value");
|
|
313
|
-
});
|
|
314
|
-
super.slottedOptionsChanged(prev, next);
|
|
315
|
-
this.options.forEach(o => {
|
|
316
|
-
const notifier = Observable.getNotifier(o);
|
|
317
|
-
notifier.subscribe(this, "value");
|
|
318
|
-
});
|
|
319
|
-
this.setProxyOptions();
|
|
320
|
-
this.updateValue();
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Prevents focus when size is set and a scrollbar is clicked.
|
|
324
|
-
*
|
|
325
|
-
* @param e - the mouse event object
|
|
326
|
-
*
|
|
327
|
-
* @override
|
|
328
|
-
* @internal
|
|
329
|
-
*/
|
|
330
|
-
mousedownHandler(e) {
|
|
331
|
-
var _a;
|
|
332
|
-
if (e.offsetX >= 0 && e.offsetX <= ((_a = this.listbox) === null || _a === void 0 ? void 0 : _a.scrollWidth)) {
|
|
333
|
-
return super.mousedownHandler(e);
|
|
334
|
-
}
|
|
335
|
-
return this.collapsible;
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Sets the multiple property on the proxy element.
|
|
339
|
-
*
|
|
340
|
-
* @param prev - the previous multiple value
|
|
341
|
-
* @param next - the current multiple value
|
|
342
|
-
*/
|
|
343
|
-
multipleChanged(prev, next) {
|
|
344
|
-
super.multipleChanged(prev, next);
|
|
345
|
-
if (this.proxy) {
|
|
346
|
-
this.proxy.multiple = next;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Updates the selectedness of each option when the list of selected options changes.
|
|
351
|
-
*
|
|
352
|
-
* @param prev - the previous list of selected options
|
|
353
|
-
* @param next - the current list of selected options
|
|
354
|
-
*
|
|
355
|
-
* @override
|
|
356
|
-
* @internal
|
|
357
|
-
*/
|
|
358
|
-
selectedOptionsChanged(prev, next) {
|
|
359
|
-
var _a;
|
|
360
|
-
super.selectedOptionsChanged(prev, next);
|
|
361
|
-
(_a = this.options) === null || _a === void 0 ? void 0 : _a.forEach((o, i) => {
|
|
362
|
-
var _a;
|
|
363
|
-
const proxyOption = (_a = this.proxy) === null || _a === void 0 ? void 0 : _a.options.item(i);
|
|
364
|
-
if (proxyOption) {
|
|
365
|
-
proxyOption.selected = o.selected;
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Sets the selected index to match the first option with the selected attribute, or
|
|
371
|
-
* the first selectable option.
|
|
372
|
-
*
|
|
373
|
-
* @override
|
|
374
|
-
* @internal
|
|
375
|
-
*/
|
|
376
|
-
setDefaultSelectedOption() {
|
|
377
|
-
var _a;
|
|
378
|
-
const options = (_a = this.options) !== null && _a !== void 0 ? _a : Array.from(this.children).filter(Listbox.slottedOptionFilter);
|
|
379
|
-
const selectedIndex = options === null || options === void 0 ? void 0 : options.findIndex(el => el.hasAttribute("selected") || el.selected || el.value === this.value);
|
|
380
|
-
if (selectedIndex !== -1) {
|
|
381
|
-
this.selectedIndex = selectedIndex;
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
this.selectedIndex = 0;
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Resets and fills the proxy to match the component's options.
|
|
388
|
-
*
|
|
389
|
-
* @internal
|
|
390
|
-
*/
|
|
391
|
-
setProxyOptions() {
|
|
392
|
-
if (this.proxy instanceof HTMLSelectElement && this.options) {
|
|
393
|
-
this.proxy.options.length = 0;
|
|
394
|
-
this.options.forEach(option => {
|
|
395
|
-
const proxyOption = option.proxy ||
|
|
396
|
-
(option instanceof HTMLOptionElement ? option.cloneNode() : null);
|
|
397
|
-
if (proxyOption) {
|
|
398
|
-
this.proxy.options.add(proxyOption);
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Handle keyboard interaction for the select.
|
|
405
|
-
*
|
|
406
|
-
* @param e - the keyboard event
|
|
407
|
-
* @internal
|
|
408
|
-
*/
|
|
409
|
-
keydownHandler(e) {
|
|
410
|
-
super.keydownHandler(e);
|
|
411
|
-
const key = e.key || e.key.charCodeAt(0);
|
|
412
|
-
switch (key) {
|
|
413
|
-
case keySpace: {
|
|
414
|
-
e.preventDefault();
|
|
415
|
-
if (this.collapsible && this.typeAheadExpired) {
|
|
416
|
-
this.open = !this.open;
|
|
417
|
-
}
|
|
418
|
-
break;
|
|
419
|
-
}
|
|
420
|
-
case keyHome:
|
|
421
|
-
case keyEnd: {
|
|
422
|
-
e.preventDefault();
|
|
423
|
-
break;
|
|
424
|
-
}
|
|
425
|
-
case keyEnter: {
|
|
426
|
-
e.preventDefault();
|
|
427
|
-
this.open = !this.open;
|
|
428
|
-
break;
|
|
429
|
-
}
|
|
430
|
-
case keyEscape: {
|
|
431
|
-
if (this.collapsible && this.open) {
|
|
432
|
-
e.preventDefault();
|
|
433
|
-
this.open = false;
|
|
434
|
-
}
|
|
435
|
-
break;
|
|
436
|
-
}
|
|
437
|
-
case keyTab: {
|
|
438
|
-
if (this.collapsible && this.open) {
|
|
439
|
-
e.preventDefault();
|
|
440
|
-
this.open = false;
|
|
441
|
-
}
|
|
442
|
-
return true;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
if (!this.open && this.indexWhenOpened !== this.selectedIndex) {
|
|
446
|
-
this.updateValue(true);
|
|
447
|
-
this.indexWhenOpened = this.selectedIndex;
|
|
448
|
-
}
|
|
449
|
-
return !(key === keyArrowDown || key === keyArrowUp);
|
|
450
|
-
}
|
|
451
|
-
connectedCallback() {
|
|
452
|
-
super.connectedCallback();
|
|
453
|
-
this.forcedPosition = !!this.positionAttribute;
|
|
454
|
-
this.addEventListener("contentchange", this.updateDisplayValue);
|
|
455
|
-
}
|
|
456
|
-
disconnectedCallback() {
|
|
457
|
-
this.removeEventListener("contentchange", this.updateDisplayValue);
|
|
458
|
-
super.disconnectedCallback();
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Updates the proxy's size property when the size attribute changes.
|
|
462
|
-
*
|
|
463
|
-
* @param prev - the previous size
|
|
464
|
-
* @param next - the current size
|
|
465
|
-
*
|
|
466
|
-
* @override
|
|
467
|
-
* @internal
|
|
468
|
-
*/
|
|
469
|
-
sizeChanged(prev, next) {
|
|
470
|
-
super.sizeChanged(prev, next);
|
|
471
|
-
if (this.proxy) {
|
|
472
|
-
this.proxy.size = next;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
*
|
|
477
|
-
* @internal
|
|
478
|
-
*/
|
|
479
|
-
updateDisplayValue() {
|
|
480
|
-
if (this.collapsible) {
|
|
481
|
-
Observable.notify(this, "displayValue");
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
};
|
|
485
|
-
__decorate([
|
|
486
|
-
attr({ attribute: "open", mode: "boolean" })
|
|
487
|
-
], Select$1.prototype, "open", void 0);
|
|
488
|
-
__decorate([
|
|
489
|
-
volatile
|
|
490
|
-
], Select$1.prototype, "collapsible", null);
|
|
491
|
-
__decorate([
|
|
492
|
-
observable
|
|
493
|
-
], Select$1.prototype, "control", void 0);
|
|
494
|
-
__decorate([
|
|
495
|
-
attr({ attribute: "position" })
|
|
496
|
-
], Select$1.prototype, "positionAttribute", void 0);
|
|
497
|
-
__decorate([
|
|
498
|
-
observable
|
|
499
|
-
], Select$1.prototype, "position", void 0);
|
|
500
|
-
__decorate([
|
|
501
|
-
observable
|
|
502
|
-
], Select$1.prototype, "maxHeight", void 0);
|
|
503
|
-
/**
|
|
504
|
-
* Includes ARIA states and properties relating to the ARIA select role.
|
|
505
|
-
*
|
|
506
|
-
* @public
|
|
507
|
-
*/
|
|
508
|
-
class DelegatesARIASelect {
|
|
509
|
-
}
|
|
510
|
-
__decorate([
|
|
511
|
-
observable
|
|
512
|
-
], DelegatesARIASelect.prototype, "ariaControls", void 0);
|
|
513
|
-
applyMixins(DelegatesARIASelect, DelegatesARIAListbox);
|
|
514
|
-
applyMixins(Select$1, StartEnd, DelegatesARIASelect);
|
|
515
|
-
|
|
516
|
-
const styles = "@supports selector(:focus-visible){:host(:focus-visible){outline:none}}:host{display:inline-flex;flex-direction:column;gap:4px;--_low-ink-color: var(--vvd-color-neutral-600);--focus-stroke-gap-color: transparent}:host([disabled]){--_low-ink-color: var(--vvd-color-neutral-400);cursor:not-allowed}.label{color:var(--vvd-color-canvas-text);contain:inline-size;font:var(--vvd-typography-base)}.control{display:flex;align-items:center;justify-content:space-between;background-color:var(--_appearance-color-fill);block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)));border-radius:var(--_select-control-border-radius);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);gap:8px;padding-inline:16px;transition:box-shadow .2s,background-color .2s}.control{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.control.appearance-ghost{--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(:hover,.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(--_connotation-color-fierce)}.control:where(:hover,.hover):where(:not(:disabled,.disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.control:where(:disabled,.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)}.control:where(:disabled,.disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.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)}.control:where(.readonly):where(:not(:disabled,.disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.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)}.control:where(.error):where(:not(:disabled,.disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.control:where(.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)}.control:where(.success):where(:not(:disabled,.disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.control{--_connotation-color-primary: var(--vvd-select-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-select-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-select-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-select-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-firm: var(--vvd-select-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-select-accent-fierce, var(--vvd-color-neutral-700))}.control-wrapper{position:relative}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}.control:not(.shape-pill){--_select-control-border-radius: 8px}.control.shape-pill{--_select-control-border-radius: 24px}:host(:focus-visible) .control{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}.listbox{display:flex;max-height:var(--select-height, 408px);flex-direction:column;padding:4px;gap:2px;overflow-y:auto}:host([multiple]:focus-visible) .listbox{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));border-radius:8px}.icon{display:flex;flex-shrink:0}.selected-value{display:flex;overflow:hidden;flex-grow:1;align-items:center;column-gap:12px;white-space:nowrap}.selected-value .text{overflow:hidden;max-inline-size:100%;text-overflow:ellipsis}.selected-value slot[name=icon]{flex:0 0 20px;font-size:20px;line-height:1}.control.has-meta .selected-value{padding-inline-end:8px}::part(popup-base){inline-size:max-content;min-inline-size:var(--_select-fixed-width, 100%)}:host([multiple]) ::part(popup-base){position:static}\n";
|
|
517
|
-
|
|
518
|
-
var __defProp = Object.defineProperty;
|
|
519
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
520
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
521
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
522
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
523
|
-
if (decorator = decorators[i])
|
|
524
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
525
|
-
if (kind && result)
|
|
526
|
-
__defProp(target, key, result);
|
|
527
|
-
return result;
|
|
528
|
-
};
|
|
529
|
-
let Select = class extends Select$1 {
|
|
530
|
-
constructor() {
|
|
531
|
-
super(...arguments);
|
|
532
|
-
this.fixedDropdown = false;
|
|
533
|
-
this.placeholderOption = null;
|
|
534
|
-
}
|
|
535
|
-
connectedCallback() {
|
|
536
|
-
super.connectedCallback();
|
|
537
|
-
}
|
|
538
|
-
get displayValue() {
|
|
539
|
-
Observable.track(this, "displayValue");
|
|
540
|
-
return this.firstSelectedOption?.getAttribute("label") ?? this.firstSelectedOption?.text ?? this.placeholder ?? "";
|
|
541
|
-
}
|
|
542
|
-
setDefaultSelectedOption() {
|
|
543
|
-
const options = Array.from(this.children).filter(Listbox$1.slottedOptionFilter);
|
|
544
|
-
const selectedIndex = options.findIndex(
|
|
545
|
-
(el) => el.hasAttribute("selected") || el.selected || el.value === this.value
|
|
546
|
-
);
|
|
547
|
-
if (selectedIndex === -1 && !this.placeholderOption) {
|
|
548
|
-
this.selectedIndex = 0;
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
if (selectedIndex !== -1 || this.placeholder !== "") {
|
|
552
|
-
this.selectedIndex = selectedIndex;
|
|
553
|
-
return;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
};
|
|
557
|
-
__decorateClass([
|
|
558
|
-
observable
|
|
559
|
-
], Select.prototype, "_anchor", 2);
|
|
560
|
-
__decorateClass([
|
|
561
|
-
attr
|
|
562
|
-
], Select.prototype, "appearance", 2);
|
|
563
|
-
__decorateClass([
|
|
564
|
-
attr
|
|
565
|
-
], Select.prototype, "shape", 2);
|
|
566
|
-
__decorateClass([
|
|
567
|
-
attr({ mode: "boolean", attribute: "fixed-dropdown" })
|
|
568
|
-
], Select.prototype, "fixedDropdown", 2);
|
|
569
|
-
__decorateClass([
|
|
570
|
-
attr
|
|
571
|
-
], Select.prototype, "placeholder", 2);
|
|
572
|
-
__decorateClass([
|
|
573
|
-
observable
|
|
574
|
-
], Select.prototype, "placeholderOption", 2);
|
|
575
|
-
__decorateClass([
|
|
576
|
-
observable
|
|
577
|
-
], Select.prototype, "metaSlottedContent", 2);
|
|
578
|
-
Select = __decorateClass([
|
|
579
|
-
errorText,
|
|
580
|
-
formElements
|
|
581
|
-
], Select);
|
|
582
|
-
applyMixins(Select, AffixIconWithTrailing, FormElementHelperText, FormElementSuccessText);
|
|
583
|
-
|
|
584
|
-
const getStateClasses = ({
|
|
585
|
-
shape,
|
|
586
|
-
disabled,
|
|
587
|
-
appearance,
|
|
588
|
-
metaSlottedContent,
|
|
589
|
-
errorValidationMessage,
|
|
590
|
-
successText
|
|
591
|
-
}) => classNames(
|
|
592
|
-
["disabled", disabled],
|
|
593
|
-
[`appearance-${appearance}`, Boolean(appearance)],
|
|
594
|
-
[`shape-${shape}`, Boolean(shape)],
|
|
595
|
-
["has-meta", Boolean(metaSlottedContent?.length)],
|
|
596
|
-
["error", Boolean(errorValidationMessage)],
|
|
597
|
-
["success", !!successText],
|
|
598
|
-
["has-meta", Boolean(metaSlottedContent?.length)]
|
|
8
|
+
const getClasses = ({ connotation, checked, readOnly, disabled }) => classNames(
|
|
9
|
+
"base",
|
|
10
|
+
[`connotation-${connotation}`, Boolean(connotation)],
|
|
11
|
+
["checked", Boolean(checked)],
|
|
12
|
+
["readonly", Boolean(readOnly)],
|
|
13
|
+
["disabled", Boolean(disabled)]
|
|
599
14
|
);
|
|
600
|
-
|
|
601
|
-
return html
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
const optionTag = context.tagFor(ListboxOption);
|
|
608
|
-
return html`
|
|
609
|
-
<${optionTag} ${ref("placeholderOption")}
|
|
610
|
-
text="${(x) => x.placeholder}" hidden disabled>
|
|
611
|
-
</${optionTag}>`;
|
|
612
|
-
}
|
|
613
|
-
function selectValue(context) {
|
|
614
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
615
|
-
return html`
|
|
616
|
-
<div class="control ${getStateClasses}" ${ref("_anchor")}
|
|
617
|
-
id="control" ?disabled="${(x) => x.disabled}">
|
|
618
|
-
<div class="selected-value">
|
|
619
|
-
${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
|
|
620
|
-
<span class="text">${(x) => x.displayValue}</span>
|
|
621
|
-
<slot name="meta" ${slotted("metaSlottedContent")}></slot>
|
|
622
|
-
</div>
|
|
623
|
-
${() => affixIconTemplate("chevron-down-line")}
|
|
624
|
-
</div>`;
|
|
625
|
-
}
|
|
626
|
-
function setFixedDropdownVarWidth(x) {
|
|
627
|
-
return x.open && x.fixedDropdown ? `--_select-fixed-width: ${Math.round(x.getBoundingClientRect().width)}px` : null;
|
|
628
|
-
}
|
|
629
|
-
function renderControl(context) {
|
|
630
|
-
const popupTag = context.tagFor(Popup);
|
|
631
|
-
return html`
|
|
632
|
-
${when((x) => x.label, renderLabel())}
|
|
633
|
-
<div class="control-wrapper">
|
|
634
|
-
${when((x) => !x.multiple, selectValue(context))}
|
|
635
|
-
<${popupTag} class="popup"
|
|
636
|
-
style="${setFixedDropdownVarWidth}"
|
|
637
|
-
?open="${(x) => x.collapsible ? x.open : true}"
|
|
638
|
-
:anchor="${(x) => x._anchor}"
|
|
639
|
-
placement="bottom-start"
|
|
640
|
-
strategy="${(x) => x.fixedDropdown ? null : "absolute"}">
|
|
641
|
-
<div class="listbox"
|
|
642
|
-
id="${(x) => x.listboxId}"
|
|
643
|
-
role="listbox"
|
|
644
|
-
?disabled="${(x) => x.disabled}"
|
|
645
|
-
?hidden="${(x) => x.collapsible ? !x.open : false}"
|
|
646
|
-
${ref("listbox")}>
|
|
647
|
-
${when((x) => x.placeholder, renderPlaceholder(context))}
|
|
648
|
-
<slot
|
|
649
|
-
${slotted({ filter: Listbox$1.slottedOptionFilter, flatten: true, property: "slottedOptions" })}>
|
|
650
|
-
</slot>
|
|
651
|
-
</div>
|
|
652
|
-
</${popupTag}>
|
|
653
|
-
</div>
|
|
654
|
-
${when((x) => x.helperText?.length, getFeedbackTemplate("helper", context))}
|
|
655
|
-
${when((x) => !x.successText && x.errorValidationMessage, getFeedbackTemplate("error", context))}
|
|
656
|
-
${when((x) => x.successText, getFeedbackTemplate("success", context))}
|
|
657
|
-
`;
|
|
658
|
-
}
|
|
659
|
-
const SelectTemplate = (context) => {
|
|
660
|
-
return html`
|
|
661
|
-
<template class="base"
|
|
15
|
+
const RadioTemplate = () => {
|
|
16
|
+
return html`<template
|
|
17
|
+
role="${(x) => x.ariaLabel ? "presentation" : null}"
|
|
18
|
+
>
|
|
19
|
+
<div
|
|
20
|
+
class="${getClasses}"
|
|
21
|
+
role="radio"
|
|
662
22
|
aria-label="${(x) => x.ariaLabel}"
|
|
663
|
-
aria-
|
|
664
|
-
aria-
|
|
665
|
-
aria-disabled="${(x) => x.
|
|
666
|
-
|
|
667
|
-
aria-haspopup="${(x) => x.collapsible ? "listbox" : null}"
|
|
668
|
-
aria-multiselectable="${(x) => x.ariaMultiSelectable}"
|
|
669
|
-
?open="${(x) => x.open}"
|
|
670
|
-
role="combobox"
|
|
671
|
-
tabindex="${(x) => !x.disabled ? "0" : null}"
|
|
23
|
+
aria-checked="${(x) => x.checked}"
|
|
24
|
+
aria-required="${(x) => x.required}"
|
|
25
|
+
aria-disabled="${(x) => x.disabled}"
|
|
26
|
+
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
672
27
|
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
28
|
+
>
|
|
29
|
+
<div class="control"></div>
|
|
30
|
+
${when(
|
|
31
|
+
(x) => x.label,
|
|
32
|
+
html`<label class="label">${(x) => x.label}</label>`
|
|
33
|
+
)}
|
|
34
|
+
</div>
|
|
35
|
+
</template>`;
|
|
679
36
|
};
|
|
680
37
|
|
|
681
|
-
const
|
|
682
|
-
baseName: "
|
|
683
|
-
template:
|
|
38
|
+
const radioDefinition = Radio.compose({
|
|
39
|
+
baseName: "radio",
|
|
40
|
+
template: RadioTemplate,
|
|
684
41
|
styles
|
|
685
42
|
});
|
|
686
|
-
const
|
|
687
|
-
const
|
|
43
|
+
const radioRegistries = [radioDefinition()];
|
|
44
|
+
const registerRadio = registerFactory(radioRegistries);
|
|
688
45
|
|
|
689
|
-
export {
|
|
46
|
+
export { radioRegistries as a, registerRadio as b, radioDefinition as r };
|