@vonage/vivid 4.12.1 → 4.13.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/custom-elements.json +1388 -128
- package/lib/file-picker/file-picker.d.ts +6 -0
- package/lib/menu/menu.d.ts +16 -3
- package/lib/menu-item/menu-item.d.ts +10 -2
- package/lib/option/option.d.ts +27 -7
- package/lib/switch/switch.d.ts +5 -2
- package/lib/switch/switch.form-associated.d.ts +10 -0
- package/lib/tabs/tabs.d.ts +3 -2
- package/lib/text-area/text-area.d.ts +25 -3
- package/lib/text-area/text-field.form-associated.d.ts +10 -0
- package/lib/text-field/text-field.d.ts +28 -3
- package/lib/text-field/text-field.form-associated.d.ts +10 -0
- package/package.json +1 -1
- package/shared/definition11.cjs +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition17.cjs +1 -1
- package/shared/definition17.js +1 -1
- package/shared/definition20.cjs +2 -1
- package/shared/definition20.js +2 -1
- package/shared/definition21.cjs +1 -1
- package/shared/definition21.js +1 -1
- package/shared/definition24.cjs +1 -1
- package/shared/definition24.js +1 -1
- package/shared/definition25.cjs +24 -3
- package/shared/definition25.js +24 -3
- package/shared/definition29.cjs +358 -559
- package/shared/definition29.js +359 -560
- package/shared/definition30.cjs +2 -0
- package/shared/definition30.js +2 -0
- package/shared/definition35.cjs +222 -2
- package/shared/definition35.js +222 -2
- package/shared/definition36.cjs +149 -14
- package/shared/definition36.js +150 -15
- package/shared/definition46.cjs +1 -1
- package/shared/definition46.js +1 -1
- package/shared/definition47.cjs +5 -14
- package/shared/definition47.js +1 -10
- package/shared/definition49.cjs +65 -90
- package/shared/definition49.js +66 -91
- package/shared/definition51.cjs +1 -1
- package/shared/definition51.js +1 -1
- package/shared/definition52.cjs +15 -1
- package/shared/definition52.js +15 -1
- package/shared/definition55.cjs +160 -180
- package/shared/definition55.js +160 -180
- package/shared/definition56.cjs +3 -307
- package/shared/definition56.js +5 -309
- package/shared/definition57.cjs +8 -7
- package/shared/definition57.js +3 -2
- package/shared/definition64.cjs +18 -7
- package/shared/definition64.js +19 -8
- package/shared/listbox.cjs +198 -3
- package/shared/listbox.js +197 -2
- package/shared/{direction.cjs → localization.cjs} +12 -3
- package/shared/{direction.js → localization.js} +12 -3
- package/shared/presentationDate.cjs +8 -8
- package/shared/presentationDate.js +1 -1
- package/shared/text-field2.cjs +538 -194
- package/shared/text-field2.js +539 -195
- package/styles/core/all.css +21 -1
- package/styles/core/theme.css +21 -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/vivid.api.json +44 -0
- package/shared/Reflector.cjs +0 -71
- package/shared/Reflector.js +0 -69
- package/shared/listbox-option.cjs +0 -204
- package/shared/listbox-option.js +0 -201
package/shared/definition57.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
|
-
const definition$
|
|
4
|
+
const definition$2 = require('./definition56.cjs');
|
|
5
5
|
const definition = require('./definition64.cjs');
|
|
6
|
-
const definition$
|
|
6
|
+
const definition$1 = require('./definition11.cjs');
|
|
7
7
|
const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
|
|
8
8
|
const index$1 = require('./index2.cjs');
|
|
9
9
|
const scrollIntoView = require('./scrollIntoView.cjs');
|
|
@@ -11,13 +11,14 @@ const formAssociated = require('./form-associated.cjs');
|
|
|
11
11
|
const formElements = require('./form-elements.cjs');
|
|
12
12
|
const trappedFocus = require('./trapped-focus.cjs');
|
|
13
13
|
const localized = require('./localized.cjs');
|
|
14
|
+
const textField = require('./text-field2.cjs');
|
|
14
15
|
const ref = require('./ref.cjs');
|
|
15
16
|
const slotted = require('./slotted.cjs');
|
|
16
17
|
const when = require('./when.cjs');
|
|
17
18
|
const repeat = require('./repeat.cjs');
|
|
18
19
|
const classNames = require('./class-names.cjs');
|
|
19
20
|
|
|
20
|
-
const styles = ":host{display:inline-block}.base,.control{inline-size:100%}.dialog{display:inline-flex;flex-direction:column}.dialog .footer{display:flex;align-items:center;justify-content:flex-end;padding:8px;border-top:1px solid var(--vvd-color-neutral-200);gap:8px}.time-pickers{display:flex;overflow:hidden;justify-content:center;padding:4px;block-size:188px;gap:4px}.time-pickers .picker{position:relative;display:flex;overflow:hidden;flex-direction:column;padding:0;border-radius:4px;margin:0;gap:4px;inline-size:50px;list-style:none
|
|
21
|
+
const styles = ":host{display:inline-block}.base,.control{inline-size:100%}.dialog{display:inline-flex;flex-direction:column}.dialog .footer{display:flex;align-items:center;justify-content:flex-end;padding:8px;border-top:1px solid var(--vvd-color-neutral-200);gap:8px}.time-pickers{display:flex;overflow:hidden;justify-content:center;padding:4px;block-size:188px;gap:4px}.time-pickers .picker{position:relative;display:flex;overflow:hidden;flex-direction:column;padding:0;border-radius:4px;margin:0;gap:4px;inline-size:50px;list-style:none}.time-pickers .picker:hover{overflow-y:auto}.time-pickers .picker:after{display:block;flex-shrink:0;block-size:156px;content:\"\"}.time-pickers .picker:focus-visible{--focus-stroke-gap-color: transparent;--focus-inset: -2px;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))}.time-pickers .item{--_connotation-color-primary: var(--vvd-time-picker-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-firm: var(--vvd-time-picker-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-time-picker-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-time-picker-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-dim: var(--vvd-time-picker-accent-dim, var(--vvd-color-neutral-200));--_connotation-color-pale: var(--vvd-time-picker-accent-pale, var(--vvd-color-neutral-300))}.time-pickers .item{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.time-pickers .item:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.time-pickers .item:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.time-pickers .item:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.time-pickers .item:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.time-pickers .item:where(.selected):where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: transparent}.time-pickers .item{display:flex;flex-shrink:0;align-items:center;justify-content:center;border-radius:4px;background-color:var(--_appearance-color-fill);block-size:28px;color:var(--_appearance-color-text);cursor:pointer;font:var(--vvd-typography-base);inline-size:50px}";
|
|
21
22
|
|
|
22
23
|
class _TimePicker extends index.FoundationElement {
|
|
23
24
|
}
|
|
@@ -767,8 +768,8 @@ const renderPicker = (id, getLabel, getSelected, setSelected, getOptions) => {
|
|
|
767
768
|
};
|
|
768
769
|
const TimePickerTemplate = (context, _) => {
|
|
769
770
|
const popupTag = context.tagFor(definition.Popup);
|
|
770
|
-
const textFieldTag = context.tagFor(
|
|
771
|
-
const buttonTag = context.tagFor(definition$
|
|
771
|
+
const textFieldTag = context.tagFor(textField.TextField);
|
|
772
|
+
const buttonTag = context.tagFor(definition$1.Button$1);
|
|
772
773
|
return index.html`<div class="base" @keydown="${(x, { event }) => x._onBaseKeyDown(event)}">
|
|
773
774
|
<${textFieldTag} id="text-field"
|
|
774
775
|
${ref.ref("_textFieldEl")}
|
|
@@ -874,9 +875,9 @@ const timePickerDefinition = TimePicker.compose({
|
|
|
874
875
|
});
|
|
875
876
|
const timePickerRegistries = [
|
|
876
877
|
timePickerDefinition(),
|
|
877
|
-
...definition$
|
|
878
|
+
...definition$2.textFieldRegistries,
|
|
878
879
|
...definition.popupRegistries,
|
|
879
|
-
...definition$
|
|
880
|
+
...definition$1.buttonRegistries
|
|
880
881
|
];
|
|
881
882
|
const registerTimePicker = index.registerFactory(timePickerRegistries);
|
|
882
883
|
|
package/shared/definition57.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { F as FoundationElement, O as Observable, g as defaultExecutionContext, D as DOM, a as attr, n as nullableNumberConverter, v as volatile, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { a as textFieldRegistries } from './definition56.js';
|
|
3
3
|
import { P as Popup, p as popupRegistries } from './definition64.js';
|
|
4
4
|
import { c as Button, a as buttonRegistries } from './definition11.js';
|
|
5
5
|
import { a as applyMixinsWithObservables } from './applyMixinsWithObservables.js';
|
|
@@ -9,13 +9,14 @@ import { F as FormAssociated } from './form-associated.js';
|
|
|
9
9
|
import { e as errorText, f as formElements, a as FormElementHelperText } from './form-elements.js';
|
|
10
10
|
import { T as TrappedFocus } from './trapped-focus.js';
|
|
11
11
|
import { L as Localized } from './localized.js';
|
|
12
|
+
import { T as TextField } from './text-field2.js';
|
|
12
13
|
import { r as ref } from './ref.js';
|
|
13
14
|
import { s as slotted } from './slotted.js';
|
|
14
15
|
import { w as when } from './when.js';
|
|
15
16
|
import { r as repeat } from './repeat.js';
|
|
16
17
|
import { c as classNames } from './class-names.js';
|
|
17
18
|
|
|
18
|
-
const styles = ":host{display:inline-block}.base,.control{inline-size:100%}.dialog{display:inline-flex;flex-direction:column}.dialog .footer{display:flex;align-items:center;justify-content:flex-end;padding:8px;border-top:1px solid var(--vvd-color-neutral-200);gap:8px}.time-pickers{display:flex;overflow:hidden;justify-content:center;padding:4px;block-size:188px;gap:4px}.time-pickers .picker{position:relative;display:flex;overflow:hidden;flex-direction:column;padding:0;border-radius:4px;margin:0;gap:4px;inline-size:50px;list-style:none
|
|
19
|
+
const styles = ":host{display:inline-block}.base,.control{inline-size:100%}.dialog{display:inline-flex;flex-direction:column}.dialog .footer{display:flex;align-items:center;justify-content:flex-end;padding:8px;border-top:1px solid var(--vvd-color-neutral-200);gap:8px}.time-pickers{display:flex;overflow:hidden;justify-content:center;padding:4px;block-size:188px;gap:4px}.time-pickers .picker{position:relative;display:flex;overflow:hidden;flex-direction:column;padding:0;border-radius:4px;margin:0;gap:4px;inline-size:50px;list-style:none}.time-pickers .picker:hover{overflow-y:auto}.time-pickers .picker:after{display:block;flex-shrink:0;block-size:156px;content:\"\"}.time-pickers .picker:focus-visible{--focus-stroke-gap-color: transparent;--focus-inset: -2px;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))}.time-pickers .item{--_connotation-color-primary: var(--vvd-time-picker-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-firm: var(--vvd-time-picker-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-time-picker-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-time-picker-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-dim: var(--vvd-time-picker-accent-dim, var(--vvd-color-neutral-200));--_connotation-color-pale: var(--vvd-time-picker-accent-pale, var(--vvd-color-neutral-300))}.time-pickers .item{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.time-pickers .item:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.time-pickers .item:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.time-pickers .item:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.time-pickers .item:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.time-pickers .item:where(.selected):where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: transparent}.time-pickers .item{display:flex;flex-shrink:0;align-items:center;justify-content:center;border-radius:4px;background-color:var(--_appearance-color-fill);block-size:28px;color:var(--_appearance-color-text);cursor:pointer;font:var(--vvd-typography-base);inline-size:50px}";
|
|
19
20
|
|
|
20
21
|
class _TimePicker extends FoundationElement {
|
|
21
22
|
}
|
package/shared/definition64.cjs
CHANGED
|
@@ -1974,11 +1974,9 @@ class Popup extends index.FoundationElement {
|
|
|
1974
1974
|
}
|
|
1975
1975
|
#cleanup;
|
|
1976
1976
|
openChanged(_, newValue) {
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
this.#togglePopover();
|
|
1981
|
-
});
|
|
1977
|
+
this.#togglePopover();
|
|
1978
|
+
this.#updateAutoUpdate();
|
|
1979
|
+
this.$emit(newValue ? "vwc-popup:open" : "vwc-popup:close");
|
|
1982
1980
|
}
|
|
1983
1981
|
/**
|
|
1984
1982
|
* @internal
|
|
@@ -1992,11 +1990,15 @@ class Popup extends index.FoundationElement {
|
|
|
1992
1990
|
anchorChanged() {
|
|
1993
1991
|
this.#updateAutoUpdate();
|
|
1994
1992
|
}
|
|
1993
|
+
/**
|
|
1994
|
+
* @internal
|
|
1995
|
+
*/
|
|
1995
1996
|
strategyChanged() {
|
|
1996
1997
|
this.#togglePopover();
|
|
1997
1998
|
}
|
|
1998
1999
|
connectedCallback() {
|
|
1999
2000
|
super.connectedCallback();
|
|
2001
|
+
this.#togglePopover();
|
|
2000
2002
|
this.#updateAutoUpdate();
|
|
2001
2003
|
}
|
|
2002
2004
|
disconnectedCallback() {
|
|
@@ -2005,6 +2007,9 @@ class Popup extends index.FoundationElement {
|
|
|
2005
2007
|
}
|
|
2006
2008
|
#updateAutoUpdate() {
|
|
2007
2009
|
this.#cleanup?.();
|
|
2010
|
+
if (this.open && this.controlEl) {
|
|
2011
|
+
this.controlEl.classList.add("open");
|
|
2012
|
+
}
|
|
2008
2013
|
if (this.anchorEl && this.open && this.popupEl) {
|
|
2009
2014
|
this.#cleanup = autoUpdate(
|
|
2010
2015
|
this.anchorEl,
|
|
@@ -2070,8 +2075,14 @@ class Popup extends index.FoundationElement {
|
|
|
2070
2075
|
get anchorEl() {
|
|
2071
2076
|
return this.anchor ?? null;
|
|
2072
2077
|
}
|
|
2078
|
+
/**
|
|
2079
|
+
* Shows the popup.
|
|
2080
|
+
* Unlike toggling the `open` attribute, show() will ensure the popup becomes visible synchronously.
|
|
2081
|
+
*/
|
|
2073
2082
|
show() {
|
|
2074
2083
|
this.open = true;
|
|
2084
|
+
this.#togglePopover();
|
|
2085
|
+
this.#updateAutoUpdate();
|
|
2075
2086
|
}
|
|
2076
2087
|
hide() {
|
|
2077
2088
|
this.open = false;
|
|
@@ -2110,7 +2121,7 @@ __decorateClass([
|
|
|
2110
2121
|
index.observable
|
|
2111
2122
|
], Popup.prototype, "anchor");
|
|
2112
2123
|
|
|
2113
|
-
const styles = ":host{display:var(--_popup-display, inline)}.control{border-radius:inherit;background:var(--vvd-color-surface-4dp);contain:layout}.control:not(.open){display:none}.popup-wrapper{white-space:initial;z-index:var(--_popup-z-index, 10);overflow:visible;padding:0;border:none;border-radius:8px;margin:0;inline-size:max-content}.popup-wrapper:not(.absolute){position:fixed}.popup-wrapper.absolute{position:absolute;top:0;left:0}.popup-content{display:grid;color:var(--vvd-color-canvas-text)}.dismissible .popup-content{align-content:start;grid-template-columns:1fr auto}.arrow{position:absolute;z-index:-1;width:8px;height:8px;background:var(--vvd-color-surface-4dp);transform:rotate(45deg)}.dismissible-button{align-self:flex-start;margin-block-start:4px;margin-inline-end:4px}";
|
|
2124
|
+
const styles = ":host{display:var(--_popup-display, inline)}.control{border-radius:inherit;background:var(--vvd-color-surface-4dp);contain:layout}.control:not(.open){display:none}.popup-wrapper{white-space:initial;--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.popup-wrapper{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.popup-wrapper ::-webkit-scrollbar{width:4px}.popup-wrapper ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.popup-wrapper ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-thumb-color)}.popup-wrapper{z-index:var(--_popup-z-index, 10);overflow:visible;padding:0;border:none;border-radius:8px;margin:0;inline-size:max-content}.popup-wrapper:not(.absolute){position:fixed}.popup-wrapper.absolute{position:absolute;top:0;left:0}.popup-content{display:grid;color:var(--vvd-color-canvas-text)}.dismissible .popup-content{align-content:start;grid-template-columns:1fr auto}.arrow{position:absolute;z-index:-1;width:8px;height:8px;background:var(--vvd-color-surface-4dp);transform:rotate(45deg)}.dismissible-button{align-self:flex-start;margin-block-start:4px;margin-inline-end:4px}";
|
|
2114
2125
|
|
|
2115
2126
|
const getClasses = ({ open, dismissible, alternate }) => classNames.classNames(
|
|
2116
2127
|
"control",
|
|
@@ -2127,7 +2138,7 @@ const popupTemplate = (context) => {
|
|
|
2127
2138
|
return index.html`
|
|
2128
2139
|
<${elevationTag}>
|
|
2129
2140
|
<div popover="${handlePopover}" class="popup-wrapper ${(x) => x.strategy}" ${ref.ref("popupEl")} part="popup-base">
|
|
2130
|
-
<div class="${getClasses}" aria-hidden="${(x) => x.open ? "false" : "true"}"
|
|
2141
|
+
<div ${ref.ref("controlEl")} class="${getClasses}" aria-hidden="${(x) => x.open ? "false" : "true"}"
|
|
2131
2142
|
part="${(x) => x.alternate ? "vvd-theme-alternate" : ""}">
|
|
2132
2143
|
<div class="popup-content">
|
|
2133
2144
|
<slot></slot>
|
package/shared/definition64.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FoundationElement,
|
|
1
|
+
import { F as FoundationElement, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
2
|
import { c as Button, a as buttonRegistries } from './definition11.js';
|
|
3
3
|
import { E as Elevation, e as elevationRegistries } from './definition63.js';
|
|
4
4
|
import { r as ref } from './ref.js';
|
|
@@ -1972,11 +1972,9 @@ class Popup extends FoundationElement {
|
|
|
1972
1972
|
}
|
|
1973
1973
|
#cleanup;
|
|
1974
1974
|
openChanged(_, newValue) {
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
this.#togglePopover();
|
|
1979
|
-
});
|
|
1975
|
+
this.#togglePopover();
|
|
1976
|
+
this.#updateAutoUpdate();
|
|
1977
|
+
this.$emit(newValue ? "vwc-popup:open" : "vwc-popup:close");
|
|
1980
1978
|
}
|
|
1981
1979
|
/**
|
|
1982
1980
|
* @internal
|
|
@@ -1990,11 +1988,15 @@ class Popup extends FoundationElement {
|
|
|
1990
1988
|
anchorChanged() {
|
|
1991
1989
|
this.#updateAutoUpdate();
|
|
1992
1990
|
}
|
|
1991
|
+
/**
|
|
1992
|
+
* @internal
|
|
1993
|
+
*/
|
|
1993
1994
|
strategyChanged() {
|
|
1994
1995
|
this.#togglePopover();
|
|
1995
1996
|
}
|
|
1996
1997
|
connectedCallback() {
|
|
1997
1998
|
super.connectedCallback();
|
|
1999
|
+
this.#togglePopover();
|
|
1998
2000
|
this.#updateAutoUpdate();
|
|
1999
2001
|
}
|
|
2000
2002
|
disconnectedCallback() {
|
|
@@ -2003,6 +2005,9 @@ class Popup extends FoundationElement {
|
|
|
2003
2005
|
}
|
|
2004
2006
|
#updateAutoUpdate() {
|
|
2005
2007
|
this.#cleanup?.();
|
|
2008
|
+
if (this.open && this.controlEl) {
|
|
2009
|
+
this.controlEl.classList.add("open");
|
|
2010
|
+
}
|
|
2006
2011
|
if (this.anchorEl && this.open && this.popupEl) {
|
|
2007
2012
|
this.#cleanup = autoUpdate(
|
|
2008
2013
|
this.anchorEl,
|
|
@@ -2068,8 +2073,14 @@ class Popup extends FoundationElement {
|
|
|
2068
2073
|
get anchorEl() {
|
|
2069
2074
|
return this.anchor ?? null;
|
|
2070
2075
|
}
|
|
2076
|
+
/**
|
|
2077
|
+
* Shows the popup.
|
|
2078
|
+
* Unlike toggling the `open` attribute, show() will ensure the popup becomes visible synchronously.
|
|
2079
|
+
*/
|
|
2071
2080
|
show() {
|
|
2072
2081
|
this.open = true;
|
|
2082
|
+
this.#togglePopover();
|
|
2083
|
+
this.#updateAutoUpdate();
|
|
2073
2084
|
}
|
|
2074
2085
|
hide() {
|
|
2075
2086
|
this.open = false;
|
|
@@ -2108,7 +2119,7 @@ __decorateClass([
|
|
|
2108
2119
|
observable
|
|
2109
2120
|
], Popup.prototype, "anchor");
|
|
2110
2121
|
|
|
2111
|
-
const styles = ":host{display:var(--_popup-display, inline)}.control{border-radius:inherit;background:var(--vvd-color-surface-4dp);contain:layout}.control:not(.open){display:none}.popup-wrapper{white-space:initial;z-index:var(--_popup-z-index, 10);overflow:visible;padding:0;border:none;border-radius:8px;margin:0;inline-size:max-content}.popup-wrapper:not(.absolute){position:fixed}.popup-wrapper.absolute{position:absolute;top:0;left:0}.popup-content{display:grid;color:var(--vvd-color-canvas-text)}.dismissible .popup-content{align-content:start;grid-template-columns:1fr auto}.arrow{position:absolute;z-index:-1;width:8px;height:8px;background:var(--vvd-color-surface-4dp);transform:rotate(45deg)}.dismissible-button{align-self:flex-start;margin-block-start:4px;margin-inline-end:4px}";
|
|
2122
|
+
const styles = ":host{display:var(--_popup-display, inline)}.control{border-radius:inherit;background:var(--vvd-color-surface-4dp);contain:layout}.control:not(.open){display:none}.popup-wrapper{white-space:initial;--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.popup-wrapper{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.popup-wrapper ::-webkit-scrollbar{width:4px}.popup-wrapper ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.popup-wrapper ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-thumb-color)}.popup-wrapper{z-index:var(--_popup-z-index, 10);overflow:visible;padding:0;border:none;border-radius:8px;margin:0;inline-size:max-content}.popup-wrapper:not(.absolute){position:fixed}.popup-wrapper.absolute{position:absolute;top:0;left:0}.popup-content{display:grid;color:var(--vvd-color-canvas-text)}.dismissible .popup-content{align-content:start;grid-template-columns:1fr auto}.arrow{position:absolute;z-index:-1;width:8px;height:8px;background:var(--vvd-color-surface-4dp);transform:rotate(45deg)}.dismissible-button{align-self:flex-start;margin-block-start:4px;margin-inline-end:4px}";
|
|
2112
2123
|
|
|
2113
2124
|
const getClasses = ({ open, dismissible, alternate }) => classNames(
|
|
2114
2125
|
"control",
|
|
@@ -2125,7 +2136,7 @@ const popupTemplate = (context) => {
|
|
|
2125
2136
|
return html`
|
|
2126
2137
|
<${elevationTag}>
|
|
2127
2138
|
<div popover="${handlePopover}" class="popup-wrapper ${(x) => x.strategy}" ${ref("popupEl")} part="popup-base">
|
|
2128
|
-
<div class="${getClasses}" aria-hidden="${(x) => x.open ? "false" : "true"}"
|
|
2139
|
+
<div ${ref("controlEl")} class="${getClasses}" aria-hidden="${(x) => x.open ? "false" : "true"}"
|
|
2129
2140
|
part="${(x) => x.alternate ? "vvd-theme-alternate" : ""}">
|
|
2130
2141
|
<div class="popup-content">
|
|
2131
2142
|
<slot></slot>
|
package/shared/listbox.cjs
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
const keyCodes$1 = require('./key-codes.cjs');
|
|
4
4
|
const index = require('./index.cjs');
|
|
5
|
-
const listboxOption = require('./listbox-option.cjs');
|
|
6
5
|
const ariaGlobal = require('./aria-global.cjs');
|
|
6
|
+
const startEnd = require('./start-end.cjs');
|
|
7
7
|
const applyMixins = require('./apply-mixins.cjs');
|
|
8
|
+
const dom = require('./dom.cjs');
|
|
8
9
|
const keyCodes = require('./key-codes2.cjs');
|
|
9
10
|
const strings = require('./strings.cjs');
|
|
10
11
|
|
|
@@ -24,6 +25,200 @@ function findLastIndex(array, predicate) {
|
|
|
24
25
|
return -1;
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Determines if the element is a {@link (ListboxOption:class)}
|
|
30
|
+
*
|
|
31
|
+
* @param element - the element to test.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
function isListboxOption(el) {
|
|
35
|
+
return (dom.isHTMLElement(el) &&
|
|
36
|
+
(el.getAttribute("role") === "option" ||
|
|
37
|
+
el instanceof HTMLOptionElement));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* An Option Custom HTML Element.
|
|
41
|
+
* Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA option }.
|
|
42
|
+
*
|
|
43
|
+
* @slot start - Content which can be provided before the listbox option content
|
|
44
|
+
* @slot end - Content which can be provided after the listbox option content
|
|
45
|
+
* @slot - The default slot for listbox option content
|
|
46
|
+
* @csspart content - Wraps the listbox option content
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
class ListboxOption extends index.FoundationElement {
|
|
51
|
+
constructor(text, value, defaultSelected, selected) {
|
|
52
|
+
super();
|
|
53
|
+
/**
|
|
54
|
+
* The defaultSelected state of the option.
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
this.defaultSelected = false;
|
|
58
|
+
/**
|
|
59
|
+
* Tracks whether the "selected" property has been changed.
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
this.dirtySelected = false;
|
|
63
|
+
/**
|
|
64
|
+
* The checked state of the control.
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
this.selected = this.defaultSelected;
|
|
69
|
+
/**
|
|
70
|
+
* Track whether the value has been changed from the initial value
|
|
71
|
+
*/
|
|
72
|
+
this.dirtyValue = false;
|
|
73
|
+
if (text) {
|
|
74
|
+
this.textContent = text;
|
|
75
|
+
}
|
|
76
|
+
if (value) {
|
|
77
|
+
this.initialValue = value;
|
|
78
|
+
}
|
|
79
|
+
if (defaultSelected) {
|
|
80
|
+
this.defaultSelected = defaultSelected;
|
|
81
|
+
}
|
|
82
|
+
if (selected) {
|
|
83
|
+
this.selected = selected;
|
|
84
|
+
}
|
|
85
|
+
this.proxy = new Option(`${this.textContent}`, this.initialValue, this.defaultSelected, this.selected);
|
|
86
|
+
this.proxy.disabled = this.disabled;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Updates the ariaChecked property when the checked property changes.
|
|
90
|
+
*
|
|
91
|
+
* @param prev - the previous checked value
|
|
92
|
+
* @param next - the current checked value
|
|
93
|
+
*
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
checkedChanged(prev, next) {
|
|
97
|
+
if (typeof next === "boolean") {
|
|
98
|
+
this.ariaChecked = next ? "true" : "false";
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
this.ariaChecked = null;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Updates the proxy's text content when the default slot changes.
|
|
105
|
+
* @param prev - the previous content value
|
|
106
|
+
* @param next - the current content value
|
|
107
|
+
*
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
110
|
+
contentChanged(prev, next) {
|
|
111
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
112
|
+
this.proxy.textContent = this.textContent;
|
|
113
|
+
}
|
|
114
|
+
this.$emit("contentchange", null, { bubbles: true });
|
|
115
|
+
}
|
|
116
|
+
defaultSelectedChanged() {
|
|
117
|
+
if (!this.dirtySelected) {
|
|
118
|
+
this.selected = this.defaultSelected;
|
|
119
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
120
|
+
this.proxy.selected = this.defaultSelected;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
disabledChanged(prev, next) {
|
|
125
|
+
this.ariaDisabled = this.disabled ? "true" : "false";
|
|
126
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
127
|
+
this.proxy.disabled = this.disabled;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
selectedAttributeChanged() {
|
|
131
|
+
this.defaultSelected = this.selectedAttribute;
|
|
132
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
133
|
+
this.proxy.defaultSelected = this.defaultSelected;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
selectedChanged() {
|
|
137
|
+
this.ariaSelected = this.selected ? "true" : "false";
|
|
138
|
+
if (!this.dirtySelected) {
|
|
139
|
+
this.dirtySelected = true;
|
|
140
|
+
}
|
|
141
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
142
|
+
this.proxy.selected = this.selected;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
initialValueChanged(previous, next) {
|
|
146
|
+
// If the value is clean and the component is connected to the DOM
|
|
147
|
+
// then set value equal to the attribute value.
|
|
148
|
+
if (!this.dirtyValue) {
|
|
149
|
+
this.value = this.initialValue;
|
|
150
|
+
this.dirtyValue = false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
get label() {
|
|
154
|
+
var _a;
|
|
155
|
+
return (_a = this.value) !== null && _a !== void 0 ? _a : this.text;
|
|
156
|
+
}
|
|
157
|
+
get text() {
|
|
158
|
+
var _a, _b;
|
|
159
|
+
return (_b = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, " ").trim()) !== null && _b !== void 0 ? _b : "";
|
|
160
|
+
}
|
|
161
|
+
set value(next) {
|
|
162
|
+
const newValue = `${next !== null && next !== void 0 ? next : ""}`;
|
|
163
|
+
this._value = newValue;
|
|
164
|
+
this.dirtyValue = true;
|
|
165
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
166
|
+
this.proxy.value = newValue;
|
|
167
|
+
}
|
|
168
|
+
index.Observable.notify(this, "value");
|
|
169
|
+
}
|
|
170
|
+
get value() {
|
|
171
|
+
var _a;
|
|
172
|
+
index.Observable.track(this, "value");
|
|
173
|
+
return (_a = this._value) !== null && _a !== void 0 ? _a : this.text;
|
|
174
|
+
}
|
|
175
|
+
get form() {
|
|
176
|
+
return this.proxy ? this.proxy.form : null;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
index.__decorate([
|
|
180
|
+
index.observable
|
|
181
|
+
], ListboxOption.prototype, "checked", void 0);
|
|
182
|
+
index.__decorate([
|
|
183
|
+
index.observable
|
|
184
|
+
], ListboxOption.prototype, "content", void 0);
|
|
185
|
+
index.__decorate([
|
|
186
|
+
index.observable
|
|
187
|
+
], ListboxOption.prototype, "defaultSelected", void 0);
|
|
188
|
+
index.__decorate([
|
|
189
|
+
index.attr({ mode: "boolean" })
|
|
190
|
+
], ListboxOption.prototype, "disabled", void 0);
|
|
191
|
+
index.__decorate([
|
|
192
|
+
index.attr({ attribute: "selected", mode: "boolean" })
|
|
193
|
+
], ListboxOption.prototype, "selectedAttribute", void 0);
|
|
194
|
+
index.__decorate([
|
|
195
|
+
index.observable
|
|
196
|
+
], ListboxOption.prototype, "selected", void 0);
|
|
197
|
+
index.__decorate([
|
|
198
|
+
index.attr({ attribute: "value", mode: "fromView" })
|
|
199
|
+
], ListboxOption.prototype, "initialValue", void 0);
|
|
200
|
+
/**
|
|
201
|
+
* States and properties relating to the ARIA `option` role.
|
|
202
|
+
*
|
|
203
|
+
* @public
|
|
204
|
+
*/
|
|
205
|
+
class DelegatesARIAListboxOption {
|
|
206
|
+
}
|
|
207
|
+
index.__decorate([
|
|
208
|
+
index.observable
|
|
209
|
+
], DelegatesARIAListboxOption.prototype, "ariaChecked", void 0);
|
|
210
|
+
index.__decorate([
|
|
211
|
+
index.observable
|
|
212
|
+
], DelegatesARIAListboxOption.prototype, "ariaPosInSet", void 0);
|
|
213
|
+
index.__decorate([
|
|
214
|
+
index.observable
|
|
215
|
+
], DelegatesARIAListboxOption.prototype, "ariaSelected", void 0);
|
|
216
|
+
index.__decorate([
|
|
217
|
+
index.observable
|
|
218
|
+
], DelegatesARIAListboxOption.prototype, "ariaSetSize", void 0);
|
|
219
|
+
applyMixins.applyMixins(DelegatesARIAListboxOption, ariaGlobal.ARIAGlobalStatesAndProperties);
|
|
220
|
+
applyMixins.applyMixins(ListboxOption, startEnd.StartEnd, DelegatesARIAListboxOption);
|
|
221
|
+
|
|
27
222
|
/**
|
|
28
223
|
* A Listbox Custom HTML Element.
|
|
29
224
|
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#listbox | ARIA listbox }.
|
|
@@ -457,7 +652,7 @@ let Listbox$1 = class Listbox extends index.FoundationElement {
|
|
|
457
652
|
*/
|
|
458
653
|
slottedOptionsChanged(prev, next) {
|
|
459
654
|
this.options = next.reduce((options, item) => {
|
|
460
|
-
if (
|
|
655
|
+
if (isListboxOption(item)) {
|
|
461
656
|
options.push(item);
|
|
462
657
|
}
|
|
463
658
|
return options;
|
|
@@ -502,7 +697,7 @@ let Listbox$1 = class Listbox extends index.FoundationElement {
|
|
|
502
697
|
* @param n - element to filter
|
|
503
698
|
* @public
|
|
504
699
|
*/
|
|
505
|
-
Listbox$1.slottedOptionFilter = (n) =>
|
|
700
|
+
Listbox$1.slottedOptionFilter = (n) => isListboxOption(n) && !n.hidden;
|
|
506
701
|
/**
|
|
507
702
|
* Typeahead timeout in milliseconds.
|
|
508
703
|
*
|