@vonage/vivid 3.14.0 → 3.16.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/checkbox/index.js +3 -0
- package/custom-elements.json +250 -27
- package/empty-state/index.js +14 -0
- package/fab/index.js +1 -1
- package/header/index.js +1 -1
- package/index.js +31 -29
- package/layout/index.js +1 -1
- package/lib/checkbox/checkbox.d.ts +6 -3
- package/lib/components.d.ts +2 -0
- package/lib/data-grid/data-grid-cell.d.ts +2 -0
- package/lib/data-grid/data-grid-row.d.ts +1 -0
- package/lib/data-grid/data-grid.d.ts +1 -1
- package/lib/empty-state/definition.d.ts +3 -0
- package/lib/empty-state/empty-state.d.ts +5 -0
- package/lib/empty-state/empty-state.template.d.ts +4 -0
- package/lib/empty-state/index.d.ts +1 -0
- package/listbox/index.js +1 -1
- package/menu/index.js +2 -2
- package/menu-item/index.js +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.js +1 -1
- package/note/index.js +1 -1
- package/number-field/index.js +1 -1
- package/package.json +1 -1
- package/pagination/index.js +14 -232
- package/progress/index.js +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.js +1 -1
- package/select/index.js +1 -1
- package/shared/definition.js +1 -1
- package/shared/definition10.js +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition12.js +1 -1
- package/shared/definition14.js +1 -1
- package/shared/definition15.js +1 -1
- package/shared/definition16.js +1 -1
- package/shared/definition17.js +1 -1
- package/shared/definition18.js +23 -8
- package/shared/definition19.js +1 -1
- package/shared/definition2.js +1 -1
- package/shared/definition21.js +1 -1
- package/shared/definition22.js +114 -40
- package/shared/definition23.js +1 -1
- package/shared/definition24.js +1 -1
- package/shared/definition25.js +39 -76
- package/shared/definition26.js +76 -47
- package/shared/definition27.js +46 -36
- package/shared/definition28.js +39 -49
- package/shared/definition29.js +48 -344
- package/shared/definition30.js +272 -291
- package/shared/definition31.js +366 -14
- package/shared/definition32.js +13 -67
- package/shared/definition33.js +66 -21
- package/shared/definition34.js +21 -39
- package/shared/definition35.js +31 -432
- package/shared/definition36.js +432 -76
- package/shared/definition37.js +223 -34
- package/shared/definition38.js +82 -425
- package/shared/definition39.js +30 -635
- package/shared/definition4.js +1 -1
- package/shared/definition40.js +420 -73
- package/shared/definition41.js +530 -484
- package/shared/definition42.js +76 -133
- package/shared/definition43.js +577 -40
- package/shared/definition44.js +135 -20
- package/shared/definition45.js +42 -423
- package/shared/definition46.js +22 -112
- package/shared/definition47.js +440 -18
- package/shared/definition48.js +92 -247
- package/shared/definition49.js +20 -112
- package/shared/definition5.js +1 -1
- package/shared/definition50.js +259 -590
- package/shared/definition51.js +110 -91
- package/shared/definition52.js +626 -67
- package/shared/definition53.js +111 -292
- package/shared/definition54.js +80 -0
- package/shared/definition55.js +305 -0
- package/shared/definition6.js +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition9.js +1 -1
- package/shared/form-elements.js +1 -1
- package/shared/icon.js +1 -1
- package/shared/patterns/form-elements/form-elements.d.ts +4 -4
- package/shared/text-field.js +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.js +1 -1
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/switch/index.js +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +3 -3
- package/tag/index.js +1 -1
- package/tag-group/index.js +1 -1
- package/text-area/index.js +1 -1
- package/text-field/index.js +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/index.js +1 -1
- package/vivid.api.json +210 -0
package/shared/definition44.js
CHANGED
|
@@ -1,32 +1,147 @@
|
|
|
1
|
-
import { F as FoundationElement, h as html, r as registerFactory } from './index.js';
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, o as observable, b as __metadata, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { i as iconRegistries } from './definition3.js';
|
|
3
|
+
import { f as focusRegistries } from './definition4.js';
|
|
4
|
+
import { C as CheckableFormAssociated } from './form-associated.js';
|
|
5
|
+
import { e as keySpace, d as keyEnter } from './key-codes.js';
|
|
6
|
+
import './affix.js';
|
|
7
|
+
import { f as focusTemplateFactory } from './focus2.js';
|
|
8
|
+
import './form-elements.js';
|
|
9
|
+
import { w as when } from './when.js';
|
|
10
|
+
import { c as classNames } from './class-names.js';
|
|
11
|
+
|
|
12
|
+
class _Switch extends FoundationElement {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A form-associated base class for the {@link @microsoft/fast-foundation#(Switch:class)} component.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
class FormAssociatedSwitch extends CheckableFormAssociated(_Switch) {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.proxy = document.createElement("input");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
2
25
|
|
|
3
26
|
/**
|
|
4
|
-
* A
|
|
27
|
+
* A Switch Custom HTML Element.
|
|
28
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#switch | ARIA switch }.
|
|
5
29
|
*
|
|
6
|
-
* @slot - The
|
|
30
|
+
* @slot - The deafult slot for the label
|
|
31
|
+
* @slot checked-message - The message when in a checked state
|
|
32
|
+
* @slot unchecked-message - The message when in an unchecked state
|
|
33
|
+
* @csspart label - The label
|
|
34
|
+
* @csspart switch - The element representing the switch, which wraps the indicator
|
|
35
|
+
* @csspart status-message - The wrapper for the status messages
|
|
36
|
+
* @csspart checked-message - The checked message
|
|
37
|
+
* @csspart unchecked-message - The unchecked message
|
|
38
|
+
* @fires change - Emits a custom change event when the checked state changes
|
|
7
39
|
*
|
|
8
40
|
* @public
|
|
9
41
|
*/
|
|
10
|
-
class
|
|
42
|
+
class Switch$1 extends FormAssociatedSwitch {
|
|
43
|
+
constructor() {
|
|
44
|
+
super();
|
|
45
|
+
/**
|
|
46
|
+
* The element's value to be included in form submission when checked.
|
|
47
|
+
* Default to "on" to reach parity with input[type="checkbox"]
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
this.initialValue = "on";
|
|
52
|
+
/**
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
this.keypressHandler = (e) => {
|
|
56
|
+
if (this.readOnly) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
switch (e.key) {
|
|
60
|
+
case keyEnter:
|
|
61
|
+
case keySpace:
|
|
62
|
+
this.checked = !this.checked;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
this.clickHandler = (e) => {
|
|
70
|
+
if (!this.disabled && !this.readOnly) {
|
|
71
|
+
this.checked = !this.checked;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
this.proxy.setAttribute("type", "checkbox");
|
|
75
|
+
}
|
|
76
|
+
readOnlyChanged() {
|
|
77
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
78
|
+
this.proxy.readOnly = this.readOnly;
|
|
79
|
+
}
|
|
80
|
+
this.readOnly
|
|
81
|
+
? this.classList.add("readonly")
|
|
82
|
+
: this.classList.remove("readonly");
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
checkedChanged(prev, next) {
|
|
88
|
+
super.checkedChanged(prev, next);
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated - this behavior already exists in the template and should not exist in the class.
|
|
91
|
+
*/
|
|
92
|
+
this.checked ? this.classList.add("checked") : this.classList.remove("checked");
|
|
93
|
+
}
|
|
11
94
|
}
|
|
95
|
+
__decorate([
|
|
96
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
97
|
+
], Switch$1.prototype, "readOnly", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
observable
|
|
100
|
+
], Switch$1.prototype, "defaultSlottedNodes", void 0);
|
|
12
101
|
|
|
13
|
-
|
|
102
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 07 Jun 2023 09:55:04 GMT\n */\n.control {\n display: inline-flex;\n gap: 8px;\n}\n.control.connotation-cta {\n /* @cssprop [--vvd-switch-cta-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-cta-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-cta-primary=var(--vvd-color-cta-500)] */\n --_connotation-color-primary: var(--vvd-switch-cta-primary, var(--vvd-color-cta-500));\n /* @cssprop [--vvd-switch-cta-primary-increment=var(--vvd-color-cta-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-cta-primary-increment, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-switch-cta-backdrop=var(--vvd-color-cta-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-cta-backdrop, var(--vvd-color-cta-50));\n /* @cssprop [--vvd-switch-cta-firm=var(--vvd-color-cta-600)] */\n --_connotation-color-firm: var(--vvd-switch-cta-firm, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-switch-cta-intermediate=var(--vvd-color-cta-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-cta-intermediate, var(--vvd-color-cta-500));\n}\n.control.connotation-alert {\n /* @cssprop [--vvd-switch-alert-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-alert-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-alert-primary=var(--vvd-color-alert-500)] */\n --_connotation-color-primary: var(--vvd-switch-alert-primary, var(--vvd-color-alert-500));\n /* @cssprop [--vvd-switch-alert-primary-increment=var(--vvd-color-alert-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-alert-primary-increment, var(--vvd-color-alert-600));\n /* @cssprop [--vvd-switch-alert-backdrop=var(--vvd-color-alert-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-alert-backdrop, var(--vvd-color-alert-50));\n /* @cssprop [--vvd-switch-alert-firm=var(--vvd-color-alert-600)] */\n --_connotation-color-firm: var(--vvd-switch-alert-firm, var(--vvd-color-alert-600));\n /* @cssprop [--vvd-switch-alert-intermediate=var(--vvd-color-alert-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-alert-intermediate, var(--vvd-color-alert-500));\n}\n.control.connotation-success {\n /* @cssprop [--vvd-switch-success-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-success-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-success-primary=var(--vvd-color-success-500)] */\n --_connotation-color-primary: var(--vvd-switch-success-primary, var(--vvd-color-success-500));\n /* @cssprop [--vvd-switch-success-primary-increment=var(--vvd-color-success-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-success-primary-increment, var(--vvd-color-success-600));\n /* @cssprop [--vvd-switch-success-backdrop=var(--vvd-color-success-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-success-backdrop, var(--vvd-color-success-50));\n /* @cssprop [--vvd-switch-success-firm=var(--vvd-color-success-600)] */\n --_connotation-color-firm: var(--vvd-switch-success-firm, var(--vvd-color-success-600));\n /* @cssprop [--vvd-switch-success-intermediate=var(--vvd-color-success-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-success-intermediate, var(--vvd-color-success-500));\n}\n.control:not(.connotation-cta, .connotation-alert, .connotation-success) {\n /* @cssprop [--vvd-switch-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-accent-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-switch-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-switch-accent-primary-increment=var(--vvd-color-neutral-800)] */\n --_connotation-color-primary-increment: var(--vvd-switch-accent-primary-increment, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-switch-accent-backdrop=var(--vvd-color-canvas)] */\n --_connotation-color-backdrop: var(--vvd-switch-accent-backdrop, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-accent-firm=var(--vvd-color-canvas-text)] */\n --_connotation-color-firm: var(--vvd-switch-accent-firm, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-switch-accent-intermediate=var(--vvd-color-neutral-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-accent-intermediate, var(--vvd-color-neutral-500));\n}\n.control {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.control.appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary-increment);\n --_appearance-color-outline: transparent;\n}\n.control:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.control:where(:disabled, .disabled).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: transparent;\n}\n.control:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.control:where(.readonly):where(:not(:disabled, .disabled)).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-800);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: transparent;\n}\n@supports selector(:focus-visible) {\n .control:focus {\n outline: none;\n }\n}\n@supports (user-select: none) {\n .control {\n user-select: none;\n }\n}\n.control:not(.disabled) {\n cursor: pointer;\n}\n.control.disabled {\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.switch {\n --_switch-inline-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) * 1.8);\n position: relative;\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n border-radius: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) / .5);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n inline-size: var(--_switch-inline-size);\n transition: all 0.2s ease-in-out 0s;\n}\n\n.checked-indicator {\n --_switch-checked-indicator-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) / 1.6667);\n --_switch-gutter: calc(var(--_switch-checked-indicator-size) / 3);\n block-size: var(--_switch-checked-indicator-size);\n border-radius: inherit;\n inline-size: var(--_switch-checked-indicator-size);\n margin-inline-start: auto;\n transition: all 0.2s ease-in-out 0s;\n}\n.control.appearance-filled .checked-indicator {\n background-color: var(--vvd-color-neutral-100);\n}\n.control:not(.appearance-filled) .checked-indicator {\n background-color: var(--_appearance-color-outline);\n}\n.control:not(.checked) .checked-indicator {\n transform: translateX(calc(-1 * var(--_switch-inline-size) + var(--_switch-checked-indicator-size) + var(--_switch-gutter)));\n}\n.control.checked .checked-indicator {\n transform: translateX(calc(-1 * var(--_switch-gutter)));\n}\n\n.label {\n color: var(--vvd-color-canvas-text);\n cursor: pointer;\n font: var(--vvd-typography-base);\n}\n\n.focus-indicator {\n --focus-inset: -4px;\n --focus-stroke-gap-color: transparent;\n border-radius: 14px;\n}\n.control:not(:focus-visible) .focus-indicator {\n display: none;\n}";
|
|
14
103
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
104
|
+
class Switch extends Switch$1 {}
|
|
105
|
+
__decorate([attr, __metadata("design:type", String)], Switch.prototype, "label", void 0);
|
|
106
|
+
__decorate([attr, __metadata("design:type", String)], Switch.prototype, "connotation", void 0);
|
|
107
|
+
|
|
108
|
+
let _2 = t => t,
|
|
109
|
+
_t,
|
|
110
|
+
_t2;
|
|
111
|
+
const getClasses = _ => classNames('control', ['appearance-filled', _.checked && !_.disabled && !_.readOnly], ['checked', _.checked], ['disabled', _.disabled], ['readonly', _.readOnly], [`connotation-${_.connotation}`, Boolean(_.checked) && Boolean(_.connotation)]);
|
|
112
|
+
const SwitchTemplate = context => {
|
|
113
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
114
|
+
return html(_t || (_t = _2`
|
|
115
|
+
<div
|
|
116
|
+
class="${0}"
|
|
117
|
+
role="switch"
|
|
118
|
+
aria-checked="${0}"
|
|
119
|
+
aria-disabled="${0}"
|
|
120
|
+
aria-readonly="${0}"
|
|
121
|
+
tabindex="${0}"
|
|
122
|
+
@keypress="${0}"
|
|
123
|
+
@click="${0}"
|
|
124
|
+
>
|
|
125
|
+
<div class="switch">
|
|
126
|
+
<span class="checked-indicator"></span>
|
|
127
|
+
${0}
|
|
128
|
+
</div>
|
|
129
|
+
${0}
|
|
130
|
+
</div>
|
|
131
|
+
`), getClasses, x => x.checked, x => x.disabled, x => x.readOnly, x => x.disabled ? null : 0, (x, c) => x.keypressHandler(c.event), (x, c) => x.clickHandler(c.event), () => focusTemplate, when(x => x.label, html(_t2 || (_t2 = _2`<div class="label">
|
|
132
|
+
${0}
|
|
133
|
+
</div>`), x => x.label)));
|
|
134
|
+
};
|
|
24
135
|
|
|
25
|
-
const
|
|
26
|
-
baseName: '
|
|
27
|
-
template:
|
|
136
|
+
const switchDefinition = Switch.compose({
|
|
137
|
+
baseName: 'switch',
|
|
138
|
+
template: SwitchTemplate,
|
|
139
|
+
styles: css_248z,
|
|
140
|
+
shadowOptions: {
|
|
141
|
+
delegatesFocus: true
|
|
142
|
+
}
|
|
28
143
|
});
|
|
29
|
-
const
|
|
30
|
-
const
|
|
144
|
+
const switchRegistries = [switchDefinition(), ...iconRegistries, ...focusRegistries];
|
|
145
|
+
const registerSwitch = registerFactory(switchRegistries);
|
|
31
146
|
|
|
32
|
-
export {
|
|
147
|
+
export { switchRegistries as a, registerSwitch as r, switchDefinition as s };
|