@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,198 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index.cjs');
|
|
4
|
+
const definition$2 = require('./definition11.cjs');
|
|
5
|
+
const definition = require('./definition59.cjs');
|
|
6
|
+
const definition$1 = require('./definition26.cjs');
|
|
7
|
+
const enums = require('./enums.cjs');
|
|
8
|
+
const affix = require('./affix.cjs');
|
|
9
|
+
require('./index2.cjs');
|
|
10
|
+
const localized = require('./localized.cjs');
|
|
11
|
+
const applyMixins = require('./apply-mixins.cjs');
|
|
12
|
+
const button = require('./button.cjs');
|
|
13
|
+
const when = require('./when.cjs');
|
|
14
|
+
const classNames = require('./class-names.cjs');
|
|
15
|
+
|
|
16
|
+
const styles = ".control{position:fixed;z-index:10;border-radius:8px;inline-size:max-content;inset-block-end:0;inset-inline-end:0;inset-inline-start:0;margin-block:16px;margin-inline:auto;max-inline-size:var(--alert-max-inline-size, fit-content);min-inline-size:var(--alert-min-inline-size, 420px);transition:opacity .15s cubic-bezier(0,0,.2,1) 0ms,transform .15s cubic-bezier(0,0,.2,1) 0ms}.control.placement-top,.control.placement-top-start,.control.placement-top-end{inset-block-end:auto;inset-block-start:0}.control.placement-top-start,.control.placement-bottom-start{right:auto;inset-inline-end:auto;margin-inline:16px}.control.placement-top-end,.control.placement-bottom-end{inset-inline-start:auto;margin-inline:16px}.control:where(.strategy-static){position:static;margin:0;inline-size:auto}.control:not(.open){opacity:0;transform:scale(.8)}.control.open{opacity:1;transform:scale(1)}.base{display:flex;align-items:center;padding:16px;background-color:var(--vvd-color-neutral-50);border-radius:8px;color:var(--vvd-color-canvas-text);column-gap:16px}.base.connotation-success{--_connotation-color-primary: var(--vvd-alert-success-primary, var(--vvd-color-success-500));--_connotation-color-primary-text: var(--vvd-alert-success-primary-text, var(--vvd-color-canvas))}.base.connotation-information{--_connotation-color-primary: var(--vvd-alert-information-primary, var(--vvd-color-information-500));--_connotation-color-primary-text: var(--vvd-alert-information-primary-text, var(--vvd-color-canvas))}.base.connotation-alert{--_connotation-color-primary: var(--vvd-alert-alert-primary, var(--vvd-color-alert-500));--_connotation-color-primary-text: var(--vvd-alert-alert-primary-text, var(--vvd-color-canvas))}.base.connotation-warning{--_connotation-color-primary: var(--vvd-alert-warning-primary, var(--vvd-color-warning-300));--_connotation-color-primary-text: var(--vvd-alert-warning-primary-text, var(--vvd-color-canvas-text))}.base:not(.connotation-success,.connotation-information,.connotation-alert,.connotation-warning){--_connotation-color-primary: var(--vvd-alert-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-alert-accent-primary-text, var(--vvd-color-canvas))}.base{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: transparent}.base .alert-text{margin-inline-end:auto}.base .alert-text .headline{font:var(--vvd-typography-base-bold);margin-block-end:4px}.base .alert-text .main-text{font:var(--vvd-typography-base)}.base .icon{flex-shrink:0;color:var(--_appearance-color-fill);font-size:24px;line-height:1}.base .dismiss-button{border-left:1px solid var(--vvd-color-neutral-200);padding-inline-start:8px}\n";
|
|
17
|
+
|
|
18
|
+
var __defProp = Object.defineProperty;
|
|
19
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
20
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
21
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
22
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
23
|
+
if (decorator = decorators[i])
|
|
24
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
25
|
+
if (kind && result)
|
|
26
|
+
__defProp(target, key, result);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
const connotationIconMap = /* @__PURE__ */ new Map([
|
|
30
|
+
[enums.Connotation.Accent, "megaphone-line"],
|
|
31
|
+
[enums.Connotation.Information, "info-line"],
|
|
32
|
+
[enums.Connotation.Success, "check-circle-line"],
|
|
33
|
+
[enums.Connotation.Warning, "warning-line"],
|
|
34
|
+
[enums.Connotation.Alert, "error-line"]
|
|
35
|
+
]);
|
|
36
|
+
class Alert extends index.FoundationElement {
|
|
37
|
+
constructor() {
|
|
38
|
+
super(...arguments);
|
|
39
|
+
this.dismissButtonAriaLabel = null;
|
|
40
|
+
this.removable = false;
|
|
41
|
+
this.placement = "bottom";
|
|
42
|
+
this.timeoutms = 0;
|
|
43
|
+
this.open = false;
|
|
44
|
+
this.#closeOnEscape = (e) => {
|
|
45
|
+
if (this.removable && e.key === "Escape")
|
|
46
|
+
this.open = false;
|
|
47
|
+
};
|
|
48
|
+
this.#onTransitionEnd = () => {
|
|
49
|
+
if (!this.open) {
|
|
50
|
+
this.style.display = "none";
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// timeout to close the alert
|
|
55
|
+
#timeoutID;
|
|
56
|
+
openChanged(oldValue, newValue) {
|
|
57
|
+
if (oldValue === void 0)
|
|
58
|
+
return;
|
|
59
|
+
this.$emit(newValue ? "open" : "close");
|
|
60
|
+
this.#setupTimeout();
|
|
61
|
+
if (newValue) {
|
|
62
|
+
this.style.display = "inline";
|
|
63
|
+
const alertText = this.shadowRoot.querySelector(".alert-text");
|
|
64
|
+
if (this.removable && alertText) {
|
|
65
|
+
alertText.setAttribute("tabindex", "0");
|
|
66
|
+
alertText.focus();
|
|
67
|
+
alertText.removeAttribute("tabindex");
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
this.style.display = "none";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
connectedCallback() {
|
|
74
|
+
super.connectedCallback();
|
|
75
|
+
this.addEventListener("keydown", this.#closeOnEscape);
|
|
76
|
+
this.controlEl = this.shadowRoot.querySelector(".control");
|
|
77
|
+
if (this.controlEl)
|
|
78
|
+
this.controlEl.addEventListener("transitionend", this.#onTransitionEnd);
|
|
79
|
+
this.#setupTimeout();
|
|
80
|
+
}
|
|
81
|
+
disconnectedCallback() {
|
|
82
|
+
super.disconnectedCallback();
|
|
83
|
+
if (this.#timeoutID)
|
|
84
|
+
clearTimeout(this.#timeoutID);
|
|
85
|
+
this.removeEventListener("keydown", this.#closeOnEscape);
|
|
86
|
+
if (this.controlEl)
|
|
87
|
+
this.controlEl.removeEventListener("transitionend", this.#onTransitionEnd);
|
|
88
|
+
}
|
|
89
|
+
get conditionedIcon() {
|
|
90
|
+
return this.icon || connotationIconMap.get(this.connotation);
|
|
91
|
+
}
|
|
92
|
+
#setupTimeout() {
|
|
93
|
+
if (this.#timeoutID)
|
|
94
|
+
clearTimeout(this.#timeoutID);
|
|
95
|
+
if (this.open && this.timeoutms > 0) {
|
|
96
|
+
this.#timeoutID = setTimeout(() => this.open = false, this.timeoutms);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
#closeOnEscape;
|
|
100
|
+
#onTransitionEnd;
|
|
101
|
+
}
|
|
102
|
+
__decorateClass([
|
|
103
|
+
index.attr({ attribute: "dismiss-button-aria-label" })
|
|
104
|
+
], Alert.prototype, "dismissButtonAriaLabel", 2);
|
|
105
|
+
__decorateClass([
|
|
106
|
+
index.attr({ mode: "boolean" })
|
|
107
|
+
], Alert.prototype, "removable", 2);
|
|
108
|
+
__decorateClass([
|
|
109
|
+
index.attr({ mode: "fromView" })
|
|
110
|
+
], Alert.prototype, "placement", 2);
|
|
111
|
+
__decorateClass([
|
|
112
|
+
index.attr
|
|
113
|
+
], Alert.prototype, "headline", 2);
|
|
114
|
+
__decorateClass([
|
|
115
|
+
index.attr
|
|
116
|
+
], Alert.prototype, "text", 2);
|
|
117
|
+
__decorateClass([
|
|
118
|
+
index.attr
|
|
119
|
+
], Alert.prototype, "icon", 2);
|
|
120
|
+
__decorateClass([
|
|
121
|
+
index.attr({
|
|
122
|
+
mode: "fromView",
|
|
123
|
+
converter: index.nullableNumberConverter
|
|
124
|
+
})
|
|
125
|
+
], Alert.prototype, "timeoutms", 2);
|
|
126
|
+
__decorateClass([
|
|
127
|
+
index.attr
|
|
128
|
+
], Alert.prototype, "connotation", 2);
|
|
129
|
+
__decorateClass([
|
|
130
|
+
index.attr
|
|
131
|
+
], Alert.prototype, "strategy", 2);
|
|
132
|
+
__decorateClass([
|
|
133
|
+
index.attr({ mode: "boolean" })
|
|
134
|
+
], Alert.prototype, "open", 2);
|
|
135
|
+
applyMixins.applyMixins(Alert, affix.AffixIcon);
|
|
136
|
+
applyMixins.applyMixins(Alert, localized.Localized);
|
|
137
|
+
|
|
138
|
+
const getClasses = ({ connotation }) => classNames.classNames(
|
|
139
|
+
"base",
|
|
140
|
+
[`connotation-${connotation}`, Boolean(connotation)]
|
|
141
|
+
);
|
|
142
|
+
const getControlClasses = ({ open, placement, strategy }) => classNames.classNames(
|
|
143
|
+
"control",
|
|
144
|
+
["open", open],
|
|
145
|
+
[`placement-${placement}`, Boolean(placement)],
|
|
146
|
+
[`strategy-${strategy}`, Boolean(strategy)]
|
|
147
|
+
);
|
|
148
|
+
function renderIcon(context) {
|
|
149
|
+
const affixIconTemplate = affix.affixIconTemplateFactory(context);
|
|
150
|
+
return index.html`${(x) => affixIconTemplate(x.conditionedIcon)}`;
|
|
151
|
+
}
|
|
152
|
+
function renderDismissButton(buttonTag) {
|
|
153
|
+
return index.html`
|
|
154
|
+
<${buttonTag}
|
|
155
|
+
aria-label="${(x) => x.dismissButtonAriaLabel || x.locale.alert.dismissButtonLabel}"
|
|
156
|
+
size="condensed"
|
|
157
|
+
class="dismiss-button"
|
|
158
|
+
icon="close-line"
|
|
159
|
+
@click="${(x) => x.open = false}">
|
|
160
|
+
</${buttonTag}>`;
|
|
161
|
+
}
|
|
162
|
+
const AlertTemplate = (context) => {
|
|
163
|
+
const elevationTag = context.tagFor(definition.Elevation);
|
|
164
|
+
const buttonTag = context.tagFor(button.Button);
|
|
165
|
+
return index.html`
|
|
166
|
+
<${elevationTag} class="elevation" dp='8' exportparts="vvd-theme-alternate">
|
|
167
|
+
<div
|
|
168
|
+
class="${getControlClasses}"
|
|
169
|
+
role="${(x) => x.removable ? "alertdialog" : "alert"}"
|
|
170
|
+
aria-live="assertive"
|
|
171
|
+
>
|
|
172
|
+
<div part="vvd-theme-alternate" class="${getClasses}">
|
|
173
|
+
${when.when((x) => x.icon || x.connotation, renderIcon(context))}
|
|
174
|
+
<div class="alert-text">
|
|
175
|
+
${when.when((x) => x.headline, index.html`<header class="headline">${(x) => x.headline}</header>`)}
|
|
176
|
+
${when.when((x) => x.text, index.html`<div class="main-text">${(x) => x.text}</div>`)}
|
|
177
|
+
<slot name="main">
|
|
178
|
+
</slot>
|
|
179
|
+
</div>
|
|
180
|
+
<slot class="action-items" name="action-items"></slot>
|
|
181
|
+
${when.when((x) => x.removable, renderDismissButton(buttonTag))}
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
</${elevationTag}>
|
|
185
|
+
`;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const alertDefinition = Alert.compose({
|
|
189
|
+
baseName: "alert",
|
|
190
|
+
template: AlertTemplate,
|
|
191
|
+
styles
|
|
192
|
+
});
|
|
193
|
+
const alertRegistries = [alertDefinition(), ...definition$1.iconRegistries, ...definition$2.buttonRegistries, ...definition.elevationRegistries];
|
|
194
|
+
const registerAlert = index.registerFactory(alertRegistries);
|
|
195
|
+
|
|
196
|
+
exports.alertDefinition = alertDefinition;
|
|
197
|
+
exports.alertRegistries = alertRegistries;
|
|
198
|
+
exports.registerAlert = registerAlert;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index.cjs');
|
|
4
|
+
const definition = require('./definition58.cjs');
|
|
5
|
+
const radio = require('./radio.cjs');
|
|
6
|
+
const focus = require('./focus2.cjs');
|
|
7
|
+
const when = require('./when.cjs');
|
|
8
|
+
const classNames = require('./class-names.cjs');
|
|
9
|
+
|
|
10
|
+
const styles = "@supports selector(:focus-visible){:host(:focus-visible){outline:none}}:host([disabled]){cursor:not-allowed}.base{display:inline-flex;align-items:center;cursor:pointer;gap:8px}.base.connotation-cta{--_connotation-color-primary: var(--vvd-radio-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-radio-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-radio-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-intermediate: var(--vvd-radio-cta-intermediate, var(--vvd-color-cta-500));--_connotation-color-backdrop: var(--vvd-radio-cta-backdrop, var(--vvd-color-cta-50));--_connotation-color-firm: var(--vvd-radio-cta-firm, var(--vvd-color-cta-600))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-radio-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-radio-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-radio-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-radio-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-backdrop: var(--vvd-radio-accent-backdrop, var(--vvd-color-canvas));--_connotation-color-firm: var(--vvd-radio-accent-firm, var(--vvd-color-canvas-text))}.base{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--_connotation-color-backdrop);--_appearance-color-outline: var(--_connotation-color-intermediate)}.base:where(:hover,.hover):where(:not(:disabled,.disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--_connotation-color-backdrop);--_appearance-color-outline: var(--_connotation-color-firm)}.base:where(:checked,.checked):where(:not(:disabled,.disabled)){--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: var(--_connotation-color-primary)}.base:where(:checked,.checked):where(:hover,.hover):where(:not(:disabled,.disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary-increment);--_appearance-color-outline: var(--_connotation-color-primary)}.base:where(:disabled,.disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.base:where(.readonly):where(:not(:disabled,.disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}@supports (user-select: none){.base{user-select:none}}.base.disabled{pointer-events:none}.control{position:relative;flex-shrink:0;block-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2)));border-radius:50%;box-shadow:inset 0 0 0 2px var(--_appearance-color-outline);inline-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}.base:not(.checked) .control{background-color:var(--_appearance-color-fill)}.control:after{position:absolute;background-color:var(--_appearance-color-outline);border-radius:inherit;content:\"\";inset:5px;opacity:1;transition:opacity .2s}.base:not(.checked) .control:after{opacity:0}label{color:var(--vvd-color-canvas-text);cursor:pointer;font:var(--vvd-typography-base)}.focus-indicator{--focus-inset: -3px;--focus-stroke-gap-color: transparent;border-radius:50%}:host(:not(:focus-visible)) .focus-indicator{display:none}\n";
|
|
11
|
+
|
|
12
|
+
const getClasses = ({ connotation, checked, readOnly, disabled }) => classNames.classNames(
|
|
13
|
+
"base",
|
|
14
|
+
[`connotation-${connotation}`, Boolean(connotation)],
|
|
15
|
+
["checked", Boolean(checked)],
|
|
16
|
+
["readonly", Boolean(readOnly)],
|
|
17
|
+
["disabled", Boolean(disabled)]
|
|
18
|
+
);
|
|
19
|
+
const RadioTemplate = (context) => {
|
|
20
|
+
const focusTemplate = focus.focusTemplateFactory(context);
|
|
21
|
+
return index.html`<template role="${(x) => x.ariaLabel ? "presentation" : null}">
|
|
22
|
+
<div class="${getClasses}"
|
|
23
|
+
role="radio"
|
|
24
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
25
|
+
aria-checked="${(x) => x.checked}"
|
|
26
|
+
aria-required="${(x) => x.required}"
|
|
27
|
+
aria-disabled="${(x) => x.disabled}"
|
|
28
|
+
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
29
|
+
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
30
|
+
>
|
|
31
|
+
<div class="control">
|
|
32
|
+
${() => focusTemplate}
|
|
33
|
+
</div>
|
|
34
|
+
${when.when((x) => x.label, index.html`<label class="label">${(x) => x.label}</label>`)}
|
|
35
|
+
</div>
|
|
36
|
+
</template>`;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const radioDefinition = radio.Radio.compose({
|
|
40
|
+
baseName: "radio",
|
|
41
|
+
template: RadioTemplate,
|
|
42
|
+
styles
|
|
43
|
+
});
|
|
44
|
+
const radioRegistries = [radioDefinition(), ...definition.focusRegistries];
|
|
45
|
+
const registerRadio = index.registerFactory(radioRegistries);
|
|
46
|
+
|
|
47
|
+
exports.radioDefinition = radioDefinition;
|
|
48
|
+
exports.radioRegistries = radioRegistries;
|
|
49
|
+
exports.registerRadio = registerRadio;
|