@vonage/vivid 3.48.0 → 3.49.0-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.cjs +21 -0
- package/accordion-item/index.cjs +18 -0
- package/action-group/index.cjs +7 -0
- package/alert/index.cjs +30 -0
- package/appearance-ui/index.cjs +96 -0
- package/audio-player/index.cjs +34 -0
- package/avatar/index.cjs +11 -0
- package/badge/index.cjs +14 -0
- package/banner/index.cjs +29 -0
- package/breadcrumb/index.cjs +13 -0
- package/breadcrumb-item/index.cjs +22 -0
- package/button/index.cjs +25 -0
- package/calendar/index.cjs +9 -0
- package/calendar-event/index.cjs +9 -0
- package/card/index.cjs +14 -0
- package/checkbox/index.cjs +21 -0
- package/combobox/index.cjs +39 -0
- package/data-grid/index.cjs +18 -0
- package/date-picker/index.cjs +40 -0
- package/date-range-picker/index.cjs +40 -0
- package/dialog/index.cjs +31 -0
- package/divider/index.cjs +8 -0
- package/elevation/index.cjs +7 -0
- package/empty-state/index.cjs +12 -0
- package/fab/index.cjs +22 -0
- package/file-picker/index.cjs +30 -0
- package/focus/index.cjs +7 -0
- package/header/index.cjs +8 -0
- package/icon/index.cjs +10 -0
- package/index.cjs +296 -0
- package/layout/index.cjs +7 -0
- package/listbox/index.cjs +77 -0
- package/locales/en-GB.cjs +106 -0
- package/locales/en-US.cjs +106 -0
- package/locales/ja-JP.cjs +106 -0
- package/locales/zh-CN.cjs +106 -0
- package/menu/index.cjs +32 -0
- package/menu-item/index.cjs +22 -0
- package/nav/index.cjs +6 -0
- package/nav-disclosure/index.cjs +17 -0
- package/nav-item/index.cjs +22 -0
- package/note/index.cjs +16 -0
- package/number-field/index.cjs +33 -0
- package/option/index.cjs +23 -0
- package/package.json +20 -2
- package/pagination/index.cjs +28 -0
- package/popup/index.cjs +27 -0
- package/progress/index.cjs +9 -0
- package/progress-ring/index.cjs +9 -0
- package/radio/index.cjs +14 -0
- package/radio-group/index.cjs +14 -0
- package/select/index.cjs +38 -0
- package/selectable-box/index.cjs +25 -0
- package/shared/Reflector.cjs +67 -0
- package/shared/_has.cjs +62 -0
- package/shared/affix.cjs +64 -0
- package/shared/affix.js +8 -4
- package/shared/anchor.cjs +90 -0
- package/shared/anchored.cjs +78 -0
- package/shared/apply-mixins.cjs +25 -0
- package/shared/aria-global.cjs +74 -0
- package/shared/aria.cjs +11 -0
- package/shared/aria2.cjs +11 -0
- package/shared/base-progress.cjs +72 -0
- package/shared/breadcrumb-item.cjs +27 -0
- package/shared/button.cjs +202 -0
- package/shared/calendar-event.cjs +41 -0
- package/shared/children.cjs +61 -0
- package/shared/class-names.cjs +17 -0
- package/shared/definition.cjs +165 -0
- package/shared/definition10.cjs +102 -0
- package/shared/definition11.cjs +164 -0
- package/shared/definition11.js +38 -36
- package/shared/definition12.cjs +50 -0
- package/shared/definition13.cjs +779 -0
- package/shared/definition14.cjs +157 -0
- package/shared/definition15.cjs +249 -0
- package/shared/definition16.cjs +746 -0
- package/shared/definition17.cjs +1372 -0
- package/shared/definition18.cjs +175 -0
- package/shared/definition19.cjs +416 -0
- package/shared/definition2.cjs +232 -0
- package/shared/definition20.cjs +278 -0
- package/shared/definition21.cjs +83 -0
- package/shared/definition22.cjs +74 -0
- package/shared/definition23.cjs +106 -0
- package/shared/definition24.cjs +2392 -0
- package/shared/definition25.cjs +75 -0
- package/shared/definition26.cjs +39 -0
- package/shared/definition27.cjs +66 -0
- package/shared/definition28.cjs +849 -0
- package/shared/definition29.cjs +72 -0
- package/shared/definition3.cjs +72 -0
- package/shared/definition30.cjs +98 -0
- package/shared/definition31.cjs +37 -0
- package/shared/definition32.cjs +24 -0
- package/shared/definition33.cjs +64 -0
- package/shared/definition34.cjs +533 -0
- package/shared/definition35.cjs +295 -0
- package/shared/definition36.cjs +219 -0
- package/shared/definition37.cjs +109 -0
- package/shared/definition38.cjs +92 -0
- package/shared/definition39.cjs +448 -0
- package/shared/definition4.cjs +198 -0
- package/shared/definition40.cjs +49 -0
- package/shared/definition41.cjs +694 -0
- package/shared/definition42.cjs +152 -0
- package/shared/definition43.cjs +113 -0
- package/shared/definition44.cjs +607 -0
- package/shared/definition45.cjs +152 -0
- package/shared/definition46.cjs +166 -0
- package/shared/definition47.cjs +35 -0
- package/shared/definition48.cjs +98 -0
- package/shared/definition49.cjs +543 -0
- package/shared/definition5.cjs +199 -0
- package/shared/definition50.cjs +52 -0
- package/shared/definition51.cjs +150 -0
- package/shared/definition52.cjs +304 -0
- package/shared/definition53.cjs +309 -0
- package/shared/definition54.cjs +146 -0
- package/shared/definition55.cjs +128 -0
- package/shared/definition56.cjs +99 -0
- package/shared/definition57.cjs +310 -0
- package/shared/definition58.cjs +20 -0
- package/shared/definition59.cjs +51 -0
- package/shared/definition6.cjs +83 -0
- package/shared/definition60.cjs +1810 -0
- package/shared/definition7.cjs +72 -0
- package/shared/definition8.cjs +152 -0
- package/shared/definition9.cjs +69 -0
- package/shared/dialog-polyfill.esm.cjs +862 -0
- package/shared/direction.cjs +22 -0
- package/shared/dom.cjs +23 -0
- package/shared/enums.cjs +87 -0
- package/shared/focus.cjs +8 -0
- package/shared/focus2.cjs +11 -0
- package/shared/form-associated.cjs +470 -0
- package/shared/icon.cjs +237 -0
- package/shared/index.cjs +5061 -0
- package/shared/index2.cjs +231 -0
- package/shared/key-codes.cjs +115 -0
- package/shared/key-codes2.cjs +14 -0
- package/shared/listbox.cjs +1072 -0
- package/shared/localized.cjs +11 -0
- package/shared/numbers.cjs +38 -0
- package/shared/patterns/affix.d.ts +5 -1
- package/shared/presentationDate.cjs +6192 -0
- package/shared/radio.cjs +153 -0
- package/shared/ref.cjs +43 -0
- package/shared/repeat.cjs +767 -0
- package/shared/select.options.cjs +12 -0
- package/shared/slotted.cjs +123 -0
- package/shared/start-end.cjs +52 -0
- package/shared/strings.cjs +11 -0
- package/shared/text-anchor.cjs +33 -0
- package/shared/text-anchor.template.cjs +48 -0
- package/shared/text-field.cjs +5 -0
- package/shared/text-field2.cjs +228 -0
- package/shared/tree-item.cjs +154 -0
- package/shared/when.cjs +31 -0
- package/side-drawer/index.cjs +8 -0
- package/slider/index.cjs +16 -0
- package/split-button/index.cjs +20 -0
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.cjs +15 -0
- package/tab/index.cjs +17 -0
- package/tab-panel/index.cjs +6 -0
- package/tabs/index.cjs +24 -0
- package/tag/index.cjs +17 -0
- package/tag-group/index.cjs +7 -0
- package/text-anchor/index.cjs +24 -0
- package/text-area/index.cjs +25 -0
- package/text-field/index.cjs +27 -0
- package/toggletip/index.cjs +29 -0
- package/tooltip/index.cjs +29 -0
- package/tree-item/index.cjs +22 -0
- package/tree-view/index.cjs +14 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index.cjs');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a function that can be used to filter a Node array, selecting only elements.
|
|
7
|
+
* @param selector - An optional selector to restrict the filter to.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
function elements(selector) {
|
|
11
|
+
if (selector) {
|
|
12
|
+
return function (value, index, array) {
|
|
13
|
+
return value.nodeType === 1 && value.matches(selector);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return function (value, index, array) {
|
|
17
|
+
return value.nodeType === 1;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A base class for node observation.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
class NodeObservationBehavior {
|
|
25
|
+
/**
|
|
26
|
+
* Creates an instance of NodeObservationBehavior.
|
|
27
|
+
* @param target - The target to assign the nodes property on.
|
|
28
|
+
* @param options - The options to use in configuring node observation.
|
|
29
|
+
*/
|
|
30
|
+
constructor(target, options) {
|
|
31
|
+
this.target = target;
|
|
32
|
+
this.options = options;
|
|
33
|
+
this.source = null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Bind this behavior to the source.
|
|
37
|
+
* @param source - The source to bind to.
|
|
38
|
+
* @param context - The execution context that the binding is operating within.
|
|
39
|
+
*/
|
|
40
|
+
bind(source) {
|
|
41
|
+
const name = this.options.property;
|
|
42
|
+
this.shouldUpdate = index.Observable.getAccessors(source).some((x) => x.name === name);
|
|
43
|
+
this.source = source;
|
|
44
|
+
this.updateTarget(this.computeNodes());
|
|
45
|
+
if (this.shouldUpdate) {
|
|
46
|
+
this.observe();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Unbinds this behavior from the source.
|
|
51
|
+
* @param source - The source to unbind from.
|
|
52
|
+
*/
|
|
53
|
+
unbind() {
|
|
54
|
+
this.updateTarget(index.emptyArray);
|
|
55
|
+
this.source = null;
|
|
56
|
+
if (this.shouldUpdate) {
|
|
57
|
+
this.disconnect();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** @internal */
|
|
61
|
+
handleEvent() {
|
|
62
|
+
this.updateTarget(this.computeNodes());
|
|
63
|
+
}
|
|
64
|
+
computeNodes() {
|
|
65
|
+
let nodes = this.getNodes();
|
|
66
|
+
if (this.options.filter !== void 0) {
|
|
67
|
+
nodes = nodes.filter(this.options.filter);
|
|
68
|
+
}
|
|
69
|
+
return nodes;
|
|
70
|
+
}
|
|
71
|
+
updateTarget(value) {
|
|
72
|
+
this.source[this.options.property] = value;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The runtime behavior for slotted node observation.
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
class SlottedBehavior extends NodeObservationBehavior {
|
|
81
|
+
/**
|
|
82
|
+
* Creates an instance of SlottedBehavior.
|
|
83
|
+
* @param target - The slot element target to observe.
|
|
84
|
+
* @param options - The options to use when observing the slot.
|
|
85
|
+
*/
|
|
86
|
+
constructor(target, options) {
|
|
87
|
+
super(target, options);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Begins observation of the nodes.
|
|
91
|
+
*/
|
|
92
|
+
observe() {
|
|
93
|
+
this.target.addEventListener("slotchange", this);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Disconnects observation of the nodes.
|
|
97
|
+
*/
|
|
98
|
+
disconnect() {
|
|
99
|
+
this.target.removeEventListener("slotchange", this);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Retrieves the nodes that should be assigned to the target.
|
|
103
|
+
*/
|
|
104
|
+
getNodes() {
|
|
105
|
+
return this.target.assignedNodes(this.options);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A directive that observes the `assignedNodes()` of a slot and updates a property
|
|
110
|
+
* whenever they change.
|
|
111
|
+
* @param propertyOrOptions - The options used to configure slotted node observation.
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
114
|
+
function slotted(propertyOrOptions) {
|
|
115
|
+
if (typeof propertyOrOptions === "string") {
|
|
116
|
+
propertyOrOptions = { property: propertyOrOptions };
|
|
117
|
+
}
|
|
118
|
+
return new index.AttachedBehaviorHTMLDirective("fast-slotted", SlottedBehavior, propertyOrOptions);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
exports.NodeObservationBehavior = NodeObservationBehavior;
|
|
122
|
+
exports.elements = elements;
|
|
123
|
+
exports.slotted = slotted;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index.cjs');
|
|
4
|
+
const ref = require('./ref.cjs');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A mixin class implementing start and end elements.
|
|
8
|
+
* These are generally used to decorate text elements with icons or other visual indicators.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
class StartEnd {
|
|
12
|
+
handleStartContentChange() {
|
|
13
|
+
this.startContainer.classList.toggle("start", this.start.assignedNodes().length > 0);
|
|
14
|
+
}
|
|
15
|
+
handleEndContentChange() {
|
|
16
|
+
this.endContainer.classList.toggle("end", this.end.assignedNodes().length > 0);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The template for the end element.
|
|
21
|
+
* For use with {@link StartEnd}
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
* @deprecated - use endSlotTemplate
|
|
25
|
+
*/
|
|
26
|
+
index.html `
|
|
27
|
+
<span part="end" ${ref.ref("endContainer")}>
|
|
28
|
+
<slot
|
|
29
|
+
name="end"
|
|
30
|
+
${ref.ref("end")}
|
|
31
|
+
@slotchange="${x => x.handleEndContentChange()}"
|
|
32
|
+
></slot>
|
|
33
|
+
</span>
|
|
34
|
+
`;
|
|
35
|
+
/**
|
|
36
|
+
* The template for the start element.
|
|
37
|
+
* For use with {@link StartEnd}
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
* @deprecated - use startSlotTemplate
|
|
41
|
+
*/
|
|
42
|
+
index.html `
|
|
43
|
+
<span part="start" ${ref.ref("startContainer")}>
|
|
44
|
+
<slot
|
|
45
|
+
name="start"
|
|
46
|
+
${ref.ref("start")}
|
|
47
|
+
@slotchange="${x => x.handleStartContentChange()}"
|
|
48
|
+
></slot>
|
|
49
|
+
</span>
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
exports.StartEnd = StartEnd;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const affix = require('./affix.cjs');
|
|
4
|
+
const anchor = require('./anchor.cjs');
|
|
5
|
+
const applyMixins = require('./apply-mixins.cjs');
|
|
6
|
+
const index = require('./index.cjs');
|
|
7
|
+
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
12
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
+
if (decorator = decorators[i])
|
|
14
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
15
|
+
if (kind && result)
|
|
16
|
+
__defProp(target, key, result);
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
class TextAnchor extends anchor.Anchor {
|
|
20
|
+
/**
|
|
21
|
+
* Allows subclasses to provide a body template that will be rendered inside the anchor.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
getBodyTemplate() {
|
|
25
|
+
return void 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
__decorateClass([
|
|
29
|
+
index.attr
|
|
30
|
+
], TextAnchor.prototype, "text", 2);
|
|
31
|
+
applyMixins.applyMixins(TextAnchor, affix.AffixIcon);
|
|
32
|
+
|
|
33
|
+
exports.TextAnchor = TextAnchor;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const affix = require('./affix.cjs');
|
|
4
|
+
const index = require('./index.cjs');
|
|
5
|
+
const ref = require('./ref.cjs');
|
|
6
|
+
const classNames = require('./class-names.cjs');
|
|
7
|
+
|
|
8
|
+
const getClasses = ({ text }) => classNames.classNames(
|
|
9
|
+
"control",
|
|
10
|
+
["icon-only", !text]
|
|
11
|
+
);
|
|
12
|
+
const textAnchorTemplate = (context) => {
|
|
13
|
+
const affixIconTemplate = affix.affixIconTemplateFactory(context);
|
|
14
|
+
return index.html`<a
|
|
15
|
+
class="${getClasses}"
|
|
16
|
+
download="${(x) => x.download}"
|
|
17
|
+
href="${(x) => x.href}"
|
|
18
|
+
hreflang="${(x) => x.hreflang}"
|
|
19
|
+
ping="${(x) => x.ping}"
|
|
20
|
+
referrerpolicy="${(x) => x.referrerpolicy}"
|
|
21
|
+
rel="${(x) => x.rel}"
|
|
22
|
+
target="${(x) => x.target}"
|
|
23
|
+
type="${(x) => x.type}"
|
|
24
|
+
aria-atomic="${(x) => x.ariaAtomic}"
|
|
25
|
+
aria-busy="${(x) => x.ariaBusy}"
|
|
26
|
+
aria-current="${(x) => x.ariaCurrent}"
|
|
27
|
+
aria-details="${(x) => x.ariaDetails}"
|
|
28
|
+
aria-disabled="${(x) => x.ariaDisabled}"
|
|
29
|
+
aria-errormessage="${(x) => x.ariaErrormessage}"
|
|
30
|
+
aria-expanded="${(x) => x.ariaExpanded}"
|
|
31
|
+
aria-haspopup="${(x) => x.ariaHaspopup}"
|
|
32
|
+
aria-hidden="${(x) => x.ariaHidden}"
|
|
33
|
+
aria-invalid="${(x) => x.ariaInvalid}"
|
|
34
|
+
aria-keyshortcuts="${(x) => x.ariaKeyshortcuts}"
|
|
35
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
36
|
+
aria-live="${(x) => x.ariaLive}"
|
|
37
|
+
aria-relevant="${(x) => x.ariaRelevant}"
|
|
38
|
+
aria-roledescription="${(x) => x.ariaRoledescription}"
|
|
39
|
+
${ref.ref("control")}
|
|
40
|
+
>
|
|
41
|
+
${(x) => affixIconTemplate(x.icon, affix.IconWrapper.Slot)}
|
|
42
|
+
${(x) => x.text}
|
|
43
|
+
${(x) => x.getBodyTemplate?.() ?? ""}
|
|
44
|
+
</a>
|
|
45
|
+
`;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports.textAnchorTemplate = textAnchorTemplate;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const styles = ":host{display:inline-block}.base{--_text-field-gutter-start:calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4);--_text-field-gutter-end:calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4);--_text-field-icon-size:calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2);display:inline-grid;width:100%;gap:4px;grid-template-columns:min-content 1fr max-content}.base{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--_connotation-color-backdrop);--_appearance-color-outline: var(--_connotation-color-intermediate)}.base.appearance-ghost{--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(:hover,.hover):where(:not(:disabled,.disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--_connotation-color-backdrop);--_appearance-color-outline: var(--_connotation-color-firm)}.base:where(:hover,.hover):where(:not(:disabled,.disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(:disabled,.disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.base:where(:disabled,.disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.readonly):where(:not(:disabled,.disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.base:where(.readonly):where(:not(:disabled,.disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.error):where(:not(:disabled,.disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.base:where(.error):where(:not(:disabled,.disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.base:where(.success):where(:not(:disabled,.disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.base:where(.success):where(:not(:disabled,.disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.base.connotation-success{--_connotation-color-primary: var(--vvd-text-field-success-primary, var(--vvd-color-success-500));--_connotation-color-backdrop: var(--vvd-text-field-success-backdrop, var(--vvd-color-success-50));--_connotation-color-intermediate: var(--vvd-text-field-success-intermediate, var(--vvd-color-success-500));--_connotation-color-firm: var(--vvd-text-field-success-firm, var(--vvd-color-success-600));--_connotation-color-faint: var(--vvd-text-field-success-faint, var(--vvd-color-success-50));--_connotation-color-soft: var(--vvd-text-field-success-soft, var(--vvd-color-success-100))}.base.connotation-alert{--_connotation-color-primary: var(--vvd-text-field-alert-primary, var(--vvd-color-alert-500));--_connotation-color-backdrop: var(--vvd-text-field-alert-backdrop, var(--vvd-color-alert-50));--_connotation-color-intermediate: var(--vvd-text-field-alert-intermediate, var(--vvd-color-alert-500));--_connotation-color-firm: var(--vvd-text-field-alert-firm, var(--vvd-color-alert-600));--_connotation-color-faint: var(--vvd-text-field-alert-faint, var(--vvd-color-alert-50));--_connotation-color-soft: var(--vvd-text-field-alert-soft, var(--vvd-color-alert-100))}.base:not(.connotation-success,.connotation-alert){--_connotation-color-primary: var(--vvd-text-field-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-backdrop: var(--vvd-text-field-accent-backdrop, var(--vvd-color-canvas));--_connotation-color-intermediate: var(--vvd-text-field-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-firm: var(--vvd-text-field-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-text-field-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-text-field-accent-soft, var(--vvd-color-neutral-100))}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){--_low-ink-color: var(--vvd-color-neutral-600)}.base.disabled{--_low-ink-color: var(--_appearance-color-text)}.label:not(slot),.label::slotted(label){box-sizing:initial!important;padding:initial!important;margin:initial!important;color:var(--vvd-color-canvas-text)!important;contain:inline-size!important;font:var(--vvd-typography-base);grid-column:1/4;grid-row:1}.char-count+.label:not(slot),.char-count+.label::slotted(label){grid-column:1/3}.char-count{color:var(--_low-ink-color);font:var(--vvd-typography-base);grid-column:3/4}.fieldset{position:relative;display:flex;align-items:center;background-color:var(--_appearance-color-fill);font:var(--vvd-typography-base);grid-column:1/4;padding-block:0;transition:color .2s,background-color .2s}.fieldset:after{position:absolute;display:block;block-size:100%;border-radius:inherit;box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);content:\"\";inline-size:100%;pointer-events:none;transition:box-shadow .2s}.fieldset:focus-visible{outline:none}.base>.fieldset{block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}.base:not(.shape-pill) .fieldset{border-radius:8px}.base.shape-pill .fieldset{border-radius:24px}.wrapper{block-size:100%;border-radius:inherit;inline-size:100%}.wrapper:focus-visible{outline:none}.control:not(slot),.control::slotted(input){width:100%!important;box-sizing:border-box!important;border:0 none!important;margin:initial!important;appearance:none!important;background-color:transparent!important;block-size:100%!important;border-radius:inherit!important;color:inherit!important;font:inherit;padding-block:0!important;padding-inline-end:var(--_text-field-gutter-end)!important;padding-inline-start:var(--_text-field-gutter-start)!important}.control:not(slot):disabled,.control::slotted(input:disabled){cursor:not-allowed!important;opacity:1!important;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control:not(slot)::placeholder{opacity:1!important;-webkit-text-fill-color:var(--_low-ink-color)!important}.control:not(slot):focus-visible,.control::slotted(input:focus-visible){outline:none}.has-icon .control:not(slot),.has-icon .control::slotted(input){padding-inline-start:calc(var(--_text-field-icon-size) + var(--_text-field-gutter-start) * 2)!important}.icon{position:absolute;z-index:1;color:var(--_low-ink-color);font-size:var(--_text-field-icon-size);inset-block-start:50%;inset-inline-start:calc(100% + var(--_text-field-gutter-start));line-height:1;transform:translateY(-50%)}.leading-items-wrapper{position:relative}.base.no-leading .leading-items-wrapper{display:none}.action-items-wrapper{margin-inline-end:4px}.base:not(.action-items) .action-items-wrapper{display:none}.focus-indicator{--focus-stroke-gap-color: transparent;pointer-events:none}.wrapper:not(:focus-visible,:focus-within)>.focus-indicator,.fieldset:not(:focus-visible,:focus-within)>.focus-indicator{display:none}\n";
|
|
4
|
+
|
|
5
|
+
exports.styles = styles;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index.cjs');
|
|
4
|
+
const applyMixins = require('./apply-mixins.cjs');
|
|
5
|
+
const formAssociated = require('./form-associated.cjs');
|
|
6
|
+
const ariaGlobal = require('./aria-global.cjs');
|
|
7
|
+
const startEnd = require('./start-end.cjs');
|
|
8
|
+
|
|
9
|
+
class _TextField extends index.FoundationElement {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A form-associated base class for the {@link @microsoft/fast-foundation#(TextField:class)} component.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
class FormAssociatedTextField extends formAssociated.FormAssociated(_TextField) {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.proxy = document.createElement("input");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Text field sub-types
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
const TextFieldType = {
|
|
28
|
+
/**
|
|
29
|
+
* An email TextField
|
|
30
|
+
*/
|
|
31
|
+
email: "email",
|
|
32
|
+
/**
|
|
33
|
+
* A password TextField
|
|
34
|
+
*/
|
|
35
|
+
password: "password",
|
|
36
|
+
/**
|
|
37
|
+
* A telephone TextField
|
|
38
|
+
*/
|
|
39
|
+
tel: "tel",
|
|
40
|
+
/**
|
|
41
|
+
* A text TextField
|
|
42
|
+
*/
|
|
43
|
+
text: "text",
|
|
44
|
+
/**
|
|
45
|
+
* A URL TextField
|
|
46
|
+
*/
|
|
47
|
+
url: "url",
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A Text Field Custom HTML Element.
|
|
52
|
+
* Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text | <input type="text" /> element }.
|
|
53
|
+
*
|
|
54
|
+
* @slot start - Content which can be provided before the number field input
|
|
55
|
+
* @slot end - Content which can be provided after the number field input
|
|
56
|
+
* @slot - The default slot for the label
|
|
57
|
+
* @csspart label - The label
|
|
58
|
+
* @csspart root - The element wrapping the control, including start and end slots
|
|
59
|
+
* @csspart control - The text field element
|
|
60
|
+
* @fires change - Fires a custom 'change' event when the value has changed
|
|
61
|
+
*
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
let TextField$1 = class TextField extends FormAssociatedTextField {
|
|
65
|
+
constructor() {
|
|
66
|
+
super(...arguments);
|
|
67
|
+
/**
|
|
68
|
+
* Allows setting a type or mode of text.
|
|
69
|
+
* @public
|
|
70
|
+
* @remarks
|
|
71
|
+
* HTML Attribute: type
|
|
72
|
+
*/
|
|
73
|
+
this.type = TextFieldType.text;
|
|
74
|
+
}
|
|
75
|
+
readOnlyChanged() {
|
|
76
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
77
|
+
this.proxy.readOnly = this.readOnly;
|
|
78
|
+
this.validate();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
autofocusChanged() {
|
|
82
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
83
|
+
this.proxy.autofocus = this.autofocus;
|
|
84
|
+
this.validate();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
placeholderChanged() {
|
|
88
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
89
|
+
this.proxy.placeholder = this.placeholder;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
typeChanged() {
|
|
93
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
94
|
+
this.proxy.type = this.type;
|
|
95
|
+
this.validate();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
listChanged() {
|
|
99
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
100
|
+
this.proxy.setAttribute("list", this.list);
|
|
101
|
+
this.validate();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
maxlengthChanged() {
|
|
105
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
106
|
+
this.proxy.maxLength = this.maxlength;
|
|
107
|
+
this.validate();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
minlengthChanged() {
|
|
111
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
112
|
+
this.proxy.minLength = this.minlength;
|
|
113
|
+
this.validate();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
patternChanged() {
|
|
117
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
118
|
+
this.proxy.pattern = this.pattern;
|
|
119
|
+
this.validate();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
sizeChanged() {
|
|
123
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
124
|
+
this.proxy.size = this.size;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
spellcheckChanged() {
|
|
128
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
129
|
+
this.proxy.spellcheck = this.spellcheck;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @internal
|
|
134
|
+
*/
|
|
135
|
+
connectedCallback() {
|
|
136
|
+
super.connectedCallback();
|
|
137
|
+
this.proxy.setAttribute("type", this.type);
|
|
138
|
+
this.validate();
|
|
139
|
+
if (this.autofocus) {
|
|
140
|
+
index.DOM.queueUpdate(() => {
|
|
141
|
+
this.focus();
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Selects all the text in the text field
|
|
147
|
+
*
|
|
148
|
+
* @public
|
|
149
|
+
*/
|
|
150
|
+
select() {
|
|
151
|
+
this.control.select();
|
|
152
|
+
/**
|
|
153
|
+
* The select event does not permeate the shadow DOM boundary.
|
|
154
|
+
* This fn effectively proxies the select event,
|
|
155
|
+
* emitting a `select` event whenever the internal
|
|
156
|
+
* control emits a `select` event
|
|
157
|
+
*/
|
|
158
|
+
this.$emit("select");
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Handles the internal control's `input` event
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
handleTextInput() {
|
|
165
|
+
this.value = this.control.value;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Change event handler for inner control.
|
|
169
|
+
* @remarks
|
|
170
|
+
* "Change" events are not `composable` so they will not
|
|
171
|
+
* permeate the shadow DOM boundary. This fn effectively proxies
|
|
172
|
+
* the change event, emitting a `change` event whenever the internal
|
|
173
|
+
* control emits a `change` event
|
|
174
|
+
* @internal
|
|
175
|
+
*/
|
|
176
|
+
handleChange() {
|
|
177
|
+
this.$emit("change");
|
|
178
|
+
}
|
|
179
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
180
|
+
validate() {
|
|
181
|
+
super.validate(this.control);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
index.__decorate([
|
|
185
|
+
index.attr({ attribute: "readonly", mode: "boolean" })
|
|
186
|
+
], TextField$1.prototype, "readOnly", void 0);
|
|
187
|
+
index.__decorate([
|
|
188
|
+
index.attr({ mode: "boolean" })
|
|
189
|
+
], TextField$1.prototype, "autofocus", void 0);
|
|
190
|
+
index.__decorate([
|
|
191
|
+
index.attr
|
|
192
|
+
], TextField$1.prototype, "placeholder", void 0);
|
|
193
|
+
index.__decorate([
|
|
194
|
+
index.attr
|
|
195
|
+
], TextField$1.prototype, "type", void 0);
|
|
196
|
+
index.__decorate([
|
|
197
|
+
index.attr
|
|
198
|
+
], TextField$1.prototype, "list", void 0);
|
|
199
|
+
index.__decorate([
|
|
200
|
+
index.attr({ converter: index.nullableNumberConverter })
|
|
201
|
+
], TextField$1.prototype, "maxlength", void 0);
|
|
202
|
+
index.__decorate([
|
|
203
|
+
index.attr({ converter: index.nullableNumberConverter })
|
|
204
|
+
], TextField$1.prototype, "minlength", void 0);
|
|
205
|
+
index.__decorate([
|
|
206
|
+
index.attr
|
|
207
|
+
], TextField$1.prototype, "pattern", void 0);
|
|
208
|
+
index.__decorate([
|
|
209
|
+
index.attr({ converter: index.nullableNumberConverter })
|
|
210
|
+
], TextField$1.prototype, "size", void 0);
|
|
211
|
+
index.__decorate([
|
|
212
|
+
index.attr({ mode: "boolean" })
|
|
213
|
+
], TextField$1.prototype, "spellcheck", void 0);
|
|
214
|
+
index.__decorate([
|
|
215
|
+
index.observable
|
|
216
|
+
], TextField$1.prototype, "defaultSlottedNodes", void 0);
|
|
217
|
+
/**
|
|
218
|
+
* Includes ARIA states and properties relating to the ARIA textbox role
|
|
219
|
+
*
|
|
220
|
+
* @public
|
|
221
|
+
*/
|
|
222
|
+
class DelegatesARIATextbox {
|
|
223
|
+
}
|
|
224
|
+
applyMixins.applyMixins(DelegatesARIATextbox, ariaGlobal.ARIAGlobalStatesAndProperties);
|
|
225
|
+
applyMixins.applyMixins(TextField$1, startEnd.StartEnd, DelegatesARIATextbox);
|
|
226
|
+
|
|
227
|
+
exports.DelegatesARIATextbox = DelegatesARIATextbox;
|
|
228
|
+
exports.TextField = TextField$1;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index.cjs');
|
|
4
|
+
const startEnd = require('./start-end.cjs');
|
|
5
|
+
const applyMixins = require('./apply-mixins.cjs');
|
|
6
|
+
const dom = require('./dom.cjs');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* check if the item is a tree item
|
|
10
|
+
* @public
|
|
11
|
+
* @remarks
|
|
12
|
+
* determines if element is an HTMLElement and if it has the role treeitem
|
|
13
|
+
*/
|
|
14
|
+
function isTreeItemElement(el) {
|
|
15
|
+
return dom.isHTMLElement(el) && el.getAttribute("role") === "treeitem";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A Tree item Custom HTML Element.
|
|
19
|
+
*
|
|
20
|
+
* @slot start - Content which can be provided before the tree item content
|
|
21
|
+
* @slot end - Content which can be provided after the tree item content
|
|
22
|
+
* @slot - The default slot for tree item text content
|
|
23
|
+
* @slot item - The slot for tree items (fast tree items manage this assignment themselves)
|
|
24
|
+
* @slot expand-collapse-button - The expand/collapse button
|
|
25
|
+
* @csspart positioning-region - The element used to position the tree item content with exception of any child nodes
|
|
26
|
+
* @csspart content-region - The element containing the expand/collapse, start, and end slots
|
|
27
|
+
* @csspart items - The element wrapping any child items
|
|
28
|
+
* @csspart expand-collapse-button - The expand/collapse button
|
|
29
|
+
* @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
|
|
30
|
+
* @fires selected-change - Fires a custom 'selected-change' event when the selected state changes
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
let TreeItem$1 = class TreeItem extends index.FoundationElement {
|
|
35
|
+
constructor() {
|
|
36
|
+
super(...arguments);
|
|
37
|
+
/**
|
|
38
|
+
* When true, the control will be appear expanded by user interaction.
|
|
39
|
+
* @public
|
|
40
|
+
* @remarks
|
|
41
|
+
* HTML Attribute: expanded
|
|
42
|
+
*/
|
|
43
|
+
this.expanded = false;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the item is focusable
|
|
46
|
+
*
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
this.focusable = false;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the tree is nested
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
this.isNestedItem = () => {
|
|
56
|
+
return isTreeItemElement(this.parentElement);
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Handle expand button click
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
this.handleExpandCollapseButtonClick = (e) => {
|
|
64
|
+
if (!this.disabled && !e.defaultPrevented) {
|
|
65
|
+
this.expanded = !this.expanded;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Handle focus events
|
|
70
|
+
*
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
this.handleFocus = (e) => {
|
|
74
|
+
this.setAttribute("tabindex", "0");
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Handle blur events
|
|
78
|
+
*
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
this.handleBlur = (e) => {
|
|
82
|
+
this.setAttribute("tabindex", "-1");
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
expandedChanged() {
|
|
86
|
+
if (this.$fastController.isConnected) {
|
|
87
|
+
this.$emit("expanded-change", this);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
selectedChanged() {
|
|
91
|
+
if (this.$fastController.isConnected) {
|
|
92
|
+
this.$emit("selected-change", this);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
itemsChanged(oldValue, newValue) {
|
|
96
|
+
if (this.$fastController.isConnected) {
|
|
97
|
+
this.items.forEach((node) => {
|
|
98
|
+
if (isTreeItemElement(node)) {
|
|
99
|
+
// TODO: maybe not require it to be a TreeItem?
|
|
100
|
+
node.nested = true;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Places document focus on a tree item
|
|
107
|
+
*
|
|
108
|
+
* @public
|
|
109
|
+
* @param el - the element to focus
|
|
110
|
+
*/
|
|
111
|
+
static focusItem(el) {
|
|
112
|
+
el.focusable = true;
|
|
113
|
+
el.focus();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Gets number of children
|
|
117
|
+
*
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
childItemLength() {
|
|
121
|
+
const treeChildren = this.childItems.filter((item) => {
|
|
122
|
+
return isTreeItemElement(item);
|
|
123
|
+
});
|
|
124
|
+
return treeChildren ? treeChildren.length : 0;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
index.__decorate([
|
|
128
|
+
index.attr({ mode: "boolean" })
|
|
129
|
+
], TreeItem$1.prototype, "expanded", void 0);
|
|
130
|
+
index.__decorate([
|
|
131
|
+
index.attr({ mode: "boolean" })
|
|
132
|
+
], TreeItem$1.prototype, "selected", void 0);
|
|
133
|
+
index.__decorate([
|
|
134
|
+
index.attr({ mode: "boolean" })
|
|
135
|
+
], TreeItem$1.prototype, "disabled", void 0);
|
|
136
|
+
index.__decorate([
|
|
137
|
+
index.observable
|
|
138
|
+
], TreeItem$1.prototype, "focusable", void 0);
|
|
139
|
+
index.__decorate([
|
|
140
|
+
index.observable
|
|
141
|
+
], TreeItem$1.prototype, "childItems", void 0);
|
|
142
|
+
index.__decorate([
|
|
143
|
+
index.observable
|
|
144
|
+
], TreeItem$1.prototype, "items", void 0);
|
|
145
|
+
index.__decorate([
|
|
146
|
+
index.observable
|
|
147
|
+
], TreeItem$1.prototype, "nested", void 0);
|
|
148
|
+
index.__decorate([
|
|
149
|
+
index.observable
|
|
150
|
+
], TreeItem$1.prototype, "renderCollapsedChildren", void 0);
|
|
151
|
+
applyMixins.applyMixins(TreeItem$1, startEnd.StartEnd);
|
|
152
|
+
|
|
153
|
+
exports.TreeItem = TreeItem$1;
|
|
154
|
+
exports.isTreeItemElement = isTreeItemElement;
|