@vonage/vivid 3.0.0-next.5 → 3.0.0-next.52
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 +135 -4
- package/accordion/index.js +2 -2
- package/accordion-item/index.js +26 -18
- package/action-group/index.js +49 -0
- package/badge/index.js +14 -18
- package/banner/index.js +20 -83
- package/breadcrumb/index.js +20 -16
- package/breadcrumb-item/index.js +14 -9
- package/button/index.js +28 -659
- package/calendar/index.js +37 -8
- package/calendar-event/index.js +117 -0
- package/card/index.js +134 -0
- package/checkbox/index.js +173 -0
- package/dialog/index.js +282 -0
- package/divider/index.js +88 -0
- package/elevation/index.js +4 -31
- package/fab/index.js +102 -0
- package/focus/index.js +20 -3
- package/header/index.js +68 -0
- package/icon/index.js +9 -3
- package/index.js +45 -20
- package/layout/index.js +4 -4
- package/lib/accordion-item/accordion-item.d.ts +2 -2
- package/lib/accordion-item/index.d.ts +2 -1
- package/lib/action-group/action-group.d.ts +10 -0
- package/lib/{sidenav-item/sidenav-item.template.d.ts → action-group/action-group.template.d.ts} +2 -2
- package/lib/{sidenav-item → action-group}/index.d.ts +1 -2
- package/lib/badge/badge.d.ts +6 -6
- package/lib/badge/index.d.ts +1 -1
- package/lib/banner/banner.d.ts +1 -1
- package/lib/banner/banner.template.d.ts +0 -2
- package/lib/banner/index.d.ts +1 -0
- package/lib/breadcrumb/breadcrumb.template.d.ts +4 -0
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
- package/lib/breadcrumb-item/index.d.ts +1 -0
- package/lib/button/button.d.ts +6 -5
- package/lib/button/index.d.ts +2 -19
- package/lib/calendar/calendar.d.ts +3 -1
- package/lib/calendar/index.d.ts +0 -1
- package/lib/calendar-event/calendar-event.d.ts +14 -0
- package/lib/calendar-event/calendar-event.template.d.ts +4 -0
- package/lib/calendar-event/index.d.ts +2 -0
- package/lib/card/card.d.ts +10 -0
- package/lib/{text/text.template.d.ts → card/card.template.d.ts} +2 -2
- package/lib/card/index.d.ts +4 -0
- package/lib/checkbox/checkbox.d.ts +5 -0
- package/lib/checkbox/checkbox.template.d.ts +4 -0
- package/lib/checkbox/index.d.ts +4 -0
- package/lib/components.d.ts +22 -10
- package/lib/dialog/dialog.d.ts +20 -0
- package/lib/dialog/dialog.template.d.ts +4 -0
- package/lib/dialog/index.d.ts +5 -0
- package/lib/divider/divider.d.ts +3 -0
- package/lib/divider/divider.template.d.ts +4 -0
- package/lib/divider/index.d.ts +2 -0
- package/lib/elevation/elevation.d.ts +1 -0
- package/lib/elevation/index.d.ts +1 -1
- package/lib/enums.d.ts +12 -6
- package/lib/fab/fab.d.ts +13 -0
- package/lib/fab/fab.template.d.ts +4 -0
- package/lib/fab/index.d.ts +4 -0
- package/lib/focus/index.d.ts +1 -1
- package/lib/header/header.d.ts +5 -0
- package/lib/header/header.template.d.ts +4 -0
- package/lib/header/index.d.ts +3 -0
- package/lib/icon/icon.d.ts +4 -3
- package/lib/layout/index.d.ts +1 -1
- package/lib/layout/layout.d.ts +3 -3
- package/lib/menu/index.d.ts +11 -0
- package/lib/menu/menu.d.ts +7 -0
- package/lib/menu/menu.template.d.ts +3 -0
- package/lib/nav/index.d.ts +2 -0
- package/lib/nav/nav.d.ts +3 -0
- package/lib/nav/nav.template.d.ts +4 -0
- package/lib/nav-disclosure/index.d.ts +4 -0
- package/lib/nav-disclosure/nav-disclosure.d.ts +10 -0
- package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -0
- package/lib/nav-item/index.d.ts +4 -0
- package/lib/{sidenav-item/sidenav-item.d.ts → nav-item/nav-item.d.ts} +2 -2
- package/lib/nav-item/nav-item.template.d.ts +4 -0
- package/lib/{text → note}/index.d.ts +1 -1
- package/lib/note/note.d.ts +10 -0
- package/lib/note/note.template.d.ts +5 -0
- package/lib/popup/index.d.ts +1 -1
- package/lib/popup/popup.d.ts +3 -15
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress-ring/progress-ring.d.ts +2 -1
- package/lib/side-drawer/index.d.ts +1 -1
- package/lib/side-drawer/side-drawer.d.ts +2 -7
- package/lib/side-drawer/side-drawer.template.d.ts +2 -2
- package/lib/text-anchor/text-anchor.d.ts +1 -1
- package/lib/text-field/index.d.ts +4 -0
- package/lib/text-field/text-field.d.ts +16 -0
- package/lib/text-field/text-field.template.d.ts +5 -0
- package/lib/tooltip/tooltip.d.ts +2 -4
- package/menu/index.js +661 -0
- package/nav/index.js +17 -0
- package/nav-disclosure/index.js +90 -0
- package/nav-item/index.js +43 -0
- package/note/index.js +68 -0
- package/package.json +48 -8
- package/popup/index.js +20 -2082
- package/progress/index.js +33 -24
- package/progress-ring/index.js +9 -3
- package/shared/anchor.js +8 -1
- package/shared/aria-global.js +3 -40
- package/shared/base-progress.js +5 -0
- package/shared/button.js +195 -0
- package/shared/calendar-event.js +26 -0
- package/shared/dialog-polyfill.esm.js +858 -0
- package/shared/enums.js +79 -0
- package/shared/es.object.assign.js +7 -6
- package/shared/export.js +972 -0
- package/shared/focus.js +5 -0
- package/shared/focus2.js +11 -0
- package/shared/form-associated.js +557 -0
- package/shared/icon.js +504 -508
- package/shared/index.js +79 -56
- package/shared/index2.js +26 -10
- package/shared/index3.js +2109 -0
- package/shared/iterators.js +61 -0
- package/shared/object-keys.js +13 -0
- package/shared/patterns/focus.d.ts +3 -0
- package/shared/patterns/form-elements.d.ts +22 -0
- package/shared/patterns/index.d.ts +1 -0
- package/shared/ref.js +41 -0
- package/shared/text-anchor.js +2 -11
- package/shared/text-anchor.template.js +5 -2
- package/shared/to-string.js +51 -0
- package/shared/web.dom-collections.iterator.js +61 -1074
- package/side-drawer/index.js +33 -51
- package/styles/fonts/SpeziaCompleteVariableItalicWeb.woff +0 -0
- package/styles/fonts/SpeziaCompleteVariableItalicWeb.woff2 +0 -0
- package/styles/fonts/SpeziaCompleteVariableUprightWeb.woff +0 -0
- package/styles/fonts/SpeziaCompleteVariableUprightWeb.woff2 +0 -0
- package/styles/fonts/SpeziaMonoCompleteVariableWeb.woff +0 -0
- package/styles/fonts/SpeziaMonoCompleteVariableWeb.woff2 +0 -0
- package/styles/fonts/spezia.css +12 -12
- package/styles/themes/dark.css +182 -176
- package/styles/themes/light.css +182 -176
- package/styles/typography/desktop.css +89 -0
- package/text-anchor/index.js +8 -1
- package/text-field/index.js +438 -0
- package/tooltip/index.js +19 -21
- package/lib/text/text.d.ts +0 -10
- package/sidenav-item/index.js +0 -38
- package/text/index.js +0 -45
package/calendar/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import '../
|
|
2
|
-
import { e as emptyArray, O as Observable, S as SubscriberSet, D as DOM, H as HTMLDirective, f as HTMLView, F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
|
|
1
|
+
import { e as emptyArray, O as Observable, S as SubscriberSet, D as DOM, H as HTMLDirective, g as HTMLView, F as FoundationElement, c as __classPrivateFieldGet, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
|
|
3
2
|
import { s as styleInject } from '../shared/style-inject.es.js';
|
|
4
3
|
import '../shared/web.dom-collections.iterator.js';
|
|
4
|
+
import { C as CalendarEvent } from '../shared/calendar-event.js';
|
|
5
5
|
import '../shared/es.object.assign.js';
|
|
6
6
|
import { b as _has, _ as _curry1, a as _curry2 } from '../shared/_has.js';
|
|
7
|
-
import '../shared/
|
|
7
|
+
import '../shared/export.js';
|
|
8
|
+
import '../shared/object-keys.js';
|
|
9
|
+
import '../shared/iterators.js';
|
|
8
10
|
|
|
9
11
|
/** @internal */
|
|
10
12
|
function newSplice(index, removed, addedCount) {
|
|
@@ -361,6 +363,10 @@ class ArrayObserver extends SubscriberSet {
|
|
|
361
363
|
enumerable: false,
|
|
362
364
|
});
|
|
363
365
|
}
|
|
366
|
+
subscribe(subscriber) {
|
|
367
|
+
this.flush();
|
|
368
|
+
super.subscribe(subscriber);
|
|
369
|
+
}
|
|
364
370
|
addSplice(splice) {
|
|
365
371
|
if (this.splices === void 0) {
|
|
366
372
|
this.splices = [splice];
|
|
@@ -1240,7 +1246,7 @@ _curry1(function isEmpty(x) {
|
|
|
1240
1246
|
|
|
1241
1247
|
var isEmpty$1 = isEmpty;
|
|
1242
1248
|
|
|
1243
|
-
var css_248z = "
|
|
1249
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Mon, 05 Sep 2022 17:52:00 GMT\n */\nol {\n padding: 0;\n margin: 0;\n list-style: none;\n}\n\n[role=grid i] {\n position: relative;\n z-index: 0;\n display: grid;\n margin: auto;\n grid-template-areas: \". column-headers\" \"row-headers calendar\";\n grid-template-columns: min-content auto;\n inline-size: max(100%, 500px);\n min-inline-size: 880px;\n}\n\n.row-headers {\n display: grid;\n grid-area: row-headers;\n grid-template-rows: repeat(24, 1fr);\n margin-inline-end: 2px;\n}\n.row-headers > [role=rowheader i] {\n display: flex;\n align-items: flex-end;\n justify-content: flex-end;\n}\n.row-headers > [role=rowheader i] > time {\n font: var(--vvd-font-base-condensed);\n font-size: small;\n line-height: 1;\n text-transform: uppercase;\n white-space: nowrap;\n}\n\n.calendar-row {\n display: contents;\n}\n\n.calendar-grid-presentation {\n display: grid;\n overflow: hidden;\n background-color: var(--vvd-color-surface-2dp);\n border-radius: 6px;\n counter-reset: listing;\n filter: var(--vvd-shadow-surface-2dp);\n gap: 1px;\n grid-area: calendar;\n grid-auto-flow: column;\n grid-template: repeat(24, 1fr)/repeat(7, 1fr);\n}\n\n.hours {\n display: contents;\n}\n.hours > [role=listitem i] {\n position: relative;\n grid-column: 1/8;\n grid-row: var(--row);\n min-block-size: 48px;\n pointer-events: none;\n}\n.hours > [role=listitem i]:not(:first-child)::after {\n position: absolute;\n border-block-end: var(--vvd-color-neutral-100) 1px solid;\n content: \"\";\n inline-size: 100%;\n margin-block-start: -1px;\n}\n.hours > [role=listitem i]:nth-child(24n+1) {\n --row: 1;\n}\n.hours > [role=listitem i]:nth-child(24n+2) {\n --row: 2;\n}\n.hours > [role=listitem i]:nth-child(24n+3) {\n --row: 3;\n}\n.hours > [role=listitem i]:nth-child(24n+4) {\n --row: 4;\n}\n.hours > [role=listitem i]:nth-child(24n+5) {\n --row: 5;\n}\n.hours > [role=listitem i]:nth-child(24n+6) {\n --row: 6;\n}\n.hours > [role=listitem i]:nth-child(24n+7) {\n --row: 7;\n}\n.hours > [role=listitem i]:nth-child(24n+8) {\n --row: 8;\n}\n.hours > [role=listitem i]:nth-child(24n+9) {\n --row: 9;\n}\n.hours > [role=listitem i]:nth-child(24n+10) {\n --row: 10;\n}\n.hours > [role=listitem i]:nth-child(24n+11) {\n --row: 11;\n}\n.hours > [role=listitem i]:nth-child(24n+12) {\n --row: 12;\n}\n.hours > [role=listitem i]:nth-child(24n+13) {\n --row: 13;\n}\n.hours > [role=listitem i]:nth-child(24n+14) {\n --row: 14;\n}\n.hours > [role=listitem i]:nth-child(24n+15) {\n --row: 15;\n}\n.hours > [role=listitem i]:nth-child(24n+16) {\n --row: 16;\n}\n.hours > [role=listitem i]:nth-child(24n+17) {\n --row: 17;\n}\n.hours > [role=listitem i]:nth-child(24n+18) {\n --row: 18;\n}\n.hours > [role=listitem i]:nth-child(24n+19) {\n --row: 19;\n}\n.hours > [role=listitem i]:nth-child(24n+20) {\n --row: 20;\n}\n.hours > [role=listitem i]:nth-child(24n+21) {\n --row: 21;\n}\n.hours > [role=listitem i]:nth-child(24n+22) {\n --row: 22;\n}\n.hours > [role=listitem i]:nth-child(24n+23) {\n --row: 23;\n}\n.hours > [role=listitem i]:nth-child(24n+24) {\n --row: 24;\n}\n\n[role=gridcell i] {\n display: grid;\n gap: 1px;\n grid-auto-flow: column;\n}\n\n[role=gridcell i],\n[role=columnheader i],\n[role=columnheader i] [role=button i] {\n position: relative;\n}\n[role=gridcell i]::before,\n[role=columnheader i]::before,\n[role=columnheader i] [role=button i]::before {\n position: absolute;\n z-index: -1;\n background-color: var(--vvd-color-information-400);\n content: \"\";\n}\n@supports (inset: 0) {\n [role=gridcell i]::before,\n[role=columnheader i]::before,\n[role=columnheader i] [role=button i]::before {\n inset: 0;\n }\n}\n@supports not (inset: 0) {\n [role=gridcell i]::before,\n[role=columnheader i]::before,\n[role=columnheader i] [role=button i]::before {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n}\n[role=gridcell i]:focus,\n[role=columnheader i]:focus,\n[role=columnheader i] [role=button i]:focus {\n outline: none;\n}\n[role=gridcell i]:not(:focus-visible)::before,\n[role=columnheader i]:not(:focus-visible)::before,\n[role=columnheader i] [role=button i]:not(:focus-visible)::before {\n display: none;\n}\n\n.columns {\n display: contents;\n}\n.columns > [role=gridcell i] {\n position: relative;\n grid-column: var(--column);\n grid-row: 1/25;\n}\n.columns > [role=gridcell i]:nth-child(1) {\n --column: 1;\n}\n.columns > [role=gridcell i]:nth-child(2) {\n --column: 2;\n}\n.columns > [role=gridcell i]:nth-child(3) {\n --column: 3;\n}\n.columns > [role=gridcell i]:nth-child(4) {\n --column: 4;\n}\n.columns > [role=gridcell i]:nth-child(5) {\n --column: 5;\n}\n.columns > [role=gridcell i]:nth-child(6) {\n --column: 6;\n}\n.columns > [role=gridcell i]:nth-child(7) {\n --column: 7;\n}\n.columns > [role=gridcell i]:not(:first-child)::after {\n position: absolute;\n block-size: 100%;\n border-inline-end: var(--vvd-color-neutral-100) 1px solid;\n content: \"\";\n margin-inline-start: -1px;\n}\n\n.column-headers {\n display: grid;\n grid-area: column-headers;\n grid-template-columns: repeat(7, 1fr);\n}\n.column-headers [role=columnheader i] h2 {\n display: grid;\n align-items: baseline;\n margin: 0;\n font: var(--vvd-font-heading4);\n grid-template-columns: 1fr auto 1fr;\n}\n.column-headers [role=columnheader i] h2 > em {\n font: inherit;\n inline-size: min-content;\n}\n@supports (inset: 0) {\n .column-headers [role=columnheader i] h2 > em {\n inset-inline-start: 0;\n }\n}\n@supports not (inset: 0) {\n .column-headers [role=columnheader i] h2 > em {\n left: 0;\n }\n}\n.column-headers [role=columnheader i] h2 > small {\n font: var(--vvd-font-base-condensed);\n text-transform: uppercase;\n}";
|
|
1244
1250
|
styleInject(css_248z);
|
|
1245
1251
|
|
|
1246
1252
|
const ARROW_UP = 'ArrowUp';
|
|
@@ -1337,9 +1343,13 @@ const getEventContext = function getEventContext(e) {
|
|
|
1337
1343
|
return not$1(isEmpty$1(context)) ? context : null;
|
|
1338
1344
|
};
|
|
1339
1345
|
|
|
1346
|
+
var _Calendar_instances, _Calendar_activeCalendarEvent_get;
|
|
1340
1347
|
class Calendar extends FoundationElement {
|
|
1341
1348
|
constructor() {
|
|
1342
1349
|
super(...arguments);
|
|
1350
|
+
|
|
1351
|
+
_Calendar_instances.add(this);
|
|
1352
|
+
|
|
1343
1353
|
this.hour12 = false;
|
|
1344
1354
|
this._hours = 24;
|
|
1345
1355
|
this._days = 7;
|
|
@@ -1360,22 +1370,32 @@ class Calendar extends FoundationElement {
|
|
|
1360
1370
|
this.getEventContext = getEventContext;
|
|
1361
1371
|
}
|
|
1362
1372
|
|
|
1373
|
+
getCalendarEventContainingCell(calendarEvent) {
|
|
1374
|
+
const slotName = calendarEvent.getAttribute('slot');
|
|
1375
|
+
const gridCell = this.shadowRoot.querySelector(`slot[name="${slotName}"i]`);
|
|
1376
|
+
return gridCell.parentElement;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1363
1379
|
arrowKeysInteractions(key) {
|
|
1364
|
-
const
|
|
1380
|
+
const {
|
|
1381
|
+
activeElement
|
|
1382
|
+
} = this.shadowRoot;
|
|
1365
1383
|
let focusNext;
|
|
1366
1384
|
|
|
1367
1385
|
if (isCellOrHeader(activeElement)) {
|
|
1368
1386
|
focusNext = getNextFocusableGridElement.call(this, key, activeElement);
|
|
1387
|
+
} else if (__classPrivateFieldGet(this, _Calendar_instances, "a", _Calendar_activeCalendarEvent_get)) {
|
|
1388
|
+
focusNext = this.getCalendarEventContainingCell(__classPrivateFieldGet(this, _Calendar_instances, "a", _Calendar_activeCalendarEvent_get));
|
|
1369
1389
|
} else if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.matches('em[role="button"i]')) {
|
|
1370
1390
|
focusNext = getHeaderDescendantGridCell.call(this, key, activeElement);
|
|
1371
1391
|
} else {
|
|
1372
1392
|
focusNext = this.shadowRoot.querySelector('[role="columnheader"i]');
|
|
1373
1393
|
}
|
|
1374
1394
|
|
|
1375
|
-
this.
|
|
1395
|
+
this.activateElement(focusNext);
|
|
1376
1396
|
}
|
|
1377
1397
|
|
|
1378
|
-
|
|
1398
|
+
activateElement(el) {
|
|
1379
1399
|
const onBlur = ({
|
|
1380
1400
|
target
|
|
1381
1401
|
}) => target.setAttribute('tabindex', '-1');
|
|
@@ -1400,6 +1420,12 @@ class Calendar extends FoundationElement {
|
|
|
1400
1420
|
}
|
|
1401
1421
|
|
|
1402
1422
|
}
|
|
1423
|
+
_Calendar_instances = new WeakSet(), _Calendar_activeCalendarEvent_get = function _Calendar_activeCalendarEvent_get() {
|
|
1424
|
+
const {
|
|
1425
|
+
activeElement
|
|
1426
|
+
} = document;
|
|
1427
|
+
return activeElement instanceof CalendarEvent ? activeElement : null;
|
|
1428
|
+
};
|
|
1403
1429
|
|
|
1404
1430
|
__decorate([attr, __metadata("design:type", Object)], Calendar.prototype, "datetime", void 0);
|
|
1405
1431
|
|
|
@@ -1514,7 +1540,10 @@ const CalendarTemplate = () => html(_t6 || (_t6 = _2`
|
|
|
1514
1540
|
const vividCalendar = Calendar.compose({
|
|
1515
1541
|
baseName: 'calendar',
|
|
1516
1542
|
template: CalendarTemplate,
|
|
1517
|
-
styles: css_248z
|
|
1543
|
+
styles: css_248z,
|
|
1544
|
+
shadowOptions: {
|
|
1545
|
+
delegatesFocus: true
|
|
1546
|
+
}
|
|
1518
1547
|
});
|
|
1519
1548
|
designSystem.register(vividCalendar());
|
|
1520
1549
|
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { h as html, d as designSystem } from '../shared/index.js';
|
|
2
|
+
import { s as styleInject } from '../shared/style-inject.es.js';
|
|
3
|
+
import { C as CalendarEvent } from '../shared/calendar-event.js';
|
|
4
|
+
import '../shared/es.object.assign.js';
|
|
5
|
+
import { _ as _export, d as descriptors, g as global$1, f as functionUncurryThis, p as hasOwnProperty_1, i as isCallable$1, o as objectDefineProperty, P as copyConstructorProperties$1, b as objectIsPrototypeOf } from '../shared/export.js';
|
|
6
|
+
import { t as toString$1 } from '../shared/to-string.js';
|
|
7
|
+
import { w as when } from '../shared/when.js';
|
|
8
|
+
import { c as classNames } from '../shared/class-names.js';
|
|
9
|
+
import '../shared/object-keys.js';
|
|
10
|
+
|
|
11
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Mon, 05 Sep 2022 17:52:00 GMT\n */\n:host {\n display: contents;\n}\n\n.base {\n /* 4 as the indentation limit */\n /* per cell divider */\n /* per cell divider */\n --vvd-calendar-event--indent: calc(0px + var(--vvd-calendar-event--overlap-count, 0) * 8px);\n position: absolute;\n z-index: var(--vvd-calendar-event--overlap-count);\n top: calc(var(--vvd-calendar-event--start, 0) * (100% - 23px) / 24 + calc(1px * var(--vvd-calendar-event--start, 0)));\n overflow: hidden;\n box-sizing: border-box;\n padding: 4px 8px;\n background-color: var(--_appearance-color-fill);\n block-size: calc(var(--vvd-calendar-event--duration, 1) * calc((100% - 23px) / 24) + calc(1px * (var(--vvd-calendar-event--duration, 1) - 1)) - 4px);\n border-radius: 6px;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n inline-size: calc(100% - 8px - min(var(--vvd-calendar-event--indent), 32px));\n margin-block-start: 2px;\n margin-inline-end: 8px;\n margin-inline-start: min(var(--vvd-calendar-event--indent), 32px);\n max-block-size: calc(100% - calc(var(--vvd-calendar-event--start, 0) * (100% - 23px) / 24 + calc(1px * var(--vvd-calendar-event--start, 0))) - 4px);\n}\n.base.connotation-accent {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-contrast: var(--vvd-color-neutral-800);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n}\n.base.connotation-cta {\n --_connotation-color-primary: var(--vvd-color-cta-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-contrast: var(--vvd-color-cta-800);\n --_connotation-color-soft: var(--vvd-color-cta-100);\n}\n.base.connotation-success {\n --_connotation-color-primary: var(--vvd-color-success-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-contrast: var(--vvd-color-success-800);\n --_connotation-color-soft: var(--vvd-color-success-100);\n}\n.base.connotation-alert {\n --_connotation-color-primary: var(--vvd-color-alert-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-contrast: var(--vvd-color-alert-800);\n --_connotation-color-soft: var(--vvd-color-alert-100);\n}\n.base.connotation-warning {\n --_connotation-color-primary: var(--vvd-color-warning-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-contrast: var(--vvd-color-warning-800);\n --_connotation-color-soft: var(--vvd-color-warning-100);\n}\n.base.connotation-announcement {\n --_connotation-color-primary: var(--vvd-color-announcement-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-contrast: var(--vvd-color-announcement-800);\n --_connotation-color-soft: var(--vvd-color-announcement-100);\n}\n.base:not(.connotation-accent, .connotation-cta, .connotation-success, .connotation-alert, .connotation-warning, .connotation-announcement) {\n --_connotation-color-primary: var(--vvd-color-information-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-contrast: var(--vvd-color-information-800);\n --_connotation-color-soft: var(--vvd-color-information-100);\n}\n.base {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transaprent;\n}\n.base.appearance-subtle {\n --_appearance-color-text: var(--_connotation-color-contrast);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transaprent;\n}\n@supports (contain: content) {\n .base {\n contain: strict;\n }\n}\n@supports not (contain: content) {\n .base {\n overflow: hidden;\n }\n}\n.base:focus {\n z-index: 2000;\n filter: var(--vvd-shadow-surface-8dp);\n outline: none;\n}\n\nh2 {\n margin: 0;\n font: var(--vvd-font-base-condensed-bold);\n}\nh2 > strong {\n font: inherit;\n}\n\np {\n margin: 0;\n font: var(--vvd-font-base-condensed);\n}";
|
|
12
|
+
styleInject(css_248z);
|
|
13
|
+
|
|
14
|
+
var $ = _export;
|
|
15
|
+
var DESCRIPTORS = descriptors;
|
|
16
|
+
var global = global$1;
|
|
17
|
+
var uncurryThis = functionUncurryThis;
|
|
18
|
+
var hasOwn = hasOwnProperty_1;
|
|
19
|
+
var isCallable = isCallable$1;
|
|
20
|
+
var isPrototypeOf = objectIsPrototypeOf;
|
|
21
|
+
var toString = toString$1;
|
|
22
|
+
var defineProperty = objectDefineProperty.f;
|
|
23
|
+
var copyConstructorProperties = copyConstructorProperties$1;
|
|
24
|
+
|
|
25
|
+
var NativeSymbol = global.Symbol;
|
|
26
|
+
var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
|
|
27
|
+
|
|
28
|
+
if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) ||
|
|
29
|
+
// Safari 12 bug
|
|
30
|
+
NativeSymbol().description !== undefined
|
|
31
|
+
)) {
|
|
32
|
+
var EmptyStringDescriptionStore = {};
|
|
33
|
+
// wrap Symbol constructor for correct work with undefined description
|
|
34
|
+
var SymbolWrapper = function Symbol() {
|
|
35
|
+
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]);
|
|
36
|
+
var result = isPrototypeOf(SymbolPrototype, this)
|
|
37
|
+
? new NativeSymbol(description)
|
|
38
|
+
// in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
|
|
39
|
+
: description === undefined ? NativeSymbol() : NativeSymbol(description);
|
|
40
|
+
if (description === '') EmptyStringDescriptionStore[result] = true;
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
copyConstructorProperties(SymbolWrapper, NativeSymbol);
|
|
45
|
+
SymbolWrapper.prototype = SymbolPrototype;
|
|
46
|
+
SymbolPrototype.constructor = SymbolWrapper;
|
|
47
|
+
|
|
48
|
+
var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)';
|
|
49
|
+
var symbolToString = uncurryThis(SymbolPrototype.toString);
|
|
50
|
+
var symbolValueOf = uncurryThis(SymbolPrototype.valueOf);
|
|
51
|
+
var regexp = /^Symbol\((.*)\)[^)]+$/;
|
|
52
|
+
var replace = uncurryThis(''.replace);
|
|
53
|
+
var stringSlice = uncurryThis(''.slice);
|
|
54
|
+
|
|
55
|
+
defineProperty(SymbolPrototype, 'description', {
|
|
56
|
+
configurable: true,
|
|
57
|
+
get: function description() {
|
|
58
|
+
var symbol = symbolValueOf(this);
|
|
59
|
+
var string = symbolToString(symbol);
|
|
60
|
+
if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
|
|
61
|
+
var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');
|
|
62
|
+
return desc === '' ? undefined : desc;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
$({ global: true, constructor: true, forced: true }, {
|
|
67
|
+
Symbol: SymbolWrapper
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let _ = t => t,
|
|
72
|
+
_t,
|
|
73
|
+
_t2,
|
|
74
|
+
_t3;
|
|
75
|
+
|
|
76
|
+
const getClasses = ({
|
|
77
|
+
connotation,
|
|
78
|
+
appearance
|
|
79
|
+
}) => classNames('base', [`connotation-${connotation}`, Boolean(connotation)], [`appearance-${appearance}`, Boolean(appearance)]);
|
|
80
|
+
|
|
81
|
+
const getStyles = ({
|
|
82
|
+
start,
|
|
83
|
+
duration,
|
|
84
|
+
overlapCount
|
|
85
|
+
}) => {
|
|
86
|
+
const stylesObj = Object.assign(Object.assign(Object.assign({}, overlapCount && {
|
|
87
|
+
'--vvd-calendar-event--overlap-count': overlapCount
|
|
88
|
+
}), start && {
|
|
89
|
+
'--vvd-calendar-event--start': start
|
|
90
|
+
}), duration && {
|
|
91
|
+
'--vvd-calendar-event--duration': duration
|
|
92
|
+
});
|
|
93
|
+
return Object.entries(stylesObj).map(entry => entry.join(':')).join(';');
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const CalendarEventTemplate = () => html(_t || (_t = _`
|
|
97
|
+
<div
|
|
98
|
+
style="${0}"
|
|
99
|
+
class="${0}"
|
|
100
|
+
role="button"
|
|
101
|
+
tabindex="0"
|
|
102
|
+
>
|
|
103
|
+
${0}
|
|
104
|
+
${0}
|
|
105
|
+
</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)));
|
|
106
|
+
|
|
107
|
+
const vividCalendarEvent = CalendarEvent.compose({
|
|
108
|
+
baseName: 'calendar-event',
|
|
109
|
+
template: CalendarEventTemplate,
|
|
110
|
+
styles: css_248z,
|
|
111
|
+
shadowOptions: {
|
|
112
|
+
delegatesFocus: true
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
designSystem.register(vividCalendarEvent());
|
|
116
|
+
|
|
117
|
+
export { vividCalendarEvent };
|
package/card/index.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import '../shared/index2.js';
|
|
2
|
+
import '../icon/index.js';
|
|
3
|
+
import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, o as observable, h as html, d as designSystem } from '../shared/index.js';
|
|
4
|
+
import { s as styleInject } from '../shared/style-inject.es.js';
|
|
5
|
+
import { s as slotted } from '../shared/slotted.js';
|
|
6
|
+
import { w as when } from '../shared/when.js';
|
|
7
|
+
import { c as classNames } from '../shared/class-names.js';
|
|
8
|
+
import '../shared/icon.js';
|
|
9
|
+
import '../shared/export.js';
|
|
10
|
+
import '../shared/iterators.js';
|
|
11
|
+
import '../shared/to-string.js';
|
|
12
|
+
import '../shared/_has.js';
|
|
13
|
+
|
|
14
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Mon, 05 Sep 2022 17:52:00 GMT\n */\n:host {\n display: flex;\n}\n\n.base {\n border-radius: 6px;\n inline-size: 100%;\n}\n\n.wrapper {\n display: flex;\n overflow: hidden;\n flex-flow: column;\n block-size: inherit;\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-font-heading4);\n -webkit-line-clamp: var(--headline-line-clamp);\n}\n.header-subtitle {\n font: var(--vvd-font-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-font-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}";
|
|
15
|
+
styleInject(css_248z);
|
|
16
|
+
|
|
17
|
+
class Card extends FoundationElement {}
|
|
18
|
+
|
|
19
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "headline", void 0);
|
|
20
|
+
|
|
21
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "subtitle", void 0);
|
|
22
|
+
|
|
23
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "text", void 0);
|
|
24
|
+
|
|
25
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "icon", void 0);
|
|
26
|
+
|
|
27
|
+
__decorate([attr, __metadata("design:type", Number)], Card.prototype, "elevation", void 0);
|
|
28
|
+
|
|
29
|
+
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "footerSlottedContent", void 0);
|
|
30
|
+
|
|
31
|
+
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "graphicSlottedContent", void 0);
|
|
32
|
+
|
|
33
|
+
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "hasMetaSlottedContent", void 0);
|
|
34
|
+
|
|
35
|
+
let _2 = t => t,
|
|
36
|
+
_t,
|
|
37
|
+
_t2,
|
|
38
|
+
_t3,
|
|
39
|
+
_t4,
|
|
40
|
+
_t5,
|
|
41
|
+
_t6,
|
|
42
|
+
_t7,
|
|
43
|
+
_t8;
|
|
44
|
+
|
|
45
|
+
const getClasses = _ => classNames('base', ['hide-footer', !_.footerSlottedContent || !_.footerSlottedContent.length], ['hide-header', shouldHideHeader(_)]);
|
|
46
|
+
|
|
47
|
+
function renderHeaderIcon() {
|
|
48
|
+
return html(_t || (_t = _2`
|
|
49
|
+
<vwc-icon class="icon" inline type="${0}"></vwc-icon>`), x => x.icon);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function Headline() {
|
|
53
|
+
return html(_t2 || (_t2 = _2`
|
|
54
|
+
<div class="header-headline">${0}</div>
|
|
55
|
+
`), x => x.headline);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function Subtitle() {
|
|
59
|
+
return html(_t3 || (_t3 = _2`
|
|
60
|
+
<div class="header-subtitle">${0}</div>
|
|
61
|
+
`), x => x.subtitle);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function headerContent() {
|
|
65
|
+
return html(_t4 || (_t4 = _2`
|
|
66
|
+
<div class="header-content">
|
|
67
|
+
${0}
|
|
68
|
+
${0}
|
|
69
|
+
</div>
|
|
70
|
+
`), when(x => x.headline, Headline()), when(x => x.subtitle, Subtitle()));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function renderHeader() {
|
|
74
|
+
return html(_t5 || (_t5 = _2`
|
|
75
|
+
<header class="header">
|
|
76
|
+
<slot name="graphic" ${0}>${0}</slot>
|
|
77
|
+
${0}
|
|
78
|
+
</header>`), slotted('graphicSlottedContent'), when(x => x.icon, renderHeaderIcon()), when(x => x.headline || x.subtitle, headerContent()));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function shouldHideHeader(card) {
|
|
82
|
+
return !card.headline && !card.subtitle && !card.icon && (!card.graphicSlottedContent || !card.graphicSlottedContent.length);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function renderMetaSlot() {
|
|
86
|
+
return html(_t6 || (_t6 = _2`
|
|
87
|
+
<slot name="meta" ${0}></slot>
|
|
88
|
+
`), slotted('metaSlottedContent'));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function text() {
|
|
92
|
+
return html(_t7 || (_t7 = _2`
|
|
93
|
+
<div class="text">${0}</div>
|
|
94
|
+
`), x => x.text);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const CardTemplate = () => html(_t8 || (_t8 = _2`
|
|
98
|
+
<vwc-elevation dp=${0}>
|
|
99
|
+
|
|
100
|
+
<div class="${0}">
|
|
101
|
+
<div class="wrapper">
|
|
102
|
+
<div class="vwc-card-media">
|
|
103
|
+
<slot name="media"></slot>
|
|
104
|
+
</div>
|
|
105
|
+
<slot name="main">
|
|
106
|
+
<div class="main-content">
|
|
107
|
+
<div class="header-wrapper">
|
|
108
|
+
${0}
|
|
109
|
+
${0}
|
|
110
|
+
</div>
|
|
111
|
+
${0}
|
|
112
|
+
</div>
|
|
113
|
+
</slot>
|
|
114
|
+
<div class="footer">
|
|
115
|
+
<slot name="footer" ${0}></slot>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
</vwc-elevation>
|
|
121
|
+
`), x => {
|
|
122
|
+
var _a;
|
|
123
|
+
|
|
124
|
+
return (_a = x.elevation) !== null && _a !== void 0 ? _a : '4';
|
|
125
|
+
}, getClasses, renderHeader(), renderMetaSlot(), when(x => x.text, text()), slotted('footerSlottedContent'));
|
|
126
|
+
|
|
127
|
+
const vividCard = Card.compose({
|
|
128
|
+
baseName: 'card',
|
|
129
|
+
template: CardTemplate,
|
|
130
|
+
styles: css_248z
|
|
131
|
+
});
|
|
132
|
+
designSystem.register(vividCard());
|
|
133
|
+
|
|
134
|
+
export { vividCard };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import '../icon/index.js';
|
|
2
|
+
import '../focus/index.js';
|
|
3
|
+
import { F as FoundationElement, _ as __decorate, a as attr, o as observable, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
|
|
4
|
+
import { s as styleInject } from '../shared/style-inject.es.js';
|
|
5
|
+
import '../shared/web.dom-collections.iterator.js';
|
|
6
|
+
import { C as CheckableFormAssociated, k as keySpace$1 } from '../shared/form-associated.js';
|
|
7
|
+
import { f as focusTemplateFactory } from '../shared/focus2.js';
|
|
8
|
+
import { I as Icon } from '../shared/icon.js';
|
|
9
|
+
import { w as when } from '../shared/when.js';
|
|
10
|
+
import { c as classNames } from '../shared/class-names.js';
|
|
11
|
+
import '../shared/export.js';
|
|
12
|
+
import '../shared/iterators.js';
|
|
13
|
+
import '../shared/to-string.js';
|
|
14
|
+
import '../shared/_has.js';
|
|
15
|
+
import '../shared/focus.js';
|
|
16
|
+
import '../shared/object-keys.js';
|
|
17
|
+
|
|
18
|
+
class _Checkbox extends FoundationElement {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A form-associated base class for the {@link @microsoft/fast-foundation#(Checkbox:class)} component.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
class FormAssociatedCheckbox extends CheckableFormAssociated(_Checkbox) {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this.proxy = document.createElement("input");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A Checkbox Custom HTML Element.
|
|
34
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#checkbox | ARIA checkbox }.
|
|
35
|
+
*
|
|
36
|
+
* @slot checked-indicator - The checked indicator
|
|
37
|
+
* @slot indeterminate-indicator - The indeterminate indicator
|
|
38
|
+
* @slot - The default slot for the label
|
|
39
|
+
* @csspart control - The element representing the visual checkbox control
|
|
40
|
+
* @csspart label - The label
|
|
41
|
+
* @fires change - Emits a custom change event when the checked state changes
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
class Checkbox$1 extends FormAssociatedCheckbox {
|
|
46
|
+
constructor() {
|
|
47
|
+
super();
|
|
48
|
+
/**
|
|
49
|
+
* The element's value to be included in form submission when checked.
|
|
50
|
+
* Default to "on" to reach parity with input[type="checkbox"]
|
|
51
|
+
*
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
this.initialValue = "on";
|
|
55
|
+
/**
|
|
56
|
+
* The indeterminate state of the control
|
|
57
|
+
*/
|
|
58
|
+
this.indeterminate = false;
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
this.keypressHandler = (e) => {
|
|
63
|
+
switch (e.key) {
|
|
64
|
+
case keySpace$1:
|
|
65
|
+
this.checked = !this.checked;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
this.clickHandler = (e) => {
|
|
73
|
+
if (!this.disabled && !this.readOnly) {
|
|
74
|
+
this.checked = !this.checked;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
this.proxy.setAttribute("type", "checkbox");
|
|
78
|
+
}
|
|
79
|
+
readOnlyChanged() {
|
|
80
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
81
|
+
this.proxy.readOnly = this.readOnly;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
__decorate([
|
|
86
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
87
|
+
], Checkbox$1.prototype, "readOnly", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
observable
|
|
90
|
+
], Checkbox$1.prototype, "defaultSlottedNodes", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
observable
|
|
93
|
+
], Checkbox$1.prototype, "indeterminate", void 0);
|
|
94
|
+
|
|
95
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Mon, 05 Sep 2022 17:52:00 GMT\n */\n.base {\n display: inline-flex;\n align-items: center;\n gap: 12px;\n}\n.base {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n}\n.base {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-canvas);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-canvas);\n --_appearance-color-outline: var(--vvd-color-canvas-text);\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(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.base:where(:readonly, .readonly):where(:not(:disabled, .disabled, :hover, .hover, :active, .active)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.base:where(:indeterminate, .indeterminate):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@supports selector(:focus-visible) {\n .base:focus {\n outline: none;\n }\n}\n@supports ((-webkit-user-select: none) or (user-select: none)) {\n .base {\n -webkit-user-select: none;\n user-select: none;\n }\n}\n\n.control {\n position: relative;\n display: inline-flex;\n width: 24px;\n height: 24px;\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 cursor: pointer;\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-font-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}";
|
|
96
|
+
styleInject(css_248z);
|
|
97
|
+
|
|
98
|
+
const keySpace = ' ';
|
|
99
|
+
class Checkbox extends Checkbox$1 {
|
|
100
|
+
constructor() {
|
|
101
|
+
super(...arguments);
|
|
102
|
+
|
|
103
|
+
this.keypressHandler = e => {
|
|
104
|
+
switch (e.key) {
|
|
105
|
+
case keySpace:
|
|
106
|
+
if (this.indeterminate) {
|
|
107
|
+
this.indeterminate = false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
this.checked = !this.checked;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
this.clickHandler = () => {
|
|
116
|
+
if (!this.disabled && !this.readOnly) {
|
|
117
|
+
if (this.indeterminate) {
|
|
118
|
+
this.indeterminate = false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
this.checked = !this.checked;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
__decorate([attr, __metadata("design:type", String)], Checkbox.prototype, "label", void 0);
|
|
129
|
+
|
|
130
|
+
let _ = t => t,
|
|
131
|
+
_t,
|
|
132
|
+
_t2;
|
|
133
|
+
|
|
134
|
+
const getClasses = ({
|
|
135
|
+
readOnly,
|
|
136
|
+
checked,
|
|
137
|
+
disabled,
|
|
138
|
+
indeterminate
|
|
139
|
+
}) => classNames('base', ['readonly', Boolean(readOnly)], ['checked', Boolean(checked)], ['disabled', Boolean(disabled)], ['indeterminate', Boolean(indeterminate)]);
|
|
140
|
+
|
|
141
|
+
const CheckboxTemplate = context => {
|
|
142
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
143
|
+
const iconTag = context.tagFor(Icon);
|
|
144
|
+
return html(_t || (_t = _`<span
|
|
145
|
+
role="checkbox"
|
|
146
|
+
aria-checked="${0}"
|
|
147
|
+
aria-required="${0}"
|
|
148
|
+
aria-disabled="${0}"
|
|
149
|
+
aria-readonly="${0}"
|
|
150
|
+
tabindex="${0}"
|
|
151
|
+
@keypress="${0}"
|
|
152
|
+
@click="${0}"
|
|
153
|
+
class="${0}"
|
|
154
|
+
>
|
|
155
|
+
<div class="control">
|
|
156
|
+
<${0} class="indicator checkmark" type="check-solid"></${0}>
|
|
157
|
+
<${0} class="indicator minus" type="minus-solid"></${0}>
|
|
158
|
+
${0}
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
${0}
|
|
162
|
+
|
|
163
|
+
</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, iconTag, iconTag, iconTag, iconTag, () => focusTemplate, when(x => x.label, html(_t2 || (_t2 = _`<label>${0}</label>`), x => x.label)));
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const vividCheckbox = Checkbox.compose({
|
|
167
|
+
baseName: 'checkbox',
|
|
168
|
+
template: CheckboxTemplate,
|
|
169
|
+
styles: css_248z
|
|
170
|
+
});
|
|
171
|
+
designSystem.register(vividCheckbox());
|
|
172
|
+
|
|
173
|
+
export { vividCheckbox };
|