@vonage/vivid 5.24.0 → 5.25.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/avatar/index.cjs +10 -10
- package/avatar/index.js +4 -3
- package/breadcrumb-item/index.cjs +9 -5
- package/breadcrumb-item/index.js +11 -6
- package/bundled/affix.cjs +1 -1
- package/bundled/affix.js +1 -1
- package/bundled/definition10.cjs +2 -1
- package/bundled/definition10.js +3 -2
- package/bundled/definition11.cjs +4 -4
- package/bundled/definition11.js +4 -3
- package/bundled/definition12.cjs +1 -1
- package/bundled/definition12.js +1 -0
- package/bundled/definition15.cjs +5 -5
- package/bundled/definition15.js +4 -3
- package/bundled/definition17.cjs +7 -7
- package/bundled/definition17.js +22 -109
- package/bundled/definition18.cjs +3 -3
- package/bundled/definition18.js +9 -31
- package/bundled/definition19.cjs +19 -19
- package/bundled/definition19.js +3 -2
- package/bundled/definition21.cjs +8 -8
- package/bundled/definition21.js +5 -4
- package/bundled/definition22.cjs +2 -2
- package/bundled/definition22.js +2 -2
- package/bundled/definition24.cjs +4 -4
- package/bundled/definition24.js +4 -3
- package/bundled/definition25.cjs +3 -3
- package/bundled/definition25.js +32 -28
- package/bundled/definition3.cjs +5 -5
- package/bundled/definition3.js +10 -40
- package/bundled/definition4.cjs +6 -6
- package/bundled/definition4.js +4 -3
- package/bundled/definition6.cjs +11 -11
- package/bundled/definition6.js +4 -3
- package/bundled/definition9.cjs +12 -6
- package/bundled/definition9.js +66 -43
- package/bundled/extractOptions.cjs +1 -1
- package/bundled/extractOptions.js +2 -2
- package/bundled/icon.cjs +1 -0
- package/bundled/icon.js +34 -0
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +5 -2
- package/bundled/mixins.cjs +8 -8
- package/bundled/mixins.js +4 -3
- package/bundled/optgroup.cjs +1 -0
- package/bundled/optgroup.js +27 -0
- package/bundled/option.cjs +1 -0
- package/bundled/option.js +93 -0
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +1 -1
- package/card/index.cjs +22 -22
- package/card/index.js +4 -3
- package/color-picker/index.cjs +18 -18
- package/color-picker/index.js +4 -3
- package/combobox/index.cjs +7 -7
- package/combobox/index.js +4 -2
- package/custom-elements.json +4159 -3847
- package/data-grid/index.cjs +24 -24
- package/data-grid/index.js +4 -3
- package/dial-pad/index.cjs +21 -21
- package/dial-pad/index.js +4 -3
- package/dialog/index.cjs +14 -14
- package/dialog/index.js +4 -3
- package/empty-state/index.cjs +3 -3
- package/empty-state/index.js +4 -3
- package/file-picker/index.cjs +7 -7
- package/file-picker/index.js +4 -3
- package/icon/definition.cjs +2 -1
- package/icon/definition.js +2 -1
- package/index.cjs +148 -141
- package/index.js +41 -37
- package/lib/accordion-item/accordion-item.d.ts +1 -0
- package/lib/combobox/combobox.d.ts +1 -1
- package/lib/components.d.ts +1 -0
- package/lib/dial-pad/dial-pad.d.ts +0 -1
- package/lib/listbox/definition.d.ts +3 -0
- package/lib/listbox/index.d.ts +1 -0
- package/lib/listbox/listbox.d.ts +1302 -0
- package/lib/listbox/listbox.template.d.ts +3 -0
- package/lib/listbox/variations.browser-spec.d.ts +1 -0
- package/lib/menu/menu.d.ts +0 -1
- package/lib/number-field/number-field.d.ts +0 -1
- package/lib/rich-text-editor/rte/features/base.d.ts +1 -0
- package/lib/rich-text-editor/rte/utils/default-textblock.d.ts +2 -2
- package/lib/tag-name-map.d.ts +2 -1
- package/lib/text-field/text-field.d.ts +1 -0
- package/lib/toggletip/toggletip.d.ts +1 -0
- package/lib/tooltip/tooltip.d.ts +1 -0
- package/listbox/definition.cjs +5 -0
- package/listbox/definition.js +2 -0
- package/listbox/index.cjs +11 -0
- package/listbox/index.js +540 -0
- package/nav/definition.cjs +1 -1
- package/nav/definition.js +1 -1
- package/nav-disclosure/definition.cjs +1 -1
- package/nav-disclosure/definition.js +1 -1
- package/nav-disclosure/index.cjs +4 -4
- package/nav-disclosure/index.js +4 -3
- package/nav-item/definition.cjs +1 -1
- package/nav-item/definition.js +1 -1
- package/note/definition.cjs +1 -1
- package/note/definition.js +1 -1
- package/number-field/definition.cjs +1 -1
- package/number-field/definition.js +1 -1
- package/optgroup/definition.cjs +2 -1
- package/optgroup/definition.js +2 -1
- package/option/definition.cjs +2 -1
- package/option/definition.js +2 -1
- package/package.json +8 -7
- package/pagination/definition.cjs +1 -1
- package/pagination/definition.js +1 -1
- package/platform-switch/definition.cjs +1 -1
- package/platform-switch/definition.js +1 -1
- package/popover/definition.cjs +1 -1
- package/popover/definition.js +1 -1
- package/popover/index.cjs +5 -5
- package/popover/index.js +4 -3
- package/progress/definition.cjs +1 -1
- package/progress/definition.js +1 -1
- package/radio/definition.cjs +1 -1
- package/radio/definition.js +1 -1
- package/radio-group/definition.cjs +1 -1
- package/radio-group/definition.js +1 -1
- package/range-slider/definition.cjs +1 -1
- package/range-slider/definition.js +1 -1
- package/rich-text-editor/definition.cjs +1 -1
- package/rich-text-editor/definition.js +1 -1
- package/rich-text-editor/index.cjs +13 -13
- package/rich-text-editor/index.js +22 -19
- package/rich-text-view/definition.cjs +1 -1
- package/rich-text-view/definition.js +1 -1
- package/searchable-select/definition.cjs +1 -1
- package/searchable-select/definition.js +1 -1
- package/searchable-select/index.cjs +23 -23
- package/searchable-select/index.js +10 -7
- package/select/definition.cjs +1 -1
- package/select/definition.js +1 -1
- package/selectable-box/definition.cjs +1 -1
- package/selectable-box/definition.js +1 -1
- package/shared/listbox/commands.d.ts +17 -0
- package/shared/listbox/move.d.ts +6 -0
- package/shared/listbox/options.d.ts +12 -0
- package/shared/listbox/selection.d.ts +28 -0
- package/shared/listbox/state.d.ts +26 -0
- package/shared/listbox/typeahead.d.ts +8 -0
- package/shared/listbox/with-options-filter.d.ts +440 -0
- package/shared/listbox/with-options.d.ts +862 -0
- package/side-drawer/definition.cjs +1 -1
- package/side-drawer/definition.js +1 -1
- package/simple-color-picker/definition.cjs +1 -1
- package/simple-color-picker/definition.js +1 -1
- package/simple-color-picker/index.cjs +6 -6
- package/simple-color-picker/index.js +4 -3
- package/split-button/definition.cjs +1 -1
- package/split-button/definition.js +1 -1
- package/status/definition.cjs +1 -1
- package/status/definition.js +1 -1
- package/switch/definition.cjs +1 -1
- package/switch/definition.js +1 -1
- package/tab/definition.cjs +1 -1
- package/tab/definition.js +1 -1
- package/tab-panel/definition.cjs +1 -1
- package/tab-panel/definition.js +1 -1
- package/table/definition.cjs +1 -1
- package/table/definition.js +1 -1
- package/table/index.cjs +13 -13
- package/table/index.js +4 -3
- package/tabs/definition.cjs +1 -1
- package/tabs/definition.js +1 -1
- package/tag/definition.cjs +1 -1
- package/tag/definition.js +1 -1
- package/tag/index.cjs +11 -11
- package/tag/index.js +4 -3
- package/tag-group/definition.cjs +1 -1
- package/tag-group/definition.js +1 -1
- package/text-area/definition.cjs +1 -1
- package/text-area/definition.js +1 -1
- package/time-picker/definition.cjs +1 -1
- package/time-picker/definition.js +1 -1
- package/tree-item/definition.cjs +1 -1
- package/tree-item/definition.js +1 -1
- package/tree-view/definition.cjs +1 -1
- package/tree-view/definition.js +1 -1
- package/unbundled/affix.cjs +2 -2
- package/unbundled/affix.js +1 -1
- package/unbundled/base-progress.cjs +1 -1
- package/unbundled/base-progress.js +1 -1
- package/unbundled/button.cjs +2 -2
- package/unbundled/button.js +2 -2
- package/unbundled/definition.cjs +2 -65
- package/unbundled/definition.js +4 -61
- package/unbundled/definition11.cjs +4 -3
- package/unbundled/definition11.js +3 -2
- package/unbundled/definition12.cjs +3 -2
- package/unbundled/definition12.js +3 -2
- package/unbundled/definition14.cjs +2 -1
- package/unbundled/definition14.js +2 -1
- package/unbundled/definition17.cjs +9 -4
- package/unbundled/definition17.js +9 -4
- package/unbundled/definition2.cjs +7 -2
- package/unbundled/definition2.js +8 -3
- package/unbundled/definition21.cjs +2 -1
- package/unbundled/definition21.js +2 -1
- package/unbundled/definition23.cjs +2 -1
- package/unbundled/definition23.js +2 -1
- package/unbundled/definition24.cjs +6 -4
- package/unbundled/definition24.js +6 -4
- package/unbundled/definition25.cjs +2 -1
- package/unbundled/definition25.js +2 -1
- package/unbundled/definition26.cjs +7 -4
- package/unbundled/definition26.js +7 -4
- package/unbundled/definition27.cjs +39 -5
- package/unbundled/definition27.js +40 -6
- package/unbundled/definition28.cjs +4 -3
- package/unbundled/definition28.js +4 -3
- package/unbundled/definition29.cjs +5 -168
- package/unbundled/definition29.js +11 -162
- package/unbundled/definition30.cjs +2 -63
- package/unbundled/definition30.js +5 -54
- package/unbundled/definition31.cjs +5 -3
- package/unbundled/definition31.js +5 -3
- package/unbundled/definition32.cjs +2 -1
- package/unbundled/definition32.js +2 -1
- package/unbundled/definition35.cjs +2 -1
- package/unbundled/definition35.js +2 -1
- package/unbundled/definition37.cjs +1 -1
- package/unbundled/definition37.js +1 -1
- package/unbundled/definition39.cjs +1 -1
- package/unbundled/definition39.js +1 -1
- package/unbundled/definition40.cjs +4 -2
- package/unbundled/definition40.js +4 -2
- package/unbundled/definition41.cjs +11 -6
- package/unbundled/definition41.js +11 -6
- package/unbundled/definition42.cjs +5 -4
- package/unbundled/definition42.js +5 -4
- package/unbundled/definition44.cjs +3 -2
- package/unbundled/definition44.js +3 -2
- package/unbundled/definition45.cjs +2 -2
- package/unbundled/definition45.js +2 -2
- package/unbundled/definition49.cjs +583 -79
- package/unbundled/definition49.js +579 -76
- package/unbundled/definition50.cjs +71 -33
- package/unbundled/definition50.js +67 -29
- package/unbundled/definition51.cjs +54 -23
- package/unbundled/definition51.js +52 -18
- package/unbundled/definition52.cjs +23 -39
- package/unbundled/definition52.js +17 -36
- package/unbundled/definition53.cjs +29 -314
- package/unbundled/definition53.js +27 -312
- package/unbundled/definition54.cjs +302 -195
- package/unbundled/definition54.js +298 -191
- package/unbundled/definition55.cjs +210 -40
- package/unbundled/definition55.js +206 -36
- package/unbundled/definition56.cjs +42 -266
- package/unbundled/definition56.js +38 -262
- package/unbundled/definition57.cjs +270 -50
- package/unbundled/definition57.js +267 -46
- package/unbundled/definition58.cjs +48 -146
- package/unbundled/definition58.js +47 -143
- package/unbundled/definition59.cjs +127 -225
- package/unbundled/definition59.js +122 -223
- package/unbundled/definition6.cjs +2 -1
- package/unbundled/definition6.js +2 -1
- package/unbundled/definition60.cjs +199 -418
- package/unbundled/definition60.js +196 -415
- package/unbundled/definition61.cjs +442 -3738
- package/unbundled/definition61.js +432 -3565
- package/unbundled/definition62.cjs +3717 -730
- package/unbundled/definition62.js +3544 -720
- package/unbundled/definition63.cjs +770 -97
- package/unbundled/definition63.js +767 -94
- package/unbundled/definition64.cjs +100 -999
- package/unbundled/definition64.js +98 -994
- package/unbundled/definition65.cjs +991 -93
- package/unbundled/definition65.js +985 -90
- package/unbundled/definition66.cjs +109 -73
- package/unbundled/definition66.js +105 -63
- package/unbundled/definition67.cjs +69 -155
- package/unbundled/definition67.js +60 -152
- package/unbundled/definition68.cjs +155 -119
- package/unbundled/definition68.js +151 -115
- package/unbundled/definition69.cjs +124 -49
- package/unbundled/definition69.js +120 -45
- package/unbundled/definition70.cjs +51 -85
- package/unbundled/definition70.js +50 -81
- package/unbundled/definition71.cjs +91 -19
- package/unbundled/definition71.js +86 -14
- package/unbundled/definition72.cjs +20 -87
- package/unbundled/definition72.js +14 -84
- package/unbundled/definition73.cjs +77 -294
- package/unbundled/definition73.js +72 -217
- package/unbundled/definition74.cjs +289 -311
- package/unbundled/definition74.js +219 -306
- package/unbundled/definition75.cjs +326 -26
- package/unbundled/definition75.js +317 -23
- package/unbundled/definition76.cjs +27 -122
- package/unbundled/definition76.js +22 -118
- package/unbundled/definition77.cjs +105 -232
- package/unbundled/definition77.js +101 -228
- package/unbundled/definition78.cjs +259 -26
- package/unbundled/definition78.js +249 -23
- package/unbundled/definition79.cjs +29 -148
- package/unbundled/definition79.js +27 -133
- package/unbundled/definition80.cjs +118 -173
- package/unbundled/definition80.js +109 -169
- package/unbundled/definition81.cjs +181 -477
- package/unbundled/definition81.js +176 -471
- package/unbundled/definition82.cjs +517 -0
- package/unbundled/definition82.js +497 -0
- package/unbundled/extractOptions.cjs +5 -5
- package/unbundled/extractOptions.js +2 -2
- package/unbundled/icon.cjs +67 -0
- package/unbundled/icon.js +61 -0
- package/unbundled/linkable.cjs +1 -1
- package/unbundled/linkable.js +1 -1
- package/unbundled/listbox.cjs +8 -3
- package/unbundled/listbox.js +7 -2
- package/unbundled/mixins.cjs +2 -1
- package/unbundled/mixins.js +2 -1
- package/unbundled/optgroup.cjs +66 -0
- package/unbundled/optgroup.js +54 -0
- package/unbundled/option.cjs +176 -0
- package/unbundled/option.js +164 -0
- package/unbundled/time-selection-picker.template.cjs +1 -1
- package/unbundled/time-selection-picker.template.js +1 -1
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.cjs +1 -1
- package/video-player/definition.js +1 -1
- package/vivid.api.json +336 -193
|
@@ -2,6 +2,7 @@ require("./chunk.cjs");
|
|
|
2
2
|
const require_vivid_element = require("./vivid-element.cjs");
|
|
3
3
|
const require_definition = require("./definition.cjs");
|
|
4
4
|
const require_decorate = require("./decorate.cjs");
|
|
5
|
+
const require_icon = require("./icon.cjs");
|
|
5
6
|
const require_definition$1 = require("./definition24.cjs");
|
|
6
7
|
let _microsoft_fast_element = require("@microsoft/fast-element");
|
|
7
8
|
let _microsoft_fast_web_utilities = require("@microsoft/fast-web-utilities");
|
|
@@ -24,7 +25,7 @@ require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "fromView
|
|
|
24
25
|
var getClasses = (_) => (0, _microsoft_fast_web_utilities.classNames)("control");
|
|
25
26
|
var ContextualHelpTemplate = (context) => {
|
|
26
27
|
const toggletipTag = context.tagFor(require_definition$1.Toggletip);
|
|
27
|
-
const iconTag = context.tagFor(
|
|
28
|
+
const iconTag = context.tagFor(require_icon.Icon);
|
|
28
29
|
return _microsoft_fast_element.html`
|
|
29
30
|
<${toggletipTag} class="base" exportparts="vvd-theme-alternate">
|
|
30
31
|
<button class="${getClasses}" slot="anchor">
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { d as createRegisterFunction, t as VividElement, u as defineVividComponent } from "./vivid-element.js";
|
|
2
|
-
import {
|
|
2
|
+
import { t as iconDefinition } from "./definition.js";
|
|
3
3
|
import { t as __decorate } from "./decorate.js";
|
|
4
|
+
import { t as Icon } from "./icon.js";
|
|
4
5
|
import { n as toggletipDefinition, r as Toggletip } from "./definition24.js";
|
|
5
6
|
import { attr, html } from "@microsoft/fast-element";
|
|
6
7
|
import { classNames } from "@microsoft/fast-web-utilities";
|
|
@@ -24,6 +24,8 @@ var TextFieldType = {
|
|
|
24
24
|
email: "email",
|
|
25
25
|
/** A password TextField */
|
|
26
26
|
password: "password",
|
|
27
|
+
/** A search TextField */
|
|
28
|
+
search: "search",
|
|
27
29
|
/** A telephone TextField */
|
|
28
30
|
tel: "tel",
|
|
29
31
|
/** A text TextField */
|
|
@@ -46,9 +48,9 @@ var installSafariWorkaroundStyleIfNeeded = (forElement) => {
|
|
|
46
48
|
*
|
|
47
49
|
* @public
|
|
48
50
|
* @component text-field
|
|
49
|
-
* @slot leading-action-items - Used to add action items to the start of the
|
|
50
|
-
* @slot action-items - Used to add action items to the end of the
|
|
51
|
-
* @slot helper-text - Describes how to use the
|
|
51
|
+
* @slot leading-action-items - Used to add action items to the start of the Text Field.
|
|
52
|
+
* @slot action-items - Used to add action items to the end of the Text Field.
|
|
53
|
+
* @slot helper-text - Describes how to use the Text Field. Alternative to the `helper-text` attribute.
|
|
52
54
|
* @event {CustomEvent<undefined>} input - Fires a custom 'input' event when the value has changed
|
|
53
55
|
* @event {CustomEvent<undefined>} change - Fires a custom 'change' event when the value has changed
|
|
54
56
|
* @vueModel modelValue value input,@lazy:change `event.currentTarget.value`
|
|
@@ -175,7 +177,7 @@ var TextField = class extends require_with_contextual_help.WithContextualHelp(re
|
|
|
175
177
|
handleChange() {
|
|
176
178
|
this.$emit("change");
|
|
177
179
|
}
|
|
178
|
-
/**
|
|
180
|
+
/** Validates the Text Field against its constraints (e.g. `pattern`, `required`) and updates its validity state. */
|
|
179
181
|
validate() {
|
|
180
182
|
super.validate(this.control);
|
|
181
183
|
}
|
|
@@ -190,6 +192,7 @@ var TextField = class extends require_with_contextual_help.WithContextualHelp(re
|
|
|
190
192
|
installSafariWorkaroundStyleIfNeeded(this);
|
|
191
193
|
this._renderCharCountRemaining();
|
|
192
194
|
}
|
|
195
|
+
/** Moves focus to the Text Field's input element. */
|
|
193
196
|
focus() {
|
|
194
197
|
this.control?.focus();
|
|
195
198
|
}
|
|
@@ -23,6 +23,8 @@ var TextFieldType = {
|
|
|
23
23
|
email: "email",
|
|
24
24
|
/** A password TextField */
|
|
25
25
|
password: "password",
|
|
26
|
+
/** A search TextField */
|
|
27
|
+
search: "search",
|
|
26
28
|
/** A telephone TextField */
|
|
27
29
|
tel: "tel",
|
|
28
30
|
/** A text TextField */
|
|
@@ -45,9 +47,9 @@ var installSafariWorkaroundStyleIfNeeded = (forElement) => {
|
|
|
45
47
|
*
|
|
46
48
|
* @public
|
|
47
49
|
* @component text-field
|
|
48
|
-
* @slot leading-action-items - Used to add action items to the start of the
|
|
49
|
-
* @slot action-items - Used to add action items to the end of the
|
|
50
|
-
* @slot helper-text - Describes how to use the
|
|
50
|
+
* @slot leading-action-items - Used to add action items to the start of the Text Field.
|
|
51
|
+
* @slot action-items - Used to add action items to the end of the Text Field.
|
|
52
|
+
* @slot helper-text - Describes how to use the Text Field. Alternative to the `helper-text` attribute.
|
|
51
53
|
* @event {CustomEvent<undefined>} input - Fires a custom 'input' event when the value has changed
|
|
52
54
|
* @event {CustomEvent<undefined>} change - Fires a custom 'change' event when the value has changed
|
|
53
55
|
* @vueModel modelValue value input,@lazy:change `event.currentTarget.value`
|
|
@@ -174,7 +176,7 @@ var TextField = class extends WithContextualHelp(WithLightDOMFeedback(WithCharCo
|
|
|
174
176
|
handleChange() {
|
|
175
177
|
this.$emit("change");
|
|
176
178
|
}
|
|
177
|
-
/**
|
|
179
|
+
/** Validates the Text Field against its constraints (e.g. `pattern`, `required`) and updates its validity state. */
|
|
178
180
|
validate() {
|
|
179
181
|
super.validate(this.control);
|
|
180
182
|
}
|
|
@@ -189,6 +191,7 @@ var TextField = class extends WithContextualHelp(WithLightDOMFeedback(WithCharCo
|
|
|
189
191
|
installSafariWorkaroundStyleIfNeeded(this);
|
|
190
192
|
this._renderCharCountRemaining();
|
|
191
193
|
}
|
|
194
|
+
/** Moves focus to the Text Field's input element. */
|
|
192
195
|
focus() {
|
|
193
196
|
this.control?.focus();
|
|
194
197
|
}
|
|
@@ -9,12 +9,13 @@ const require_randomId = require("./randomId.cjs");
|
|
|
9
9
|
let _microsoft_fast_element = require("@microsoft/fast-element");
|
|
10
10
|
let _microsoft_fast_web_utilities = require("@microsoft/fast-web-utilities");
|
|
11
11
|
//#region src/lib/tooltip/tooltip.scss?inline
|
|
12
|
-
var tooltip_default = ":host :host{display:var(--_popup-display,inline)}:host :host([slotted-anchor]){--_popup-display:contents}.control{pointer-events:none}.tooltip{width:var(--tooltip-inline-size,auto);box-sizing:border-box;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);max-inline-size:var(--tooltip-max-inline-size,30ch);flex-direction:column;align-items:flex-start;gap:4px;padding:8px 12px;display:flex}";
|
|
12
|
+
var tooltip_default = ":host :host{display:var(--_popup-display,inline)}:host :host([slotted-anchor]){--_popup-display:contents}.control{pointer-events:none}.tooltip{width:var(--tooltip-inline-size,auto);box-sizing:border-box;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);max-inline-size:var(--tooltip-max-inline-size,30ch);flex-direction:column;align-items:flex-start;gap:4px;padding:8px 12px;display:flex}.text-secondary{color:var(--vvd-color-neutral-600);font:var(--vvd-typography-base)}";
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/lib/tooltip/tooltip.ts
|
|
15
15
|
/**
|
|
16
16
|
* @public
|
|
17
17
|
* @component tooltip
|
|
18
|
+
* @slot - Content for the Tooltip. An alternative to the `text` attribute for cases that require custom, non-interactive markup.
|
|
18
19
|
* @slot anchor - Used to set the anchor element for the tooltip.
|
|
19
20
|
* @testSelector byText byText
|
|
20
21
|
* @testQuery open open true
|
|
@@ -25,6 +26,8 @@ var Tooltip = class extends require_kbd_shortcut.WithKbdShortcut(require_anchore
|
|
|
25
26
|
super(..._args);
|
|
26
27
|
this.open = false;
|
|
27
28
|
this._descriptionId = `vwc-tooltip-desc-${require_randomId.generateRandomId()}`;
|
|
29
|
+
this._descriptionSecondaryId = `vwc-tooltip-desc-secondary-${require_randomId.generateRandomId()}`;
|
|
30
|
+
this._defaultSlotContent = [];
|
|
28
31
|
this.#show = () => {
|
|
29
32
|
this.open = true;
|
|
30
33
|
};
|
|
@@ -37,6 +40,11 @@ var Tooltip = class extends require_kbd_shortcut.WithKbdShortcut(require_anchore
|
|
|
37
40
|
};
|
|
38
41
|
}
|
|
39
42
|
/** @internal */
|
|
43
|
+
_defaultSlotContentChanged() {
|
|
44
|
+
for (const el of this._defaultSlotContent) if (!el.id) el.id = `vwc-tooltip-content-${require_randomId.generateRandomId()}`;
|
|
45
|
+
if (this._anchorEl) this.#syncDescribedBy(this._anchorEl);
|
|
46
|
+
}
|
|
47
|
+
/** @internal */
|
|
40
48
|
_kbdAriaShortcutsValueChanged() {
|
|
41
49
|
if (!this._anchorEl) return;
|
|
42
50
|
_microsoft_fast_element.DOM.setAttribute(this._anchorEl, "aria-keyshortcuts", this._kbdAriaShortcutsValue);
|
|
@@ -54,13 +62,26 @@ var Tooltip = class extends require_kbd_shortcut.WithKbdShortcut(require_anchore
|
|
|
54
62
|
if (oldValue) this.#cleanupAnchor(oldValue);
|
|
55
63
|
if (newValue) this.#setupAnchor(newValue);
|
|
56
64
|
}
|
|
65
|
+
/** @internal */
|
|
66
|
+
#descriptionIds() {
|
|
67
|
+
return [
|
|
68
|
+
this._descriptionId,
|
|
69
|
+
this._descriptionSecondaryId,
|
|
70
|
+
...this._defaultSlotContent.map((el) => el.id).filter(Boolean)
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
#syncDescribedBy(a) {
|
|
74
|
+
const existing = a.getAttribute("aria-describedby") ?? a.ariaDescribedBy ?? "";
|
|
75
|
+
const ownedIds = new Set(this.#descriptionIds());
|
|
76
|
+
const otherTokens = existing.split(" ").filter((t) => t && !ownedIds.has(t));
|
|
77
|
+
a.setAttribute("aria-describedby", [...otherTokens, ...this.#descriptionIds()].join(" "));
|
|
78
|
+
}
|
|
57
79
|
#setupAnchor(a) {
|
|
58
80
|
a.addEventListener("mouseover", this.#show);
|
|
59
81
|
a.addEventListener("mouseout", this.#hide);
|
|
60
82
|
a.addEventListener("focusin", this.#show);
|
|
61
83
|
a.addEventListener("focusout", this.#hide);
|
|
62
|
-
|
|
63
|
-
a.setAttribute("aria-describedby", existing ? `${existing} ${this._descriptionId}` : this._descriptionId);
|
|
84
|
+
this.#syncDescribedBy(a);
|
|
64
85
|
_microsoft_fast_element.DOM.setAttribute(a, "aria-keyshortcuts", this._kbdAriaShortcutsValue);
|
|
65
86
|
}
|
|
66
87
|
#cleanupAnchor(a) {
|
|
@@ -68,7 +89,9 @@ var Tooltip = class extends require_kbd_shortcut.WithKbdShortcut(require_anchore
|
|
|
68
89
|
a.removeEventListener("mouseout", this.#hide);
|
|
69
90
|
a.removeEventListener("focusin", this.#show);
|
|
70
91
|
a.removeEventListener("focusout", this.#hide);
|
|
71
|
-
const
|
|
92
|
+
const describedBy = a.getAttribute("aria-describedby") ?? a.ariaDescribedBy ?? "";
|
|
93
|
+
const ownedIds = new Set(this.#descriptionIds());
|
|
94
|
+
const tokens = describedBy.split(" ").filter((t) => t && !ownedIds.has(t));
|
|
72
95
|
const newDescribedBy = tokens.length ? tokens.join(" ") : null;
|
|
73
96
|
if (a.hasAttribute("aria-describedby")) _microsoft_fast_element.DOM.setAttribute(a, "aria-describedby", newDescribedBy);
|
|
74
97
|
else a.ariaDescribedBy = newDescribedBy;
|
|
@@ -88,15 +111,17 @@ var Tooltip = class extends require_kbd_shortcut.WithKbdShortcut(require_anchore
|
|
|
88
111
|
}
|
|
89
112
|
};
|
|
90
113
|
require_decorate.__decorate([_microsoft_fast_element.attr], Tooltip.prototype, "text", void 0);
|
|
114
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "text-secondary" })], Tooltip.prototype, "textSecondary", void 0);
|
|
91
115
|
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "fromView" })], Tooltip.prototype, "placement", void 0);
|
|
92
116
|
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], Tooltip.prototype, "open", void 0);
|
|
117
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Tooltip.prototype, "_defaultSlotContent", void 0);
|
|
93
118
|
//#endregion
|
|
94
119
|
//#region src/lib/tooltip/tooltip.template.ts
|
|
95
120
|
var TooltipTemplate = (context) => {
|
|
96
121
|
const popupTag = context.tagFor(require_definition.Popup);
|
|
97
122
|
return _microsoft_fast_element.html`
|
|
98
123
|
${require_anchored.anchorSlotTemplateFactory()}
|
|
99
|
-
${require_randomId.renderInLightDOM(_microsoft_fast_element.html`<span slot="_description" id="${(x) => x._descriptionId}">${(x) => x.text}</span>`)}
|
|
124
|
+
${require_randomId.renderInLightDOM(_microsoft_fast_element.html`<span slot="_description" id="${(x) => x._descriptionId}">${(x) => x.text}</span><span slot="_description-secondary" id="${(x) => x._descriptionSecondaryId}">${(x) => x.textSecondary}</span>`)}
|
|
100
125
|
<${popupTag} class="${(x) => (0, _microsoft_fast_web_utilities.classNames)("control", ["open", x.open])}" arrow alternate
|
|
101
126
|
:placement=${(x) => x.placement}
|
|
102
127
|
:anchor="${(x) => x._anchorEl}"
|
|
@@ -107,6 +132,15 @@ ${require_randomId.renderInLightDOM(_microsoft_fast_element.html`<span slot="_de
|
|
|
107
132
|
exportparts="vvd-theme-alternate">
|
|
108
133
|
<div part="vvd-theme-alternate" class="tooltip" role="tooltip">
|
|
109
134
|
<span class="text"><slot name="_description"></slot></span>
|
|
135
|
+
${(0, _microsoft_fast_element.when)((x) => x.textSecondary, _microsoft_fast_element.html`<span class="text-secondary"
|
|
136
|
+
><slot name="_description-secondary"></slot
|
|
137
|
+
></span>`)}
|
|
138
|
+
<slot
|
|
139
|
+
${(0, _microsoft_fast_element.slotted)({
|
|
140
|
+
property: "_defaultSlotContent",
|
|
141
|
+
filter: (0, _microsoft_fast_element.elements)()
|
|
142
|
+
})}
|
|
143
|
+
></slot>
|
|
110
144
|
<slot name="kbd-shortcut"
|
|
111
145
|
${(0, _microsoft_fast_element.slotted)({
|
|
112
146
|
property: "_kbdShortcutSlotted",
|
|
@@ -5,15 +5,16 @@ import { i as Popup, t as popupDefinition } from "./definition9.js";
|
|
|
5
5
|
import { t as WithKbdShortcut } from "./kbd-shortcut.js";
|
|
6
6
|
import { n as anchorSlotTemplateFactory, t as Anchored } from "./anchored.js";
|
|
7
7
|
import { n as renderInLightDOM, t as generateRandomId } from "./randomId.js";
|
|
8
|
-
import { DOM, attr, elements, html, slotted } from "@microsoft/fast-element";
|
|
8
|
+
import { DOM, attr, elements, html, observable, slotted, when } from "@microsoft/fast-element";
|
|
9
9
|
import { classNames } from "@microsoft/fast-web-utilities";
|
|
10
10
|
//#region src/lib/tooltip/tooltip.scss?inline
|
|
11
|
-
var tooltip_default = ":host :host{display:var(--_popup-display,inline)}:host :host([slotted-anchor]){--_popup-display:contents}.control{pointer-events:none}.tooltip{width:var(--tooltip-inline-size,auto);box-sizing:border-box;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);max-inline-size:var(--tooltip-max-inline-size,30ch);flex-direction:column;align-items:flex-start;gap:4px;padding:8px 12px;display:flex}";
|
|
11
|
+
var tooltip_default = ":host :host{display:var(--_popup-display,inline)}:host :host([slotted-anchor]){--_popup-display:contents}.control{pointer-events:none}.tooltip{width:var(--tooltip-inline-size,auto);box-sizing:border-box;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);max-inline-size:var(--tooltip-max-inline-size,30ch);flex-direction:column;align-items:flex-start;gap:4px;padding:8px 12px;display:flex}.text-secondary{color:var(--vvd-color-neutral-600);font:var(--vvd-typography-base)}";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/lib/tooltip/tooltip.ts
|
|
14
14
|
/**
|
|
15
15
|
* @public
|
|
16
16
|
* @component tooltip
|
|
17
|
+
* @slot - Content for the Tooltip. An alternative to the `text` attribute for cases that require custom, non-interactive markup.
|
|
17
18
|
* @slot anchor - Used to set the anchor element for the tooltip.
|
|
18
19
|
* @testSelector byText byText
|
|
19
20
|
* @testQuery open open true
|
|
@@ -24,6 +25,8 @@ var Tooltip = class extends WithKbdShortcut(Anchored(VividElement)) {
|
|
|
24
25
|
super(..._args);
|
|
25
26
|
this.open = false;
|
|
26
27
|
this._descriptionId = `vwc-tooltip-desc-${generateRandomId()}`;
|
|
28
|
+
this._descriptionSecondaryId = `vwc-tooltip-desc-secondary-${generateRandomId()}`;
|
|
29
|
+
this._defaultSlotContent = [];
|
|
27
30
|
this.#show = () => {
|
|
28
31
|
this.open = true;
|
|
29
32
|
};
|
|
@@ -36,6 +39,11 @@ var Tooltip = class extends WithKbdShortcut(Anchored(VividElement)) {
|
|
|
36
39
|
};
|
|
37
40
|
}
|
|
38
41
|
/** @internal */
|
|
42
|
+
_defaultSlotContentChanged() {
|
|
43
|
+
for (const el of this._defaultSlotContent) if (!el.id) el.id = `vwc-tooltip-content-${generateRandomId()}`;
|
|
44
|
+
if (this._anchorEl) this.#syncDescribedBy(this._anchorEl);
|
|
45
|
+
}
|
|
46
|
+
/** @internal */
|
|
39
47
|
_kbdAriaShortcutsValueChanged() {
|
|
40
48
|
if (!this._anchorEl) return;
|
|
41
49
|
DOM.setAttribute(this._anchorEl, "aria-keyshortcuts", this._kbdAriaShortcutsValue);
|
|
@@ -53,13 +61,26 @@ var Tooltip = class extends WithKbdShortcut(Anchored(VividElement)) {
|
|
|
53
61
|
if (oldValue) this.#cleanupAnchor(oldValue);
|
|
54
62
|
if (newValue) this.#setupAnchor(newValue);
|
|
55
63
|
}
|
|
64
|
+
/** @internal */
|
|
65
|
+
#descriptionIds() {
|
|
66
|
+
return [
|
|
67
|
+
this._descriptionId,
|
|
68
|
+
this._descriptionSecondaryId,
|
|
69
|
+
...this._defaultSlotContent.map((el) => el.id).filter(Boolean)
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
#syncDescribedBy(a) {
|
|
73
|
+
const existing = a.getAttribute("aria-describedby") ?? a.ariaDescribedBy ?? "";
|
|
74
|
+
const ownedIds = new Set(this.#descriptionIds());
|
|
75
|
+
const otherTokens = existing.split(" ").filter((t) => t && !ownedIds.has(t));
|
|
76
|
+
a.setAttribute("aria-describedby", [...otherTokens, ...this.#descriptionIds()].join(" "));
|
|
77
|
+
}
|
|
56
78
|
#setupAnchor(a) {
|
|
57
79
|
a.addEventListener("mouseover", this.#show);
|
|
58
80
|
a.addEventListener("mouseout", this.#hide);
|
|
59
81
|
a.addEventListener("focusin", this.#show);
|
|
60
82
|
a.addEventListener("focusout", this.#hide);
|
|
61
|
-
|
|
62
|
-
a.setAttribute("aria-describedby", existing ? `${existing} ${this._descriptionId}` : this._descriptionId);
|
|
83
|
+
this.#syncDescribedBy(a);
|
|
63
84
|
DOM.setAttribute(a, "aria-keyshortcuts", this._kbdAriaShortcutsValue);
|
|
64
85
|
}
|
|
65
86
|
#cleanupAnchor(a) {
|
|
@@ -67,7 +88,9 @@ var Tooltip = class extends WithKbdShortcut(Anchored(VividElement)) {
|
|
|
67
88
|
a.removeEventListener("mouseout", this.#hide);
|
|
68
89
|
a.removeEventListener("focusin", this.#show);
|
|
69
90
|
a.removeEventListener("focusout", this.#hide);
|
|
70
|
-
const
|
|
91
|
+
const describedBy = a.getAttribute("aria-describedby") ?? a.ariaDescribedBy ?? "";
|
|
92
|
+
const ownedIds = new Set(this.#descriptionIds());
|
|
93
|
+
const tokens = describedBy.split(" ").filter((t) => t && !ownedIds.has(t));
|
|
71
94
|
const newDescribedBy = tokens.length ? tokens.join(" ") : null;
|
|
72
95
|
if (a.hasAttribute("aria-describedby")) DOM.setAttribute(a, "aria-describedby", newDescribedBy);
|
|
73
96
|
else a.ariaDescribedBy = newDescribedBy;
|
|
@@ -87,15 +110,17 @@ var Tooltip = class extends WithKbdShortcut(Anchored(VividElement)) {
|
|
|
87
110
|
}
|
|
88
111
|
};
|
|
89
112
|
__decorate([attr], Tooltip.prototype, "text", void 0);
|
|
113
|
+
__decorate([attr({ attribute: "text-secondary" })], Tooltip.prototype, "textSecondary", void 0);
|
|
90
114
|
__decorate([attr({ mode: "fromView" })], Tooltip.prototype, "placement", void 0);
|
|
91
115
|
__decorate([attr({ mode: "boolean" })], Tooltip.prototype, "open", void 0);
|
|
116
|
+
__decorate([observable], Tooltip.prototype, "_defaultSlotContent", void 0);
|
|
92
117
|
//#endregion
|
|
93
118
|
//#region src/lib/tooltip/tooltip.template.ts
|
|
94
119
|
var TooltipTemplate = (context) => {
|
|
95
120
|
const popupTag = context.tagFor(Popup);
|
|
96
121
|
return html`
|
|
97
122
|
${anchorSlotTemplateFactory()}
|
|
98
|
-
${renderInLightDOM(html`<span slot="_description" id="${(x) => x._descriptionId}">${(x) => x.text}</span>`)}
|
|
123
|
+
${renderInLightDOM(html`<span slot="_description" id="${(x) => x._descriptionId}">${(x) => x.text}</span><span slot="_description-secondary" id="${(x) => x._descriptionSecondaryId}">${(x) => x.textSecondary}</span>`)}
|
|
99
124
|
<${popupTag} class="${(x) => classNames("control", ["open", x.open])}" arrow alternate
|
|
100
125
|
:placement=${(x) => x.placement}
|
|
101
126
|
:anchor="${(x) => x._anchorEl}"
|
|
@@ -106,6 +131,15 @@ ${renderInLightDOM(html`<span slot="_description" id="${(x) => x._descriptionId}
|
|
|
106
131
|
exportparts="vvd-theme-alternate">
|
|
107
132
|
<div part="vvd-theme-alternate" class="tooltip" role="tooltip">
|
|
108
133
|
<span class="text"><slot name="_description"></slot></span>
|
|
134
|
+
${when((x) => x.textSecondary, html`<span class="text-secondary"
|
|
135
|
+
><slot name="_description-secondary"></slot
|
|
136
|
+
></span>`)}
|
|
137
|
+
<slot
|
|
138
|
+
${slotted({
|
|
139
|
+
property: "_defaultSlotContent",
|
|
140
|
+
filter: elements()
|
|
141
|
+
})}
|
|
142
|
+
></slot>
|
|
109
143
|
<slot name="kbd-shortcut"
|
|
110
144
|
${slotted({
|
|
111
145
|
property: "_kbdShortcutSlotted",
|
|
@@ -2,6 +2,7 @@ require("./chunk.cjs");
|
|
|
2
2
|
const require_vivid_element = require("./vivid-element.cjs");
|
|
3
3
|
const require_definition = require("./definition.cjs");
|
|
4
4
|
const require_decorate = require("./decorate.cjs");
|
|
5
|
+
const require_icon = require("./icon.cjs");
|
|
5
6
|
const require_delegates_aria = require("./delegates-aria.cjs");
|
|
6
7
|
const require_definition$1 = require("./definition6.cjs");
|
|
7
8
|
const require_dialog = require("./dialog.cjs");
|
|
@@ -43,9 +44,9 @@ var vcInputTag = VC_HEX_INPUT_TAG;
|
|
|
43
44
|
/**
|
|
44
45
|
* @public
|
|
45
46
|
* @component color-picker
|
|
46
|
-
* @slot helper-text - Describes how to use the
|
|
47
|
+
* @slot helper-text - Describes how to use the Color Picker. Alternative to the `helper-text` attribute.
|
|
47
48
|
* @slot popup-text - Overrides the default "Color Picker" title of the Popup window.
|
|
48
|
-
* @slot swatches-text -
|
|
49
|
+
* @slot swatches-text - Overrides the default "Saved colors" text above color swatches.
|
|
49
50
|
* @event {CustomEvent<undefined>} change - Fires when the value changes
|
|
50
51
|
* @event {Event} input - Fires when the value of the element changes.
|
|
51
52
|
* @vueModel modelValue value input,@lazy:change `event.currentTarget.value`
|
|
@@ -430,7 +431,7 @@ function renderSwatchesCount() {
|
|
|
430
431
|
}
|
|
431
432
|
var ColorPickerTemplate = (context) => {
|
|
432
433
|
const textFieldTag = context.tagFor(require_definition$3.TextField);
|
|
433
|
-
const iconTag = context.tagFor(
|
|
434
|
+
const iconTag = context.tagFor(require_icon.Icon);
|
|
434
435
|
const popupTag = context.tagFor(require_definition$2.Popup);
|
|
435
436
|
const buttonTag = context.tagFor(require_definition$1.Button);
|
|
436
437
|
const tooltipTag = context.tagFor(require_definition$4.Tooltip);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { d as createRegisterFunction, t as VividElement, u as defineVividComponent } from "./vivid-element.js";
|
|
2
|
-
import {
|
|
2
|
+
import { t as iconDefinition } from "./definition.js";
|
|
3
3
|
import { t as __decorate } from "./decorate.js";
|
|
4
|
+
import { t as Icon } from "./icon.js";
|
|
4
5
|
import { n as delegateAria, t as DelegatesAria } from "./delegates-aria.js";
|
|
5
6
|
import { i as Button, t as buttonDefinition } from "./definition6.js";
|
|
6
7
|
import { t as handleEscapeKeyAndStopPropogation } from "./dialog.js";
|
|
@@ -42,9 +43,9 @@ var vcInputTag = VC_HEX_INPUT_TAG;
|
|
|
42
43
|
/**
|
|
43
44
|
* @public
|
|
44
45
|
* @component color-picker
|
|
45
|
-
* @slot helper-text - Describes how to use the
|
|
46
|
+
* @slot helper-text - Describes how to use the Color Picker. Alternative to the `helper-text` attribute.
|
|
46
47
|
* @slot popup-text - Overrides the default "Color Picker" title of the Popup window.
|
|
47
|
-
* @slot swatches-text -
|
|
48
|
+
* @slot swatches-text - Overrides the default "Saved colors" text above color swatches.
|
|
48
49
|
* @event {CustomEvent<undefined>} change - Fires when the value changes
|
|
49
50
|
* @event {Event} input - Fires when the value of the element changes.
|
|
50
51
|
* @vueModel modelValue value input,@lazy:change `event.currentTarget.value`
|
|
@@ -1,163 +1,12 @@
|
|
|
1
1
|
require("./chunk.cjs");
|
|
2
2
|
const require_vivid_element = require("./vivid-element.cjs");
|
|
3
3
|
const require_definition = require("./definition.cjs");
|
|
4
|
-
const
|
|
4
|
+
const require_icon = require("./icon.cjs");
|
|
5
5
|
const require_affix = require("./affix.cjs");
|
|
6
6
|
const require_host_semantics = require("./host-semantics.cjs");
|
|
7
|
+
const require_option = require("./option.cjs");
|
|
7
8
|
let _microsoft_fast_element = require("@microsoft/fast-element");
|
|
8
9
|
let _microsoft_fast_web_utilities = require("@microsoft/fast-web-utilities");
|
|
9
|
-
//#region src/lib/option/option.ts
|
|
10
|
-
/**
|
|
11
|
-
* Determines if the element is a {@link (ListboxOption:class)}
|
|
12
|
-
*
|
|
13
|
-
* @param element - the element to test.
|
|
14
|
-
*/
|
|
15
|
-
function isListboxOption(el) {
|
|
16
|
-
return (0, _microsoft_fast_web_utilities.isHTMLElement)(el) && (el.getAttribute("role") === "option" || el instanceof HTMLOptionElement || el instanceof ListboxOption);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA option }.
|
|
20
|
-
*
|
|
21
|
-
* @public
|
|
22
|
-
* @component option
|
|
23
|
-
* @slot icon - The preferred way to add an icon to the component.
|
|
24
|
-
* @slot tag-icon - Icon to be displayed in the tag when selected inside of Searchable Select.
|
|
25
|
-
* @slot trailing-meta - For additional elements at the end of the Option.
|
|
26
|
-
* @testAction click click #locator
|
|
27
|
-
*/
|
|
28
|
-
var ListboxOption = class extends require_host_semantics.HostSemantics(require_affix.AffixIconWithTrailing(require_vivid_element.VividElement)) {
|
|
29
|
-
defaultSelectedChanged() {
|
|
30
|
-
if (!this.dirtySelected) {
|
|
31
|
-
this.selected = this.defaultSelected;
|
|
32
|
-
if (this.proxy instanceof HTMLOptionElement) this.proxy.selected = this.defaultSelected;
|
|
33
|
-
}
|
|
34
|
-
if (this.proxy instanceof HTMLOptionElement) this.proxy.defaultSelected = this.defaultSelected;
|
|
35
|
-
}
|
|
36
|
-
disabledChanged() {
|
|
37
|
-
/* v8 ignore if -- @preserve */
|
|
38
|
-
if (this.proxy instanceof HTMLOptionElement) this.proxy.disabled = this.disabled;
|
|
39
|
-
}
|
|
40
|
-
/** @deprecated Use `defaultSelected` instead. */
|
|
41
|
-
get selectedAttribute() {
|
|
42
|
-
return this.defaultSelected;
|
|
43
|
-
}
|
|
44
|
-
set selectedAttribute(value) {
|
|
45
|
-
this.defaultSelected = value;
|
|
46
|
-
}
|
|
47
|
-
selectedChanged() {
|
|
48
|
-
if (!this.dirtySelected) this.dirtySelected = true;
|
|
49
|
-
if (this.proxy instanceof HTMLOptionElement) this.proxy.selected = this.selected;
|
|
50
|
-
}
|
|
51
|
-
valueChanged() {
|
|
52
|
-
if (typeof this.value !== "string") {
|
|
53
|
-
this.value = "";
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (this.proxy instanceof HTMLOptionElement) this.proxy.value = this.value;
|
|
57
|
-
}
|
|
58
|
-
get label() {
|
|
59
|
-
return this._label ?? this.text;
|
|
60
|
-
}
|
|
61
|
-
set label(value) {
|
|
62
|
-
this._label = value;
|
|
63
|
-
}
|
|
64
|
-
set text(value) {
|
|
65
|
-
this._text = value;
|
|
66
|
-
}
|
|
67
|
-
get text() {
|
|
68
|
-
return this._text ?? "";
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Provides an accessible name for use by parent components.
|
|
72
|
-
* Note: Does not implement full accessible name computation, e.g. slotted content is missed.
|
|
73
|
-
* @internal
|
|
74
|
-
*/
|
|
75
|
-
_getAccessibleName() {
|
|
76
|
-
return this.ariaLabel || `${this.text}${this.textSecondary ? ` ${this.textSecondary}` : ""}`;
|
|
77
|
-
}
|
|
78
|
-
get form() {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
/** @internal */
|
|
82
|
-
get _hasMatchedText() {
|
|
83
|
-
return Boolean(this.matchedText ?? this._vvdSearchText);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* From is inclusive, to is exclusive.
|
|
87
|
-
* @internal
|
|
88
|
-
*/
|
|
89
|
-
get _matchedRange() {
|
|
90
|
-
const matchedText = this.matchedText ?? this._vvdSearchText;
|
|
91
|
-
if (matchedText) {
|
|
92
|
-
const matchIndex = this.text.toLowerCase().indexOf(matchedText.toLowerCase());
|
|
93
|
-
return matchIndex === -1 ? {
|
|
94
|
-
from: 0,
|
|
95
|
-
to: 0
|
|
96
|
-
} : {
|
|
97
|
-
from: matchIndex,
|
|
98
|
-
to: matchIndex + matchedText.length
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
return {
|
|
102
|
-
from: 0,
|
|
103
|
-
to: 0
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
constructor(text, value, defaultSelected, selected) {
|
|
107
|
-
super();
|
|
108
|
-
this.defaultSelected = false;
|
|
109
|
-
this.dirtySelected = false;
|
|
110
|
-
this.value = "";
|
|
111
|
-
this._highlighted = false;
|
|
112
|
-
this._displayCheckmark = false;
|
|
113
|
-
this._vvdSearchText = "";
|
|
114
|
-
this._isNotMatching = false;
|
|
115
|
-
if (text) this.text = text;
|
|
116
|
-
if (value) this.value = value;
|
|
117
|
-
if (defaultSelected) this.defaultSelected = defaultSelected;
|
|
118
|
-
if (selected) this.selected = selected;
|
|
119
|
-
this.proxy = new Option(this.text, this.value, this.defaultSelected, this.selected);
|
|
120
|
-
this.proxy.disabled = this.disabled;
|
|
121
|
-
}
|
|
122
|
-
/** @internal */
|
|
123
|
-
connectedCallback() {
|
|
124
|
-
super.connectedCallback();
|
|
125
|
-
if (!this.dirtySelected) {
|
|
126
|
-
this.selected = this.defaultSelected;
|
|
127
|
-
this.dirtySelected = false;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ converter: {
|
|
132
|
-
fromView: (value) => {
|
|
133
|
-
if (value === true || value === "true") return true;
|
|
134
|
-
if (value === false || value === "false") return false;
|
|
135
|
-
},
|
|
136
|
-
toView: (value) => value
|
|
137
|
-
} })], ListboxOption.prototype, "checked", void 0);
|
|
138
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
139
|
-
attribute: "selected",
|
|
140
|
-
mode: "boolean"
|
|
141
|
-
})], ListboxOption.prototype, "defaultSelected", void 0);
|
|
142
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], ListboxOption.prototype, "disabled", void 0);
|
|
143
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
144
|
-
attribute: "current-selected",
|
|
145
|
-
mode: "boolean"
|
|
146
|
-
})], ListboxOption.prototype, "selected", void 0);
|
|
147
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "value" })], ListboxOption.prototype, "value", void 0);
|
|
148
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "label" })], ListboxOption.prototype, "_label", void 0);
|
|
149
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "text" })], ListboxOption.prototype, "_text", void 0);
|
|
150
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "text-secondary" })], ListboxOption.prototype, "textSecondary", void 0);
|
|
151
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], ListboxOption.prototype, "_highlighted", void 0);
|
|
152
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], ListboxOption.prototype, "_displayCheckmark", void 0);
|
|
153
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "matched-text" })], ListboxOption.prototype, "matchedText", void 0);
|
|
154
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], ListboxOption.prototype, "_vvdSearchText", void 0);
|
|
155
|
-
require_decorate.__decorate([_microsoft_fast_element.volatile], ListboxOption.prototype, "_hasMatchedText", null);
|
|
156
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], ListboxOption.prototype, "_isNotMatching", void 0);
|
|
157
|
-
require_decorate.__decorate([_microsoft_fast_element.volatile], ListboxOption.prototype, "_matchedRange", null);
|
|
158
|
-
require_decorate.__decorate([_microsoft_fast_element.attr], ListboxOption.prototype, "connotation", void 0);
|
|
159
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "tag-connotation" })], ListboxOption.prototype, "tagConnotation", void 0);
|
|
160
|
-
//#endregion
|
|
161
10
|
//#region src/lib/option/option.template.ts
|
|
162
11
|
function text() {
|
|
163
12
|
return _microsoft_fast_element.html`${(0, _microsoft_fast_element.when)((x) => x.text || x.textSecondary, _microsoft_fast_element.html`<span class="text">
|
|
@@ -171,7 +20,7 @@ function text() {
|
|
|
171
20
|
}
|
|
172
21
|
var ListboxOptionTemplate = (context) => {
|
|
173
22
|
const affixIconTemplate = require_affix.affixIconTemplateFactory(context);
|
|
174
|
-
const iconTag = context.tagFor(
|
|
23
|
+
const iconTag = context.tagFor(require_icon.Icon);
|
|
175
24
|
return _microsoft_fast_element.html`
|
|
176
25
|
<template
|
|
177
26
|
${require_host_semantics.applyHostSemantics({
|
|
@@ -183,7 +32,7 @@ var ListboxOptionTemplate = (context) => {
|
|
|
183
32
|
style="${(x) => x._isNotMatching ? "display: none" : ""}"
|
|
184
33
|
>
|
|
185
34
|
<div
|
|
186
|
-
class="${(x) => (0, _microsoft_fast_web_utilities.classNames)("base", [`connotation-${x.connotation}`, Boolean(x.connotation)], ["disabled", x.disabled], ["selected", x.selected], ["
|
|
35
|
+
class="${(x) => (0, _microsoft_fast_web_utilities.classNames)("base", [`connotation-${x.connotation}`, Boolean(x.connotation)], ["disabled", x.disabled], ["selected", x.selected], ["highlighted", x._highlighted], ["active", Boolean(x.checked)], ["icon", Boolean(x.icon)], ["two-lines", Boolean(x.text?.length) && Boolean(x.textSecondary?.length)])}"
|
|
187
36
|
>
|
|
188
37
|
${(x) => affixIconTemplate(x.icon, require_affix.IconWrapper.Slot)} ${text()}
|
|
189
38
|
<slot name="trailing-meta"></slot>
|
|
@@ -195,7 +44,7 @@ var ListboxOptionTemplate = (context) => {
|
|
|
195
44
|
//#endregion
|
|
196
45
|
//#region src/lib/option/definition.ts
|
|
197
46
|
/** @internal */
|
|
198
|
-
var listboxOptionDefinition = require_vivid_element.defineVividComponent("option", ListboxOption, ListboxOptionTemplate, [require_definition.iconDefinition], { styles: ":host([disabled]){cursor:not-allowed}.base.connotation-cta{--_connotation-color-primary:var(--vvd-option-cta-primary,var(--vvd-color-cta-500));--_connotation-color-primary-text:var(--vvd-option-cta-primary-text,var(--vvd-color-canvas));--_connotation-color-primary-increment:var(--vvd-option-cta-primary-increment,var(--vvd-color-cta-600));--_connotation-color-firm:var(--vvd-option-cta-firm,var(--vvd-color-cta-600));--_connotation-color-faint:var(--vvd-option-cta-faint,var(--vvd-color-cta-50));--_connotation-color-soft:var(--vvd-option-cta-soft,var(--vvd-color-cta-100));--_connotation-color-pale:var(--vvd-option-cta-pale,var(--vvd-color-cta-300));--_connotation-color-dim:var(--vvd-option-cta-dim,var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_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,.base.disabled{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.base:active:where(:not(.disabled,:disabled)),.base.active:where(:not(.disabled,:disabled)),.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{box-sizing:border-box;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);align-items:center;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;--_option-min-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));--_option-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_option-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);border-radius:8px;display:flex}.base:not(.two-lines){--_option-gap:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 4)) / 3);padding-block:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 4)}.base.two-lines{gap:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);padding-block:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2)}.base{user-select:none}.base:not(.disabled){cursor:pointer}.base.disabled{pointer-events:none}:host([scale=condensed]) .base{--_option-min-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));--_option-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_option-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5)}:host([scale=condensed]) .base:not(.two-lines){--_option-gap:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 5);padding-block:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 4)) / 6)}:host([scale=condensed]) .base.two-lines{gap:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 4)) / 3);padding-block:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8)) / 4)}.base.
|
|
47
|
+
var listboxOptionDefinition = require_vivid_element.defineVividComponent("option", require_option.ListboxOption, ListboxOptionTemplate, [require_definition.iconDefinition], { styles: ":host([disabled]){cursor:not-allowed}.base.connotation-cta{--_connotation-color-primary:var(--vvd-option-cta-primary,var(--vvd-color-cta-500));--_connotation-color-primary-text:var(--vvd-option-cta-primary-text,var(--vvd-color-canvas));--_connotation-color-primary-increment:var(--vvd-option-cta-primary-increment,var(--vvd-color-cta-600));--_connotation-color-firm:var(--vvd-option-cta-firm,var(--vvd-color-cta-600));--_connotation-color-faint:var(--vvd-option-cta-faint,var(--vvd-color-cta-50));--_connotation-color-soft:var(--vvd-option-cta-soft,var(--vvd-color-cta-100));--_connotation-color-pale:var(--vvd-option-cta-pale,var(--vvd-color-cta-300));--_connotation-color-dim:var(--vvd-option-cta-dim,var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_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,.base.disabled{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.base:active:where(:not(.disabled,:disabled)),.base.active:where(:not(.disabled,:disabled)),.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{box-sizing:border-box;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);align-items:center;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;--_option-min-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));--_option-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_option-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);border-radius:8px;display:flex}.base:not(.two-lines){--_option-gap:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 4)) / 3);padding-block:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 4)}.base.two-lines{gap:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);padding-block:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2)}.base{user-select:none}.base:not(.disabled){cursor:pointer}.base.disabled{pointer-events:none}:host([scale=condensed]) .base{--_option-min-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));--_option-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2);--_option-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5)}:host([scale=condensed]) .base:not(.two-lines){--_option-gap:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 5);padding-block:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 4)) / 6)}:host([scale=condensed]) .base.two-lines{gap:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 4)) / 3);padding-block:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8)) / 4)}.base.highlighted{--focus-stroke-gap-color:transparent;box-shadow:var(--_suppressable-focus-shadow,0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor));outline:var(--_suppressable-focus-outline,1px solid var(--focus-stroke-color,var(--vvd-color-cta-500)));outline-offset:var(--_suppressable-focus-outline-offset,calc(-1px - var(--focus-inset,0px)))}.base.hidden{display:none}.text{font:var(--vvd-typography-base);flex-direction:column;gap:4px;margin-inline-end:auto;display:flex}.text-primary,.text-secondary{font:var(--vvd-typography-base);display:block}.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)}" });
|
|
199
48
|
/**
|
|
200
49
|
* Registers the listbox-option elements with the design system.
|
|
201
50
|
*
|
|
@@ -203,18 +52,6 @@ var listboxOptionDefinition = require_vivid_element.defineVividComponent("option
|
|
|
203
52
|
*/
|
|
204
53
|
var registerOption = require_vivid_element.createRegisterFunction(listboxOptionDefinition);
|
|
205
54
|
//#endregion
|
|
206
|
-
Object.defineProperty(exports, "ListboxOption", {
|
|
207
|
-
enumerable: true,
|
|
208
|
-
get: function() {
|
|
209
|
-
return ListboxOption;
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
Object.defineProperty(exports, "isListboxOption", {
|
|
213
|
-
enumerable: true,
|
|
214
|
-
get: function() {
|
|
215
|
-
return isListboxOption;
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
55
|
Object.defineProperty(exports, "listboxOptionDefinition", {
|
|
219
56
|
enumerable: true,
|
|
220
57
|
get: function() {
|