@vonage/vivid 3.0.0-next.119 → 3.0.0-next.120
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/README.md +11 -6
- package/accordion/index.js +4 -51
- package/accordion-item/index.js +11 -109
- package/action-group/index.js +4 -36
- package/avatar/index.js +8 -64
- package/badge/index.js +9 -48
- package/banner/index.js +15 -117
- package/breadcrumb/index.js +5 -97
- package/breadcrumb-item/index.js +14 -53
- package/button/index.js +14 -92
- package/calendar/index.js +5 -1520
- package/calendar-event/index.js +7 -107
- package/card/index.js +10 -117
- package/checkbox/index.js +13 -175
- package/custom-elements.json +1827 -8
- package/dialog/index.js +14 -227
- package/divider/index.js +4 -25
- package/elevation/index.js +4 -24
- package/fab/index.js +13 -89
- package/focus/index.js +4 -17
- package/header/index.js +7 -12
- package/icon/index.js +7 -28
- package/index.js +49 -55
- package/layout/index.js +4 -42
- package/lib/accordion/definition.d.ts +3 -0
- package/lib/accordion/index.d.ts +1 -2
- package/lib/accordion-item/definition.d.ts +3 -0
- package/lib/accordion-item/index.d.ts +1 -2
- package/lib/action-group/definition.d.ts +3 -0
- package/lib/action-group/index.d.ts +1 -2
- package/lib/avatar/definition.d.ts +3 -0
- package/lib/avatar/index.d.ts +1 -2
- package/lib/badge/definition.d.ts +3 -0
- package/lib/badge/index.d.ts +1 -2
- package/lib/banner/definition.d.ts +3 -0
- package/lib/banner/index.d.ts +1 -2
- package/lib/breadcrumb/definition.d.ts +3 -0
- package/lib/breadcrumb/index.d.ts +1 -2
- package/lib/breadcrumb-item/definition.d.ts +3 -0
- package/lib/breadcrumb-item/index.d.ts +1 -2
- package/lib/button/definition.d.ts +3 -0
- package/lib/calendar/definition.d.ts +3 -0
- package/lib/calendar/index.d.ts +1 -2
- package/lib/calendar-event/definition.d.ts +3 -0
- package/lib/calendar-event/index.d.ts +1 -2
- package/lib/card/definition.d.ts +3 -0
- package/lib/card/index.d.ts +1 -2
- package/lib/checkbox/definition.d.ts +3 -0
- package/lib/checkbox/index.d.ts +1 -2
- package/lib/components.d.ts +38 -38
- package/lib/dialog/definition.d.ts +3 -0
- package/lib/dialog/index.d.ts +1 -2
- package/lib/divider/definition.d.ts +3 -0
- package/lib/divider/index.d.ts +1 -2
- package/lib/elevation/definition.d.ts +3 -0
- package/lib/elevation/index.d.ts +1 -2
- package/lib/fab/definition.d.ts +3 -0
- package/lib/fab/index.d.ts +1 -2
- package/lib/focus/definition.d.ts +3 -0
- package/lib/focus/index.d.ts +1 -2
- package/lib/header/definition.d.ts +3 -0
- package/lib/header/index.d.ts +1 -2
- package/lib/icon/definition.d.ts +3 -0
- package/lib/icon/index.d.ts +1 -2
- package/lib/layout/definition.d.ts +3 -0
- package/lib/layout/index.d.ts +1 -2
- package/lib/listbox/definition.d.ts +3 -0
- package/lib/menu/definition.d.ts +7 -0
- package/lib/menu/index.d.ts +1 -10
- package/lib/menu-item/definition.d.ts +3 -0
- package/lib/menu-item/index.d.ts +1 -2
- package/lib/nav/definition.d.ts +3 -0
- package/lib/nav/index.d.ts +1 -2
- package/lib/nav-disclosure/definition.d.ts +3 -0
- package/lib/nav-disclosure/index.d.ts +1 -2
- package/lib/nav-item/definition.d.ts +3 -0
- package/lib/nav-item/index.d.ts +1 -2
- package/lib/note/definition.d.ts +3 -0
- package/lib/note/index.d.ts +1 -2
- package/lib/number-field/definition.d.ts +3 -0
- package/lib/number-field/index.d.ts +1 -2
- package/lib/option/definition.d.ts +3 -0
- package/lib/option/index.d.ts +1 -2
- package/lib/popup/definition.d.ts +4 -0
- package/lib/popup/index.d.ts +1 -2
- package/lib/progress/definition.d.ts +3 -0
- package/lib/progress/index.d.ts +1 -2
- package/lib/progress-ring/definition.d.ts +3 -0
- package/lib/progress-ring/index.d.ts +1 -2
- package/lib/radio/definition.d.ts +3 -0
- package/lib/radio/index.d.ts +1 -2
- package/lib/radio-group/definition.d.ts +7 -0
- package/lib/radio-group/index.d.ts +1 -10
- package/lib/side-drawer/definition.d.ts +3 -0
- package/lib/side-drawer/index.d.ts +1 -2
- package/lib/slider/definition.d.ts +3 -0
- package/lib/slider/index.d.ts +1 -2
- package/lib/switch/definition.d.ts +3 -0
- package/lib/switch/index.d.ts +1 -2
- package/lib/text-anchor/definition.d.ts +3 -0
- package/lib/text-anchor/index.d.ts +1 -2
- package/lib/text-area/definition.d.ts +3 -0
- package/lib/text-area/index.d.ts +1 -2
- package/lib/text-field/definition.d.ts +3 -0
- package/lib/text-field/index.d.ts +1 -2
- package/lib/tooltip/definition.d.ts +3 -0
- package/lib/tooltip/index.d.ts +1 -2
- package/listbox/index.js +18 -1080
- package/menu/index.js +27 -354
- package/menu-item/index.js +11 -81
- package/nav/index.js +3 -16
- package/nav-disclosure/index.js +13 -77
- package/nav-item/index.js +13 -35
- package/note/index.js +13 -60
- package/number-field/index.js +14 -16
- package/option/index.js +13 -68
- package/package.json +2 -2
- package/popup/index.js +17 -55
- package/progress/index.js +6 -92
- package/progress-ring/index.js +6 -75
- package/radio/index.js +8 -48
- package/radio-group/index.js +9 -433
- package/shared/anchor.js +1 -1
- package/shared/apply-mixins.js +1 -1
- package/shared/base-progress.js +1 -1
- package/shared/breadcrumb-item.js +1 -1
- package/shared/button.js +195 -18
- package/shared/calendar-event.js +1 -1
- package/shared/definition.js +53 -0
- package/shared/definition10.js +99 -0
- package/shared/definition11.js +48 -0
- package/shared/definition12.js +1523 -0
- package/shared/definition13.js +111 -0
- package/shared/definition14.js +114 -0
- package/shared/definition15.js +32 -0
- package/shared/definition16.js +172 -0
- package/shared/definition17.js +223 -0
- package/shared/{divider.js → definition18.js} +25 -2
- package/shared/definition19.js +87 -0
- package/shared/definition2.js +106 -0
- package/shared/definition20.js +44 -0
- package/shared/definition21.js +1078 -0
- package/shared/{listbox-option.js → definition22.js} +71 -11
- package/shared/definition23.js +348 -0
- package/shared/{popup.js → definition24.js} +46 -3
- package/shared/{menu-item.js → definition25.js} +87 -13
- package/shared/definition26.js +18 -0
- package/shared/definition27.js +75 -0
- package/shared/definition28.js +31 -0
- package/shared/definition29.js +56 -0
- package/shared/definition3.js +29 -0
- package/shared/definition30.js +94 -0
- package/shared/definition31.js +77 -0
- package/shared/definition32.js +45 -0
- package/shared/definition33.js +435 -0
- package/shared/definition34.js +86 -0
- package/shared/definition35.js +592 -0
- package/shared/definition36.js +147 -0
- package/shared/definition37.js +279 -0
- package/shared/definition38.js +119 -0
- package/shared/definition39.js +77 -0
- package/shared/definition4.js +19 -0
- package/shared/definition5.js +38 -0
- package/shared/definition6.js +60 -0
- package/shared/definition7.js +45 -0
- package/shared/definition8.js +113 -0
- package/shared/definition9.js +107 -0
- package/shared/design-system/index.d.ts +1 -2
- package/shared/es.object.assign.js +58 -1
- package/shared/es.regexp.to-string.js +2 -1
- package/shared/focus.js +3 -9
- package/shared/focus2.js +9 -3
- package/shared/form-associated.js +1 -1
- package/shared/form-elements.js +2 -2
- package/shared/icon.js +1096 -9
- package/shared/index.js +385 -2501
- package/shared/patterns/form-elements/form-elements.d.ts +2 -2
- package/shared/radio.js +1 -1
- package/shared/ref.js +1 -1
- package/shared/slotted.js +1 -1
- package/shared/string-trim.js +2 -1
- package/shared/text-anchor.template.js +1 -1
- package/shared/to-string.js +51 -0
- package/side-drawer/index.js +5 -84
- package/slider/index.js +14 -593
- 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 +13 -149
- package/text-anchor/index.js +8 -7
- package/text-area/index.js +16 -282
- package/text-field/index.js +14 -121
- package/tooltip/index.js +24 -82
- package/vivid.api.json +1640 -850
- package/shared/button2.js +0 -200
- package/shared/elevation.js +0 -10
- package/shared/es.promise.resolve.js +0 -944
- package/shared/index2.js +0 -9
- package/shared/utils/index.d.ts +0 -1
package/calendar-event/index.js
CHANGED
|
@@ -1,109 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { r as registerCalendarEvent } from '../shared/definition13.js';
|
|
2
|
+
import '../shared/index.js';
|
|
3
|
+
import '../shared/calendar-event.js';
|
|
3
4
|
import '../shared/es.object.assign.js';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
5
|
+
import '../shared/to-string.js';
|
|
6
|
+
import '../shared/when.js';
|
|
7
|
+
import '../shared/class-names.js';
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var $ = _export;
|
|
10
|
-
var DESCRIPTORS = descriptors;
|
|
11
|
-
var global = global$1;
|
|
12
|
-
var uncurryThis = functionUncurryThis;
|
|
13
|
-
var hasOwn = hasOwnProperty_1;
|
|
14
|
-
var isCallable = isCallable$1;
|
|
15
|
-
var isPrototypeOf = objectIsPrototypeOf;
|
|
16
|
-
var toString = toString$1;
|
|
17
|
-
var defineProperty = objectDefineProperty.f;
|
|
18
|
-
var copyConstructorProperties = copyConstructorProperties$1;
|
|
19
|
-
|
|
20
|
-
var NativeSymbol = global.Symbol;
|
|
21
|
-
var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
|
|
22
|
-
|
|
23
|
-
if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) ||
|
|
24
|
-
// Safari 12 bug
|
|
25
|
-
NativeSymbol().description !== undefined
|
|
26
|
-
)) {
|
|
27
|
-
var EmptyStringDescriptionStore = {};
|
|
28
|
-
// wrap Symbol constructor for correct work with undefined description
|
|
29
|
-
var SymbolWrapper = function Symbol() {
|
|
30
|
-
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]);
|
|
31
|
-
var result = isPrototypeOf(SymbolPrototype, this)
|
|
32
|
-
? new NativeSymbol(description)
|
|
33
|
-
// in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
|
|
34
|
-
: description === undefined ? NativeSymbol() : NativeSymbol(description);
|
|
35
|
-
if (description === '') EmptyStringDescriptionStore[result] = true;
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
copyConstructorProperties(SymbolWrapper, NativeSymbol);
|
|
40
|
-
SymbolWrapper.prototype = SymbolPrototype;
|
|
41
|
-
SymbolPrototype.constructor = SymbolWrapper;
|
|
42
|
-
|
|
43
|
-
var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)';
|
|
44
|
-
var thisSymbolValue = uncurryThis(SymbolPrototype.valueOf);
|
|
45
|
-
var symbolDescriptiveString = uncurryThis(SymbolPrototype.toString);
|
|
46
|
-
var regexp = /^Symbol\((.*)\)[^)]+$/;
|
|
47
|
-
var replace = uncurryThis(''.replace);
|
|
48
|
-
var stringSlice = uncurryThis(''.slice);
|
|
49
|
-
|
|
50
|
-
defineProperty(SymbolPrototype, 'description', {
|
|
51
|
-
configurable: true,
|
|
52
|
-
get: function description() {
|
|
53
|
-
var symbol = thisSymbolValue(this);
|
|
54
|
-
if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
|
|
55
|
-
var string = symbolDescriptiveString(symbol);
|
|
56
|
-
var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');
|
|
57
|
-
return desc === '' ? undefined : desc;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
$({ global: true, constructor: true, forced: true }, {
|
|
62
|
-
Symbol: SymbolWrapper
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let _ = t => t,
|
|
67
|
-
_t,
|
|
68
|
-
_t2,
|
|
69
|
-
_t3;
|
|
70
|
-
const getClasses = ({
|
|
71
|
-
connotation,
|
|
72
|
-
appearance
|
|
73
|
-
}) => classNames('base', [`connotation-${connotation}`, Boolean(connotation)], [`appearance-${appearance}`, Boolean(appearance)]);
|
|
74
|
-
const getStyles = ({
|
|
75
|
-
start,
|
|
76
|
-
duration,
|
|
77
|
-
overlapCount
|
|
78
|
-
}) => {
|
|
79
|
-
const stylesObj = Object.assign(Object.assign(Object.assign({}, overlapCount && {
|
|
80
|
-
'--vvd-calendar-event--overlap-count': overlapCount
|
|
81
|
-
}), start && {
|
|
82
|
-
'--vvd-calendar-event--start': start
|
|
83
|
-
}), duration && {
|
|
84
|
-
'--vvd-calendar-event--duration': duration
|
|
85
|
-
});
|
|
86
|
-
return Object.entries(stylesObj).map(entry => entry.join(':')).join(';');
|
|
87
|
-
};
|
|
88
|
-
const CalendarEventTemplate = () => html(_t || (_t = _`
|
|
89
|
-
<div
|
|
90
|
-
style="${0}"
|
|
91
|
-
class="${0}"
|
|
92
|
-
role="button"
|
|
93
|
-
tabindex="0"
|
|
94
|
-
>
|
|
95
|
-
${0}
|
|
96
|
-
${0}
|
|
97
|
-
</div>`), getStyles, getClasses, when(x => x.heading, html(_t2 || (_t2 = _`<h2><strong>${0}</strong></h2>`), x => x.heading)), when(x => x.description, html(_t3 || (_t3 = _`<p>${0}</p>`), x => x.description)));
|
|
98
|
-
|
|
99
|
-
const vividCalendarEvent = CalendarEvent.compose({
|
|
100
|
-
baseName: 'calendar-event',
|
|
101
|
-
template: CalendarEventTemplate,
|
|
102
|
-
styles: css_248z,
|
|
103
|
-
shadowOptions: {
|
|
104
|
-
delegatesFocus: true
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
designSystem.withPrefix(getPrefix(import.meta.url)).register(vividCalendarEvent());
|
|
108
|
-
|
|
109
|
-
export { vividCalendarEvent };
|
|
9
|
+
registerCalendarEvent();
|
package/card/index.js
CHANGED
|
@@ -1,120 +1,13 @@
|
|
|
1
|
-
import '../shared/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { s as slotted } from '../shared/slotted.js';
|
|
7
|
-
import { w as when } from '../shared/when.js';
|
|
8
|
-
import { c as classNames } from '../shared/class-names.js';
|
|
1
|
+
import { r as registerCard } from '../shared/definition14.js';
|
|
2
|
+
import '../shared/index.js';
|
|
3
|
+
import '../shared/definition3.js';
|
|
4
|
+
import '../shared/icon.js';
|
|
5
|
+
import '../shared/to-string.js';
|
|
9
6
|
import '../shared/string-trim.js';
|
|
10
7
|
import '../shared/_has.js';
|
|
8
|
+
import '../shared/when.js';
|
|
9
|
+
import '../shared/class-names.js';
|
|
10
|
+
import '../shared/definition15.js';
|
|
11
|
+
import '../shared/slotted.js';
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class Card extends FoundationElement {}
|
|
15
|
-
__decorate([attr, __metadata("design:type", String)], Card.prototype, "headline", void 0);
|
|
16
|
-
__decorate([attr, __metadata("design:type", String)], Card.prototype, "subtitle", void 0);
|
|
17
|
-
__decorate([attr, __metadata("design:type", String)], Card.prototype, "text", void 0);
|
|
18
|
-
__decorate([attr, __metadata("design:type", String)], Card.prototype, "icon", void 0);
|
|
19
|
-
__decorate([attr, __metadata("design:type", Number)], Card.prototype, "elevation", void 0);
|
|
20
|
-
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "footerSlottedContent", void 0);
|
|
21
|
-
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "graphicSlottedContent", void 0);
|
|
22
|
-
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "hasMetaSlottedContent", void 0);
|
|
23
|
-
|
|
24
|
-
let _2 = t => t,
|
|
25
|
-
_t,
|
|
26
|
-
_t2,
|
|
27
|
-
_t3,
|
|
28
|
-
_t4,
|
|
29
|
-
_t5,
|
|
30
|
-
_t6,
|
|
31
|
-
_t7,
|
|
32
|
-
_t8;
|
|
33
|
-
const getClasses = _ => classNames('base', ['hide-footer', !_.footerSlottedContent || !_.footerSlottedContent.length], ['hide-header', shouldHideHeader(_)]);
|
|
34
|
-
function renderHeaderIcon(iconTag) {
|
|
35
|
-
return html(_t || (_t = _2`
|
|
36
|
-
<${0} class="icon" inline name="${0}"></${0}>`), iconTag, x => x.icon, iconTag);
|
|
37
|
-
}
|
|
38
|
-
function Headline() {
|
|
39
|
-
return html(_t2 || (_t2 = _2`
|
|
40
|
-
<div class="header-headline">${0}</div>
|
|
41
|
-
`), x => x.headline);
|
|
42
|
-
}
|
|
43
|
-
function Subtitle() {
|
|
44
|
-
return html(_t3 || (_t3 = _2`
|
|
45
|
-
<div class="header-subtitle">${0}</div>
|
|
46
|
-
`), x => x.subtitle);
|
|
47
|
-
}
|
|
48
|
-
function headerContent() {
|
|
49
|
-
return html(_t4 || (_t4 = _2`
|
|
50
|
-
<div class="header-content">
|
|
51
|
-
${0}
|
|
52
|
-
${0}
|
|
53
|
-
</div>
|
|
54
|
-
`), when(x => x.headline, Headline()), when(x => x.subtitle, Subtitle()));
|
|
55
|
-
}
|
|
56
|
-
function renderHeader(iconTag) {
|
|
57
|
-
return html(_t5 || (_t5 = _2`
|
|
58
|
-
<header class="header">
|
|
59
|
-
<slot name="graphic" ${0}>${0}</slot>
|
|
60
|
-
${0}
|
|
61
|
-
</header>`), slotted('graphicSlottedContent'), when(x => x.icon, renderHeaderIcon(iconTag)), when(x => x.headline || x.subtitle, headerContent()));
|
|
62
|
-
}
|
|
63
|
-
function shouldHideHeader(card) {
|
|
64
|
-
return !card.headline && !card.subtitle && !card.icon && (!card.graphicSlottedContent || !card.graphicSlottedContent.length);
|
|
65
|
-
}
|
|
66
|
-
function renderMetaSlot() {
|
|
67
|
-
return html(_t6 || (_t6 = _2`
|
|
68
|
-
<slot name="meta" ${0}></slot>
|
|
69
|
-
`), slotted('metaSlottedContent'));
|
|
70
|
-
}
|
|
71
|
-
function text() {
|
|
72
|
-
return html(_t7 || (_t7 = _2`
|
|
73
|
-
<div class="text">${0}</div>
|
|
74
|
-
`), x => x.text);
|
|
75
|
-
}
|
|
76
|
-
const CardTemplate = context => {
|
|
77
|
-
const elevationTag = context.tagFor(Elevation);
|
|
78
|
-
const iconTag = context.tagFor(Icon);
|
|
79
|
-
return html(_t8 || (_t8 = _2`
|
|
80
|
-
<${0} dp=${0}>
|
|
81
|
-
|
|
82
|
-
<div class="${0}">
|
|
83
|
-
<div class="wrapper">
|
|
84
|
-
<div class="vwc-card-media">
|
|
85
|
-
<slot name="media"></slot>
|
|
86
|
-
</div>
|
|
87
|
-
<slot name="main">
|
|
88
|
-
<div class="main-content">
|
|
89
|
-
<div class="header-wrapper">
|
|
90
|
-
${0}
|
|
91
|
-
${0}
|
|
92
|
-
</div>
|
|
93
|
-
${0}
|
|
94
|
-
</div>
|
|
95
|
-
</slot>
|
|
96
|
-
<div class="footer">
|
|
97
|
-
<slot name="footer" ${0}></slot>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
</${0}>
|
|
103
|
-
`), elevationTag, x => {
|
|
104
|
-
var _a;
|
|
105
|
-
return (_a = x.elevation) !== null && _a !== void 0 ? _a : '4';
|
|
106
|
-
}, getClasses, renderHeader(iconTag), renderMetaSlot(), when(x => x.text, text()), slotted('footerSlottedContent'), elevationTag);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const prefix = getPrefix(import.meta.url);
|
|
110
|
-
const vividCard = Card.compose({
|
|
111
|
-
baseName: 'card',
|
|
112
|
-
template: CardTemplate,
|
|
113
|
-
styles: css_248z
|
|
114
|
-
});
|
|
115
|
-
(async () => {
|
|
116
|
-
await loadComponentsModules(['icon', 'elevation'], prefix);
|
|
117
|
-
designSystem.withPrefix(prefix).register(vividCard());
|
|
118
|
-
})();
|
|
119
|
-
|
|
120
|
-
export { vividCard };
|
|
13
|
+
registerCard();
|
package/checkbox/index.js
CHANGED
|
@@ -1,178 +1,16 @@
|
|
|
1
|
-
import '../shared/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { f as focusTemplateFactory } from '../shared/focus.js';
|
|
7
|
-
import { I as Icon } from '../shared/icon.js';
|
|
8
|
-
import { w as when } from '../shared/when.js';
|
|
9
|
-
import { c as classNames } from '../shared/class-names.js';
|
|
10
|
-
import '../shared/focus2.js';
|
|
1
|
+
import { r as registerCheckbox } from '../shared/definition16.js';
|
|
2
|
+
import '../shared/index.js';
|
|
3
|
+
import '../shared/definition3.js';
|
|
4
|
+
import '../shared/icon.js';
|
|
5
|
+
import '../shared/to-string.js';
|
|
11
6
|
import '../shared/string-trim.js';
|
|
12
7
|
import '../shared/_has.js';
|
|
8
|
+
import '../shared/when.js';
|
|
9
|
+
import '../shared/class-names.js';
|
|
10
|
+
import '../shared/definition4.js';
|
|
11
|
+
import '../shared/focus.js';
|
|
12
|
+
import '../shared/form-associated.js';
|
|
13
|
+
import '../shared/key-codes.js';
|
|
14
|
+
import '../shared/focus2.js';
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* A form-associated base class for the {@link @microsoft/fast-foundation#(Checkbox:class)} component.
|
|
18
|
-
*
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
class FormAssociatedCheckbox extends CheckableFormAssociated(_Checkbox) {
|
|
22
|
-
constructor() {
|
|
23
|
-
super(...arguments);
|
|
24
|
-
this.proxy = document.createElement("input");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* A Checkbox Custom HTML Element.
|
|
30
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#checkbox | ARIA checkbox }.
|
|
31
|
-
*
|
|
32
|
-
* @slot checked-indicator - The checked indicator
|
|
33
|
-
* @slot indeterminate-indicator - The indeterminate indicator
|
|
34
|
-
* @slot - The default slot for the label
|
|
35
|
-
* @csspart control - The element representing the visual checkbox control
|
|
36
|
-
* @csspart label - The label
|
|
37
|
-
* @fires change - Emits a custom change event when the checked state changes
|
|
38
|
-
*
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
class Checkbox$1 extends FormAssociatedCheckbox {
|
|
42
|
-
constructor() {
|
|
43
|
-
super();
|
|
44
|
-
/**
|
|
45
|
-
* The element's value to be included in form submission when checked.
|
|
46
|
-
* Default to "on" to reach parity with input[type="checkbox"]
|
|
47
|
-
*
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
this.initialValue = "on";
|
|
51
|
-
/**
|
|
52
|
-
* The indeterminate state of the control
|
|
53
|
-
*/
|
|
54
|
-
this.indeterminate = false;
|
|
55
|
-
/**
|
|
56
|
-
* @internal
|
|
57
|
-
*/
|
|
58
|
-
this.keypressHandler = (e) => {
|
|
59
|
-
if (this.readOnly) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
switch (e.key) {
|
|
63
|
-
case keySpace$1:
|
|
64
|
-
if (this.indeterminate) {
|
|
65
|
-
this.indeterminate = false;
|
|
66
|
-
}
|
|
67
|
-
this.checked = !this.checked;
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* @internal
|
|
73
|
-
*/
|
|
74
|
-
this.clickHandler = (e) => {
|
|
75
|
-
if (!this.disabled && !this.readOnly) {
|
|
76
|
-
if (this.indeterminate) {
|
|
77
|
-
this.indeterminate = false;
|
|
78
|
-
}
|
|
79
|
-
this.checked = !this.checked;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
this.proxy.setAttribute("type", "checkbox");
|
|
83
|
-
}
|
|
84
|
-
readOnlyChanged() {
|
|
85
|
-
if (this.proxy instanceof HTMLInputElement) {
|
|
86
|
-
this.proxy.readOnly = this.readOnly;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
__decorate([
|
|
91
|
-
attr({ attribute: "readonly", mode: "boolean" })
|
|
92
|
-
], Checkbox$1.prototype, "readOnly", void 0);
|
|
93
|
-
__decorate([
|
|
94
|
-
observable
|
|
95
|
-
], Checkbox$1.prototype, "defaultSlottedNodes", void 0);
|
|
96
|
-
__decorate([
|
|
97
|
-
observable
|
|
98
|
-
], Checkbox$1.prototype, "indeterminate", void 0);
|
|
99
|
-
|
|
100
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 14 Dec 2022 14:20:57 GMT\n */\n.base {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n vertical-align: middle;\n}\n.base {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary-increment: var(--vvd-color-neutral-800);\n --_connotation-color-intermediate: var(--vvd-color-neutral-500);\n --_connotation-color-backdrop: var(--vvd-color-canvas);\n --_connotation-color-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: transparent;\n}\n.base: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.base:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-neutral-800);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-500);\n}\n@supports selector(:focus-visible) {\n .base:focus {\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}\n\n.control {\n position: relative;\n display: flex;\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n background-color: var(--_appearance-color-fill);\n border-radius: 3px;\n box-shadow: inset 0 0 0 2px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n}\n\n.indicator {\n font-size: 16px;\n}\n.base:not(.checked) .indicator.checkmark {\n display: none;\n}\n\n.base:not(.indeterminate) .indicator.minus, .base.checked .indicator.minus {\n display: none;\n}\n\nlabel {\n color: var(--vvd-color-canvas-text);\n cursor: pointer;\n font: var(--vvd-typography-base);\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}";
|
|
101
|
-
|
|
102
|
-
const keySpace = ' ';
|
|
103
|
-
class Checkbox extends Checkbox$1 {
|
|
104
|
-
constructor() {
|
|
105
|
-
super(...arguments);
|
|
106
|
-
this.keypressHandler = e => {
|
|
107
|
-
switch (e.key) {
|
|
108
|
-
case keySpace:
|
|
109
|
-
if (this.indeterminate) {
|
|
110
|
-
this.indeterminate = false;
|
|
111
|
-
}
|
|
112
|
-
this.checked = !this.checked;
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
this.clickHandler = () => {
|
|
117
|
-
if (!this.disabled && !this.readOnly) {
|
|
118
|
-
if (this.indeterminate) {
|
|
119
|
-
this.indeterminate = false;
|
|
120
|
-
}
|
|
121
|
-
this.checked = !this.checked;
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
__decorate([attr, __metadata("design:type", String)], Checkbox.prototype, "label", void 0);
|
|
127
|
-
|
|
128
|
-
let _ = t => t,
|
|
129
|
-
_t,
|
|
130
|
-
_t2,
|
|
131
|
-
_t3,
|
|
132
|
-
_t4;
|
|
133
|
-
const getClasses = ({
|
|
134
|
-
readOnly,
|
|
135
|
-
checked,
|
|
136
|
-
disabled,
|
|
137
|
-
indeterminate
|
|
138
|
-
}) => classNames('base', ['readonly', Boolean(readOnly)], ['checked', Boolean(checked) || Boolean(indeterminate)], ['disabled', Boolean(disabled)]);
|
|
139
|
-
const CheckboxTemplate = context => {
|
|
140
|
-
const focusTemplate = focusTemplateFactory(context);
|
|
141
|
-
const iconTag = context.tagFor(Icon);
|
|
142
|
-
return html(_t || (_t = _`<span
|
|
143
|
-
role="checkbox"
|
|
144
|
-
aria-checked="${0}"
|
|
145
|
-
aria-required="${0}"
|
|
146
|
-
aria-disabled="${0}"
|
|
147
|
-
aria-readonly="${0}"
|
|
148
|
-
tabindex="${0}"
|
|
149
|
-
@keypress="${0}"
|
|
150
|
-
@click="${0}"
|
|
151
|
-
class="${0}"
|
|
152
|
-
>
|
|
153
|
-
<div class="control">
|
|
154
|
-
${0}
|
|
155
|
-
${0}
|
|
156
|
-
${0}
|
|
157
|
-
</div>
|
|
158
|
-
|
|
159
|
-
${0}
|
|
160
|
-
|
|
161
|
-
</span>`), x => x.checked, x => x.required, x => x.disabled, x => x.readOnly, x => x.disabled ? null : 0, (x, c) => x.keypressHandler(c.event), x => x.clickHandler(), getClasses, when(x => x.checked, html(_t2 || (_t2 = _`<${0} name="check-solid"></${0}>`), iconTag, iconTag)), when(x => x.indeterminate, html(_t3 || (_t3 = _`<${0} name="minus-solid"></${0}>`), iconTag, iconTag)), () => focusTemplate, when(x => x.label, html(_t4 || (_t4 = _`<label>${0}</label>`), x => x.label)));
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const prefix = getPrefix(import.meta.url);
|
|
165
|
-
const vividCheckbox = Checkbox.compose({
|
|
166
|
-
baseName: 'checkbox',
|
|
167
|
-
template: CheckboxTemplate,
|
|
168
|
-
styles: css_248z,
|
|
169
|
-
shadowOptions: {
|
|
170
|
-
delegatesFocus: true
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
(async () => {
|
|
174
|
-
await loadComponentsModules(['icon', 'focus'], prefix);
|
|
175
|
-
designSystem.withPrefix(prefix).register(vividCheckbox());
|
|
176
|
-
})();
|
|
177
|
-
|
|
178
|
-
export { vividCheckbox };
|
|
16
|
+
registerCheckbox();
|