@vonage/vivid 3.0.0-next.11 → 3.0.0-next.110
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 +165 -4
- package/accordion/index.js +5 -14
- package/accordion-item/index.js +34 -41
- package/action-group/index.js +37 -0
- package/avatar/index.js +61 -0
- package/badge/index.js +23 -35
- package/banner/index.js +20 -115
- package/breadcrumb/index.js +22 -19
- package/breadcrumb-item/index.js +28 -25
- package/button/index.js +29 -690
- package/calendar/index.js +70 -69
- package/calendar-event/index.js +109 -0
- package/card/index.js +112 -0
- package/checkbox/index.js +178 -0
- package/custom-elements.json +3941 -0
- package/dialog/index.js +214 -0
- package/divider/index.js +27 -0
- package/elevation/index.js +10 -16
- package/fab/index.js +98 -0
- package/focus/index.js +18 -3
- package/header/index.js +63 -0
- package/icon/index.js +9 -12
- package/index.js +68 -22
- package/layout/index.js +6 -16
- package/lib/accordion-item/accordion-item.d.ts +2 -2
- package/lib/accordion-item/index.d.ts +0 -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 +2 -0
- package/lib/badge/badge.d.ts +3 -5
- package/lib/badge/index.d.ts +1 -2
- package/lib/banner/banner.d.ts +1 -1
- package/lib/banner/banner.template.d.ts +0 -2
- 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 +0 -1
- package/lib/button/button.d.ts +4 -3
- package/lib/button/index.d.ts +1 -21
- 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/{text → card}/index.d.ts +1 -1
- package/lib/checkbox/checkbox.d.ts +5 -0
- package/lib/checkbox/checkbox.template.d.ts +4 -0
- package/lib/checkbox/index.d.ts +2 -0
- package/lib/components.d.ts +32 -10
- package/lib/dialog/dialog.d.ts +20 -0
- package/lib/dialog/dialog.template.d.ts +4 -0
- package/lib/dialog/index.d.ts +2 -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 +19 -6
- package/lib/fab/fab.d.ts +13 -0
- package/lib/fab/fab.template.d.ts +4 -0
- package/lib/fab/index.d.ts +2 -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 +2 -0
- package/lib/icon/icon.d.ts +5 -6
- package/lib/layout/index.d.ts +1 -1
- package/lib/layout/layout.d.ts +4 -4
- package/lib/listbox/index.d.ts +1 -0
- package/lib/listbox/listbox.d.ts +9 -0
- package/lib/listbox/listbox.template.d.ts +4 -0
- package/lib/menu/index.d.ts +10 -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 +2 -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 +2 -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 +2 -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/note/index.d.ts +2 -0
- package/lib/note/note.d.ts +10 -0
- package/lib/note/note.template.d.ts +4 -0
- package/lib/number-field/index.d.ts +2 -0
- package/lib/number-field/number-field.d.ts +14 -0
- package/lib/number-field/number-field.template.d.ts +4 -0
- package/lib/option/index.d.ts +2 -0
- package/lib/option/option.d.ts +9 -0
- package/lib/option/option.template.d.ts +4 -0
- package/lib/popup/index.d.ts +1 -3
- package/lib/popup/popup.d.ts +3 -2
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress-ring/progress-ring.d.ts +2 -1
- package/lib/radio/index.d.ts +2 -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/slider/index.d.ts +2 -0
- package/lib/slider/slider.d.ts +4 -0
- package/lib/slider/slider.template.d.ts +4 -0
- package/lib/switch/index.d.ts +2 -0
- package/lib/switch/switch.d.ts +7 -0
- package/lib/switch/switch.template.d.ts +4 -0
- package/lib/text-anchor/text-anchor.d.ts +1 -1
- package/lib/text-area/index.d.ts +2 -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 +2 -0
- package/lib/text-field/text-field.d.ts +14 -0
- package/lib/text-field/text-field.template.d.ts +4 -0
- package/lib/tooltip/index.d.ts +0 -1
- package/lib/tooltip/tooltip.d.ts +7 -7
- package/listbox/index.js +1086 -0
- package/menu/index.js +357 -0
- package/menu-item/index.js +90 -0
- package/nav/index.js +17 -0
- package/nav-disclosure/index.js +80 -0
- package/nav-item/index.js +44 -0
- package/note/index.js +59 -0
- package/number-field/index.js +460 -0
- package/option/index.js +75 -0
- package/package.json +62 -10
- package/popup/index.js +35 -2036
- package/progress/index.js +33 -38
- package/progress-ring/index.js +13 -13
- package/radio/index.js +52 -0
- package/radio-group/index.js +435 -0
- package/shared/affix.js +2 -8
- package/shared/anchor.js +11 -3
- 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 +6 -1
- package/shared/breadcrumb-item.js +2 -2
- package/shared/button.js +23 -0
- package/shared/button2.js +200 -0
- package/shared/calendar-event.js +19 -0
- package/shared/design-system/index.d.ts +1 -1
- package/shared/dialog-polyfill.esm.js +858 -0
- package/shared/direction.js +20 -0
- package/shared/divider.js +55 -0
- package/shared/dom.js +8 -0
- package/shared/elevation.js +10 -0
- package/shared/enums.js +70 -0
- package/shared/es.object.assign.js +2 -59
- package/shared/es.promise.resolve.js +944 -0
- package/shared/es.regexp.to-string.js +58 -0
- package/shared/focus.js +11 -0
- package/shared/focus2.js +5 -0
- package/shared/form-associated.js +466 -0
- package/shared/form-elements.js +343 -0
- package/shared/icon.js +32 -1153
- package/shared/index.js +3780 -83
- package/shared/index2.js +7 -19
- package/shared/key-codes.js +97 -0
- package/shared/listbox-option.js +201 -0
- package/shared/menu-item.js +277 -0
- package/shared/numbers.js +25 -0
- package/shared/patterns/focus.d.ts +3 -0
- package/shared/patterns/form-elements/form-elements.d.ts +31 -0
- package/shared/patterns/form-elements/index.d.ts +1 -0
- package/shared/patterns/index.d.ts +2 -0
- package/shared/popup.js +1484 -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/string-trim.js +39 -0
- package/shared/text-anchor.js +2 -13
- package/shared/text-anchor.template.js +6 -5
- package/shared/utils/index.d.ts +1 -0
- package/side-drawer/index.js +38 -34
- package/slider/index.js +596 -0
- package/styles/core/all.css +86 -0
- package/styles/core/theme.css +11 -0
- package/styles/core/typography.css +80 -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/switch/index.js +153 -0
- package/text-anchor/index.js +8 -3
- package/text-area/index.js +288 -0
- package/text-field/index.js +129 -0
- package/tooltip/index.js +59 -43
- package/vivid.api.json +2979 -0
- package/lib/text/text.d.ts +0 -10
- package/shared/style-inject.es.js +0 -28
- package/shared/web.dom-collections.iterator.js +0 -1479
- 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,7 @@
|
|
|
1
|
-
import '../
|
|
2
|
-
import {
|
|
3
|
-
import { s as styleInject } from '../shared/style-inject.es.js';
|
|
4
|
-
import '../shared/web.dom-collections.iterator.js';
|
|
1
|
+
import { $ as emptyArray, Z as Observable, a3 as SubscriberSet, a2 as DOM, a4 as HTMLDirective, a5 as HTMLView, F as FoundationElement, Y as __classPrivateFieldGet, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem, g as getPrefix } from '../shared/index.js';
|
|
2
|
+
import { C as CalendarEvent } from '../shared/calendar-event.js';
|
|
5
3
|
import '../shared/es.object.assign.js';
|
|
6
4
|
import { b as _has, _ as _curry1, a as _curry2 } from '../shared/_has.js';
|
|
7
|
-
import '../shared/class-names.js';
|
|
8
5
|
|
|
9
6
|
/** @internal */
|
|
10
7
|
function newSplice(index, removed, addedCount) {
|
|
@@ -361,6 +358,10 @@ class ArrayObserver extends SubscriberSet {
|
|
|
361
358
|
enumerable: false,
|
|
362
359
|
});
|
|
363
360
|
}
|
|
361
|
+
subscribe(subscriber) {
|
|
362
|
+
this.flush();
|
|
363
|
+
super.subscribe(subscriber);
|
|
364
|
+
}
|
|
364
365
|
addSplice(splice) {
|
|
365
366
|
if (this.splices === void 0) {
|
|
366
367
|
this.splices = [splice];
|
|
@@ -610,34 +611,50 @@ class RepeatBehavior {
|
|
|
610
611
|
updateViews(splices) {
|
|
611
612
|
const childContext = this.childContext;
|
|
612
613
|
const views = this.views;
|
|
613
|
-
const totalRemoved = [];
|
|
614
614
|
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
615
|
const items = this.items;
|
|
623
616
|
const template = this.template;
|
|
617
|
+
const recycle = this.options.recycle;
|
|
618
|
+
const leftoverViews = [];
|
|
619
|
+
let leftoverIndex = 0;
|
|
620
|
+
let availableViews = 0;
|
|
624
621
|
for (let i = 0, ii = splices.length; i < ii; ++i) {
|
|
625
622
|
const splice = splices[i];
|
|
623
|
+
const removed = splice.removed;
|
|
624
|
+
let removeIndex = 0;
|
|
626
625
|
let addIndex = splice.index;
|
|
627
626
|
const end = addIndex + splice.addedCount;
|
|
627
|
+
const removedViews = views.splice(splice.index, removed.length);
|
|
628
|
+
const totalAvailableViews = (availableViews =
|
|
629
|
+
leftoverViews.length + removedViews.length);
|
|
628
630
|
for (; addIndex < end; ++addIndex) {
|
|
629
631
|
const neighbor = views[addIndex];
|
|
630
632
|
const location = neighbor ? neighbor.firstChild : this.location;
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
633
|
+
let view;
|
|
634
|
+
if (recycle && availableViews > 0) {
|
|
635
|
+
if (removeIndex <= totalAvailableViews && removedViews.length > 0) {
|
|
636
|
+
view = removedViews[removeIndex];
|
|
637
|
+
removeIndex++;
|
|
638
|
+
}
|
|
639
|
+
else {
|
|
640
|
+
view = leftoverViews[leftoverIndex];
|
|
641
|
+
leftoverIndex++;
|
|
642
|
+
}
|
|
643
|
+
availableViews--;
|
|
644
|
+
}
|
|
645
|
+
else {
|
|
646
|
+
view = template.create();
|
|
647
|
+
}
|
|
634
648
|
views.splice(addIndex, 0, view);
|
|
635
649
|
bindView(view, items, addIndex, childContext);
|
|
636
650
|
view.insertBefore(location);
|
|
637
651
|
}
|
|
652
|
+
if (removedViews[removeIndex]) {
|
|
653
|
+
leftoverViews.push(...removedViews.slice(removeIndex));
|
|
654
|
+
}
|
|
638
655
|
}
|
|
639
|
-
for (let i =
|
|
640
|
-
|
|
656
|
+
for (let i = leftoverIndex, ii = leftoverViews.length; i < ii; ++i) {
|
|
657
|
+
leftoverViews[i].dispose();
|
|
641
658
|
}
|
|
642
659
|
if (this.options.positioning) {
|
|
643
660
|
for (let i = 0, ii = views.length; i < ii; ++i) {
|
|
@@ -656,7 +673,7 @@ class RepeatBehavior {
|
|
|
656
673
|
let itemsLength = items.length;
|
|
657
674
|
let views = this.views;
|
|
658
675
|
let viewsLength = views.length;
|
|
659
|
-
if (itemsLength === 0 || templateChanged) {
|
|
676
|
+
if (itemsLength === 0 || templateChanged || !this.options.recycle) {
|
|
660
677
|
// all views need to be removed
|
|
661
678
|
HTMLView.disposeContiguousBatch(views);
|
|
662
679
|
viewsLength = 0;
|
|
@@ -744,7 +761,7 @@ function repeat(itemsBinding, templateOrTemplateBinding, options = defaultRepeat
|
|
|
744
761
|
const templateBinding = typeof templateOrTemplateBinding === "function"
|
|
745
762
|
? templateOrTemplateBinding
|
|
746
763
|
: () => templateOrTemplateBinding;
|
|
747
|
-
return new RepeatDirective(itemsBinding, templateBinding, options);
|
|
764
|
+
return new RepeatDirective(itemsBinding, templateBinding, Object.assign(Object.assign({}, defaultRepeatOptions), options));
|
|
748
765
|
}
|
|
749
766
|
|
|
750
767
|
/**
|
|
@@ -1240,8 +1257,7 @@ _curry1(function isEmpty(x) {
|
|
|
1240
1257
|
|
|
1241
1258
|
var isEmpty$1 = isEmpty;
|
|
1242
1259
|
|
|
1243
|
-
var css_248z = "
|
|
1244
|
-
styleInject(css_248z);
|
|
1260
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Sun, 04 Dec 2022 15:37:45 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: 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 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 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
1261
|
|
|
1246
1262
|
const ARROW_UP = 'ArrowUp';
|
|
1247
1263
|
const ARROW_RIGHT = 'ArrowRight';
|
|
@@ -1250,18 +1266,14 @@ const ARROW_LEFT = 'ArrowLeft';
|
|
|
1250
1266
|
function isCellOrHeader(el) {
|
|
1251
1267
|
return el instanceof HTMLElement && (el.matches('[role="gridcell"i]') || el.matches('[role="columnheader"i]'));
|
|
1252
1268
|
}
|
|
1253
|
-
|
|
1254
1269
|
const getCellOrHeader = f => f.matches('[role="columnheader"i]') ? '[role="gridcell"i]' : '[role="columnheader"i]';
|
|
1255
|
-
|
|
1256
1270
|
function getNextFocusableGridElement(key, activeElement) {
|
|
1257
1271
|
if (activeElement.parentNode instanceof HTMLElement) {
|
|
1258
1272
|
switch (key) {
|
|
1259
1273
|
case ARROW_RIGHT:
|
|
1260
1274
|
return activeElement.nextElementSibling || activeElement.parentNode.firstElementChild;
|
|
1261
|
-
|
|
1262
1275
|
case ARROW_LEFT:
|
|
1263
1276
|
return activeElement.previousElementSibling || activeElement.parentNode.lastElementChild;
|
|
1264
|
-
|
|
1265
1277
|
case ARROW_UP:
|
|
1266
1278
|
case ARROW_DOWN:
|
|
1267
1279
|
{
|
|
@@ -1278,7 +1290,6 @@ function getHeaderDescendantGridCell(key, activeElement) {
|
|
|
1278
1290
|
if (key !== ARROW_DOWN) {
|
|
1279
1291
|
return;
|
|
1280
1292
|
}
|
|
1281
|
-
|
|
1282
1293
|
const header = activeElement.closest('[role="columnheader"i]');
|
|
1283
1294
|
const columnHeaders = this.shadowRoot.querySelectorAll('[role="columnheader"i]');
|
|
1284
1295
|
const i = Array.from(columnHeaders).indexOf(header);
|
|
@@ -1287,21 +1298,17 @@ function getHeaderDescendantGridCell(key, activeElement) {
|
|
|
1287
1298
|
|
|
1288
1299
|
function getDay(el) {
|
|
1289
1300
|
const cellOrHeader = el.closest('[role="gridcell"i], [role="columnheader"i]');
|
|
1290
|
-
|
|
1291
1301
|
if (cellOrHeader) {
|
|
1292
1302
|
const {
|
|
1293
1303
|
parentElement
|
|
1294
1304
|
} = cellOrHeader;
|
|
1295
|
-
|
|
1296
1305
|
if (parentElement) {
|
|
1297
1306
|
return parentElement.children && Array.from(parentElement.children).indexOf(cellOrHeader);
|
|
1298
1307
|
}
|
|
1299
1308
|
}
|
|
1300
1309
|
}
|
|
1301
|
-
|
|
1302
1310
|
function getHour(e, el, hours) {
|
|
1303
1311
|
const rowHeaderOrCell = el.closest('[role="rowheader"], [role="gridcell"i]');
|
|
1304
|
-
|
|
1305
1312
|
if (rowHeaderOrCell) {
|
|
1306
1313
|
const DOMRect = rowHeaderOrCell.getBoundingClientRect();
|
|
1307
1314
|
const offsetY = e.clientY - DOMRect.y;
|
|
@@ -1310,25 +1317,19 @@ function getHour(e, el, hours) {
|
|
|
1310
1317
|
return Math.round((hour + Number.EPSILON) * 100) / 100;
|
|
1311
1318
|
}
|
|
1312
1319
|
}
|
|
1313
|
-
|
|
1314
1320
|
const getEventContext = function getEventContext(e) {
|
|
1315
1321
|
if (!(e instanceof KeyboardEvent || e instanceof MouseEvent)) {
|
|
1316
1322
|
throw new Error('Invalid event. Event must be instance of KeyboardEvent or MouseEvent');
|
|
1317
1323
|
}
|
|
1318
|
-
|
|
1319
1324
|
const [el] = e.composedPath();
|
|
1320
|
-
|
|
1321
1325
|
if (!(el && el instanceof HTMLElement && this.shadowRoot.contains(el))) {
|
|
1322
1326
|
throw new Error('Invalid event. Event must contain a target object which is a direct descendant of calendar');
|
|
1323
1327
|
}
|
|
1324
|
-
|
|
1325
1328
|
const day = getDay(el);
|
|
1326
1329
|
let hour;
|
|
1327
|
-
|
|
1328
1330
|
if (e instanceof MouseEvent) {
|
|
1329
1331
|
hour = getHour(e, el, this._hours);
|
|
1330
1332
|
}
|
|
1331
|
-
|
|
1332
1333
|
const context = Object.assign(Object.assign({}, day != undefined && {
|
|
1333
1334
|
day
|
|
1334
1335
|
}), hour != undefined && {
|
|
@@ -1337,85 +1338,85 @@ const getEventContext = function getEventContext(e) {
|
|
|
1337
1338
|
return not$1(isEmpty$1(context)) ? context : null;
|
|
1338
1339
|
};
|
|
1339
1340
|
|
|
1341
|
+
var _Calendar_instances, _Calendar_activeCalendarEvent_get;
|
|
1340
1342
|
class Calendar extends FoundationElement {
|
|
1341
1343
|
constructor() {
|
|
1342
1344
|
super(...arguments);
|
|
1345
|
+
_Calendar_instances.add(this);
|
|
1343
1346
|
this.hour12 = false;
|
|
1344
1347
|
this._hours = 24;
|
|
1345
1348
|
this._days = 7;
|
|
1346
1349
|
this.hoursAsDatetime = Array.from({
|
|
1347
1350
|
length: this._hours - 1
|
|
1348
1351
|
}).fill(new Date(new Date().setHours(0, 0, 0))).map((d, i) => new Date(d.setHours(++i)));
|
|
1349
|
-
|
|
1350
1352
|
this._generateDaysArr = dateArr => {
|
|
1351
1353
|
if (dateArr.length == this._days) {
|
|
1352
1354
|
return dateArr;
|
|
1353
1355
|
}
|
|
1354
|
-
|
|
1355
1356
|
const lastDate = new Date(dateArr[dateArr.length - 1]);
|
|
1356
1357
|
lastDate.setDate(lastDate.getDate() + 1);
|
|
1357
1358
|
return this._generateDaysArr([...dateArr, lastDate]);
|
|
1358
1359
|
};
|
|
1359
|
-
|
|
1360
1360
|
this.getEventContext = getEventContext;
|
|
1361
1361
|
}
|
|
1362
|
-
|
|
1362
|
+
getCalendarEventContainingCell(calendarEvent) {
|
|
1363
|
+
const slotName = calendarEvent.getAttribute('slot');
|
|
1364
|
+
const gridCell = this.shadowRoot.querySelector(`slot[name="${slotName}"i]`);
|
|
1365
|
+
return gridCell.parentElement;
|
|
1366
|
+
}
|
|
1363
1367
|
arrowKeysInteractions(key) {
|
|
1364
|
-
const
|
|
1368
|
+
const {
|
|
1369
|
+
activeElement
|
|
1370
|
+
} = this.shadowRoot;
|
|
1365
1371
|
let focusNext;
|
|
1366
|
-
|
|
1367
1372
|
if (isCellOrHeader(activeElement)) {
|
|
1368
1373
|
focusNext = getNextFocusableGridElement.call(this, key, activeElement);
|
|
1374
|
+
} else if (__classPrivateFieldGet(this, _Calendar_instances, "a", _Calendar_activeCalendarEvent_get)) {
|
|
1375
|
+
focusNext = this.getCalendarEventContainingCell(__classPrivateFieldGet(this, _Calendar_instances, "a", _Calendar_activeCalendarEvent_get));
|
|
1369
1376
|
} else if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.matches('em[role="button"i]')) {
|
|
1370
1377
|
focusNext = getHeaderDescendantGridCell.call(this, key, activeElement);
|
|
1371
1378
|
} else {
|
|
1372
1379
|
focusNext = this.shadowRoot.querySelector('[role="columnheader"i]');
|
|
1373
1380
|
}
|
|
1374
|
-
|
|
1375
|
-
this.moveTo(focusNext);
|
|
1381
|
+
this.activateElement(focusNext);
|
|
1376
1382
|
}
|
|
1377
|
-
|
|
1378
|
-
moveTo(el) {
|
|
1383
|
+
activateElement(el) {
|
|
1379
1384
|
const onBlur = ({
|
|
1380
1385
|
target
|
|
1381
1386
|
}) => target.setAttribute('tabindex', '-1');
|
|
1382
|
-
|
|
1383
1387
|
el === null || el === void 0 ? void 0 : el.addEventListener('blur', onBlur, {
|
|
1384
1388
|
once: true
|
|
1385
1389
|
});
|
|
1386
1390
|
el === null || el === void 0 ? void 0 : el.setAttribute('tabindex', '0');
|
|
1387
1391
|
el === null || el === void 0 ? void 0 : el.focus();
|
|
1388
1392
|
}
|
|
1389
|
-
|
|
1390
1393
|
onKeydown({
|
|
1391
1394
|
key
|
|
1392
1395
|
}) {
|
|
1393
1396
|
const isArrow = [ARROW_UP, ARROW_RIGHT, ARROW_DOWN, ARROW_LEFT].some(predefinedKey => predefinedKey == key);
|
|
1394
|
-
|
|
1395
1397
|
if (isArrow) {
|
|
1396
1398
|
this.arrowKeysInteractions(key);
|
|
1397
1399
|
}
|
|
1398
|
-
|
|
1399
1400
|
return !isArrow;
|
|
1400
1401
|
}
|
|
1401
|
-
|
|
1402
1402
|
}
|
|
1403
|
-
|
|
1403
|
+
_Calendar_instances = new WeakSet(), _Calendar_activeCalendarEvent_get = function _Calendar_activeCalendarEvent_get() {
|
|
1404
|
+
const {
|
|
1405
|
+
activeElement
|
|
1406
|
+
} = document;
|
|
1407
|
+
return activeElement instanceof CalendarEvent ? activeElement : null;
|
|
1408
|
+
};
|
|
1404
1409
|
__decorate([attr, __metadata("design:type", Object)], Calendar.prototype, "datetime", void 0);
|
|
1405
|
-
|
|
1406
1410
|
__decorate([attr({
|
|
1407
1411
|
attribute: 'start-day'
|
|
1408
1412
|
}), __metadata("design:type", String)], Calendar.prototype, "startDay", void 0);
|
|
1409
|
-
|
|
1410
1413
|
__decorate([attr, __metadata("design:type", Object)], Calendar.prototype, "locales", void 0);
|
|
1411
|
-
|
|
1412
1414
|
__decorate([attr({
|
|
1413
1415
|
mode: 'boolean'
|
|
1414
1416
|
}), __metadata("design:type", Object)], Calendar.prototype, "hour12", void 0);
|
|
1415
1417
|
|
|
1416
1418
|
function getValidDateString(date) {
|
|
1417
1419
|
const twoDigit = num => `0${num}`.slice(-2);
|
|
1418
|
-
|
|
1419
1420
|
return `${date.getFullYear()}-${twoDigit(date.getMonth() + 1)}-${twoDigit(date.getDate())}`;
|
|
1420
1421
|
}
|
|
1421
1422
|
const weekdaysMap = new Map([['sunday', 0], ['monday', 1]]);
|
|
@@ -1428,14 +1429,13 @@ function getFirstDateOfTheWeek(date = new Date(), startDay) {
|
|
|
1428
1429
|
}
|
|
1429
1430
|
|
|
1430
1431
|
let _2 = t => t,
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1432
|
+
_t,
|
|
1433
|
+
_t2,
|
|
1434
|
+
_t3,
|
|
1435
|
+
_t4,
|
|
1436
|
+
_t5,
|
|
1437
|
+
_t6,
|
|
1438
|
+
_t7;
|
|
1439
1439
|
const HoursTemplate = () => {
|
|
1440
1440
|
return html(_t || (_t = _2`
|
|
1441
1441
|
<div class="row-headers" role="presentation">
|
|
@@ -1453,7 +1453,6 @@ const HoursTemplate = () => {
|
|
|
1453
1453
|
hour12: c.parent.hour12
|
|
1454
1454
|
}).format(x))));
|
|
1455
1455
|
};
|
|
1456
|
-
|
|
1457
1456
|
const DaysTemplate = () => {
|
|
1458
1457
|
return html(_t3 || (_t3 = _2`
|
|
1459
1458
|
<div class="column-headers" role="row">
|
|
@@ -1482,7 +1481,6 @@ const DaysTemplate = () => {
|
|
|
1482
1481
|
weekday: 'short'
|
|
1483
1482
|
}).format(x))));
|
|
1484
1483
|
};
|
|
1485
|
-
|
|
1486
1484
|
const ColumnTemplate = html(_t5 || (_t5 = _2`
|
|
1487
1485
|
<div role="gridcell" tabindex="-1">
|
|
1488
1486
|
<slot name="day-${0}"></slot>
|
|
@@ -1514,8 +1512,11 @@ const CalendarTemplate = () => html(_t6 || (_t6 = _2`
|
|
|
1514
1512
|
const vividCalendar = Calendar.compose({
|
|
1515
1513
|
baseName: 'calendar',
|
|
1516
1514
|
template: CalendarTemplate,
|
|
1517
|
-
styles: css_248z
|
|
1515
|
+
styles: css_248z,
|
|
1516
|
+
shadowOptions: {
|
|
1517
|
+
delegatesFocus: true
|
|
1518
|
+
}
|
|
1518
1519
|
});
|
|
1519
|
-
designSystem.register(vividCalendar());
|
|
1520
|
+
designSystem.withPrefix(getPrefix(import.meta.url)).register(vividCalendar());
|
|
1520
1521
|
|
|
1521
1522
|
export { vividCalendar };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { E as _export, i as descriptors, e as global$1, n as functionUncurryThis, y as hasOwnProperty_1, r as isCallable$1, o as objectDefineProperty, a8 as copyConstructorProperties$1, P as objectIsPrototypeOf, X as toString$1, h as html, d as designSystem, g as getPrefix } from '../shared/index.js';
|
|
2
|
+
import { C as CalendarEvent } from '../shared/calendar-event.js';
|
|
3
|
+
import '../shared/es.object.assign.js';
|
|
4
|
+
import { w as when } from '../shared/when.js';
|
|
5
|
+
import { c as classNames } from '../shared/class-names.js';
|
|
6
|
+
|
|
7
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Sun, 04 Dec 2022 15:37:45 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-300);\n --_connotation-color-primary-text: var(--vvd-color-canvas-text);\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}";
|
|
8
|
+
|
|
9
|
+
var $ = _export;
|
|
10
|
+
var DESCRIPTORS = descriptors;
|
|
11
|
+
var global = global$1;
|
|
12
|
+
var uncurryThis = functionUncurryThis;
|
|
13
|
+
var hasOwn = hasOwnProperty_1;
|
|
14
|
+
var isCallable = isCallable$1;
|
|
15
|
+
var isPrototypeOf = objectIsPrototypeOf;
|
|
16
|
+
var toString = toString$1;
|
|
17
|
+
var defineProperty = objectDefineProperty.f;
|
|
18
|
+
var copyConstructorProperties = copyConstructorProperties$1;
|
|
19
|
+
|
|
20
|
+
var NativeSymbol = global.Symbol;
|
|
21
|
+
var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
|
|
22
|
+
|
|
23
|
+
if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) ||
|
|
24
|
+
// Safari 12 bug
|
|
25
|
+
NativeSymbol().description !== undefined
|
|
26
|
+
)) {
|
|
27
|
+
var EmptyStringDescriptionStore = {};
|
|
28
|
+
// wrap Symbol constructor for correct work with undefined description
|
|
29
|
+
var SymbolWrapper = function Symbol() {
|
|
30
|
+
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]);
|
|
31
|
+
var result = isPrototypeOf(SymbolPrototype, this)
|
|
32
|
+
? new NativeSymbol(description)
|
|
33
|
+
// in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
|
|
34
|
+
: description === undefined ? NativeSymbol() : NativeSymbol(description);
|
|
35
|
+
if (description === '') EmptyStringDescriptionStore[result] = true;
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
copyConstructorProperties(SymbolWrapper, NativeSymbol);
|
|
40
|
+
SymbolWrapper.prototype = SymbolPrototype;
|
|
41
|
+
SymbolPrototype.constructor = SymbolWrapper;
|
|
42
|
+
|
|
43
|
+
var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)';
|
|
44
|
+
var thisSymbolValue = uncurryThis(SymbolPrototype.valueOf);
|
|
45
|
+
var symbolDescriptiveString = uncurryThis(SymbolPrototype.toString);
|
|
46
|
+
var regexp = /^Symbol\((.*)\)[^)]+$/;
|
|
47
|
+
var replace = uncurryThis(''.replace);
|
|
48
|
+
var stringSlice = uncurryThis(''.slice);
|
|
49
|
+
|
|
50
|
+
defineProperty(SymbolPrototype, 'description', {
|
|
51
|
+
configurable: true,
|
|
52
|
+
get: function description() {
|
|
53
|
+
var symbol = thisSymbolValue(this);
|
|
54
|
+
if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
|
|
55
|
+
var string = symbolDescriptiveString(symbol);
|
|
56
|
+
var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');
|
|
57
|
+
return desc === '' ? undefined : desc;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
$({ global: true, constructor: true, forced: true }, {
|
|
62
|
+
Symbol: SymbolWrapper
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let _ = t => t,
|
|
67
|
+
_t,
|
|
68
|
+
_t2,
|
|
69
|
+
_t3;
|
|
70
|
+
const getClasses = ({
|
|
71
|
+
connotation,
|
|
72
|
+
appearance
|
|
73
|
+
}) => classNames('base', [`connotation-${connotation}`, Boolean(connotation)], [`appearance-${appearance}`, Boolean(appearance)]);
|
|
74
|
+
const getStyles = ({
|
|
75
|
+
start,
|
|
76
|
+
duration,
|
|
77
|
+
overlapCount
|
|
78
|
+
}) => {
|
|
79
|
+
const stylesObj = Object.assign(Object.assign(Object.assign({}, overlapCount && {
|
|
80
|
+
'--vvd-calendar-event--overlap-count': overlapCount
|
|
81
|
+
}), start && {
|
|
82
|
+
'--vvd-calendar-event--start': start
|
|
83
|
+
}), duration && {
|
|
84
|
+
'--vvd-calendar-event--duration': duration
|
|
85
|
+
});
|
|
86
|
+
return Object.entries(stylesObj).map(entry => entry.join(':')).join(';');
|
|
87
|
+
};
|
|
88
|
+
const CalendarEventTemplate = () => html(_t || (_t = _`
|
|
89
|
+
<div
|
|
90
|
+
style="${0}"
|
|
91
|
+
class="${0}"
|
|
92
|
+
role="button"
|
|
93
|
+
tabindex="0"
|
|
94
|
+
>
|
|
95
|
+
${0}
|
|
96
|
+
${0}
|
|
97
|
+
</div>`), getStyles, getClasses, when(x => x.heading, html(_t2 || (_t2 = _`<h2><strong>${0}</strong></h2>`), x => x.heading)), when(x => x.description, html(_t3 || (_t3 = _`<p>${0}</p>`), x => x.description)));
|
|
98
|
+
|
|
99
|
+
const vividCalendarEvent = CalendarEvent.compose({
|
|
100
|
+
baseName: 'calendar-event',
|
|
101
|
+
template: CalendarEventTemplate,
|
|
102
|
+
styles: css_248z,
|
|
103
|
+
shadowOptions: {
|
|
104
|
+
delegatesFocus: true
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
designSystem.withPrefix(getPrefix(import.meta.url)).register(vividCalendarEvent());
|
|
108
|
+
|
|
109
|
+
export { vividCalendarEvent };
|
package/card/index.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import '../shared/es.promise.resolve.js';
|
|
2
|
+
import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, V as observable, h as html, g as getPrefix, d as designSystem } from '../shared/index.js';
|
|
3
|
+
import { l as loadComponentsModules } from '../shared/index2.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
|
+
|
|
8
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Sun, 04 Dec 2022 15:37:45 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}";
|
|
9
|
+
|
|
10
|
+
class Card extends FoundationElement {}
|
|
11
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "headline", void 0);
|
|
12
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "subtitle", void 0);
|
|
13
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "text", void 0);
|
|
14
|
+
__decorate([attr, __metadata("design:type", String)], Card.prototype, "icon", void 0);
|
|
15
|
+
__decorate([attr, __metadata("design:type", Number)], Card.prototype, "elevation", void 0);
|
|
16
|
+
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "footerSlottedContent", void 0);
|
|
17
|
+
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "graphicSlottedContent", void 0);
|
|
18
|
+
__decorate([observable, __metadata("design:type", Array)], Card.prototype, "hasMetaSlottedContent", void 0);
|
|
19
|
+
|
|
20
|
+
let _2 = t => t,
|
|
21
|
+
_t,
|
|
22
|
+
_t2,
|
|
23
|
+
_t3,
|
|
24
|
+
_t4,
|
|
25
|
+
_t5,
|
|
26
|
+
_t6,
|
|
27
|
+
_t7,
|
|
28
|
+
_t8;
|
|
29
|
+
const getClasses = _ => classNames('base', ['hide-footer', !_.footerSlottedContent || !_.footerSlottedContent.length], ['hide-header', shouldHideHeader(_)]);
|
|
30
|
+
function renderHeaderIcon() {
|
|
31
|
+
return html(_t || (_t = _2`
|
|
32
|
+
<vwc-icon class="icon" inline name="${0}"></vwc-icon>`), x => x.icon);
|
|
33
|
+
}
|
|
34
|
+
function Headline() {
|
|
35
|
+
return html(_t2 || (_t2 = _2`
|
|
36
|
+
<div class="header-headline">${0}</div>
|
|
37
|
+
`), x => x.headline);
|
|
38
|
+
}
|
|
39
|
+
function Subtitle() {
|
|
40
|
+
return html(_t3 || (_t3 = _2`
|
|
41
|
+
<div class="header-subtitle">${0}</div>
|
|
42
|
+
`), x => x.subtitle);
|
|
43
|
+
}
|
|
44
|
+
function headerContent() {
|
|
45
|
+
return html(_t4 || (_t4 = _2`
|
|
46
|
+
<div class="header-content">
|
|
47
|
+
${0}
|
|
48
|
+
${0}
|
|
49
|
+
</div>
|
|
50
|
+
`), when(x => x.headline, Headline()), when(x => x.subtitle, Subtitle()));
|
|
51
|
+
}
|
|
52
|
+
function renderHeader() {
|
|
53
|
+
return html(_t5 || (_t5 = _2`
|
|
54
|
+
<header class="header">
|
|
55
|
+
<slot name="graphic" ${0}>${0}</slot>
|
|
56
|
+
${0}
|
|
57
|
+
</header>`), slotted('graphicSlottedContent'), when(x => x.icon, renderHeaderIcon()), when(x => x.headline || x.subtitle, headerContent()));
|
|
58
|
+
}
|
|
59
|
+
function shouldHideHeader(card) {
|
|
60
|
+
return !card.headline && !card.subtitle && !card.icon && (!card.graphicSlottedContent || !card.graphicSlottedContent.length);
|
|
61
|
+
}
|
|
62
|
+
function renderMetaSlot() {
|
|
63
|
+
return html(_t6 || (_t6 = _2`
|
|
64
|
+
<slot name="meta" ${0}></slot>
|
|
65
|
+
`), slotted('metaSlottedContent'));
|
|
66
|
+
}
|
|
67
|
+
function text() {
|
|
68
|
+
return html(_t7 || (_t7 = _2`
|
|
69
|
+
<div class="text">${0}</div>
|
|
70
|
+
`), x => x.text);
|
|
71
|
+
}
|
|
72
|
+
const CardTemplate = () => html(_t8 || (_t8 = _2`
|
|
73
|
+
<vwc-elevation dp=${0}>
|
|
74
|
+
|
|
75
|
+
<div class="${0}">
|
|
76
|
+
<div class="wrapper">
|
|
77
|
+
<div class="vwc-card-media">
|
|
78
|
+
<slot name="media"></slot>
|
|
79
|
+
</div>
|
|
80
|
+
<slot name="main">
|
|
81
|
+
<div class="main-content">
|
|
82
|
+
<div class="header-wrapper">
|
|
83
|
+
${0}
|
|
84
|
+
${0}
|
|
85
|
+
</div>
|
|
86
|
+
${0}
|
|
87
|
+
</div>
|
|
88
|
+
</slot>
|
|
89
|
+
<div class="footer">
|
|
90
|
+
<slot name="footer" ${0}></slot>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
</vwc-elevation>
|
|
96
|
+
`), x => {
|
|
97
|
+
var _a;
|
|
98
|
+
return (_a = x.elevation) !== null && _a !== void 0 ? _a : '4';
|
|
99
|
+
}, getClasses, renderHeader(), renderMetaSlot(), when(x => x.text, text()), slotted('footerSlottedContent'));
|
|
100
|
+
|
|
101
|
+
const prefix = getPrefix(import.meta.url);
|
|
102
|
+
const vividCard = Card.compose({
|
|
103
|
+
baseName: 'card',
|
|
104
|
+
template: CardTemplate,
|
|
105
|
+
styles: css_248z
|
|
106
|
+
});
|
|
107
|
+
(async () => {
|
|
108
|
+
await loadComponentsModules(['icon', 'elevation'], prefix);
|
|
109
|
+
designSystem.withPrefix(prefix).register(vividCard());
|
|
110
|
+
})();
|
|
111
|
+
|
|
112
|
+
export { vividCard };
|