@vonage/vivid 3.32.0 → 3.35.0
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/accordion/index.js +5 -5
- package/accordion-item/index.js +4 -4
- package/action-group/index.js +1 -1
- package/alert/index.js +6 -6
- package/avatar/index.js +2 -2
- package/badge/index.js +2 -2
- package/banner/index.js +5 -5
- package/breadcrumb/index.js +1 -1
- package/breadcrumb-item/index.js +3 -3
- package/button/index.js +4 -4
- package/calendar/index.js +1 -1
- package/calendar-event/index.js +1 -1
- package/card/index.js +3 -3
- package/checkbox/index.js +5 -3
- package/combobox/index.js +8 -8
- package/custom-elements.json +256 -18
- package/data-grid/index.js +2 -2
- package/date-picker/index.js +9 -9
- package/dialog/index.js +6 -6
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -2
- package/fab/index.js +4 -4
- package/file-picker/index.js +5 -5
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +59 -59
- package/layout/index.js +1 -1
- package/lib/avatar/avatar.d.ts +1 -1
- package/lib/calendar/calendar.d.ts +1 -1
- package/lib/date-picker/calendar/dateStr.d.ts +1 -0
- package/lib/date-picker/calendar/month.d.ts +1 -0
- package/lib/date-picker/calendar/year.d.ts +2 -0
- package/lib/date-picker/date-picker.d.ts +2 -0
- package/lib/icon/icon.d.ts +0 -1
- package/lib/listbox/listbox.d.ts +9 -1
- package/lib/progress-ring/progress-ring.d.ts +1 -1
- package/lib/text-field/text-field.d.ts +1 -0
- package/listbox/index.js +20 -16
- package/locales/en-GB.js +48 -14
- package/locales/en-US.js +48 -14
- package/locales/ja-JP.js +48 -14
- package/locales/zh-CN.js +48 -14
- package/menu/index.js +8 -8
- package/menu-item/index.js +4 -4
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +3 -3
- package/nav-item/index.js +3 -3
- package/note/index.js +2 -3
- package/number-field/index.js +6 -6
- package/option/index.js +3 -3
- package/package.json +2 -16
- package/pagination/index.js +5 -5
- package/popup/index.js +6 -6
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +2 -2
- package/radio-group/index.js +1 -1
- package/select/index.js +8 -8
- package/shared/affix.js +25 -9
- package/shared/apply-mixins.js +1 -1
- package/shared/breadcrumb-item.js +5 -5
- package/shared/button.js +13 -13
- package/shared/calendar-event.js +36 -16
- package/shared/definition.js +133 -194
- package/shared/definition10.js +225 -40
- package/shared/definition11.js +36 -32
- package/shared/definition12.js +763 -98
- package/shared/definition13.js +125 -89
- package/shared/definition14.js +207 -27
- package/shared/definition15.js +710 -731
- package/shared/definition16.js +1289 -47
- package/shared/definition17.js +6113 -93
- package/shared/definition18.js +242 -164
- package/shared/definition19.js +47 -692
- package/shared/definition2.js +199 -117
- package/shared/definition20.js +59 -1671
- package/shared/definition21.js +95 -255
- package/shared/definition22.js +2218 -1167
- package/shared/definition23.js +61 -5784
- package/shared/definition24.js +28 -117
- package/shared/definition25.js +52 -66
- package/shared/definition26.js +391 -214
- package/shared/definition27.js +441 -34
- package/shared/definition28.js +85 -73
- package/shared/definition29.js +21 -2283
- package/shared/definition3.js +61 -24
- package/shared/definition30.js +13 -49
- package/shared/definition31.js +54 -39
- package/shared/definition32.js +413 -375
- package/shared/definition33.js +223 -304
- package/shared/definition34.js +197 -13
- package/shared/definition35.js +88 -73
- package/shared/definition36.js +75 -25
- package/shared/definition37.js +434 -34
- package/shared/definition38.js +32 -432
- package/shared/definition39.js +677 -187
- package/shared/definition4.js +157 -12
- package/shared/definition40.js +95 -48
- package/shared/definition41.js +577 -31
- package/shared/definition42.js +126 -424
- package/shared/definition43.js +114 -618
- package/shared/definition44.js +24 -80
- package/shared/definition45.js +71 -543
- package/shared/definition46.js +499 -92
- package/shared/definition47.js +19 -133
- package/shared/definition48.js +129 -52
- package/shared/definition49.js +281 -17
- package/shared/definition5.js +71 -36
- package/shared/definition50.js +153 -484
- package/shared/definition51.js +131 -98
- package/shared/definition52.js +131 -16
- package/shared/definition53.js +80 -264
- package/shared/definition54.js +293 -118
- package/shared/definition55.js +12 -117
- package/shared/definition56.js +39 -68
- package/shared/definition57.js +166 -288
- package/shared/definition6.js +56 -111
- package/shared/definition7.js +120 -195
- package/shared/definition8.js +58 -23
- package/shared/definition9.js +92 -66
- package/shared/focus.js +2 -1
- package/shared/focus2.js +1 -1
- package/shared/form-associated.js +2 -2
- package/shared/icon.js +48 -27
- package/shared/index.js +7 -27
- package/shared/index2.js +108 -80
- package/shared/key-codes.js +1 -1
- package/shared/listbox.js +88 -11
- package/shared/patterns/form-elements/form-elements.d.ts +4 -4
- package/shared/radio.js +23 -7
- package/shared/repeat.js +1 -1
- package/shared/text-anchor.js +21 -4
- package/shared/text-anchor.template.js +37 -40
- package/shared/text-field.js +2 -2
- package/shared/text-field2.js +15 -15
- package/shared/tree-item.js +12 -12
- package/side-drawer/index.js +1 -1
- package/slider/index.js +2 -2
- package/split-button/index.js +3 -3
- package/style.css +6106 -0
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.js +3 -3
- package/tab/index.js +3 -3
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +5 -5
- package/tag/index.js +3 -3
- package/tag-group/index.js +1 -1
- package/text-anchor/index.js +1 -1
- package/text-area/index.js +3 -3
- package/text-field/index.js +3 -3
- package/toggletip/index.js +7 -7
- package/tooltip/index.js +7 -7
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/vivid.api.json +10 -1
- package/lib/accordion/index.d.ts +0 -1
- package/lib/accordion-item/index.d.ts +0 -1
- package/lib/action-group/index.d.ts +0 -1
- package/lib/alert/index.d.ts +0 -1
- package/lib/avatar/index.d.ts +0 -1
- package/lib/badge/index.d.ts +0 -1
- package/lib/banner/index.d.ts +0 -1
- package/lib/breadcrumb/index.d.ts +0 -1
- package/lib/breadcrumb-item/index.d.ts +0 -1
- package/lib/button/index.d.ts +0 -1
- package/lib/calendar/index.d.ts +0 -1
- package/lib/calendar-event/index.d.ts +0 -1
- package/lib/card/index.d.ts +0 -1
- package/lib/checkbox/index.d.ts +0 -1
- package/lib/combobox/index.d.ts +0 -1
- package/lib/data-grid/index.d.ts +0 -1
- package/lib/date-picker/index.d.ts +0 -1
- package/lib/dialog/index.d.ts +0 -1
- package/lib/divider/index.d.ts +0 -1
- package/lib/elevation/index.d.ts +0 -1
- package/lib/empty-state/index.d.ts +0 -1
- package/lib/fab/index.d.ts +0 -1
- package/lib/file-picker/index.d.ts +0 -1
- package/lib/focus/index.d.ts +0 -1
- package/lib/header/index.d.ts +0 -1
- package/lib/icon/index.d.ts +0 -1
- package/lib/layout/index.d.ts +0 -1
- package/lib/listbox/index.d.ts +0 -1
- package/lib/menu/index.d.ts +0 -1
- package/lib/menu-item/index.d.ts +0 -1
- package/lib/nav/index.d.ts +0 -1
- package/lib/nav-disclosure/index.d.ts +0 -1
- package/lib/nav-item/index.d.ts +0 -1
- package/lib/note/index.d.ts +0 -1
- package/lib/number-field/index.d.ts +0 -1
- package/lib/option/index.d.ts +0 -1
- package/lib/pagination/index.d.ts +0 -1
- package/lib/popup/index.d.ts +0 -1
- package/lib/progress/index.d.ts +0 -1
- package/lib/progress-ring/index.d.ts +0 -1
- package/lib/radio/index.d.ts +0 -1
- package/lib/radio-group/index.d.ts +0 -1
- package/lib/select/index.d.ts +0 -1
- package/lib/side-drawer/index.d.ts +0 -1
- package/lib/slider/index.d.ts +0 -1
- package/lib/split-button/index.d.ts +0 -1
- package/lib/switch/index.d.ts +0 -1
- package/lib/tab/index.d.ts +0 -1
- package/lib/tab-panel/index.d.ts +0 -1
- package/lib/tabs/index.d.ts +0 -1
- package/lib/tag/index.d.ts +0 -1
- package/lib/tag-group/index.d.ts +0 -1
- package/lib/text-anchor/index.d.ts +0 -1
- package/lib/text-area/index.d.ts +0 -1
- package/lib/text-field/index.d.ts +0 -1
- package/lib/toggletip/index.d.ts +0 -1
- package/lib/tooltip/index.d.ts +0 -1
- package/lib/tree-item/index.d.ts +0 -1
- package/lib/tree-view/index.d.ts +0 -1
package/shared/definition4.js
CHANGED
|
@@ -1,17 +1,162 @@
|
|
|
1
|
-
import { h as html, r as registerFactory } from './index.js';
|
|
2
|
-
import {
|
|
1
|
+
import { a as attr, F as FoundationElement, n as nullableNumberConverter, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { C as Connotation, a as buttonRegistries } from './definition10.js';
|
|
3
|
+
import { E as Elevation, e as elevationRegistries } from './definition56.js';
|
|
4
|
+
import { a as iconRegistries } from './definition24.js';
|
|
5
|
+
import { A as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
|
|
6
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
7
|
+
import './index2.js';
|
|
8
|
+
import { B as Button$1 } from './button.js';
|
|
9
|
+
import { w as when } from './when.js';
|
|
10
|
+
import { c as classNames } from './class-names.js';
|
|
3
11
|
|
|
4
|
-
|
|
12
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Wed, 06 Sep 2023 09:40:36 GMT\n */\n.control {\n position: fixed;\n z-index: 10;\n border-radius: 6px;\n inline-size: max-content;\n inset-block-end: 0;\n inset-inline-end: 0;\n inset-inline-start: 0;\n margin-block: 16px;\n margin-inline: auto;\n max-inline-size: var(--alert-max-inline-size, fit-content);\n min-inline-size: var(--alert-min-inline-size, 420px);\n transition: opacity 150ms cubic-bezier(0, 0, 0.2, 1) 0ms, transform 150ms cubic-bezier(0, 0, 0.2, 1) 0ms;\n}\n.control.placement-top, .control.placement-top-start, .control.placement-top-end {\n inset-block-end: auto;\n inset-block-start: 0;\n}\n.control.placement-top-start, .control.placement-bottom-start {\n right: auto;\n inset-inline-end: auto;\n margin-inline: 16px;\n}\n.control.placement-top-end, .control.placement-bottom-end {\n inset-inline-start: auto;\n margin-inline: 16px;\n}\n.control:not(.open) {\n opacity: 0;\n transform: scale(0.8);\n}\n.control.open {\n opacity: 1;\n transform: scale(1);\n}\n\n.base {\n display: flex;\n align-items: center;\n padding: 16px;\n background-color: var(--vvd-color-neutral-50);\n border-radius: 6px;\n color: var(--vvd-color-canvas-text);\n column-gap: 16px;\n}\n.base.connotation-success {\n /* @cssprop [--vvd-alert-success-primary=var(--vvd-color-success-500)] */\n --_connotation-color-primary: var(--vvd-alert-success-primary, var(--vvd-color-success-500));\n /* @cssprop [--vvd-alert-success-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-alert-success-primary-text, var(--vvd-color-canvas));\n}\n.base.connotation-information {\n /* @cssprop [--vvd-alert-information-primary=var(--vvd-color-information-500)] */\n --_connotation-color-primary: var(--vvd-alert-information-primary, var(--vvd-color-information-500));\n /* @cssprop [--vvd-alert-information-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-alert-information-primary-text, var(--vvd-color-canvas));\n}\n.base.connotation-alert {\n /* @cssprop [--vvd-alert-alert-primary=var(--vvd-color-alert-500)] */\n --_connotation-color-primary: var(--vvd-alert-alert-primary, var(--vvd-color-alert-500));\n /* @cssprop [--vvd-alert-alert-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-alert-alert-primary-text, var(--vvd-color-canvas));\n}\n.base.connotation-warning {\n /* @cssprop [--vvd-alert-warning-primary=var(--vvd-color-warning-300)] */\n --_connotation-color-primary: var(--vvd-alert-warning-primary, var(--vvd-color-warning-300));\n /* @cssprop [--vvd-alert-warning-primary-text=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary-text: var(--vvd-alert-warning-primary-text, var(--vvd-color-canvas-text));\n}\n.base:not(.connotation-success, .connotation-information, .connotation-alert, .connotation-warning) {\n /* @cssprop [--vvd-alert-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-alert-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-alert-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-alert-accent-primary-text, var(--vvd-color-canvas));\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 .alert-text {\n margin-inline-end: auto;\n}\n.base .alert-text .headline {\n font: var(--vvd-typography-base-bold);\n margin-block-end: 4px;\n}\n.base .alert-text .main-text {\n font: var(--vvd-typography-base);\n}\n.base .icon {\n flex-shrink: 0;\n color: var(--_appearance-color-fill);\n font-size: 24px;\n line-height: 1;\n}\n.base .dismiss-button {\n border-left: 1px solid var(--vvd-color-neutral-200);\n padding-inline-start: 8px;\n}";
|
|
5
13
|
|
|
6
|
-
|
|
7
|
-
|
|
14
|
+
var __defProp = Object.defineProperty;
|
|
15
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
16
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
17
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
18
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
19
|
+
if (decorator = decorators[i])
|
|
20
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
21
|
+
if (kind && result)
|
|
22
|
+
__defProp(target, key, result);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
const connotationIconMap = /* @__PURE__ */ new Map([
|
|
26
|
+
[Connotation.Accent, "megaphone-line"],
|
|
27
|
+
[Connotation.Information, "info-line"],
|
|
28
|
+
[Connotation.Success, "check-circle-line"],
|
|
29
|
+
[Connotation.Warning, "warning-line"],
|
|
30
|
+
[Connotation.Alert, "error-line"]
|
|
31
|
+
]);
|
|
32
|
+
class Alert extends FoundationElement {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
this.removable = false;
|
|
36
|
+
this.placement = "bottom";
|
|
37
|
+
this.timeoutms = 0;
|
|
38
|
+
this.open = false;
|
|
39
|
+
this.#closeOnEscape = (e) => {
|
|
40
|
+
if (this.removable && e.key === "Escape")
|
|
41
|
+
this.open = false;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// timeout to close the alert
|
|
45
|
+
#timeoutID;
|
|
46
|
+
openChanged(oldValue, newValue) {
|
|
47
|
+
if (oldValue === void 0)
|
|
48
|
+
return;
|
|
49
|
+
this.$emit(newValue ? "open" : "close");
|
|
50
|
+
this.#setupTimeout();
|
|
51
|
+
}
|
|
52
|
+
connectedCallback() {
|
|
53
|
+
this.#setupTimeout();
|
|
54
|
+
this.addEventListener("keydown", this.#closeOnEscape);
|
|
55
|
+
super.connectedCallback();
|
|
56
|
+
}
|
|
57
|
+
disconnectedCallback() {
|
|
58
|
+
super.disconnectedCallback();
|
|
59
|
+
if (this.#timeoutID)
|
|
60
|
+
clearTimeout(this.#timeoutID);
|
|
61
|
+
this.removeEventListener("keydown", this.#closeOnEscape);
|
|
62
|
+
}
|
|
63
|
+
get conditionedIcon() {
|
|
64
|
+
return this.icon || connotationIconMap.get(this.connotation);
|
|
65
|
+
}
|
|
66
|
+
#setupTimeout() {
|
|
67
|
+
if (this.#timeoutID)
|
|
68
|
+
clearTimeout(this.#timeoutID);
|
|
69
|
+
if (this.open && this.timeoutms > 0) {
|
|
70
|
+
this.#timeoutID = setTimeout(() => this.open = false, this.timeoutms);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
#closeOnEscape;
|
|
74
|
+
}
|
|
75
|
+
__decorateClass([
|
|
76
|
+
attr({ mode: "boolean" })
|
|
77
|
+
], Alert.prototype, "removable", 2);
|
|
78
|
+
__decorateClass([
|
|
79
|
+
attr({ mode: "fromView" })
|
|
80
|
+
], Alert.prototype, "placement", 2);
|
|
81
|
+
__decorateClass([
|
|
82
|
+
attr
|
|
83
|
+
], Alert.prototype, "headline", 2);
|
|
84
|
+
__decorateClass([
|
|
85
|
+
attr
|
|
86
|
+
], Alert.prototype, "text", 2);
|
|
87
|
+
__decorateClass([
|
|
88
|
+
attr
|
|
89
|
+
], Alert.prototype, "icon", 2);
|
|
90
|
+
__decorateClass([
|
|
91
|
+
attr({
|
|
92
|
+
mode: "fromView",
|
|
93
|
+
converter: nullableNumberConverter
|
|
94
|
+
})
|
|
95
|
+
], Alert.prototype, "timeoutms", 2);
|
|
96
|
+
__decorateClass([
|
|
97
|
+
attr
|
|
98
|
+
], Alert.prototype, "connotation", 2);
|
|
99
|
+
__decorateClass([
|
|
100
|
+
attr({ mode: "boolean" })
|
|
101
|
+
], Alert.prototype, "open", 2);
|
|
102
|
+
applyMixins(Alert, AffixIcon);
|
|
8
103
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
104
|
+
const getClasses = ({ connotation }) => classNames(
|
|
105
|
+
"base",
|
|
106
|
+
[`connotation-${connotation}`, Boolean(connotation)]
|
|
107
|
+
);
|
|
108
|
+
const getControlClasses = ({ open, placement }) => classNames(
|
|
109
|
+
"control",
|
|
110
|
+
["open", open],
|
|
111
|
+
[`placement-${placement}`, Boolean(placement)]
|
|
112
|
+
);
|
|
113
|
+
function renderIcon(context) {
|
|
114
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
115
|
+
return html`${(x) => affixIconTemplate(x.conditionedIcon)}`;
|
|
116
|
+
}
|
|
117
|
+
function renderDismissButton(buttonTag) {
|
|
118
|
+
return html`
|
|
119
|
+
<${buttonTag}
|
|
120
|
+
size="condensed"
|
|
121
|
+
class="dismiss-button"
|
|
122
|
+
icon="close-line"
|
|
123
|
+
@click="${(x) => x.open = false}">
|
|
124
|
+
</${buttonTag}>`;
|
|
125
|
+
}
|
|
126
|
+
const AlertTemplate = (context) => {
|
|
127
|
+
const elevationTag = context.tagFor(Elevation);
|
|
128
|
+
const buttonTag = context.tagFor(Button$1);
|
|
129
|
+
return html`
|
|
130
|
+
<${elevationTag} class="elevation" dp='8' exportparts="vvd-theme-alternate">
|
|
131
|
+
<div class="${getControlClasses}" role="alert" aria-live="assertive">
|
|
132
|
+
<div part="vvd-theme-alternate" class="${getClasses}">
|
|
133
|
+
${when((x) => x.icon || x.connotation, renderIcon(context))}
|
|
134
|
+
<div class="alert-text">
|
|
135
|
+
${when(
|
|
136
|
+
(x) => x.headline,
|
|
137
|
+
html`<header class="headline">${(x) => x.headline}</header>`
|
|
138
|
+
)}
|
|
139
|
+
${when(
|
|
140
|
+
(x) => x.text,
|
|
141
|
+
html`<div class="main-text">${(x) => x.text}</div>`
|
|
142
|
+
)}
|
|
143
|
+
<slot name="main">
|
|
144
|
+
</slot>
|
|
145
|
+
</div>
|
|
146
|
+
<slot class="action-items" name="action-items"></slot>
|
|
147
|
+
${when((x) => x.removable, renderDismissButton(buttonTag))}
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
</${elevationTag}>
|
|
151
|
+
`;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const alertDefinition = Alert.compose({
|
|
155
|
+
baseName: "alert",
|
|
156
|
+
template: AlertTemplate,
|
|
157
|
+
styles
|
|
13
158
|
});
|
|
14
|
-
const
|
|
15
|
-
const
|
|
159
|
+
const alertRegistries = [alertDefinition(), ...iconRegistries, ...buttonRegistries, ...elevationRegistries];
|
|
160
|
+
const registerAlert = registerFactory(alertRegistries);
|
|
16
161
|
|
|
17
|
-
export {
|
|
162
|
+
export { alertDefinition as a, alertRegistries as b, registerAlert as r };
|
package/shared/definition40.js
CHANGED
|
@@ -1,62 +1,109 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as BaseProgress } from './base-progress.js';
|
|
1
|
+
import { a as attr, F as FoundationElement, h as html, r as registerFactory } from './index.js';
|
|
3
2
|
import { w as when } from './when.js';
|
|
4
3
|
import { c as classNames } from './class-names.js';
|
|
5
4
|
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
9
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
+
if (decorator = decorators[i])
|
|
11
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
12
|
+
if (kind && result)
|
|
13
|
+
__defProp(target, key, result);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
class SideDrawer extends FoundationElement {
|
|
9
17
|
constructor() {
|
|
10
18
|
super(...arguments);
|
|
11
|
-
this.
|
|
19
|
+
this.alternate = false;
|
|
20
|
+
this.modal = false;
|
|
21
|
+
this.open = false;
|
|
22
|
+
this.trailing = false;
|
|
23
|
+
}
|
|
24
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
25
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
26
|
+
switch (name) {
|
|
27
|
+
case "open": {
|
|
28
|
+
this.open ? this.#open() : this.#close();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
#close() {
|
|
33
|
+
this.$emit("close", void 0, { bubbles: false });
|
|
34
|
+
}
|
|
35
|
+
#open() {
|
|
36
|
+
this.$emit("open", void 0, { bubbles: false });
|
|
12
37
|
}
|
|
13
38
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
39
|
+
__decorateClass([
|
|
40
|
+
attr({
|
|
41
|
+
mode: "boolean"
|
|
42
|
+
})
|
|
43
|
+
], SideDrawer.prototype, "alternate", 2);
|
|
44
|
+
__decorateClass([
|
|
45
|
+
attr({
|
|
46
|
+
mode: "boolean"
|
|
47
|
+
})
|
|
48
|
+
], SideDrawer.prototype, "modal", 2);
|
|
49
|
+
__decorateClass([
|
|
50
|
+
attr({
|
|
51
|
+
mode: "boolean"
|
|
52
|
+
})
|
|
53
|
+
], SideDrawer.prototype, "open", 2);
|
|
54
|
+
__decorateClass([
|
|
55
|
+
attr({
|
|
56
|
+
mode: "boolean"
|
|
57
|
+
})
|
|
58
|
+
], SideDrawer.prototype, "trailing", 2);
|
|
59
|
+
|
|
60
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Wed, 06 Sep 2023 09:40:36 GMT\n */\n.control {\n position: fixed;\n z-index: 1;\n background-color: var(--vvd-color-canvas);\n color: var(--vvd-color-canvas-text);\n inline-size: 280px;\n inset-block: 0;\n overflow-y: auto;\n}\n.control[part~=vvd-theme-alternate] {\n background-color: var(--vvd-color-canvas);\n color: var(--vvd-color-canvas-text);\n color-scheme: var(--vvd-color-scheme);\n}\n.control.trailing {\n inset-inline-end: 0;\n}\n.control:not(.open).trailing {\n transform: translateX(100%);\n}\n.control:not(.open):not(.trailing) {\n transform: translateX(-100%);\n}\n.control.open:not(.modal).trailing + .side-drawer-app-content {\n margin-inline-end: var(--side-drawer-app-content-offset, 280px);\n}\n.control.open:not(.modal):not(.trailing) + .side-drawer-app-content {\n margin-inline-start: var(--side-drawer-app-content-offset, 280px);\n}\n@media (prefers-reduced-motion: no-preference) {\n .control {\n transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n }\n}\n\n.scrim {\n background-color: var(--vvd-color-canvas-text, currentColor);\n opacity: 0.5;\n position: fixed;\n inset: 0;\n}\n.scrim:not(.open) {\n display: none;\n}";
|
|
19
61
|
|
|
20
62
|
const getClasses = ({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class="${getClasses}"
|
|
45
|
-
>
|
|
46
|
-
<div class="progress">
|
|
47
|
-
${when(x => typeof x.value === 'number', determinate())}
|
|
48
|
-
${when(x => typeof x.value !== 'number', indeterminate())}
|
|
49
|
-
</div>
|
|
63
|
+
modal,
|
|
64
|
+
open,
|
|
65
|
+
trailing
|
|
66
|
+
}) => classNames(
|
|
67
|
+
"control",
|
|
68
|
+
["modal", modal],
|
|
69
|
+
["open", open],
|
|
70
|
+
["trailing", trailing]
|
|
71
|
+
);
|
|
72
|
+
const getScrimClasses = ({
|
|
73
|
+
open
|
|
74
|
+
}) => classNames(
|
|
75
|
+
"scrim",
|
|
76
|
+
["open", open]
|
|
77
|
+
);
|
|
78
|
+
const sideDrawerTemplate = () => html`
|
|
79
|
+
<aside class="${getClasses}" part="base ${(x) => x.alternate ? "vvd-theme-alternate" : ""}"
|
|
80
|
+
@keydown="${(x, c) => handleKeydown(x, c.event)}">
|
|
81
|
+
<slot></slot>
|
|
82
|
+
</aside>
|
|
83
|
+
|
|
84
|
+
<div class="side-drawer-app-content" ?inert="${(x) => x.open && x.modal}">
|
|
85
|
+
<slot name="app-content"></slot>
|
|
50
86
|
</div>
|
|
51
|
-
|
|
87
|
+
|
|
88
|
+
${when(
|
|
89
|
+
(x) => x.modal,
|
|
90
|
+
html`<div class="${getScrimClasses}" @click="${(x) => x.open = false}"></div>`
|
|
91
|
+
)}
|
|
92
|
+
`;
|
|
93
|
+
const handleKeydown = (x, { key }) => {
|
|
94
|
+
if (key === "Escape") {
|
|
95
|
+
x.open = false;
|
|
96
|
+
} else {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
52
99
|
};
|
|
53
100
|
|
|
54
|
-
const
|
|
55
|
-
baseName:
|
|
56
|
-
template:
|
|
57
|
-
styles
|
|
101
|
+
const sideDrawerDefinition = SideDrawer.compose({
|
|
102
|
+
baseName: "side-drawer",
|
|
103
|
+
template: sideDrawerTemplate,
|
|
104
|
+
styles
|
|
58
105
|
});
|
|
59
|
-
const
|
|
60
|
-
const
|
|
106
|
+
const sideDrawerRegistries = [sideDrawerDefinition()];
|
|
107
|
+
const registerSideDrawer = registerFactory(sideDrawerRegistries);
|
|
61
108
|
|
|
62
|
-
export {
|
|
109
|
+
export { sideDrawerRegistries as a, registerSideDrawer as r, sideDrawerDefinition as s };
|