@vonage/vivid 3.32.0 → 3.34.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.js +5 -5
- package/accordion-item/index.js +4 -4
- package/action-group/index.js +1 -1
- package/alert/index.js +6 -6
- package/avatar/index.js +2 -2
- package/badge/index.js +2 -2
- package/banner/index.js +5 -5
- package/breadcrumb/index.js +1 -1
- package/breadcrumb-item/index.js +3 -3
- package/button/index.js +4 -4
- package/calendar/index.js +1 -1
- package/calendar-event/index.js +1 -1
- package/card/index.js +3 -3
- package/checkbox/index.js +5 -3
- package/combobox/index.js +8 -8
- package/custom-elements.json +246 -16
- package/data-grid/index.js +2 -2
- package/date-picker/index.js +9 -9
- package/dialog/index.js +6 -6
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -2
- package/fab/index.js +4 -4
- package/file-picker/index.js +5 -5
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +59 -59
- package/layout/index.js +1 -1
- package/lib/calendar/calendar.d.ts +1 -1
- package/lib/date-picker/calendar/dateStr.d.ts +1 -0
- package/lib/date-picker/calendar/month.d.ts +1 -0
- package/lib/date-picker/calendar/year.d.ts +2 -0
- package/lib/date-picker/date-picker.d.ts +2 -0
- package/lib/icon/icon.d.ts +0 -1
- package/lib/listbox/listbox.d.ts +9 -1
- package/lib/text-field/text-field.d.ts +1 -0
- package/listbox/index.js +20 -16
- package/locales/en-GB.js +48 -14
- package/locales/en-US.js +48 -14
- package/locales/ja-JP.js +48 -14
- package/locales/zh-CN.js +48 -14
- package/menu/index.js +8 -8
- package/menu-item/index.js +4 -4
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +3 -3
- package/nav-item/index.js +3 -3
- package/note/index.js +2 -3
- package/number-field/index.js +6 -6
- package/option/index.js +3 -3
- package/package.json +2 -16
- package/pagination/index.js +5 -5
- package/popup/index.js +6 -6
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +2 -2
- package/radio-group/index.js +1 -1
- package/select/index.js +8 -8
- package/shared/affix.js +25 -9
- package/shared/apply-mixins.js +1 -1
- package/shared/breadcrumb-item.js +5 -5
- package/shared/button.js +13 -13
- package/shared/calendar-event.js +36 -16
- package/shared/definition.js +133 -194
- package/shared/definition10.js +225 -40
- package/shared/definition11.js +36 -32
- package/shared/definition12.js +763 -98
- package/shared/definition13.js +125 -89
- package/shared/definition14.js +207 -27
- package/shared/definition15.js +710 -731
- package/shared/definition16.js +1289 -47
- package/shared/definition17.js +6113 -93
- package/shared/definition18.js +242 -164
- package/shared/definition19.js +47 -692
- package/shared/definition2.js +199 -117
- package/shared/definition20.js +59 -1671
- package/shared/definition21.js +95 -255
- package/shared/definition22.js +2218 -1167
- package/shared/definition23.js +61 -5784
- package/shared/definition24.js +28 -117
- package/shared/definition25.js +52 -66
- package/shared/definition26.js +391 -214
- package/shared/definition27.js +441 -34
- package/shared/definition28.js +85 -73
- package/shared/definition29.js +21 -2283
- package/shared/definition3.js +61 -24
- package/shared/definition30.js +13 -49
- package/shared/definition31.js +54 -39
- package/shared/definition32.js +413 -375
- package/shared/definition33.js +223 -304
- package/shared/definition34.js +197 -13
- package/shared/definition35.js +88 -73
- package/shared/definition36.js +75 -25
- package/shared/definition37.js +434 -34
- package/shared/definition38.js +32 -432
- package/shared/definition39.js +677 -187
- package/shared/definition4.js +157 -12
- package/shared/definition40.js +95 -48
- package/shared/definition41.js +577 -31
- package/shared/definition42.js +126 -424
- package/shared/definition43.js +114 -618
- package/shared/definition44.js +24 -80
- package/shared/definition45.js +71 -543
- package/shared/definition46.js +499 -92
- package/shared/definition47.js +19 -133
- package/shared/definition48.js +129 -52
- package/shared/definition49.js +281 -17
- package/shared/definition5.js +71 -36
- package/shared/definition50.js +153 -484
- package/shared/definition51.js +131 -98
- package/shared/definition52.js +131 -16
- package/shared/definition53.js +80 -264
- package/shared/definition54.js +293 -118
- package/shared/definition55.js +12 -117
- package/shared/definition56.js +39 -68
- package/shared/definition57.js +166 -288
- package/shared/definition6.js +56 -111
- package/shared/definition7.js +120 -195
- package/shared/definition8.js +58 -23
- package/shared/definition9.js +92 -66
- package/shared/focus.js +2 -1
- package/shared/focus2.js +1 -1
- package/shared/form-associated.js +2 -2
- package/shared/icon.js +48 -27
- package/shared/index.js +7 -27
- package/shared/index2.js +108 -80
- package/shared/key-codes.js +1 -1
- package/shared/listbox.js +88 -11
- package/shared/patterns/form-elements/form-elements.d.ts +4 -4
- package/shared/radio.js +23 -7
- package/shared/repeat.js +1 -1
- package/shared/text-anchor.js +21 -4
- package/shared/text-anchor.template.js +37 -40
- package/shared/text-field.js +2 -2
- package/shared/text-field2.js +15 -15
- package/shared/tree-item.js +12 -12
- package/side-drawer/index.js +1 -1
- package/slider/index.js +2 -2
- package/split-button/index.js +3 -3
- package/style.css +6097 -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.js +3 -3
- package/tab/index.js +3 -3
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +5 -5
- package/tag/index.js +3 -3
- package/tag-group/index.js +1 -1
- package/text-anchor/index.js +1 -1
- package/text-area/index.js +3 -3
- package/text-field/index.js +3 -3
- package/toggletip/index.js +7 -7
- package/tooltip/index.js +7 -7
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/lib/accordion/index.d.ts +0 -1
- package/lib/accordion-item/index.d.ts +0 -1
- package/lib/action-group/index.d.ts +0 -1
- package/lib/alert/index.d.ts +0 -1
- package/lib/avatar/index.d.ts +0 -1
- package/lib/badge/index.d.ts +0 -1
- package/lib/banner/index.d.ts +0 -1
- package/lib/breadcrumb/index.d.ts +0 -1
- package/lib/breadcrumb-item/index.d.ts +0 -1
- package/lib/button/index.d.ts +0 -1
- package/lib/calendar/index.d.ts +0 -1
- package/lib/calendar-event/index.d.ts +0 -1
- package/lib/card/index.d.ts +0 -1
- package/lib/checkbox/index.d.ts +0 -1
- package/lib/combobox/index.d.ts +0 -1
- package/lib/data-grid/index.d.ts +0 -1
- package/lib/date-picker/index.d.ts +0 -1
- package/lib/dialog/index.d.ts +0 -1
- package/lib/divider/index.d.ts +0 -1
- package/lib/elevation/index.d.ts +0 -1
- package/lib/empty-state/index.d.ts +0 -1
- package/lib/fab/index.d.ts +0 -1
- package/lib/file-picker/index.d.ts +0 -1
- package/lib/focus/index.d.ts +0 -1
- package/lib/header/index.d.ts +0 -1
- package/lib/icon/index.d.ts +0 -1
- package/lib/layout/index.d.ts +0 -1
- package/lib/listbox/index.d.ts +0 -1
- package/lib/menu/index.d.ts +0 -1
- package/lib/menu-item/index.d.ts +0 -1
- package/lib/nav/index.d.ts +0 -1
- package/lib/nav-disclosure/index.d.ts +0 -1
- package/lib/nav-item/index.d.ts +0 -1
- package/lib/note/index.d.ts +0 -1
- package/lib/number-field/index.d.ts +0 -1
- package/lib/option/index.d.ts +0 -1
- package/lib/pagination/index.d.ts +0 -1
- package/lib/popup/index.d.ts +0 -1
- package/lib/progress/index.d.ts +0 -1
- package/lib/progress-ring/index.d.ts +0 -1
- package/lib/radio/index.d.ts +0 -1
- package/lib/radio-group/index.d.ts +0 -1
- package/lib/select/index.d.ts +0 -1
- package/lib/side-drawer/index.d.ts +0 -1
- package/lib/slider/index.d.ts +0 -1
- package/lib/split-button/index.d.ts +0 -1
- package/lib/switch/index.d.ts +0 -1
- package/lib/tab/index.d.ts +0 -1
- package/lib/tab-panel/index.d.ts +0 -1
- package/lib/tabs/index.d.ts +0 -1
- package/lib/tag/index.d.ts +0 -1
- package/lib/tag-group/index.d.ts +0 -1
- package/lib/text-anchor/index.d.ts +0 -1
- package/lib/text-area/index.d.ts +0 -1
- package/lib/text-field/index.d.ts +0 -1
- package/lib/toggletip/index.d.ts +0 -1
- package/lib/tooltip/index.d.ts +0 -1
- package/lib/tree-item/index.d.ts +0 -1
- package/lib/tree-view/index.d.ts +0 -1
package/shared/definition13.js
CHANGED
|
@@ -1,98 +1,134 @@
|
|
|
1
|
-
import { F as FoundationElement,
|
|
2
|
-
import {
|
|
1
|
+
import { F as FoundationElement, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { a as iconRegistries } from './definition24.js';
|
|
3
|
+
import { E as Elevation, e as elevationRegistries } from './definition56.js';
|
|
4
|
+
import { I as Icon } from './icon.js';
|
|
5
|
+
import { w as when } from './when.js';
|
|
3
6
|
import { s as slotted } from './slotted.js';
|
|
4
|
-
import {
|
|
7
|
+
import { c as classNames } from './class-names.js';
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const lastNode = this.slottedBreadcrumbItems[this.slottedBreadcrumbItems.length - 1];
|
|
21
|
-
this.slottedBreadcrumbItems.forEach((item) => {
|
|
22
|
-
const itemIsLastNode = item === lastNode;
|
|
23
|
-
this.setItemSeparator(item, itemIsLastNode);
|
|
24
|
-
this.setAriaCurrent(item, itemIsLastNode);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
setItemSeparator(item, isLastNode) {
|
|
29
|
-
if (item instanceof BreadcrumbItem) {
|
|
30
|
-
item.separator = !isLastNode;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Finds href on childnodes in the light DOM or shadow DOM.
|
|
35
|
-
* We look in the shadow DOM because we insert an anchor when breadcrumb-item has an href.
|
|
36
|
-
*/
|
|
37
|
-
findChildWithHref(node) {
|
|
38
|
-
var _a, _b;
|
|
39
|
-
if (node.childElementCount > 0) {
|
|
40
|
-
return node.querySelector("a[href]");
|
|
41
|
-
}
|
|
42
|
-
else if ((_a = node.shadowRoot) === null || _a === void 0 ? void 0 : _a.childElementCount) {
|
|
43
|
-
return (_b = node.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("a[href]");
|
|
44
|
-
}
|
|
45
|
-
else
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Sets ARIA Current for the current node
|
|
50
|
-
* If child node with an anchor tag and with href is found then set aria-current to correct value for the child node,
|
|
51
|
-
* otherwise apply aria-current to the host element, with an href
|
|
52
|
-
*/
|
|
53
|
-
setAriaCurrent(item, isLastNode) {
|
|
54
|
-
const childNodeWithHref = this.findChildWithHref(item);
|
|
55
|
-
if (childNodeWithHref === null &&
|
|
56
|
-
item.hasAttribute("href") &&
|
|
57
|
-
item instanceof BreadcrumbItem) {
|
|
58
|
-
isLastNode
|
|
59
|
-
? item.setAttribute("aria-current", "page")
|
|
60
|
-
: item.removeAttribute("aria-current");
|
|
61
|
-
}
|
|
62
|
-
else if (childNodeWithHref !== null) {
|
|
63
|
-
isLastNode
|
|
64
|
-
? childNodeWithHref.setAttribute("aria-current", "page")
|
|
65
|
-
: childNodeWithHref.removeAttribute("aria-current");
|
|
66
|
-
}
|
|
67
|
-
}
|
|
9
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Mon, 04 Sep 2023 12:44:18 GMT\n */\n:host {\n display: flex;\n}\n\n.base {\n border-radius: 6px;\n inline-size: 100%;\n text-align: start;\n}\n\n.wrapper {\n display: flex;\n overflow: hidden;\n flex-flow: column;\n block-size: 100%;\n border-radius: inherit;\n color: var(--vvd-color-canvas-text);\n}\n\n.main-content {\n display: flex;\n flex-flow: column;\n padding: 24px;\n}\n\n.header {\n display: flex;\n flex: 1;\n align-items: flex-start;\n gap: 8px;\n}\n.header-content {\n flex: 1;\n}\n.header-wrapper {\n display: flex;\n gap: 8px;\n}\n.header-headline, .header-subtitle {\n /* stylelint-disable value-no-vendor-prefix */\n display: -webkit-box;\n /* stylelint-enable value-no-vendor-prefix */\n overflow: hidden;\n -webkit-box-orient: vertical;\n}\n.header-headline {\n font: var(--vvd-typography-heading-4);\n -webkit-line-clamp: var(--headline-line-clamp);\n}\n.header-subtitle {\n font: var(--vvd-typography-base);\n -webkit-line-clamp: var(--subtitle-line-clamp);\n}\n.hide-header .header {\n display: none;\n}\n\n.header-subtitle,\n.text {\n color: var(--vvd-color-neutral-600);\n font: var(--vvd-typography-base);\n}\n\n.text {\n padding-right: 8px;\n margin-top: 12px;\n}\n\n.footer {\n display: inline-flex;\n flex-direction: column;\n align-items: flex-end;\n padding-bottom: 24px;\n margin-top: auto;\n padding-inline: 24px;\n}\n.hide-footer .footer {\n display: none;\n}\n\n::slotted([slot=graphic i]),\n.icon {\n flex-shrink: 0;\n align-self: baseline;\n margin-block-start: 4px;\n}\n\n.icon {\n font-size: 20px;\n}\n\n::slotted([slot=meta i]) {\n flex-shrink: 0;\n align-self: flex-start;\n margin-block-start: -8px;\n margin-inline-end: -8px;\n margin-inline-start: auto;\n}";
|
|
10
|
+
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
14
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
15
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
16
|
+
if (decorator = decorators[i])
|
|
17
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
18
|
+
if (kind && result)
|
|
19
|
+
__defProp(target, key, result);
|
|
20
|
+
return result;
|
|
21
|
+
};
|
|
22
|
+
class Card extends FoundationElement {
|
|
68
23
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
],
|
|
24
|
+
__decorateClass([
|
|
25
|
+
attr
|
|
26
|
+
], Card.prototype, "headline", 2);
|
|
27
|
+
__decorateClass([
|
|
28
|
+
attr
|
|
29
|
+
], Card.prototype, "subtitle", 2);
|
|
30
|
+
__decorateClass([
|
|
31
|
+
attr
|
|
32
|
+
], Card.prototype, "text", 2);
|
|
33
|
+
__decorateClass([
|
|
34
|
+
attr
|
|
35
|
+
], Card.prototype, "icon", 2);
|
|
36
|
+
__decorateClass([
|
|
37
|
+
attr
|
|
38
|
+
], Card.prototype, "elevation", 2);
|
|
39
|
+
__decorateClass([
|
|
40
|
+
observable
|
|
41
|
+
], Card.prototype, "footerSlottedContent", 2);
|
|
42
|
+
__decorateClass([
|
|
43
|
+
observable
|
|
44
|
+
], Card.prototype, "graphicSlottedContent", 2);
|
|
45
|
+
__decorateClass([
|
|
46
|
+
observable
|
|
47
|
+
], Card.prototype, "hasMetaSlottedContent", 2);
|
|
72
48
|
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
})}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
49
|
+
const getClasses = (_) => classNames(
|
|
50
|
+
"base",
|
|
51
|
+
["hide-footer", !_.footerSlottedContent || !_.footerSlottedContent.length],
|
|
52
|
+
["hide-header", shouldHideHeader(_)]
|
|
53
|
+
);
|
|
54
|
+
function renderHeaderIcon(iconTag) {
|
|
55
|
+
return html`
|
|
56
|
+
<${iconTag} class="icon" inline name="${(x) => x.icon}"></${iconTag}>`;
|
|
57
|
+
}
|
|
58
|
+
function Headline() {
|
|
59
|
+
return html`
|
|
60
|
+
<div class="header-headline">${(x) => x.headline}</div>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
function Subtitle() {
|
|
64
|
+
return html`
|
|
65
|
+
<div class="header-subtitle">${(x) => x.subtitle}</div>
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
function headerContent() {
|
|
69
|
+
return html`
|
|
70
|
+
<div class="header-content">
|
|
71
|
+
${when((x) => x.headline, Headline())}
|
|
72
|
+
${when((x) => x.subtitle, Subtitle())}
|
|
73
|
+
</div>
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
function renderHeader(iconTag) {
|
|
77
|
+
return html`
|
|
78
|
+
<header class="header">
|
|
79
|
+
<slot name="graphic" ${slotted("graphicSlottedContent")}>${when((x) => x.icon, renderHeaderIcon(iconTag))}</slot>
|
|
80
|
+
${when((x) => x.headline || x.subtitle, headerContent())}
|
|
81
|
+
</header>`;
|
|
82
|
+
}
|
|
83
|
+
function shouldHideHeader(card) {
|
|
84
|
+
return !card.headline && !card.subtitle && !card.icon && (!card.graphicSlottedContent || !card.graphicSlottedContent.length);
|
|
85
|
+
}
|
|
86
|
+
function renderMetaSlot() {
|
|
87
|
+
return html`
|
|
88
|
+
<slot name="meta" ${slotted("metaSlottedContent")}></slot>
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
function text() {
|
|
92
|
+
return html`
|
|
93
|
+
<div class="text">${(x) => x.text}</div>
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
const CardTemplate = (context) => {
|
|
97
|
+
const elevationTag = context.tagFor(Elevation);
|
|
98
|
+
const iconTag = context.tagFor(Icon);
|
|
99
|
+
return html`
|
|
100
|
+
<${elevationTag} dp=${(x) => x.elevation ?? "4"}>
|
|
85
101
|
|
|
86
|
-
|
|
102
|
+
<div class="${getClasses}">
|
|
103
|
+
<div class="wrapper">
|
|
104
|
+
<div class="vwc-card-media">
|
|
105
|
+
<slot name="media"></slot>
|
|
106
|
+
</div>
|
|
107
|
+
<slot name="main">
|
|
108
|
+
<div class="main-content">
|
|
109
|
+
<div class="header-wrapper">
|
|
110
|
+
${renderHeader(iconTag)}
|
|
111
|
+
${renderMetaSlot()}
|
|
112
|
+
</div>
|
|
113
|
+
${when((x) => x.text, text())}
|
|
114
|
+
</div>
|
|
115
|
+
</slot>
|
|
116
|
+
<div class="footer">
|
|
117
|
+
<slot name="footer" ${slotted("footerSlottedContent")}></slot>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
87
121
|
|
|
88
|
-
|
|
122
|
+
</${elevationTag}>
|
|
123
|
+
`;
|
|
124
|
+
};
|
|
89
125
|
|
|
90
|
-
const
|
|
91
|
-
baseName:
|
|
92
|
-
template:
|
|
93
|
-
styles
|
|
126
|
+
const cardDefinition = Card.compose({
|
|
127
|
+
baseName: "card",
|
|
128
|
+
template: CardTemplate,
|
|
129
|
+
styles
|
|
94
130
|
});
|
|
95
|
-
const
|
|
96
|
-
const
|
|
131
|
+
const cardRegistries = [cardDefinition(), ...iconRegistries, ...elevationRegistries];
|
|
132
|
+
const registerCard = registerFactory(cardRegistries);
|
|
97
133
|
|
|
98
|
-
export {
|
|
134
|
+
export { cardRegistries as a, cardDefinition as c, registerCard as r };
|
package/shared/definition14.js
CHANGED
|
@@ -1,43 +1,223 @@
|
|
|
1
|
-
import { _ as __decorate, a as attr,
|
|
2
|
-
import {
|
|
3
|
-
import { f as focusRegistries } from './
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { a as iconRegistries } from './definition24.js';
|
|
3
|
+
import { f as focusRegistries } from './definition55.js';
|
|
4
|
+
import './affix.js';
|
|
5
|
+
import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, g as getFeedbackTemplate } from './index2.js';
|
|
6
|
+
import { C as CheckableFormAssociated } from './form-associated.js';
|
|
7
|
+
import { a as keySpace$1 } from './key-codes.js';
|
|
8
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
9
|
+
import { f as focusTemplateFactory } from './focus2.js';
|
|
6
10
|
import { I as Icon } from './icon.js';
|
|
7
11
|
import { w as when } from './when.js';
|
|
12
|
+
import { s as slotted } from './slotted.js';
|
|
8
13
|
import { c as classNames } from './class-names.js';
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
class _Checkbox extends FoundationElement {
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A form-associated base class for the {@link @microsoft/fast-foundation#(Checkbox:class)} component.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
class FormAssociatedCheckbox extends CheckableFormAssociated(_Checkbox) {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.proxy = document.createElement("input");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A Checkbox Custom HTML Element.
|
|
31
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#checkbox | ARIA checkbox }.
|
|
32
|
+
*
|
|
33
|
+
* @slot checked-indicator - The checked indicator
|
|
34
|
+
* @slot indeterminate-indicator - The indeterminate indicator
|
|
35
|
+
* @slot - The default slot for the label
|
|
36
|
+
* @csspart control - The element representing the visual checkbox control
|
|
37
|
+
* @csspart label - The label
|
|
38
|
+
* @fires change - Emits a custom change event when the checked state changes
|
|
39
|
+
*
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
let Checkbox$1 = class Checkbox extends FormAssociatedCheckbox {
|
|
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
|
+
* The indeterminate state of the control
|
|
54
|
+
*/
|
|
55
|
+
this.indeterminate = false;
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
this.keypressHandler = (e) => {
|
|
60
|
+
if (this.readOnly) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
switch (e.key) {
|
|
64
|
+
case keySpace$1:
|
|
65
|
+
if (this.indeterminate) {
|
|
66
|
+
this.indeterminate = false;
|
|
67
|
+
}
|
|
68
|
+
this.checked = !this.checked;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
this.clickHandler = (e) => {
|
|
76
|
+
if (!this.disabled && !this.readOnly) {
|
|
77
|
+
if (this.indeterminate) {
|
|
78
|
+
this.indeterminate = false;
|
|
79
|
+
}
|
|
80
|
+
this.checked = !this.checked;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
this.proxy.setAttribute("type", "checkbox");
|
|
84
|
+
}
|
|
85
|
+
readOnlyChanged() {
|
|
86
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
87
|
+
this.proxy.readOnly = this.readOnly;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
__decorate([
|
|
92
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
93
|
+
], Checkbox$1.prototype, "readOnly", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
observable
|
|
96
|
+
], Checkbox$1.prototype, "defaultSlottedNodes", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
observable
|
|
99
|
+
], Checkbox$1.prototype, "indeterminate", void 0);
|
|
100
|
+
|
|
101
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Mon, 04 Sep 2023 12:44:18 GMT\n */\n.base {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n vertical-align: middle;\n}\n.base.connotation-cta {\n /* @cssprop [--vvd-checkbox-cta-primary=var(--vvd-color-cta-500)] */\n --_connotation-color-primary: var(--vvd-checkbox-cta-primary, var(--vvd-color-cta-500));\n /* @cssprop [--vvd-checkbox-cta-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-checkbox-cta-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-checkbox-cta-primary-increment=var(--vvd-color-cta-600)] */\n --_connotation-color-primary-increment: var(--vvd-checkbox-cta-primary-increment, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-checkbox-cta-intermediate=var(--vvd-color-cta-500)] */\n --_connotation-color-intermediate: var(--vvd-checkbox-cta-intermediate, var(--vvd-color-cta-500));\n /* @cssprop [--vvd-checkbox-cta-backdrop=var(--vvd-color-cta-50)] */\n --_connotation-color-backdrop: var(--vvd-checkbox-cta-backdrop, var(--vvd-color-cta-50));\n /* @cssprop [--vvd-checkbox-cta-firm=var(--vvd-color-cta-600)] */\n --_connotation-color-firm: var(--vvd-checkbox-cta-firm, var(--vvd-color-cta-600));\n}\n.base:not(.connotation-cta) {\n /* @cssprop [--vvd-checkbox-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-checkbox-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-checkbox-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-checkbox-accent-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-checkbox-accent-primary-increment=var(--vvd-color-neutral-800)] */\n --_connotation-color-primary-increment: var(--vvd-checkbox-accent-primary-increment, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-checkbox-accent-intermediate=var(--vvd-color-neutral-500)] */\n --_connotation-color-intermediate: var(--vvd-checkbox-accent-intermediate, var(--vvd-color-neutral-500));\n /* @cssprop [--vvd-checkbox-accent-backdrop=var(--vvd-color-canvas)] */\n --_connotation-color-backdrop: var(--vvd-checkbox-accent-backdrop, var(--vvd-color-canvas));\n /* @cssprop [--vvd-checkbox-accent-firm=var(--vvd-color-canvas-text)] */\n --_connotation-color-firm: var(--vvd-checkbox-accent-firm, var(--vvd-color-canvas-text));\n}\n.base {\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.base: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.base:where(:checked, .checked):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: var(--_connotation-color-primary);\n}\n.base:where(:checked, .checked):where(:hover, .hover) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary-increment);\n --_appearance-color-outline: var(--_connotation-color-primary);\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-300);\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n@supports selector(:focus-visible) {\n .base:focus-visible {\n outline: none;\n }\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n cursor: pointer;\n}\n.base.disabled {\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.control {\n position: relative;\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: 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: 5px;\n box-shadow: inset 0 0 0 2px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n}\n\n.indicator {\n font-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) - 4px);\n}\n.base:not(.checked) .indicator.checkmark {\n display: none;\n}\n\n.base.checked .indicator.minus, .base:not(.indeterminate) .indicator.minus {\n display: none;\n}\n\nlabel {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n color: var(--vvd-color-canvas-text);\n column-gap: 4px;\n cursor: pointer;\n font: var(--vvd-typography-base);\n}\n.hide-label label {\n display: none;\n}\n\n.focus-indicator {\n --focus-inset: -3px;\n --focus-stroke-gap-color: transparent;\n border-radius: 6px;\n}\n.base:not(:focus-visible) .focus-indicator {\n display: none;\n}\n\n.icon {\n font-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) * 0.6);\n line-height: 1;\n}\n\n.message {\n margin-block-start: 4px;\n --_low-ink-color: var(--vvd-color-neutral-600);\n}";
|
|
11
102
|
|
|
12
|
-
|
|
103
|
+
var __defProp = Object.defineProperty;
|
|
104
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
105
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
106
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
107
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
108
|
+
if (decorator = decorators[i])
|
|
109
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
110
|
+
if (kind && result)
|
|
111
|
+
__defProp(target, key, result);
|
|
112
|
+
return result;
|
|
113
|
+
};
|
|
114
|
+
const keySpace = " ";
|
|
115
|
+
let Checkbox = class extends Checkbox$1 {
|
|
13
116
|
constructor() {
|
|
14
|
-
super();
|
|
117
|
+
super(...arguments);
|
|
118
|
+
/**
|
|
119
|
+
* !remove method as will be implemented by fast-foundation in version after 2.46.9
|
|
120
|
+
*
|
|
121
|
+
* @internal
|
|
122
|
+
*/
|
|
123
|
+
this.keypressHandler = (event) => {
|
|
124
|
+
if (event.target instanceof HTMLAnchorElement) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
switch (event.key) {
|
|
128
|
+
case keySpace:
|
|
129
|
+
if (this.indeterminate) {
|
|
130
|
+
this.indeterminate = false;
|
|
131
|
+
}
|
|
132
|
+
this.checked = !this.checked;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
return false;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* !remove method as will be implemented by fast-foundation in version after 2.46.9
|
|
139
|
+
*
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
142
|
+
this.clickHandler = (event) => {
|
|
143
|
+
if (event.target instanceof HTMLAnchorElement) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
if (!this.disabled && !this.readOnly) {
|
|
147
|
+
if (this.indeterminate) {
|
|
148
|
+
this.indeterminate = false;
|
|
149
|
+
}
|
|
150
|
+
this.checked = !this.checked;
|
|
151
|
+
}
|
|
152
|
+
return false;
|
|
153
|
+
};
|
|
15
154
|
}
|
|
16
|
-
}
|
|
17
|
-
|
|
155
|
+
};
|
|
156
|
+
__decorateClass([
|
|
157
|
+
attr
|
|
158
|
+
], Checkbox.prototype, "connotation", 2);
|
|
159
|
+
__decorateClass([
|
|
160
|
+
observable
|
|
161
|
+
], Checkbox.prototype, "slottedContent", 2);
|
|
162
|
+
Checkbox = __decorateClass([
|
|
163
|
+
errorText,
|
|
164
|
+
formElements
|
|
165
|
+
], Checkbox);
|
|
166
|
+
applyMixins(Checkbox, FormElementHelperText, FormElementSuccessText);
|
|
18
167
|
|
|
19
|
-
const getClasses =
|
|
20
|
-
|
|
168
|
+
const getClasses = ({
|
|
169
|
+
connotation,
|
|
170
|
+
readOnly,
|
|
171
|
+
checked,
|
|
172
|
+
disabled,
|
|
173
|
+
indeterminate,
|
|
174
|
+
errorValidationMessage,
|
|
175
|
+
successText,
|
|
176
|
+
label,
|
|
177
|
+
slottedContent
|
|
178
|
+
}) => classNames(
|
|
179
|
+
"base",
|
|
180
|
+
[`connotation-${connotation}`, Boolean(connotation)],
|
|
181
|
+
["readonly", Boolean(readOnly)],
|
|
182
|
+
["checked", Boolean(checked) || Boolean(indeterminate)],
|
|
183
|
+
["disabled", Boolean(disabled)],
|
|
184
|
+
["error connotation-alert", Boolean(errorValidationMessage)],
|
|
185
|
+
["success connotation-success", !!successText],
|
|
186
|
+
["hide-label", !label && !slottedContent?.length]
|
|
187
|
+
);
|
|
188
|
+
const CheckboxTemplate = (context) => {
|
|
189
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
21
190
|
const iconTag = context.tagFor(Icon);
|
|
22
|
-
return html
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
191
|
+
return html`<div class="${getClasses}"
|
|
192
|
+
role="checkbox"
|
|
193
|
+
aria-checked="${(x) => x.checked}"
|
|
194
|
+
aria-required="${(x) => x.required}"
|
|
195
|
+
aria-disabled="${(x) => x.disabled}"
|
|
196
|
+
aria-readonly="${(x) => x.readOnly}"
|
|
197
|
+
tabindex="${(x) => x.disabled ? null : 0}"
|
|
198
|
+
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
199
|
+
@click="${(x, c) => x.clickHandler(c.event)}">
|
|
200
|
+
<div class="control">
|
|
201
|
+
${when((x) => x.checked, html`<${iconTag} name="check-solid" class="icon"></${iconTag}>`)}
|
|
202
|
+
${when((x) => x.indeterminate, html`<${iconTag} name="minus-solid" class="icon"></${iconTag}>`)}
|
|
203
|
+
${() => focusTemplate}
|
|
204
|
+
</div>
|
|
205
|
+
${html`<label>${(x) => x.label}<slot ${slotted("slottedContent")}></slot></label>`}
|
|
206
|
+
</div>
|
|
207
|
+
${when((x) => x.helperText?.length, getFeedbackTemplate("helper", context))}
|
|
208
|
+
${when((x) => !x.successText && x.errorValidationMessage, getFeedbackTemplate("error", context))}
|
|
209
|
+
${when((x) => x.successText, getFeedbackTemplate("success", context))}`;
|
|
30
210
|
};
|
|
31
211
|
|
|
32
|
-
const
|
|
33
|
-
baseName:
|
|
34
|
-
template:
|
|
35
|
-
styles
|
|
212
|
+
const checkboxDefinition = Checkbox.compose({
|
|
213
|
+
baseName: "checkbox",
|
|
214
|
+
template: CheckboxTemplate,
|
|
215
|
+
styles,
|
|
36
216
|
shadowOptions: {
|
|
37
217
|
delegatesFocus: true
|
|
38
218
|
}
|
|
39
219
|
});
|
|
40
|
-
const
|
|
41
|
-
const
|
|
220
|
+
const checkboxRegistries = [checkboxDefinition(), ...iconRegistries, ...focusRegistries];
|
|
221
|
+
const registerCheckbox = registerFactory(checkboxRegistries);
|
|
42
222
|
|
|
43
|
-
export {
|
|
223
|
+
export { checkboxRegistries as a, checkboxDefinition as c, registerCheckbox as r };
|