@vonage/vivid 3.48.0 → 3.49.0-preview.1
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,157 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index.cjs');
|
|
4
|
+
const definition$1 = require('./definition26.cjs');
|
|
5
|
+
const definition = require('./definition59.cjs');
|
|
6
|
+
const enums = require('./enums.cjs');
|
|
7
|
+
const icon = require('./icon.cjs');
|
|
8
|
+
const when = require('./when.cjs');
|
|
9
|
+
const slotted = require('./slotted.cjs');
|
|
10
|
+
const classNames = require('./class-names.cjs');
|
|
11
|
+
|
|
12
|
+
const styles = ":host{display:flex}.base{border-radius:8px;inline-size:100%;text-align:start}.wrapper{display:flex;overflow:hidden;flex-flow:column;block-size:100%;border-radius:inherit;color:var(--vvd-color-canvas-text)}.main-content{display:flex;flex-flow:column;padding:24px}.header{display:flex;flex:1;align-items:flex-start;gap:8px}.header-content{flex:1}.header-wrapper{display:flex;gap:8px}.header-headline,.header-subtitle{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical}.header-headline{font:var(--vvd-typography-heading-4);-webkit-line-clamp:var(--headline-line-clamp)}.header-subtitle{font:var(--vvd-typography-base);-webkit-line-clamp:var(--subtitle-line-clamp)}.hide-header .header{display:none}.header-subtitle,.text{color:var(--vvd-color-neutral-600);font:var(--vvd-typography-base)}.text{padding-right:8px;margin-top:12px}.footer{display:inline-flex;flex-direction:column;align-items:flex-end;padding-bottom:24px;margin-top:auto;padding-inline:24px}.hide-footer .footer{display:none}::slotted([slot=graphic i]),.icon{flex-shrink:0;align-self:baseline;margin-block-start:4px}.icon{font-size:20px}::slotted([slot=meta i]){flex-shrink:0;align-self:flex-start;margin-block-start:-8px;margin-inline-end:-8px;margin-inline-start:auto}\n";
|
|
13
|
+
|
|
14
|
+
var __defProp = Object.defineProperty;
|
|
15
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
16
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
17
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
18
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
19
|
+
if (decorator = decorators[i])
|
|
20
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
21
|
+
if (kind && result)
|
|
22
|
+
__defProp(target, key, result);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
class Card extends index.FoundationElement {
|
|
26
|
+
}
|
|
27
|
+
__decorateClass([
|
|
28
|
+
index.attr
|
|
29
|
+
], Card.prototype, "appearance", 2);
|
|
30
|
+
__decorateClass([
|
|
31
|
+
index.attr
|
|
32
|
+
], Card.prototype, "headline", 2);
|
|
33
|
+
__decorateClass([
|
|
34
|
+
index.attr
|
|
35
|
+
], Card.prototype, "subtitle", 2);
|
|
36
|
+
__decorateClass([
|
|
37
|
+
index.attr
|
|
38
|
+
], Card.prototype, "text", 2);
|
|
39
|
+
__decorateClass([
|
|
40
|
+
index.attr
|
|
41
|
+
], Card.prototype, "icon", 2);
|
|
42
|
+
__decorateClass([
|
|
43
|
+
index.attr
|
|
44
|
+
], Card.prototype, "elevation", 2);
|
|
45
|
+
__decorateClass([
|
|
46
|
+
index.observable
|
|
47
|
+
], Card.prototype, "footerSlottedContent", 2);
|
|
48
|
+
__decorateClass([
|
|
49
|
+
index.observable
|
|
50
|
+
], Card.prototype, "graphicSlottedContent", 2);
|
|
51
|
+
__decorateClass([
|
|
52
|
+
index.observable
|
|
53
|
+
], Card.prototype, "hasMetaSlottedContent", 2);
|
|
54
|
+
|
|
55
|
+
const getClasses = (_) => classNames.classNames(
|
|
56
|
+
"base",
|
|
57
|
+
["hide-footer", !_.footerSlottedContent || !_.footerSlottedContent.length],
|
|
58
|
+
["hide-header", shouldHideHeader(_)]
|
|
59
|
+
);
|
|
60
|
+
function renderHeaderIcon(iconTag) {
|
|
61
|
+
return index.html`
|
|
62
|
+
<${iconTag} class="icon" inline name="${(x) => x.icon}"></${iconTag}>`;
|
|
63
|
+
}
|
|
64
|
+
function Headline() {
|
|
65
|
+
return index.html`
|
|
66
|
+
<div class="header-headline">${(x) => x.headline}</div>
|
|
67
|
+
`;
|
|
68
|
+
}
|
|
69
|
+
function Subtitle() {
|
|
70
|
+
return index.html`
|
|
71
|
+
<div class="header-subtitle">${(x) => x.subtitle}</div>
|
|
72
|
+
`;
|
|
73
|
+
}
|
|
74
|
+
function headerContent() {
|
|
75
|
+
return index.html`
|
|
76
|
+
<div class="header-content">
|
|
77
|
+
${when.when((x) => x.headline, Headline())}
|
|
78
|
+
${when.when((x) => x.subtitle, Subtitle())}
|
|
79
|
+
</div>
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
function renderHeader(iconTag) {
|
|
83
|
+
return index.html`
|
|
84
|
+
<header class="header">
|
|
85
|
+
<slot name="graphic" ${slotted.slotted("graphicSlottedContent")}>${when.when((x) => x.icon, renderHeaderIcon(iconTag))}</slot>
|
|
86
|
+
${when.when((x) => x.headline || x.subtitle, headerContent())}
|
|
87
|
+
</header>`;
|
|
88
|
+
}
|
|
89
|
+
function shouldHideHeader(card) {
|
|
90
|
+
return !card.headline && !card.subtitle && !card.icon && (!card.graphicSlottedContent || !card.graphicSlottedContent.length);
|
|
91
|
+
}
|
|
92
|
+
function renderMetaSlot() {
|
|
93
|
+
return index.html`
|
|
94
|
+
<slot name="meta" ${slotted.slotted("metaSlottedContent")}></slot>
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
function text() {
|
|
98
|
+
return index.html`
|
|
99
|
+
<div class="text">${(x) => x.text}</div>
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
function renderCardContent(context) {
|
|
103
|
+
const iconTag = context.tagFor(icon.Icon);
|
|
104
|
+
return index.html`
|
|
105
|
+
<div class="${getClasses}">
|
|
106
|
+
<div class="wrapper">
|
|
107
|
+
<div class="vwc-card-media">
|
|
108
|
+
<slot name="media"></slot>
|
|
109
|
+
</div>
|
|
110
|
+
<slot name="main">
|
|
111
|
+
<div class="main-content">
|
|
112
|
+
<div class="header-wrapper">
|
|
113
|
+
${renderHeader(iconTag)}
|
|
114
|
+
${renderMetaSlot()}
|
|
115
|
+
</div>
|
|
116
|
+
${when.when((x) => x.text, text())}
|
|
117
|
+
</div>
|
|
118
|
+
</slot>
|
|
119
|
+
<div class="footer">
|
|
120
|
+
<slot name="footer" ${slotted.slotted("footerSlottedContent")}></slot>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
`;
|
|
125
|
+
}
|
|
126
|
+
const CardTemplate = (context) => {
|
|
127
|
+
const elevationTag = context.tagFor(definition.Elevation);
|
|
128
|
+
return index.html`
|
|
129
|
+
${when.when((x) => x.appearance !== enums.Appearance.Ghost && x.appearance !== enums.Appearance.Outlined, index.html`
|
|
130
|
+
<${elevationTag} dp=${(x) => x.elevation ?? "4"}>
|
|
131
|
+
${renderCardContent(context)}
|
|
132
|
+
</${elevationTag}>
|
|
133
|
+
`)}
|
|
134
|
+
|
|
135
|
+
${when.when((x) => x.appearance === enums.Appearance.Outlined, index.html`
|
|
136
|
+
<${elevationTag} dp='0')}>
|
|
137
|
+
${renderCardContent(context)}
|
|
138
|
+
</${elevationTag}>
|
|
139
|
+
`)}
|
|
140
|
+
|
|
141
|
+
${when.when((x) => x.appearance === enums.Appearance.Ghost, index.html`
|
|
142
|
+
${renderCardContent(context)}
|
|
143
|
+
`)}
|
|
144
|
+
`;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const cardDefinition = Card.compose({
|
|
148
|
+
baseName: "card",
|
|
149
|
+
template: CardTemplate,
|
|
150
|
+
styles
|
|
151
|
+
});
|
|
152
|
+
const cardRegistries = [cardDefinition(), ...definition$1.iconRegistries, ...definition.elevationRegistries];
|
|
153
|
+
const registerCard = index.registerFactory(cardRegistries);
|
|
154
|
+
|
|
155
|
+
exports.cardDefinition = cardDefinition;
|
|
156
|
+
exports.cardRegistries = cardRegistries;
|
|
157
|
+
exports.registerCard = registerCard;
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index.cjs');
|
|
4
|
+
const definition = require('./definition26.cjs');
|
|
5
|
+
const definition$1 = require('./definition58.cjs');
|
|
6
|
+
require('./affix.cjs');
|
|
7
|
+
const index$1 = require('./index2.cjs');
|
|
8
|
+
const formAssociated = require('./form-associated.cjs');
|
|
9
|
+
const keyCodes = require('./key-codes.cjs');
|
|
10
|
+
const applyMixins = require('./apply-mixins.cjs');
|
|
11
|
+
const focus = require('./focus2.cjs');
|
|
12
|
+
const icon = require('./icon.cjs');
|
|
13
|
+
const when = require('./when.cjs');
|
|
14
|
+
const slotted = require('./slotted.cjs');
|
|
15
|
+
const classNames = require('./class-names.cjs');
|
|
16
|
+
|
|
17
|
+
class _Checkbox extends index.FoundationElement {
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A form-associated base class for the {@link @microsoft/fast-foundation#(Checkbox:class)} component.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
class FormAssociatedCheckbox extends formAssociated.CheckableFormAssociated(_Checkbox) {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.proxy = document.createElement("input");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A Checkbox Custom HTML Element.
|
|
33
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#checkbox | ARIA checkbox }.
|
|
34
|
+
*
|
|
35
|
+
* @slot checked-indicator - The checked indicator
|
|
36
|
+
* @slot indeterminate-indicator - The indeterminate indicator
|
|
37
|
+
* @slot - The default slot for the label
|
|
38
|
+
* @csspart control - The element representing the visual checkbox control
|
|
39
|
+
* @csspart label - The label
|
|
40
|
+
* @fires change - Emits a custom change event when the checked state changes
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
let Checkbox$1 = class Checkbox extends FormAssociatedCheckbox {
|
|
45
|
+
constructor() {
|
|
46
|
+
super();
|
|
47
|
+
/**
|
|
48
|
+
* The element's value to be included in form submission when checked.
|
|
49
|
+
* Default to "on" to reach parity with input[type="checkbox"]
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
this.initialValue = "on";
|
|
54
|
+
/**
|
|
55
|
+
* The indeterminate state of the control
|
|
56
|
+
*/
|
|
57
|
+
this.indeterminate = false;
|
|
58
|
+
/**
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
this.keypressHandler = (e) => {
|
|
62
|
+
if (this.readOnly) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
switch (e.key) {
|
|
66
|
+
case keyCodes.keySpace:
|
|
67
|
+
if (this.indeterminate) {
|
|
68
|
+
this.indeterminate = false;
|
|
69
|
+
}
|
|
70
|
+
this.checked = !this.checked;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
this.clickHandler = (e) => {
|
|
78
|
+
if (!this.disabled && !this.readOnly) {
|
|
79
|
+
if (this.indeterminate) {
|
|
80
|
+
this.indeterminate = false;
|
|
81
|
+
}
|
|
82
|
+
this.checked = !this.checked;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
this.proxy.setAttribute("type", "checkbox");
|
|
86
|
+
}
|
|
87
|
+
readOnlyChanged() {
|
|
88
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
89
|
+
this.proxy.readOnly = this.readOnly;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
index.__decorate([
|
|
94
|
+
index.attr({ attribute: "readonly", mode: "boolean" })
|
|
95
|
+
], Checkbox$1.prototype, "readOnly", void 0);
|
|
96
|
+
index.__decorate([
|
|
97
|
+
index.observable
|
|
98
|
+
], Checkbox$1.prototype, "defaultSlottedNodes", void 0);
|
|
99
|
+
index.__decorate([
|
|
100
|
+
index.observable
|
|
101
|
+
], Checkbox$1.prototype, "indeterminate", void 0);
|
|
102
|
+
|
|
103
|
+
const styles = ":host{display:inline-flex;flex-direction:column;vertical-align:middle}:host([disabled]){cursor:not-allowed}.base{display:inline-flex;align-items:center;gap:8px;vertical-align:middle}.base.connotation-cta{--_connotation-color-primary: var(--vvd-checkbox-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-checkbox-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-checkbox-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-intermediate: var(--vvd-checkbox-cta-intermediate, var(--vvd-color-cta-500));--_connotation-color-backdrop: var(--vvd-checkbox-cta-backdrop, var(--vvd-color-cta-50));--_connotation-color-firm: var(--vvd-checkbox-cta-firm, var(--vvd-color-cta-600))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-checkbox-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-checkbox-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-checkbox-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-checkbox-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-backdrop: var(--vvd-checkbox-accent-backdrop, var(--vvd-color-canvas));--_connotation-color-firm: var(--vvd-checkbox-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 selector(:focus-visible){.base:focus-visible{outline:none}}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){cursor:pointer}.base.disabled{pointer-events:none}.control{position:relative;display:flex;flex-shrink:0;align-items:center;justify-content:center;background-color:var(--_appearance-color-fill);block-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2)));border-radius:4px;box-shadow:inset 0 0 0 2px var(--_appearance-color-outline);color:var(--_appearance-color-text);inline-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}.indicator{font-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2)) - 4px)}.base:not(.checked) .indicator.checkmark{display:none}.base.checked .indicator.minus,.base:not(.indeterminate) .indicator.minus{display:none}label{display:flex;flex-wrap:wrap;align-items:center;color:var(--vvd-color-canvas-text);column-gap:4px;cursor:pointer;font:var(--vvd-typography-base)}.hide-label label{display:none}.focus-indicator{--focus-inset: -3px;--focus-stroke-gap-color: transparent;border-radius:4px}.base:not(:focus-visible) .focus-indicator{display:none}.icon{font-size:calc(1px*(20 + 4*clamp(-1,var(--vvd-size-density, 0),2))*.6);line-height:1}.message{margin-block-start:4px;--_low-ink-color: var(--vvd-color-neutral-600)}\n";
|
|
104
|
+
|
|
105
|
+
var __defProp = Object.defineProperty;
|
|
106
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
107
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
108
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
109
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
110
|
+
if (decorator = decorators[i])
|
|
111
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
112
|
+
if (kind && result)
|
|
113
|
+
__defProp(target, key, result);
|
|
114
|
+
return result;
|
|
115
|
+
};
|
|
116
|
+
const keySpace = " ";
|
|
117
|
+
exports.Checkbox = class Checkbox extends Checkbox$1 {
|
|
118
|
+
constructor() {
|
|
119
|
+
super(...arguments);
|
|
120
|
+
this.ariaLabel = null;
|
|
121
|
+
this.tabindex = null;
|
|
122
|
+
/**
|
|
123
|
+
* !remove method as will be implemented by fast-foundation in version after 2.46.9
|
|
124
|
+
*
|
|
125
|
+
* @internal
|
|
126
|
+
*/
|
|
127
|
+
this.keypressHandler = (event) => {
|
|
128
|
+
if (event.target instanceof HTMLAnchorElement) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
if (!this.disabled && !this.readOnly) {
|
|
132
|
+
switch (event.key) {
|
|
133
|
+
case keySpace:
|
|
134
|
+
if (this.indeterminate) {
|
|
135
|
+
this.indeterminate = false;
|
|
136
|
+
}
|
|
137
|
+
this.checked = !this.checked;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* !remove method as will be implemented by fast-foundation in version after 2.46.9
|
|
145
|
+
*
|
|
146
|
+
* @internal
|
|
147
|
+
*/
|
|
148
|
+
this.clickHandler = (event) => {
|
|
149
|
+
if (event.target instanceof HTMLAnchorElement) {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
if (!this.disabled && !this.readOnly) {
|
|
153
|
+
if (this.indeterminate) {
|
|
154
|
+
this.indeterminate = false;
|
|
155
|
+
}
|
|
156
|
+
this.checked = !this.checked;
|
|
157
|
+
}
|
|
158
|
+
return false;
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
checkedChanged(prev, next) {
|
|
165
|
+
super.checkedChanged(prev, next);
|
|
166
|
+
if (prev !== void 0) {
|
|
167
|
+
this.$emit("input");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
__decorateClass([
|
|
172
|
+
index.attr({ attribute: "aria-label" })
|
|
173
|
+
], exports.Checkbox.prototype, "ariaLabel", 2);
|
|
174
|
+
__decorateClass([
|
|
175
|
+
index.attr({ attribute: "tabindex" })
|
|
176
|
+
], exports.Checkbox.prototype, "tabindex", 2);
|
|
177
|
+
__decorateClass([
|
|
178
|
+
index.attr
|
|
179
|
+
], exports.Checkbox.prototype, "connotation", 2);
|
|
180
|
+
__decorateClass([
|
|
181
|
+
index.observable
|
|
182
|
+
], exports.Checkbox.prototype, "slottedContent", 2);
|
|
183
|
+
exports.Checkbox = __decorateClass([
|
|
184
|
+
index$1.errorText,
|
|
185
|
+
index$1.formElements
|
|
186
|
+
], exports.Checkbox);
|
|
187
|
+
applyMixins.applyMixins(exports.Checkbox, index$1.FormElementHelperText, index$1.FormElementSuccessText);
|
|
188
|
+
|
|
189
|
+
const getClasses = ({
|
|
190
|
+
connotation,
|
|
191
|
+
readOnly,
|
|
192
|
+
checked,
|
|
193
|
+
disabled,
|
|
194
|
+
indeterminate,
|
|
195
|
+
errorValidationMessage,
|
|
196
|
+
successText,
|
|
197
|
+
label,
|
|
198
|
+
slottedContent
|
|
199
|
+
}) => classNames.classNames(
|
|
200
|
+
"base",
|
|
201
|
+
[`connotation-${connotation}`, Boolean(connotation)],
|
|
202
|
+
["readonly", Boolean(readOnly)],
|
|
203
|
+
["checked", Boolean(checked) || Boolean(indeterminate)],
|
|
204
|
+
["disabled", Boolean(disabled)],
|
|
205
|
+
["error connotation-alert", Boolean(errorValidationMessage)],
|
|
206
|
+
["success connotation-success", !!successText],
|
|
207
|
+
["hide-label", !label && !slottedContent?.length]
|
|
208
|
+
);
|
|
209
|
+
const CheckboxTemplate = (context) => {
|
|
210
|
+
const focusTemplate = focus.focusTemplateFactory(context);
|
|
211
|
+
const iconTag = context.tagFor(icon.Icon);
|
|
212
|
+
return index.html`<template role="${(x) => x.ariaLabel ? "presentation" : null}">
|
|
213
|
+
<div class="${getClasses}"
|
|
214
|
+
role="checkbox"
|
|
215
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
216
|
+
aria-checked="${(x) => x.checked}"
|
|
217
|
+
aria-required="${(x) => x.required}"
|
|
218
|
+
aria-disabled="${(x) => x.disabled}"
|
|
219
|
+
aria-readonly="${(x) => x.readOnly}"
|
|
220
|
+
tabindex="${(x) => x.tabindex !== null ? x.tabindex : x.disabled ? null : 0}"
|
|
221
|
+
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
222
|
+
@click="${(x, c) => x.clickHandler(c.event)}">
|
|
223
|
+
<div class="control">
|
|
224
|
+
${when.when((x) => x.checked, index.html`<${iconTag} name="check-solid" class="icon"></${iconTag}>`)}
|
|
225
|
+
${when.when((x) => x.indeterminate, index.html`<${iconTag} name="minus-solid" class="icon"></${iconTag}>`)}
|
|
226
|
+
${() => focusTemplate}
|
|
227
|
+
</div>
|
|
228
|
+
${index.html`<label>${(x) => x.label}<slot ${slotted.slotted("slottedContent")}></slot></label>`}
|
|
229
|
+
</div>
|
|
230
|
+
${when.when((x) => x.helperText?.length, index$1.getFeedbackTemplate("helper", context))}
|
|
231
|
+
${when.when((x) => !x.successText && x.errorValidationMessage, index$1.getFeedbackTemplate("error", context))}
|
|
232
|
+
${when.when((x) => x.successText, index$1.getFeedbackTemplate("success", context))}
|
|
233
|
+
</template>`;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const checkboxDefinition = exports.Checkbox.compose({
|
|
237
|
+
baseName: "checkbox",
|
|
238
|
+
template: CheckboxTemplate,
|
|
239
|
+
styles,
|
|
240
|
+
shadowOptions: {
|
|
241
|
+
delegatesFocus: true
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
const checkboxRegistries = [checkboxDefinition(), ...definition.iconRegistries, ...definition$1.focusRegistries];
|
|
245
|
+
const registerCheckbox = index.registerFactory(checkboxRegistries);
|
|
246
|
+
|
|
247
|
+
exports.checkboxDefinition = checkboxDefinition;
|
|
248
|
+
exports.checkboxRegistries = checkboxRegistries;
|
|
249
|
+
exports.registerCheckbox = registerCheckbox;
|