@vonage/vivid 3.0.0-next.8 → 3.0.0-next.81
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 +141 -4
- package/accordion/index.js +2 -4
- package/accordion-item/index.js +26 -20
- package/action-group/index.js +47 -0
- package/avatar/index.js +70 -0
- package/badge/index.js +17 -21
- package/banner/index.js +23 -87
- package/breadcrumb/index.js +21 -18
- package/breadcrumb-item/index.js +19 -12
- package/button/index.js +19 -757
- package/calendar/index.js +67 -25
- package/calendar-event/index.js +115 -0
- package/card/index.js +132 -0
- package/checkbox/index.js +184 -0
- package/dialog/index.js +281 -0
- package/divider/index.js +3 -0
- package/elevation/index.js +3 -31
- package/fab/index.js +105 -0
- package/focus/index.js +18 -3
- package/header/index.js +66 -0
- package/icon/index.js +9 -5
- package/index.js +53 -20
- package/layout/index.js +4 -6
- 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/avatar/avatar.d.ts +15 -0
- package/lib/avatar/avatar.template.d.ts +4 -0
- package/lib/avatar/index.d.ts +3 -0
- package/lib/badge/badge.d.ts +5 -5
- 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 +27 -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 +11 -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 +12 -0
- package/lib/menu/menu.d.ts +10 -0
- package/lib/menu/menu.template.d.ts +3 -0
- package/lib/menu-item/index.d.ts +3 -0
- package/lib/menu-item/menu-item.d.ts +7 -0
- package/lib/menu-item/menu-item.template.d.ts +5 -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/number-field/index.d.ts +4 -0
- package/lib/number-field/number-field.d.ts +16 -0
- package/lib/number-field/number-field.template.d.ts +4 -0
- package/lib/popup/index.d.ts +1 -1
- package/lib/popup/popup.d.ts +2 -1
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress-ring/progress-ring.d.ts +2 -1
- package/lib/radio/index.d.ts +3 -0
- package/lib/radio/radio.d.ts +4 -0
- package/lib/radio/radio.template.d.ts +4 -0
- package/lib/side-drawer/index.d.ts +1 -1
- package/lib/side-drawer/side-drawer.d.ts +3 -2
- package/lib/text-anchor/text-anchor.d.ts +1 -1
- package/lib/text-area/index.d.ts +4 -0
- package/lib/text-area/text-area.d.ts +9 -0
- package/lib/text-area/text-area.template.d.ts +4 -0
- 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 -2
- package/menu/index.js +381 -0
- package/menu-item/index.js +19 -0
- package/nav/index.js +17 -0
- package/nav-disclosure/index.js +88 -0
- package/nav-item/index.js +45 -0
- package/note/index.js +66 -0
- package/number-field/index.js +517 -0
- package/package.json +51 -7
- package/popup/index.js +23 -2061
- package/progress/index.js +35 -28
- package/progress-ring/index.js +9 -5
- package/radio/index.js +174 -0
- package/shared/anchor.js +10 -2
- package/shared/aria-global.js +2 -86
- package/shared/base-progress.js +5 -0
- package/shared/breadcrumb-item.js +1 -1
- package/shared/button.js +200 -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 +995 -0
- package/shared/focus.js +5 -0
- package/shared/focus2.js +11 -0
- package/shared/form-associated.js +466 -0
- package/shared/form-elements.js +353 -0
- package/shared/icon.js +533 -520
- package/shared/index.js +71 -55
- package/shared/index2.js +110 -13
- package/shared/index3.js +35 -0
- package/shared/index4.js +86 -0
- package/shared/index5.js +2100 -0
- package/shared/index6.js +371 -0
- package/shared/iterators.js +61 -0
- package/shared/key-codes.js +90 -0
- package/shared/object-keys.js +13 -0
- package/shared/patterns/focus.d.ts +3 -0
- package/shared/patterns/form-elements/form-elements.d.ts +28 -0
- package/shared/patterns/form-elements/index.d.ts +1 -0
- package/shared/patterns/index.d.ts +2 -0
- package/shared/ref.js +41 -0
- package/shared/regexp-flags.js +21 -0
- package/shared/start-end.js +50 -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 +78 -1083
- package/side-drawer/index.js +44 -23
- package/styles/core/all.css +75 -0
- package/styles/core/theme.css +11 -0
- package/styles/core/typography.css +69 -0
- package/styles/fonts/SpeziaCompleteVariableItalicWeb.woff2 +0 -0
- package/styles/fonts/SpeziaCompleteVariableUprightWeb.woff2 +0 -0
- package/styles/fonts/SpeziaMonoCompleteVariableWeb.woff2 +0 -0
- package/styles/fonts/spezia.css +9 -12
- package/styles/tokens/theme-dark.css +211 -0
- package/styles/tokens/theme-light.css +211 -0
- package/text-anchor/index.js +9 -1
- package/text-area/index.js +294 -0
- package/text-field/index.js +141 -0
- package/tooltip/index.js +23 -16
- package/lib/text/text.d.ts +0 -10
- package/shared/style-inject.es.js +0 -28
- package/sidenav-item/index.js +0 -38
- package/styles/themes/dark.css +0 -205
- package/styles/themes/light.css +0 -205
- package/text/index.js +0 -45
package/calendar/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
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';
|
|
3
|
-
import { s as styleInject } from '../shared/style-inject.es.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';
|
|
4
2
|
import '../shared/web.dom-collections.iterator.js';
|
|
3
|
+
import { C as CalendarEvent } from '../shared/calendar-event.js';
|
|
5
4
|
import '../shared/es.object.assign.js';
|
|
6
5
|
import { b as _has, _ as _curry1, a as _curry2 } from '../shared/_has.js';
|
|
7
|
-
import '../shared/
|
|
6
|
+
import '../shared/export.js';
|
|
7
|
+
import '../shared/object-keys.js';
|
|
8
|
+
import '../shared/iterators.js';
|
|
8
9
|
|
|
9
10
|
/** @internal */
|
|
10
11
|
function newSplice(index, removed, addedCount) {
|
|
@@ -361,6 +362,10 @@ class ArrayObserver extends SubscriberSet {
|
|
|
361
362
|
enumerable: false,
|
|
362
363
|
});
|
|
363
364
|
}
|
|
365
|
+
subscribe(subscriber) {
|
|
366
|
+
this.flush();
|
|
367
|
+
super.subscribe(subscriber);
|
|
368
|
+
}
|
|
364
369
|
addSplice(splice) {
|
|
365
370
|
if (this.splices === void 0) {
|
|
366
371
|
this.splices = [splice];
|
|
@@ -610,34 +615,49 @@ class RepeatBehavior {
|
|
|
610
615
|
updateViews(splices) {
|
|
611
616
|
const childContext = this.childContext;
|
|
612
617
|
const views = this.views;
|
|
613
|
-
const totalRemoved = [];
|
|
614
618
|
const bindView = this.bindView;
|
|
615
|
-
let removeDelta = 0;
|
|
616
|
-
for (let i = 0, ii = splices.length; i < ii; ++i) {
|
|
617
|
-
const splice = splices[i];
|
|
618
|
-
const removed = splice.removed;
|
|
619
|
-
totalRemoved.push(...views.splice(splice.index + removeDelta, removed.length));
|
|
620
|
-
removeDelta -= splice.addedCount;
|
|
621
|
-
}
|
|
622
619
|
const items = this.items;
|
|
623
620
|
const template = this.template;
|
|
621
|
+
const recycle = this.options.recycle;
|
|
622
|
+
const leftoverViews = [];
|
|
623
|
+
let leftoverIndex = 0;
|
|
624
|
+
let availableViews = 0;
|
|
624
625
|
for (let i = 0, ii = splices.length; i < ii; ++i) {
|
|
625
626
|
const splice = splices[i];
|
|
627
|
+
const removed = splice.removed;
|
|
628
|
+
let removeIndex = 0;
|
|
626
629
|
let addIndex = splice.index;
|
|
627
630
|
const end = addIndex + splice.addedCount;
|
|
631
|
+
const removedViews = views.splice(splice.index, removed.length);
|
|
632
|
+
availableViews = leftoverViews.length + removedViews.length;
|
|
628
633
|
for (; addIndex < end; ++addIndex) {
|
|
629
634
|
const neighbor = views[addIndex];
|
|
630
635
|
const location = neighbor ? neighbor.firstChild : this.location;
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
636
|
+
let view;
|
|
637
|
+
if (recycle && availableViews > 0) {
|
|
638
|
+
if (removeIndex <= availableViews && removedViews.length > 0) {
|
|
639
|
+
view = removedViews[removeIndex];
|
|
640
|
+
removeIndex++;
|
|
641
|
+
}
|
|
642
|
+
else {
|
|
643
|
+
view = leftoverViews[leftoverIndex];
|
|
644
|
+
leftoverIndex++;
|
|
645
|
+
}
|
|
646
|
+
availableViews--;
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
view = template.create();
|
|
650
|
+
}
|
|
634
651
|
views.splice(addIndex, 0, view);
|
|
635
652
|
bindView(view, items, addIndex, childContext);
|
|
636
653
|
view.insertBefore(location);
|
|
637
654
|
}
|
|
655
|
+
if (removedViews[removeIndex]) {
|
|
656
|
+
leftoverViews.push(...removedViews.slice(removeIndex));
|
|
657
|
+
}
|
|
638
658
|
}
|
|
639
|
-
for (let i =
|
|
640
|
-
|
|
659
|
+
for (let i = leftoverIndex, ii = leftoverViews.length; i < ii; ++i) {
|
|
660
|
+
leftoverViews[i].dispose();
|
|
641
661
|
}
|
|
642
662
|
if (this.options.positioning) {
|
|
643
663
|
for (let i = 0, ii = views.length; i < ii; ++i) {
|
|
@@ -656,7 +676,7 @@ class RepeatBehavior {
|
|
|
656
676
|
let itemsLength = items.length;
|
|
657
677
|
let views = this.views;
|
|
658
678
|
let viewsLength = views.length;
|
|
659
|
-
if (itemsLength === 0 || templateChanged) {
|
|
679
|
+
if (itemsLength === 0 || templateChanged || !this.options.recycle) {
|
|
660
680
|
// all views need to be removed
|
|
661
681
|
HTMLView.disposeContiguousBatch(views);
|
|
662
682
|
viewsLength = 0;
|
|
@@ -744,7 +764,7 @@ function repeat(itemsBinding, templateOrTemplateBinding, options = defaultRepeat
|
|
|
744
764
|
const templateBinding = typeof templateOrTemplateBinding === "function"
|
|
745
765
|
? templateOrTemplateBinding
|
|
746
766
|
: () => templateOrTemplateBinding;
|
|
747
|
-
return new RepeatDirective(itemsBinding, templateBinding, options);
|
|
767
|
+
return new RepeatDirective(itemsBinding, templateBinding, Object.assign(Object.assign({}, defaultRepeatOptions), options));
|
|
748
768
|
}
|
|
749
769
|
|
|
750
770
|
/**
|
|
@@ -1240,8 +1260,7 @@ _curry1(function isEmpty(x) {
|
|
|
1240
1260
|
|
|
1241
1261
|
var isEmpty$1 = isEmpty;
|
|
1242
1262
|
|
|
1243
|
-
var css_248z = "
|
|
1244
|
-
styleInject(css_248z);
|
|
1263
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Mon, 24 Oct 2022 13:21:54 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}";
|
|
1245
1264
|
|
|
1246
1265
|
const ARROW_UP = 'ArrowUp';
|
|
1247
1266
|
const ARROW_RIGHT = 'ArrowRight';
|
|
@@ -1337,9 +1356,13 @@ const getEventContext = function getEventContext(e) {
|
|
|
1337
1356
|
return not$1(isEmpty$1(context)) ? context : null;
|
|
1338
1357
|
};
|
|
1339
1358
|
|
|
1359
|
+
var _Calendar_instances, _Calendar_activeCalendarEvent_get;
|
|
1340
1360
|
class Calendar extends FoundationElement {
|
|
1341
1361
|
constructor() {
|
|
1342
1362
|
super(...arguments);
|
|
1363
|
+
|
|
1364
|
+
_Calendar_instances.add(this);
|
|
1365
|
+
|
|
1343
1366
|
this.hour12 = false;
|
|
1344
1367
|
this._hours = 24;
|
|
1345
1368
|
this._days = 7;
|
|
@@ -1360,22 +1383,32 @@ class Calendar extends FoundationElement {
|
|
|
1360
1383
|
this.getEventContext = getEventContext;
|
|
1361
1384
|
}
|
|
1362
1385
|
|
|
1386
|
+
getCalendarEventContainingCell(calendarEvent) {
|
|
1387
|
+
const slotName = calendarEvent.getAttribute('slot');
|
|
1388
|
+
const gridCell = this.shadowRoot.querySelector(`slot[name="${slotName}"i]`);
|
|
1389
|
+
return gridCell.parentElement;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1363
1392
|
arrowKeysInteractions(key) {
|
|
1364
|
-
const
|
|
1393
|
+
const {
|
|
1394
|
+
activeElement
|
|
1395
|
+
} = this.shadowRoot;
|
|
1365
1396
|
let focusNext;
|
|
1366
1397
|
|
|
1367
1398
|
if (isCellOrHeader(activeElement)) {
|
|
1368
1399
|
focusNext = getNextFocusableGridElement.call(this, key, activeElement);
|
|
1400
|
+
} else if (__classPrivateFieldGet(this, _Calendar_instances, "a", _Calendar_activeCalendarEvent_get)) {
|
|
1401
|
+
focusNext = this.getCalendarEventContainingCell(__classPrivateFieldGet(this, _Calendar_instances, "a", _Calendar_activeCalendarEvent_get));
|
|
1369
1402
|
} else if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.matches('em[role="button"i]')) {
|
|
1370
1403
|
focusNext = getHeaderDescendantGridCell.call(this, key, activeElement);
|
|
1371
1404
|
} else {
|
|
1372
1405
|
focusNext = this.shadowRoot.querySelector('[role="columnheader"i]');
|
|
1373
1406
|
}
|
|
1374
1407
|
|
|
1375
|
-
this.
|
|
1408
|
+
this.activateElement(focusNext);
|
|
1376
1409
|
}
|
|
1377
1410
|
|
|
1378
|
-
|
|
1411
|
+
activateElement(el) {
|
|
1379
1412
|
const onBlur = ({
|
|
1380
1413
|
target
|
|
1381
1414
|
}) => target.setAttribute('tabindex', '-1');
|
|
@@ -1400,6 +1433,12 @@ class Calendar extends FoundationElement {
|
|
|
1400
1433
|
}
|
|
1401
1434
|
|
|
1402
1435
|
}
|
|
1436
|
+
_Calendar_instances = new WeakSet(), _Calendar_activeCalendarEvent_get = function _Calendar_activeCalendarEvent_get() {
|
|
1437
|
+
const {
|
|
1438
|
+
activeElement
|
|
1439
|
+
} = document;
|
|
1440
|
+
return activeElement instanceof CalendarEvent ? activeElement : null;
|
|
1441
|
+
};
|
|
1403
1442
|
|
|
1404
1443
|
__decorate([attr, __metadata("design:type", Object)], Calendar.prototype, "datetime", void 0);
|
|
1405
1444
|
|
|
@@ -1514,7 +1553,10 @@ const CalendarTemplate = () => html(_t6 || (_t6 = _2`
|
|
|
1514
1553
|
const vividCalendar = Calendar.compose({
|
|
1515
1554
|
baseName: 'calendar',
|
|
1516
1555
|
template: CalendarTemplate,
|
|
1517
|
-
styles: css_248z
|
|
1556
|
+
styles: css_248z,
|
|
1557
|
+
shadowOptions: {
|
|
1558
|
+
delegatesFocus: true
|
|
1559
|
+
}
|
|
1518
1560
|
});
|
|
1519
1561
|
designSystem.register(vividCalendar());
|
|
1520
1562
|
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { h as html, d as designSystem } from '../shared/index.js';
|
|
2
|
+
import { C as CalendarEvent } from '../shared/calendar-event.js';
|
|
3
|
+
import '../shared/es.object.assign.js';
|
|
4
|
+
import { _ as _export, d as descriptors, g as global$1, f as functionUncurryThis, q as hasOwnProperty_1, i as isCallable$1, o as objectDefineProperty, Q as copyConstructorProperties$1, b as objectIsPrototypeOf } from '../shared/export.js';
|
|
5
|
+
import { t as toString$1 } from '../shared/to-string.js';
|
|
6
|
+
import { w as when } from '../shared/when.js';
|
|
7
|
+
import { c as classNames } from '../shared/class-names.js';
|
|
8
|
+
import '../shared/object-keys.js';
|
|
9
|
+
|
|
10
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Mon, 24 Oct 2022 13:21:54 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: transparent;\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: transparent;\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}";
|
|
11
|
+
|
|
12
|
+
var $ = _export;
|
|
13
|
+
var DESCRIPTORS = descriptors;
|
|
14
|
+
var global = global$1;
|
|
15
|
+
var uncurryThis = functionUncurryThis;
|
|
16
|
+
var hasOwn = hasOwnProperty_1;
|
|
17
|
+
var isCallable = isCallable$1;
|
|
18
|
+
var isPrototypeOf = objectIsPrototypeOf;
|
|
19
|
+
var toString = toString$1;
|
|
20
|
+
var defineProperty = objectDefineProperty.f;
|
|
21
|
+
var copyConstructorProperties = copyConstructorProperties$1;
|
|
22
|
+
|
|
23
|
+
var NativeSymbol = global.Symbol;
|
|
24
|
+
var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
|
|
25
|
+
|
|
26
|
+
if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) ||
|
|
27
|
+
// Safari 12 bug
|
|
28
|
+
NativeSymbol().description !== undefined
|
|
29
|
+
)) {
|
|
30
|
+
var EmptyStringDescriptionStore = {};
|
|
31
|
+
// wrap Symbol constructor for correct work with undefined description
|
|
32
|
+
var SymbolWrapper = function Symbol() {
|
|
33
|
+
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]);
|
|
34
|
+
var result = isPrototypeOf(SymbolPrototype, this)
|
|
35
|
+
? new NativeSymbol(description)
|
|
36
|
+
// in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
|
|
37
|
+
: description === undefined ? NativeSymbol() : NativeSymbol(description);
|
|
38
|
+
if (description === '') EmptyStringDescriptionStore[result] = true;
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
copyConstructorProperties(SymbolWrapper, NativeSymbol);
|
|
43
|
+
SymbolWrapper.prototype = SymbolPrototype;
|
|
44
|
+
SymbolPrototype.constructor = SymbolWrapper;
|
|
45
|
+
|
|
46
|
+
var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)';
|
|
47
|
+
var thisSymbolValue = uncurryThis(SymbolPrototype.valueOf);
|
|
48
|
+
var symbolDescriptiveString = uncurryThis(SymbolPrototype.toString);
|
|
49
|
+
var regexp = /^Symbol\((.*)\)[^)]+$/;
|
|
50
|
+
var replace = uncurryThis(''.replace);
|
|
51
|
+
var stringSlice = uncurryThis(''.slice);
|
|
52
|
+
|
|
53
|
+
defineProperty(SymbolPrototype, 'description', {
|
|
54
|
+
configurable: true,
|
|
55
|
+
get: function description() {
|
|
56
|
+
var symbol = thisSymbolValue(this);
|
|
57
|
+
if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
|
|
58
|
+
var string = symbolDescriptiveString(symbol);
|
|
59
|
+
var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');
|
|
60
|
+
return desc === '' ? undefined : desc;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
$({ global: true, constructor: true, forced: true }, {
|
|
65
|
+
Symbol: SymbolWrapper
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let _ = t => t,
|
|
70
|
+
_t,
|
|
71
|
+
_t2,
|
|
72
|
+
_t3;
|
|
73
|
+
|
|
74
|
+
const getClasses = ({
|
|
75
|
+
connotation,
|
|
76
|
+
appearance
|
|
77
|
+
}) => classNames('base', [`connotation-${connotation}`, Boolean(connotation)], [`appearance-${appearance}`, Boolean(appearance)]);
|
|
78
|
+
|
|
79
|
+
const getStyles = ({
|
|
80
|
+
start,
|
|
81
|
+
duration,
|
|
82
|
+
overlapCount
|
|
83
|
+
}) => {
|
|
84
|
+
const stylesObj = Object.assign(Object.assign(Object.assign({}, overlapCount && {
|
|
85
|
+
'--vvd-calendar-event--overlap-count': overlapCount
|
|
86
|
+
}), start && {
|
|
87
|
+
'--vvd-calendar-event--start': start
|
|
88
|
+
}), duration && {
|
|
89
|
+
'--vvd-calendar-event--duration': duration
|
|
90
|
+
});
|
|
91
|
+
return Object.entries(stylesObj).map(entry => entry.join(':')).join(';');
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const CalendarEventTemplate = () => html(_t || (_t = _`
|
|
95
|
+
<div
|
|
96
|
+
style="${0}"
|
|
97
|
+
class="${0}"
|
|
98
|
+
role="button"
|
|
99
|
+
tabindex="0"
|
|
100
|
+
>
|
|
101
|
+
${0}
|
|
102
|
+
${0}
|
|
103
|
+
</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)));
|
|
104
|
+
|
|
105
|
+
const vividCalendarEvent = CalendarEvent.compose({
|
|
106
|
+
baseName: 'calendar-event',
|
|
107
|
+
template: CalendarEventTemplate,
|
|
108
|
+
styles: css_248z,
|
|
109
|
+
shadowOptions: {
|
|
110
|
+
delegatesFocus: true
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
designSystem.register(vividCalendarEvent());
|
|
114
|
+
|
|
115
|
+
export { vividCalendarEvent };
|
package/card/index.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import '../shared/index3.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 slotted } from '../shared/slotted.js';
|
|
5
|
+
import { w as when } from '../shared/when.js';
|
|
6
|
+
import { c as classNames } from '../shared/class-names.js';
|
|
7
|
+
import '../shared/icon.js';
|
|
8
|
+
import '../shared/export.js';
|
|
9
|
+
import '../shared/iterators.js';
|
|
10
|
+
import '../shared/to-string.js';
|
|
11
|
+
import '../shared/_has.js';
|
|
12
|
+
|
|
13
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Mon, 24 Oct 2022 13:21:54 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}";
|
|
14
|
+
|
|
15
|
+
class Card extends FoundationElement {}
|
|
16
|
+
|
|
17
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "headline", void 0);
|
|
18
|
+
|
|
19
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "subtitle", void 0);
|
|
20
|
+
|
|
21
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "text", void 0);
|
|
22
|
+
|
|
23
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "icon", void 0);
|
|
24
|
+
|
|
25
|
+
__decorate([attr, __metadata("design:type", Number)], Card.prototype, "elevation", void 0);
|
|
26
|
+
|
|
27
|
+
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "footerSlottedContent", void 0);
|
|
28
|
+
|
|
29
|
+
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "graphicSlottedContent", void 0);
|
|
30
|
+
|
|
31
|
+
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "hasMetaSlottedContent", void 0);
|
|
32
|
+
|
|
33
|
+
let _2 = t => t,
|
|
34
|
+
_t,
|
|
35
|
+
_t2,
|
|
36
|
+
_t3,
|
|
37
|
+
_t4,
|
|
38
|
+
_t5,
|
|
39
|
+
_t6,
|
|
40
|
+
_t7,
|
|
41
|
+
_t8;
|
|
42
|
+
|
|
43
|
+
const getClasses = _ => classNames('base', ['hide-footer', !_.footerSlottedContent || !_.footerSlottedContent.length], ['hide-header', shouldHideHeader(_)]);
|
|
44
|
+
|
|
45
|
+
function renderHeaderIcon() {
|
|
46
|
+
return html(_t || (_t = _2`
|
|
47
|
+
<vwc-icon class="icon" inline type="${0}"></vwc-icon>`), x => x.icon);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function Headline() {
|
|
51
|
+
return html(_t2 || (_t2 = _2`
|
|
52
|
+
<div class="header-headline">${0}</div>
|
|
53
|
+
`), x => x.headline);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function Subtitle() {
|
|
57
|
+
return html(_t3 || (_t3 = _2`
|
|
58
|
+
<div class="header-subtitle">${0}</div>
|
|
59
|
+
`), x => x.subtitle);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function headerContent() {
|
|
63
|
+
return html(_t4 || (_t4 = _2`
|
|
64
|
+
<div class="header-content">
|
|
65
|
+
${0}
|
|
66
|
+
${0}
|
|
67
|
+
</div>
|
|
68
|
+
`), when(x => x.headline, Headline()), when(x => x.subtitle, Subtitle()));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function renderHeader() {
|
|
72
|
+
return html(_t5 || (_t5 = _2`
|
|
73
|
+
<header class="header">
|
|
74
|
+
<slot name="graphic" ${0}>${0}</slot>
|
|
75
|
+
${0}
|
|
76
|
+
</header>`), slotted('graphicSlottedContent'), when(x => x.icon, renderHeaderIcon()), when(x => x.headline || x.subtitle, headerContent()));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function shouldHideHeader(card) {
|
|
80
|
+
return !card.headline && !card.subtitle && !card.icon && (!card.graphicSlottedContent || !card.graphicSlottedContent.length);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function renderMetaSlot() {
|
|
84
|
+
return html(_t6 || (_t6 = _2`
|
|
85
|
+
<slot name="meta" ${0}></slot>
|
|
86
|
+
`), slotted('metaSlottedContent'));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function text() {
|
|
90
|
+
return html(_t7 || (_t7 = _2`
|
|
91
|
+
<div class="text">${0}</div>
|
|
92
|
+
`), x => x.text);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const CardTemplate = () => html(_t8 || (_t8 = _2`
|
|
96
|
+
<vwc-elevation dp=${0}>
|
|
97
|
+
|
|
98
|
+
<div class="${0}">
|
|
99
|
+
<div class="wrapper">
|
|
100
|
+
<div class="vwc-card-media">
|
|
101
|
+
<slot name="media"></slot>
|
|
102
|
+
</div>
|
|
103
|
+
<slot name="main">
|
|
104
|
+
<div class="main-content">
|
|
105
|
+
<div class="header-wrapper">
|
|
106
|
+
${0}
|
|
107
|
+
${0}
|
|
108
|
+
</div>
|
|
109
|
+
${0}
|
|
110
|
+
</div>
|
|
111
|
+
</slot>
|
|
112
|
+
<div class="footer">
|
|
113
|
+
<slot name="footer" ${0}></slot>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
</vwc-elevation>
|
|
119
|
+
`), x => {
|
|
120
|
+
var _a;
|
|
121
|
+
|
|
122
|
+
return (_a = x.elevation) !== null && _a !== void 0 ? _a : '4';
|
|
123
|
+
}, getClasses, renderHeader(), renderMetaSlot(), when(x => x.text, text()), slotted('footerSlottedContent'));
|
|
124
|
+
|
|
125
|
+
const vividCard = Card.compose({
|
|
126
|
+
baseName: 'card',
|
|
127
|
+
template: CardTemplate,
|
|
128
|
+
styles: css_248z
|
|
129
|
+
});
|
|
130
|
+
designSystem.register(vividCard());
|
|
131
|
+
|
|
132
|
+
export { vividCard };
|
|
@@ -0,0 +1,184 @@
|
|
|
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 '../shared/web.dom-collections.iterator.js';
|
|
5
|
+
import { C as CheckableFormAssociated } from '../shared/form-associated.js';
|
|
6
|
+
import { a as keySpace$1 } from '../shared/key-codes.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
|
+
if (this.readOnly) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
switch (e.key) {
|
|
67
|
+
case keySpace$1:
|
|
68
|
+
if (this.indeterminate) {
|
|
69
|
+
this.indeterminate = false;
|
|
70
|
+
}
|
|
71
|
+
this.checked = !this.checked;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
this.clickHandler = (e) => {
|
|
79
|
+
if (!this.disabled && !this.readOnly) {
|
|
80
|
+
if (this.indeterminate) {
|
|
81
|
+
this.indeterminate = false;
|
|
82
|
+
}
|
|
83
|
+
this.checked = !this.checked;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
this.proxy.setAttribute("type", "checkbox");
|
|
87
|
+
}
|
|
88
|
+
readOnlyChanged() {
|
|
89
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
90
|
+
this.proxy.readOnly = this.readOnly;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
__decorate([
|
|
95
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
96
|
+
], Checkbox$1.prototype, "readOnly", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
observable
|
|
99
|
+
], Checkbox$1.prototype, "defaultSlottedNodes", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
observable
|
|
102
|
+
], Checkbox$1.prototype, "indeterminate", void 0);
|
|
103
|
+
|
|
104
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Mon, 24 Oct 2022 13:21:54 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}\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, :hover, .hover, :active, .active)) {\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 (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-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}";
|
|
105
|
+
|
|
106
|
+
const keySpace = ' ';
|
|
107
|
+
class Checkbox extends Checkbox$1 {
|
|
108
|
+
constructor() {
|
|
109
|
+
super(...arguments);
|
|
110
|
+
|
|
111
|
+
this.keypressHandler = e => {
|
|
112
|
+
switch (e.key) {
|
|
113
|
+
case keySpace:
|
|
114
|
+
if (this.indeterminate) {
|
|
115
|
+
this.indeterminate = false;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
this.checked = !this.checked;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
this.clickHandler = () => {
|
|
124
|
+
if (!this.disabled && !this.readOnly) {
|
|
125
|
+
if (this.indeterminate) {
|
|
126
|
+
this.indeterminate = false;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
this.checked = !this.checked;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
__decorate([attr, __metadata("design:type", String)], Checkbox.prototype, "label", void 0);
|
|
137
|
+
|
|
138
|
+
let _ = t => t,
|
|
139
|
+
_t,
|
|
140
|
+
_t2;
|
|
141
|
+
|
|
142
|
+
const getClasses = ({
|
|
143
|
+
readOnly,
|
|
144
|
+
checked,
|
|
145
|
+
disabled,
|
|
146
|
+
indeterminate
|
|
147
|
+
}) => classNames('base', ['readonly', Boolean(readOnly)], ['checked', Boolean(checked)], ['disabled', Boolean(disabled)], ['indeterminate', Boolean(indeterminate)]);
|
|
148
|
+
|
|
149
|
+
const CheckboxTemplate = context => {
|
|
150
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
151
|
+
const iconTag = context.tagFor(Icon);
|
|
152
|
+
return html(_t || (_t = _`<span
|
|
153
|
+
role="checkbox"
|
|
154
|
+
aria-checked="${0}"
|
|
155
|
+
aria-required="${0}"
|
|
156
|
+
aria-disabled="${0}"
|
|
157
|
+
aria-readonly="${0}"
|
|
158
|
+
tabindex="${0}"
|
|
159
|
+
@keypress="${0}"
|
|
160
|
+
@click="${0}"
|
|
161
|
+
class="${0}"
|
|
162
|
+
>
|
|
163
|
+
<div class="control">
|
|
164
|
+
<${0} class="indicator checkmark" type="check-solid"></${0}>
|
|
165
|
+
<${0} class="indicator minus" type="minus-solid"></${0}>
|
|
166
|
+
${0}
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
${0}
|
|
170
|
+
|
|
171
|
+
</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)));
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const vividCheckbox = Checkbox.compose({
|
|
175
|
+
baseName: 'checkbox',
|
|
176
|
+
template: CheckboxTemplate,
|
|
177
|
+
styles: css_248z,
|
|
178
|
+
shadowOptions: {
|
|
179
|
+
delegatesFocus: true
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
designSystem.register(vividCheckbox());
|
|
183
|
+
|
|
184
|
+
export { vividCheckbox };
|