@vonage/vivid 3.0.0-next.9 → 3.0.0-next.91
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 +3 -12
- package/accordion-item/index.js +30 -38
- package/action-group/index.js +41 -0
- package/avatar/index.js +60 -0
- package/badge/index.js +16 -30
- package/banner/index.js +25 -111
- package/breadcrumb/index.js +21 -18
- package/breadcrumb-item/index.js +23 -20
- package/button/index.js +19 -757
- package/calendar/index.js +72 -67
- package/calendar-event/index.js +112 -0
- package/card/index.js +113 -0
- package/checkbox/index.js +176 -0
- package/dialog/index.js +229 -0
- package/divider/index.js +4 -0
- package/elevation/index.js +3 -31
- package/fab/index.js +99 -0
- package/focus/index.js +18 -3
- package/header/index.js +61 -0
- package/icon/index.js +10 -9
- package/index.js +57 -20
- package/layout/index.js +5 -15
- 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 +3 -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 +29 -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/listbox-option/index.d.ts +4 -0
- package/lib/listbox-option/listbox-option.d.ts +7 -0
- package/lib/listbox-option/listbox-option.template.d.ts +4 -0
- 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 +14 -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/radio-group/index.d.ts +10 -0
- package/lib/radio-group/radio-group.d.ts +4 -0
- package/lib/radio-group/radio-group.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 +14 -0
- package/lib/text-field/text-field.template.d.ts +5 -0
- package/lib/tooltip/tooltip.d.ts +2 -2
- package/listbox-option/index.js +248 -0
- package/menu/index.js +376 -0
- package/menu-item/index.js +20 -0
- package/nav/index.js +17 -0
- package/nav-disclosure/index.js +81 -0
- package/nav-item/index.js +45 -0
- package/note/index.js +58 -0
- package/number-field/index.js +516 -0
- package/package.json +58 -10
- package/popup/index.js +22 -2061
- package/progress/index.js +35 -36
- package/progress-ring/index.js +11 -11
- package/radio/index.js +50 -0
- package/radio-group/index.js +435 -0
- package/shared/affix.js +1 -6
- package/shared/anchor.js +10 -2
- package/shared/apply-mixins.js +5 -4
- package/shared/aria-global.js +2 -86
- package/shared/aria.js +9 -0
- 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 +19 -0
- package/shared/dialog-polyfill.esm.js +858 -0
- package/shared/direction.js +20 -0
- package/shared/enums.js +62 -0
- package/shared/es.object.assign.js +3 -2
- package/shared/export.js +1017 -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 +331 -0
- package/shared/icon.js +534 -531
- package/shared/index.js +108 -79
- package/shared/index2.js +100 -14
- package/shared/index3.js +31 -0
- package/shared/index4.js +77 -0
- package/shared/index5.js +1525 -0
- package/shared/index6.js +349 -0
- package/shared/iterators.js +61 -0
- package/shared/key-codes.js +96 -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/radio.js +127 -0
- package/shared/ref.js +41 -0
- package/shared/slotted.js +1 -1
- package/shared/start-end.js +50 -0
- package/shared/text-anchor.js +2 -13
- package/shared/text-anchor.template.js +6 -5
- package/shared/to-string.js +51 -0
- package/shared/web.dom-collections.iterator.js +74 -1081
- package/side-drawer/index.js +41 -33
- 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 +230 -0
- package/styles/tokens/theme-light.css +230 -0
- package/text-anchor/index.js +9 -1
- package/text-area/index.js +288 -0
- package/text-field/index.js +129 -0
- package/tooltip/index.js +23 -24
- 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 { g as emptyArray, O as Observable, S as SubscriberSet, D as DOM, H as HTMLDirective, i 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,50 @@ 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
|
+
const totalAvailableViews = (availableViews =
|
|
633
|
+
leftoverViews.length + removedViews.length);
|
|
628
634
|
for (; addIndex < end; ++addIndex) {
|
|
629
635
|
const neighbor = views[addIndex];
|
|
630
636
|
const location = neighbor ? neighbor.firstChild : this.location;
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
637
|
+
let view;
|
|
638
|
+
if (recycle && availableViews > 0) {
|
|
639
|
+
if (removeIndex <= totalAvailableViews && removedViews.length > 0) {
|
|
640
|
+
view = removedViews[removeIndex];
|
|
641
|
+
removeIndex++;
|
|
642
|
+
}
|
|
643
|
+
else {
|
|
644
|
+
view = leftoverViews[leftoverIndex];
|
|
645
|
+
leftoverIndex++;
|
|
646
|
+
}
|
|
647
|
+
availableViews--;
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
view = template.create();
|
|
651
|
+
}
|
|
634
652
|
views.splice(addIndex, 0, view);
|
|
635
653
|
bindView(view, items, addIndex, childContext);
|
|
636
654
|
view.insertBefore(location);
|
|
637
655
|
}
|
|
656
|
+
if (removedViews[removeIndex]) {
|
|
657
|
+
leftoverViews.push(...removedViews.slice(removeIndex));
|
|
658
|
+
}
|
|
638
659
|
}
|
|
639
|
-
for (let i =
|
|
640
|
-
|
|
660
|
+
for (let i = leftoverIndex, ii = leftoverViews.length; i < ii; ++i) {
|
|
661
|
+
leftoverViews[i].dispose();
|
|
641
662
|
}
|
|
642
663
|
if (this.options.positioning) {
|
|
643
664
|
for (let i = 0, ii = views.length; i < ii; ++i) {
|
|
@@ -656,7 +677,7 @@ class RepeatBehavior {
|
|
|
656
677
|
let itemsLength = items.length;
|
|
657
678
|
let views = this.views;
|
|
658
679
|
let viewsLength = views.length;
|
|
659
|
-
if (itemsLength === 0 || templateChanged) {
|
|
680
|
+
if (itemsLength === 0 || templateChanged || !this.options.recycle) {
|
|
660
681
|
// all views need to be removed
|
|
661
682
|
HTMLView.disposeContiguousBatch(views);
|
|
662
683
|
viewsLength = 0;
|
|
@@ -744,7 +765,7 @@ function repeat(itemsBinding, templateOrTemplateBinding, options = defaultRepeat
|
|
|
744
765
|
const templateBinding = typeof templateOrTemplateBinding === "function"
|
|
745
766
|
? templateOrTemplateBinding
|
|
746
767
|
: () => templateOrTemplateBinding;
|
|
747
|
-
return new RepeatDirective(itemsBinding, templateBinding, options);
|
|
768
|
+
return new RepeatDirective(itemsBinding, templateBinding, Object.assign(Object.assign({}, defaultRepeatOptions), options));
|
|
748
769
|
}
|
|
749
770
|
|
|
750
771
|
/**
|
|
@@ -1240,8 +1261,7 @@ _curry1(function isEmpty(x) {
|
|
|
1240
1261
|
|
|
1241
1262
|
var isEmpty$1 = isEmpty;
|
|
1242
1263
|
|
|
1243
|
-
var css_248z = "
|
|
1244
|
-
styleInject(css_248z);
|
|
1264
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 03 Nov 2022 17:26:06 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-typography-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: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) + 8));\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-typography-heading-4);\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-typography-base-condensed);\n text-transform: uppercase;\n}";
|
|
1245
1265
|
|
|
1246
1266
|
const ARROW_UP = 'ArrowUp';
|
|
1247
1267
|
const ARROW_RIGHT = 'ArrowRight';
|
|
@@ -1250,18 +1270,14 @@ const ARROW_LEFT = 'ArrowLeft';
|
|
|
1250
1270
|
function isCellOrHeader(el) {
|
|
1251
1271
|
return el instanceof HTMLElement && (el.matches('[role="gridcell"i]') || el.matches('[role="columnheader"i]'));
|
|
1252
1272
|
}
|
|
1253
|
-
|
|
1254
1273
|
const getCellOrHeader = f => f.matches('[role="columnheader"i]') ? '[role="gridcell"i]' : '[role="columnheader"i]';
|
|
1255
|
-
|
|
1256
1274
|
function getNextFocusableGridElement(key, activeElement) {
|
|
1257
1275
|
if (activeElement.parentNode instanceof HTMLElement) {
|
|
1258
1276
|
switch (key) {
|
|
1259
1277
|
case ARROW_RIGHT:
|
|
1260
1278
|
return activeElement.nextElementSibling || activeElement.parentNode.firstElementChild;
|
|
1261
|
-
|
|
1262
1279
|
case ARROW_LEFT:
|
|
1263
1280
|
return activeElement.previousElementSibling || activeElement.parentNode.lastElementChild;
|
|
1264
|
-
|
|
1265
1281
|
case ARROW_UP:
|
|
1266
1282
|
case ARROW_DOWN:
|
|
1267
1283
|
{
|
|
@@ -1278,7 +1294,6 @@ function getHeaderDescendantGridCell(key, activeElement) {
|
|
|
1278
1294
|
if (key !== ARROW_DOWN) {
|
|
1279
1295
|
return;
|
|
1280
1296
|
}
|
|
1281
|
-
|
|
1282
1297
|
const header = activeElement.closest('[role="columnheader"i]');
|
|
1283
1298
|
const columnHeaders = this.shadowRoot.querySelectorAll('[role="columnheader"i]');
|
|
1284
1299
|
const i = Array.from(columnHeaders).indexOf(header);
|
|
@@ -1287,21 +1302,17 @@ function getHeaderDescendantGridCell(key, activeElement) {
|
|
|
1287
1302
|
|
|
1288
1303
|
function getDay(el) {
|
|
1289
1304
|
const cellOrHeader = el.closest('[role="gridcell"i], [role="columnheader"i]');
|
|
1290
|
-
|
|
1291
1305
|
if (cellOrHeader) {
|
|
1292
1306
|
const {
|
|
1293
1307
|
parentElement
|
|
1294
1308
|
} = cellOrHeader;
|
|
1295
|
-
|
|
1296
1309
|
if (parentElement) {
|
|
1297
1310
|
return parentElement.children && Array.from(parentElement.children).indexOf(cellOrHeader);
|
|
1298
1311
|
}
|
|
1299
1312
|
}
|
|
1300
1313
|
}
|
|
1301
|
-
|
|
1302
1314
|
function getHour(e, el, hours) {
|
|
1303
1315
|
const rowHeaderOrCell = el.closest('[role="rowheader"], [role="gridcell"i]');
|
|
1304
|
-
|
|
1305
1316
|
if (rowHeaderOrCell) {
|
|
1306
1317
|
const DOMRect = rowHeaderOrCell.getBoundingClientRect();
|
|
1307
1318
|
const offsetY = e.clientY - DOMRect.y;
|
|
@@ -1310,25 +1321,19 @@ function getHour(e, el, hours) {
|
|
|
1310
1321
|
return Math.round((hour + Number.EPSILON) * 100) / 100;
|
|
1311
1322
|
}
|
|
1312
1323
|
}
|
|
1313
|
-
|
|
1314
1324
|
const getEventContext = function getEventContext(e) {
|
|
1315
1325
|
if (!(e instanceof KeyboardEvent || e instanceof MouseEvent)) {
|
|
1316
1326
|
throw new Error('Invalid event. Event must be instance of KeyboardEvent or MouseEvent');
|
|
1317
1327
|
}
|
|
1318
|
-
|
|
1319
1328
|
const [el] = e.composedPath();
|
|
1320
|
-
|
|
1321
1329
|
if (!(el && el instanceof HTMLElement && this.shadowRoot.contains(el))) {
|
|
1322
1330
|
throw new Error('Invalid event. Event must contain a target object which is a direct descendant of calendar');
|
|
1323
1331
|
}
|
|
1324
|
-
|
|
1325
1332
|
const day = getDay(el);
|
|
1326
1333
|
let hour;
|
|
1327
|
-
|
|
1328
1334
|
if (e instanceof MouseEvent) {
|
|
1329
1335
|
hour = getHour(e, el, this._hours);
|
|
1330
1336
|
}
|
|
1331
|
-
|
|
1332
1337
|
const context = Object.assign(Object.assign({}, day != undefined && {
|
|
1333
1338
|
day
|
|
1334
1339
|
}), hour != undefined && {
|
|
@@ -1337,85 +1342,85 @@ const getEventContext = function getEventContext(e) {
|
|
|
1337
1342
|
return not$1(isEmpty$1(context)) ? context : null;
|
|
1338
1343
|
};
|
|
1339
1344
|
|
|
1345
|
+
var _Calendar_instances, _Calendar_activeCalendarEvent_get;
|
|
1340
1346
|
class Calendar extends FoundationElement {
|
|
1341
1347
|
constructor() {
|
|
1342
1348
|
super(...arguments);
|
|
1349
|
+
_Calendar_instances.add(this);
|
|
1343
1350
|
this.hour12 = false;
|
|
1344
1351
|
this._hours = 24;
|
|
1345
1352
|
this._days = 7;
|
|
1346
1353
|
this.hoursAsDatetime = Array.from({
|
|
1347
1354
|
length: this._hours - 1
|
|
1348
1355
|
}).fill(new Date(new Date().setHours(0, 0, 0))).map((d, i) => new Date(d.setHours(++i)));
|
|
1349
|
-
|
|
1350
1356
|
this._generateDaysArr = dateArr => {
|
|
1351
1357
|
if (dateArr.length == this._days) {
|
|
1352
1358
|
return dateArr;
|
|
1353
1359
|
}
|
|
1354
|
-
|
|
1355
1360
|
const lastDate = new Date(dateArr[dateArr.length - 1]);
|
|
1356
1361
|
lastDate.setDate(lastDate.getDate() + 1);
|
|
1357
1362
|
return this._generateDaysArr([...dateArr, lastDate]);
|
|
1358
1363
|
};
|
|
1359
|
-
|
|
1360
1364
|
this.getEventContext = getEventContext;
|
|
1361
1365
|
}
|
|
1362
|
-
|
|
1366
|
+
getCalendarEventContainingCell(calendarEvent) {
|
|
1367
|
+
const slotName = calendarEvent.getAttribute('slot');
|
|
1368
|
+
const gridCell = this.shadowRoot.querySelector(`slot[name="${slotName}"i]`);
|
|
1369
|
+
return gridCell.parentElement;
|
|
1370
|
+
}
|
|
1363
1371
|
arrowKeysInteractions(key) {
|
|
1364
|
-
const
|
|
1372
|
+
const {
|
|
1373
|
+
activeElement
|
|
1374
|
+
} = this.shadowRoot;
|
|
1365
1375
|
let focusNext;
|
|
1366
|
-
|
|
1367
1376
|
if (isCellOrHeader(activeElement)) {
|
|
1368
1377
|
focusNext = getNextFocusableGridElement.call(this, key, activeElement);
|
|
1378
|
+
} else if (__classPrivateFieldGet(this, _Calendar_instances, "a", _Calendar_activeCalendarEvent_get)) {
|
|
1379
|
+
focusNext = this.getCalendarEventContainingCell(__classPrivateFieldGet(this, _Calendar_instances, "a", _Calendar_activeCalendarEvent_get));
|
|
1369
1380
|
} else if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.matches('em[role="button"i]')) {
|
|
1370
1381
|
focusNext = getHeaderDescendantGridCell.call(this, key, activeElement);
|
|
1371
1382
|
} else {
|
|
1372
1383
|
focusNext = this.shadowRoot.querySelector('[role="columnheader"i]');
|
|
1373
1384
|
}
|
|
1374
|
-
|
|
1375
|
-
this.moveTo(focusNext);
|
|
1385
|
+
this.activateElement(focusNext);
|
|
1376
1386
|
}
|
|
1377
|
-
|
|
1378
|
-
moveTo(el) {
|
|
1387
|
+
activateElement(el) {
|
|
1379
1388
|
const onBlur = ({
|
|
1380
1389
|
target
|
|
1381
1390
|
}) => target.setAttribute('tabindex', '-1');
|
|
1382
|
-
|
|
1383
1391
|
el === null || el === void 0 ? void 0 : el.addEventListener('blur', onBlur, {
|
|
1384
1392
|
once: true
|
|
1385
1393
|
});
|
|
1386
1394
|
el === null || el === void 0 ? void 0 : el.setAttribute('tabindex', '0');
|
|
1387
1395
|
el === null || el === void 0 ? void 0 : el.focus();
|
|
1388
1396
|
}
|
|
1389
|
-
|
|
1390
1397
|
onKeydown({
|
|
1391
1398
|
key
|
|
1392
1399
|
}) {
|
|
1393
1400
|
const isArrow = [ARROW_UP, ARROW_RIGHT, ARROW_DOWN, ARROW_LEFT].some(predefinedKey => predefinedKey == key);
|
|
1394
|
-
|
|
1395
1401
|
if (isArrow) {
|
|
1396
1402
|
this.arrowKeysInteractions(key);
|
|
1397
1403
|
}
|
|
1398
|
-
|
|
1399
1404
|
return !isArrow;
|
|
1400
1405
|
}
|
|
1401
|
-
|
|
1402
1406
|
}
|
|
1403
|
-
|
|
1407
|
+
_Calendar_instances = new WeakSet(), _Calendar_activeCalendarEvent_get = function _Calendar_activeCalendarEvent_get() {
|
|
1408
|
+
const {
|
|
1409
|
+
activeElement
|
|
1410
|
+
} = document;
|
|
1411
|
+
return activeElement instanceof CalendarEvent ? activeElement : null;
|
|
1412
|
+
};
|
|
1404
1413
|
__decorate([attr, __metadata("design:type", Object)], Calendar.prototype, "datetime", void 0);
|
|
1405
|
-
|
|
1406
1414
|
__decorate([attr({
|
|
1407
1415
|
attribute: 'start-day'
|
|
1408
1416
|
}), __metadata("design:type", String)], Calendar.prototype, "startDay", void 0);
|
|
1409
|
-
|
|
1410
1417
|
__decorate([attr, __metadata("design:type", Object)], Calendar.prototype, "locales", void 0);
|
|
1411
|
-
|
|
1412
1418
|
__decorate([attr({
|
|
1413
1419
|
mode: 'boolean'
|
|
1414
1420
|
}), __metadata("design:type", Object)], Calendar.prototype, "hour12", void 0);
|
|
1415
1421
|
|
|
1416
1422
|
function getValidDateString(date) {
|
|
1417
1423
|
const twoDigit = num => `0${num}`.slice(-2);
|
|
1418
|
-
|
|
1419
1424
|
return `${date.getFullYear()}-${twoDigit(date.getMonth() + 1)}-${twoDigit(date.getDate())}`;
|
|
1420
1425
|
}
|
|
1421
1426
|
const weekdaysMap = new Map([['sunday', 0], ['monday', 1]]);
|
|
@@ -1428,14 +1433,13 @@ function getFirstDateOfTheWeek(date = new Date(), startDay) {
|
|
|
1428
1433
|
}
|
|
1429
1434
|
|
|
1430
1435
|
let _2 = t => t,
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1436
|
+
_t,
|
|
1437
|
+
_t2,
|
|
1438
|
+
_t3,
|
|
1439
|
+
_t4,
|
|
1440
|
+
_t5,
|
|
1441
|
+
_t6,
|
|
1442
|
+
_t7;
|
|
1439
1443
|
const HoursTemplate = () => {
|
|
1440
1444
|
return html(_t || (_t = _2`
|
|
1441
1445
|
<div class="row-headers" role="presentation">
|
|
@@ -1453,7 +1457,6 @@ const HoursTemplate = () => {
|
|
|
1453
1457
|
hour12: c.parent.hour12
|
|
1454
1458
|
}).format(x))));
|
|
1455
1459
|
};
|
|
1456
|
-
|
|
1457
1460
|
const DaysTemplate = () => {
|
|
1458
1461
|
return html(_t3 || (_t3 = _2`
|
|
1459
1462
|
<div class="column-headers" role="row">
|
|
@@ -1482,7 +1485,6 @@ const DaysTemplate = () => {
|
|
|
1482
1485
|
weekday: 'short'
|
|
1483
1486
|
}).format(x))));
|
|
1484
1487
|
};
|
|
1485
|
-
|
|
1486
1488
|
const ColumnTemplate = html(_t5 || (_t5 = _2`
|
|
1487
1489
|
<div role="gridcell" tabindex="-1">
|
|
1488
1490
|
<slot name="day-${0}"></slot>
|
|
@@ -1514,7 +1516,10 @@ const CalendarTemplate = () => html(_t6 || (_t6 = _2`
|
|
|
1514
1516
|
const vividCalendar = Calendar.compose({
|
|
1515
1517
|
baseName: 'calendar',
|
|
1516
1518
|
template: CalendarTemplate,
|
|
1517
|
-
styles: css_248z
|
|
1519
|
+
styles: css_248z,
|
|
1520
|
+
shadowOptions: {
|
|
1521
|
+
delegatesFocus: true
|
|
1522
|
+
}
|
|
1518
1523
|
});
|
|
1519
1524
|
designSystem.register(vividCalendar());
|
|
1520
1525
|
|
|
@@ -0,0 +1,112 @@
|
|
|
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 Thu, 03 Nov 2022 17:26:06 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-typography-base-condensed-bold);\n}\nh2 > strong {\n font: inherit;\n}\n\np {\n margin: 0;\n font: var(--vvd-typography-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
|
+
const getClasses = ({
|
|
74
|
+
connotation,
|
|
75
|
+
appearance
|
|
76
|
+
}) => classNames('base', [`connotation-${connotation}`, Boolean(connotation)], [`appearance-${appearance}`, Boolean(appearance)]);
|
|
77
|
+
const getStyles = ({
|
|
78
|
+
start,
|
|
79
|
+
duration,
|
|
80
|
+
overlapCount
|
|
81
|
+
}) => {
|
|
82
|
+
const stylesObj = Object.assign(Object.assign(Object.assign({}, overlapCount && {
|
|
83
|
+
'--vvd-calendar-event--overlap-count': overlapCount
|
|
84
|
+
}), start && {
|
|
85
|
+
'--vvd-calendar-event--start': start
|
|
86
|
+
}), duration && {
|
|
87
|
+
'--vvd-calendar-event--duration': duration
|
|
88
|
+
});
|
|
89
|
+
return Object.entries(stylesObj).map(entry => entry.join(':')).join(';');
|
|
90
|
+
};
|
|
91
|
+
const CalendarEventTemplate = () => html(_t || (_t = _`
|
|
92
|
+
<div
|
|
93
|
+
style="${0}"
|
|
94
|
+
class="${0}"
|
|
95
|
+
role="button"
|
|
96
|
+
tabindex="0"
|
|
97
|
+
>
|
|
98
|
+
${0}
|
|
99
|
+
${0}
|
|
100
|
+
</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)));
|
|
101
|
+
|
|
102
|
+
const vividCalendarEvent = CalendarEvent.compose({
|
|
103
|
+
baseName: 'calendar-event',
|
|
104
|
+
template: CalendarEventTemplate,
|
|
105
|
+
styles: css_248z,
|
|
106
|
+
shadowOptions: {
|
|
107
|
+
delegatesFocus: true
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
designSystem.register(vividCalendarEvent());
|
|
111
|
+
|
|
112
|
+
export { vividCalendarEvent };
|
package/card/index.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
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 Thu, 03 Nov 2022 17:26:06 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-typography-heading-4);\n -webkit-line-clamp: var(--headline-line-clamp);\n}\n.header-subtitle {\n font: var(--vvd-typography-base);\n -webkit-line-clamp: var(--subtitle-line-clamp);\n}\n.hide-header .header {\n display: none;\n}\n\n.header-subtitle,\n.text {\n color: var(--vvd-color-neutral-600);\n font: var(--vvd-typography-base);\n}\n\n.text {\n padding-right: 8px;\n margin-top: 12px;\n}\n\n.footer {\n display: inline-flex;\n flex-direction: column;\n align-items: flex-end;\n padding-bottom: 24px;\n margin-top: auto;\n padding-inline: 24px;\n}\n.hide-footer .footer {\n display: none;\n}\n\n::slotted([slot=graphic i]),\n.icon {\n flex-shrink: 0;\n align-self: baseline;\n margin-block-start: 4px;\n}\n\n.icon {\n font-size: 20px;\n}\n\n::slotted([slot=meta i]) {\n flex-shrink: 0;\n align-self: flex-start;\n margin-block-start: -8px;\n margin-inline-end: -8px;\n margin-inline-start: auto;\n}";
|
|
14
|
+
|
|
15
|
+
class Card extends FoundationElement {}
|
|
16
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "headline", void 0);
|
|
17
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "subtitle", void 0);
|
|
18
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "text", void 0);
|
|
19
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "icon", void 0);
|
|
20
|
+
__decorate([attr, __metadata("design:type", Number)], Card.prototype, "elevation", void 0);
|
|
21
|
+
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "footerSlottedContent", void 0);
|
|
22
|
+
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "graphicSlottedContent", void 0);
|
|
23
|
+
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "hasMetaSlottedContent", void 0);
|
|
24
|
+
|
|
25
|
+
let _2 = t => t,
|
|
26
|
+
_t,
|
|
27
|
+
_t2,
|
|
28
|
+
_t3,
|
|
29
|
+
_t4,
|
|
30
|
+
_t5,
|
|
31
|
+
_t6,
|
|
32
|
+
_t7,
|
|
33
|
+
_t8;
|
|
34
|
+
const getClasses = _ => classNames('base', ['hide-footer', !_.footerSlottedContent || !_.footerSlottedContent.length], ['hide-header', shouldHideHeader(_)]);
|
|
35
|
+
function renderHeaderIcon() {
|
|
36
|
+
return html(_t || (_t = _2`
|
|
37
|
+
<vwc-icon class="icon" inline type="${0}"></vwc-icon>`), x => x.icon);
|
|
38
|
+
}
|
|
39
|
+
function Headline() {
|
|
40
|
+
return html(_t2 || (_t2 = _2`
|
|
41
|
+
<div class="header-headline">${0}</div>
|
|
42
|
+
`), x => x.headline);
|
|
43
|
+
}
|
|
44
|
+
function Subtitle() {
|
|
45
|
+
return html(_t3 || (_t3 = _2`
|
|
46
|
+
<div class="header-subtitle">${0}</div>
|
|
47
|
+
`), x => x.subtitle);
|
|
48
|
+
}
|
|
49
|
+
function headerContent() {
|
|
50
|
+
return html(_t4 || (_t4 = _2`
|
|
51
|
+
<div class="header-content">
|
|
52
|
+
${0}
|
|
53
|
+
${0}
|
|
54
|
+
</div>
|
|
55
|
+
`), when(x => x.headline, Headline()), when(x => x.subtitle, Subtitle()));
|
|
56
|
+
}
|
|
57
|
+
function renderHeader() {
|
|
58
|
+
return html(_t5 || (_t5 = _2`
|
|
59
|
+
<header class="header">
|
|
60
|
+
<slot name="graphic" ${0}>${0}</slot>
|
|
61
|
+
${0}
|
|
62
|
+
</header>`), slotted('graphicSlottedContent'), when(x => x.icon, renderHeaderIcon()), when(x => x.headline || x.subtitle, headerContent()));
|
|
63
|
+
}
|
|
64
|
+
function shouldHideHeader(card) {
|
|
65
|
+
return !card.headline && !card.subtitle && !card.icon && (!card.graphicSlottedContent || !card.graphicSlottedContent.length);
|
|
66
|
+
}
|
|
67
|
+
function renderMetaSlot() {
|
|
68
|
+
return html(_t6 || (_t6 = _2`
|
|
69
|
+
<slot name="meta" ${0}></slot>
|
|
70
|
+
`), slotted('metaSlottedContent'));
|
|
71
|
+
}
|
|
72
|
+
function text() {
|
|
73
|
+
return html(_t7 || (_t7 = _2`
|
|
74
|
+
<div class="text">${0}</div>
|
|
75
|
+
`), x => x.text);
|
|
76
|
+
}
|
|
77
|
+
const CardTemplate = () => html(_t8 || (_t8 = _2`
|
|
78
|
+
<vwc-elevation dp=${0}>
|
|
79
|
+
|
|
80
|
+
<div class="${0}">
|
|
81
|
+
<div class="wrapper">
|
|
82
|
+
<div class="vwc-card-media">
|
|
83
|
+
<slot name="media"></slot>
|
|
84
|
+
</div>
|
|
85
|
+
<slot name="main">
|
|
86
|
+
<div class="main-content">
|
|
87
|
+
<div class="header-wrapper">
|
|
88
|
+
${0}
|
|
89
|
+
${0}
|
|
90
|
+
</div>
|
|
91
|
+
${0}
|
|
92
|
+
</div>
|
|
93
|
+
</slot>
|
|
94
|
+
<div class="footer">
|
|
95
|
+
<slot name="footer" ${0}></slot>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
</vwc-elevation>
|
|
101
|
+
`), x => {
|
|
102
|
+
var _a;
|
|
103
|
+
return (_a = x.elevation) !== null && _a !== void 0 ? _a : '4';
|
|
104
|
+
}, getClasses, renderHeader(), renderMetaSlot(), when(x => x.text, text()), slotted('footerSlottedContent'));
|
|
105
|
+
|
|
106
|
+
const vividCard = Card.compose({
|
|
107
|
+
baseName: 'card',
|
|
108
|
+
template: CardTemplate,
|
|
109
|
+
styles: css_248z
|
|
110
|
+
});
|
|
111
|
+
designSystem.register(vividCard());
|
|
112
|
+
|
|
113
|
+
export { vividCard };
|