@vonage/vivid 3.0.0-next.119 → 3.0.0-next.120
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 +11 -6
- package/accordion/index.js +4 -51
- package/accordion-item/index.js +11 -109
- package/action-group/index.js +4 -36
- package/avatar/index.js +8 -64
- package/badge/index.js +9 -48
- package/banner/index.js +15 -117
- package/breadcrumb/index.js +5 -97
- package/breadcrumb-item/index.js +14 -53
- package/button/index.js +14 -92
- package/calendar/index.js +5 -1520
- package/calendar-event/index.js +7 -107
- package/card/index.js +10 -117
- package/checkbox/index.js +13 -175
- package/custom-elements.json +1827 -8
- package/dialog/index.js +14 -227
- package/divider/index.js +4 -25
- package/elevation/index.js +4 -24
- package/fab/index.js +13 -89
- package/focus/index.js +4 -17
- package/header/index.js +7 -12
- package/icon/index.js +7 -28
- package/index.js +49 -55
- package/layout/index.js +4 -42
- package/lib/accordion/definition.d.ts +3 -0
- package/lib/accordion/index.d.ts +1 -2
- package/lib/accordion-item/definition.d.ts +3 -0
- package/lib/accordion-item/index.d.ts +1 -2
- package/lib/action-group/definition.d.ts +3 -0
- package/lib/action-group/index.d.ts +1 -2
- package/lib/avatar/definition.d.ts +3 -0
- package/lib/avatar/index.d.ts +1 -2
- package/lib/badge/definition.d.ts +3 -0
- package/lib/badge/index.d.ts +1 -2
- package/lib/banner/definition.d.ts +3 -0
- package/lib/banner/index.d.ts +1 -2
- package/lib/breadcrumb/definition.d.ts +3 -0
- package/lib/breadcrumb/index.d.ts +1 -2
- package/lib/breadcrumb-item/definition.d.ts +3 -0
- package/lib/breadcrumb-item/index.d.ts +1 -2
- package/lib/button/definition.d.ts +3 -0
- package/lib/calendar/definition.d.ts +3 -0
- package/lib/calendar/index.d.ts +1 -2
- package/lib/calendar-event/definition.d.ts +3 -0
- package/lib/calendar-event/index.d.ts +1 -2
- package/lib/card/definition.d.ts +3 -0
- package/lib/card/index.d.ts +1 -2
- package/lib/checkbox/definition.d.ts +3 -0
- package/lib/checkbox/index.d.ts +1 -2
- package/lib/components.d.ts +38 -38
- package/lib/dialog/definition.d.ts +3 -0
- package/lib/dialog/index.d.ts +1 -2
- package/lib/divider/definition.d.ts +3 -0
- package/lib/divider/index.d.ts +1 -2
- package/lib/elevation/definition.d.ts +3 -0
- package/lib/elevation/index.d.ts +1 -2
- package/lib/fab/definition.d.ts +3 -0
- package/lib/fab/index.d.ts +1 -2
- package/lib/focus/definition.d.ts +3 -0
- package/lib/focus/index.d.ts +1 -2
- package/lib/header/definition.d.ts +3 -0
- package/lib/header/index.d.ts +1 -2
- package/lib/icon/definition.d.ts +3 -0
- package/lib/icon/index.d.ts +1 -2
- package/lib/layout/definition.d.ts +3 -0
- package/lib/layout/index.d.ts +1 -2
- package/lib/listbox/definition.d.ts +3 -0
- package/lib/menu/definition.d.ts +7 -0
- package/lib/menu/index.d.ts +1 -10
- package/lib/menu-item/definition.d.ts +3 -0
- package/lib/menu-item/index.d.ts +1 -2
- package/lib/nav/definition.d.ts +3 -0
- package/lib/nav/index.d.ts +1 -2
- package/lib/nav-disclosure/definition.d.ts +3 -0
- package/lib/nav-disclosure/index.d.ts +1 -2
- package/lib/nav-item/definition.d.ts +3 -0
- package/lib/nav-item/index.d.ts +1 -2
- package/lib/note/definition.d.ts +3 -0
- package/lib/note/index.d.ts +1 -2
- package/lib/number-field/definition.d.ts +3 -0
- package/lib/number-field/index.d.ts +1 -2
- package/lib/option/definition.d.ts +3 -0
- package/lib/option/index.d.ts +1 -2
- package/lib/popup/definition.d.ts +4 -0
- package/lib/popup/index.d.ts +1 -2
- package/lib/progress/definition.d.ts +3 -0
- package/lib/progress/index.d.ts +1 -2
- package/lib/progress-ring/definition.d.ts +3 -0
- package/lib/progress-ring/index.d.ts +1 -2
- package/lib/radio/definition.d.ts +3 -0
- package/lib/radio/index.d.ts +1 -2
- package/lib/radio-group/definition.d.ts +7 -0
- package/lib/radio-group/index.d.ts +1 -10
- package/lib/side-drawer/definition.d.ts +3 -0
- package/lib/side-drawer/index.d.ts +1 -2
- package/lib/slider/definition.d.ts +3 -0
- package/lib/slider/index.d.ts +1 -2
- package/lib/switch/definition.d.ts +3 -0
- package/lib/switch/index.d.ts +1 -2
- package/lib/text-anchor/definition.d.ts +3 -0
- package/lib/text-anchor/index.d.ts +1 -2
- package/lib/text-area/definition.d.ts +3 -0
- package/lib/text-area/index.d.ts +1 -2
- package/lib/text-field/definition.d.ts +3 -0
- package/lib/text-field/index.d.ts +1 -2
- package/lib/tooltip/definition.d.ts +3 -0
- package/lib/tooltip/index.d.ts +1 -2
- package/listbox/index.js +18 -1080
- package/menu/index.js +27 -354
- package/menu-item/index.js +11 -81
- package/nav/index.js +3 -16
- package/nav-disclosure/index.js +13 -77
- package/nav-item/index.js +13 -35
- package/note/index.js +13 -60
- package/number-field/index.js +14 -16
- package/option/index.js +13 -68
- package/package.json +2 -2
- package/popup/index.js +17 -55
- package/progress/index.js +6 -92
- package/progress-ring/index.js +6 -75
- package/radio/index.js +8 -48
- package/radio-group/index.js +9 -433
- package/shared/anchor.js +1 -1
- package/shared/apply-mixins.js +1 -1
- package/shared/base-progress.js +1 -1
- package/shared/breadcrumb-item.js +1 -1
- package/shared/button.js +195 -18
- package/shared/calendar-event.js +1 -1
- package/shared/definition.js +53 -0
- package/shared/definition10.js +99 -0
- package/shared/definition11.js +48 -0
- package/shared/definition12.js +1523 -0
- package/shared/definition13.js +111 -0
- package/shared/definition14.js +114 -0
- package/shared/definition15.js +32 -0
- package/shared/definition16.js +172 -0
- package/shared/definition17.js +223 -0
- package/shared/{divider.js → definition18.js} +25 -2
- package/shared/definition19.js +87 -0
- package/shared/definition2.js +106 -0
- package/shared/definition20.js +44 -0
- package/shared/definition21.js +1078 -0
- package/shared/{listbox-option.js → definition22.js} +71 -11
- package/shared/definition23.js +348 -0
- package/shared/{popup.js → definition24.js} +46 -3
- package/shared/{menu-item.js → definition25.js} +87 -13
- package/shared/definition26.js +18 -0
- package/shared/definition27.js +75 -0
- package/shared/definition28.js +31 -0
- package/shared/definition29.js +56 -0
- package/shared/definition3.js +29 -0
- package/shared/definition30.js +94 -0
- package/shared/definition31.js +77 -0
- package/shared/definition32.js +45 -0
- package/shared/definition33.js +435 -0
- package/shared/definition34.js +86 -0
- package/shared/definition35.js +592 -0
- package/shared/definition36.js +147 -0
- package/shared/definition37.js +279 -0
- package/shared/definition38.js +119 -0
- package/shared/definition39.js +77 -0
- package/shared/definition4.js +19 -0
- package/shared/definition5.js +38 -0
- package/shared/definition6.js +60 -0
- package/shared/definition7.js +45 -0
- package/shared/definition8.js +113 -0
- package/shared/definition9.js +107 -0
- package/shared/design-system/index.d.ts +1 -2
- package/shared/es.object.assign.js +58 -1
- package/shared/es.regexp.to-string.js +2 -1
- package/shared/focus.js +3 -9
- package/shared/focus2.js +9 -3
- package/shared/form-associated.js +1 -1
- package/shared/form-elements.js +2 -2
- package/shared/icon.js +1096 -9
- package/shared/index.js +385 -2501
- package/shared/patterns/form-elements/form-elements.d.ts +2 -2
- package/shared/radio.js +1 -1
- package/shared/ref.js +1 -1
- package/shared/slotted.js +1 -1
- package/shared/string-trim.js +2 -1
- package/shared/text-anchor.template.js +1 -1
- package/shared/to-string.js +51 -0
- package/side-drawer/index.js +5 -84
- package/slider/index.js +14 -593
- 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/switch/index.js +13 -149
- package/text-anchor/index.js +8 -7
- package/text-area/index.js +16 -282
- package/text-field/index.js +14 -121
- package/tooltip/index.js +24 -82
- package/vivid.api.json +1640 -850
- package/shared/button2.js +0 -200
- package/shared/elevation.js +0 -10
- package/shared/es.promise.resolve.js +0 -944
- package/shared/index2.js +0 -9
- package/shared/utils/index.d.ts +0 -1
package/README.md
CHANGED
|
@@ -77,27 +77,32 @@ Note: scss users can simply [forward](https://sass-lang.com/documentation/at-rul
|
|
|
77
77
|
|
|
78
78
|
## Advanced Usage
|
|
79
79
|
|
|
80
|
-
### Scoped Elements
|
|
80
|
+
### Scoped Elements (🧪 Alpha)
|
|
81
81
|
|
|
82
82
|
Custom elements, by browsers limitations, are registered globally, and thus may conflict when multiple versions of the library are used in the same application as all custom elements register under the same namespace.
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
Enforcing only a single version of the library to be used simultaneously makes it difficult to progressively migrate to newer versions of the library, as each update will require a full application update.
|
|
85
|
+
Also, in a micro-frontend architecture, this can be a major bottleneck as each micro-frontend may use a different version of the library.
|
|
85
86
|
|
|
86
|
-
To
|
|
87
|
+
To work around this limitation, Vivid provides a way for authors' to scope each custom element namespace by passing an argument to the `prefix` parameter when registering each custom element.
|
|
87
88
|
|
|
88
89
|
The following example will register *badge* custom element as `dashboard-badge`:
|
|
89
90
|
|
|
90
91
|
```js
|
|
91
|
-
import '
|
|
92
|
+
import { registerBadge } from '@vonage/vivid';
|
|
93
|
+
|
|
94
|
+
registerBadge('dashboard');
|
|
92
95
|
```
|
|
93
96
|
|
|
94
97
|
then use it as:
|
|
95
98
|
|
|
96
99
|
```html
|
|
97
|
-
<dashboard-badge text="
|
|
100
|
+
<dashboard-badge text="dashboard scoped badge"></dashboard-badge>
|
|
98
101
|
```
|
|
99
102
|
|
|
100
|
-
|
|
103
|
+
Remember to not include the default side-effect import (`import '@vonage/vivid/button';`) when using scoped elements as it will register the default namespace.
|
|
104
|
+
|
|
105
|
+
Even though custom elements can be registered under different namespaces, as many as needed, this approach lets you enjoy the benefits of [npm dedupe](https://docs.npmjs.com/cli/v8/commands/npm-dedupe) to ensure only a single version of the library is used in the application.
|
|
101
106
|
|
|
102
107
|
## Support
|
|
103
108
|
|
package/accordion/index.js
CHANGED
|
@@ -1,52 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { r as registerAccordion } from '../shared/definition.js';
|
|
2
|
+
import '../shared/index.js';
|
|
3
|
+
import '../shared/class-names.js';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Accordion extends FoundationElement {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
this.accordionItems = undefined;
|
|
10
|
-
this.multi = false;
|
|
11
|
-
this.addEventListener('opened', this.handleOpened);
|
|
12
|
-
}
|
|
13
|
-
connectedCallback() {
|
|
14
|
-
super.connectedCallback();
|
|
15
|
-
this.accordionItems = this.children;
|
|
16
|
-
}
|
|
17
|
-
handleOpened(e) {
|
|
18
|
-
if (!this.multi && this.accordionItems) {
|
|
19
|
-
for (let i = 0; i < this.accordionItems.length; i++) {
|
|
20
|
-
if (this.accordionItems[i] !== e.target) {
|
|
21
|
-
this.accordionItems[i].open = false;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
closeAll() {
|
|
27
|
-
if (this.accordionItems) {
|
|
28
|
-
for (let i = 0; i < this.accordionItems.length; i++) {
|
|
29
|
-
this.accordionItems[i].open = false;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
__decorate([attr({
|
|
35
|
-
mode: 'boolean'
|
|
36
|
-
}), __metadata("design:type", Object)], Accordion.prototype, "multi", void 0);
|
|
37
|
-
|
|
38
|
-
let _2 = t => t,
|
|
39
|
-
_t;
|
|
40
|
-
const getClasses = _ => classNames('base');
|
|
41
|
-
const AccordionTemplate = () => html(_t || (_t = _2`<div class="${0}">
|
|
42
|
-
<slot></slot>
|
|
43
|
-
</div>`), getClasses);
|
|
44
|
-
|
|
45
|
-
const vividAccordion = Accordion.compose({
|
|
46
|
-
baseName: 'accordion',
|
|
47
|
-
template: AccordionTemplate,
|
|
48
|
-
styles: css_248z
|
|
49
|
-
});
|
|
50
|
-
designSystem.withPrefix(getPrefix(import.meta.url)).register(vividAccordion());
|
|
51
|
-
|
|
52
|
-
export { vividAccordion };
|
|
5
|
+
registerAccordion();
|
package/accordion-item/index.js
CHANGED
|
@@ -1,114 +1,16 @@
|
|
|
1
|
-
import '../shared/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { A as AffixIconWithTrailing, a as affixIconTemplateFactory } from '../shared/affix.js';
|
|
5
|
-
import { a as applyMixins } from '../shared/apply-mixins.js';
|
|
6
|
-
import { f as focusTemplateFactory } from '../shared/focus.js';
|
|
7
|
-
import { w as when } from '../shared/when.js';
|
|
8
|
-
import { c as classNames } from '../shared/class-names.js';
|
|
1
|
+
import { r as registerAccordionItem } from '../shared/definition2.js';
|
|
2
|
+
import '../shared/index.js';
|
|
3
|
+
import '../shared/definition3.js';
|
|
9
4
|
import '../shared/icon.js';
|
|
5
|
+
import '../shared/to-string.js';
|
|
10
6
|
import '../shared/string-trim.js';
|
|
11
7
|
import '../shared/_has.js';
|
|
8
|
+
import '../shared/when.js';
|
|
9
|
+
import '../shared/class-names.js';
|
|
10
|
+
import '../shared/definition4.js';
|
|
11
|
+
import '../shared/focus.js';
|
|
12
|
+
import '../shared/affix.js';
|
|
13
|
+
import '../shared/apply-mixins.js';
|
|
12
14
|
import '../shared/focus2.js';
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class AccordionItem extends FoundationElement {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
this.noIndicator = false;
|
|
20
|
-
this.open = false;
|
|
21
|
-
}
|
|
22
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
23
|
-
super.attributeChangedCallback(name, oldValue, newValue);
|
|
24
|
-
if (name === 'open') {
|
|
25
|
-
newValue === null ? this.emitEvent('closed') : this.emitEvent('opened');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
emitEvent(name) {
|
|
29
|
-
const init = {
|
|
30
|
-
bubbles: true,
|
|
31
|
-
composed: true
|
|
32
|
-
};
|
|
33
|
-
const ev = new CustomEvent(name, init);
|
|
34
|
-
this.dispatchEvent(ev);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
__decorate([attr, __metadata("design:type", String)], AccordionItem.prototype, "heading", void 0);
|
|
38
|
-
__decorate([attr({
|
|
39
|
-
attribute: 'heading-level'
|
|
40
|
-
}), __metadata("design:type", Number)], AccordionItem.prototype, "headingLevel", void 0);
|
|
41
|
-
__decorate([attr({
|
|
42
|
-
mode: 'boolean',
|
|
43
|
-
attribute: 'no-indicator'
|
|
44
|
-
}), __metadata("design:type", Object)], AccordionItem.prototype, "noIndicator", void 0);
|
|
45
|
-
__decorate([attr, __metadata("design:type", String)], AccordionItem.prototype, "meta", void 0);
|
|
46
|
-
__decorate([attr({
|
|
47
|
-
mode: 'boolean'
|
|
48
|
-
}), __metadata("design:type", Object)], AccordionItem.prototype, "open", void 0);
|
|
49
|
-
applyMixins(AccordionItem, AffixIconWithTrailing);
|
|
50
|
-
|
|
51
|
-
let _ = t => t,
|
|
52
|
-
_t,
|
|
53
|
-
_t2,
|
|
54
|
-
_t3,
|
|
55
|
-
_t4,
|
|
56
|
-
_t5;
|
|
57
|
-
const PANEL = 'panel';
|
|
58
|
-
const getClasses = ({
|
|
59
|
-
open,
|
|
60
|
-
iconTrailing,
|
|
61
|
-
icon,
|
|
62
|
-
noIndicator
|
|
63
|
-
}) => classNames('base', ['open', open], ['icon', Boolean(icon)], ['icon-trailing', iconTrailing], ['no-indicator', noIndicator]);
|
|
64
|
-
const AccordionItemTemplate = context => html(_t || (_t = _`
|
|
65
|
-
<div class="${0}">
|
|
66
|
-
${0}
|
|
67
|
-
<div class="body" id="${0}" role="region" aria-labelledby="header">
|
|
68
|
-
<slot></slot>
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
`), getClasses, x => renderPanelHeader(context, x.headingLevel), PANEL);
|
|
72
|
-
const renderPanelHeader = (context, headingLevel) => {
|
|
73
|
-
const header = headingLevel ? 'h' + headingLevel : 'h3';
|
|
74
|
-
return html(_t2 || (_t2 = _`
|
|
75
|
-
<${0} class="header">
|
|
76
|
-
${0}
|
|
77
|
-
</${0}>
|
|
78
|
-
`), header, renderHeaderButton(context), header);
|
|
79
|
-
};
|
|
80
|
-
const renderHeaderButton = context => {
|
|
81
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
82
|
-
const focusTemplate = focusTemplateFactory(context);
|
|
83
|
-
return html(_t3 || (_t3 = _`
|
|
84
|
-
<button class="button" id="header" @click=${0}
|
|
85
|
-
aria-expanded=${0}
|
|
86
|
-
aria-controls="${0}">
|
|
87
|
-
${0}
|
|
88
|
-
${0}
|
|
89
|
-
<span class="heading-text">${0}</span>
|
|
90
|
-
${0}
|
|
91
|
-
|
|
92
|
-
${0}
|
|
93
|
-
</button>
|
|
94
|
-
`), x => x.open = !x.open, x => x.open, PANEL, () => focusTemplate, x => affixIconTemplate(x.icon), x => x.heading, when(x => x.meta, html(_t4 || (_t4 = _`<span class="meta">${0}</span>`), x => x.meta)), when(x => !x.noIndicator && !x.iconTrailing, html(_t5 || (_t5 = _`${0}`), x => {
|
|
95
|
-
return affixIconTemplate(x.open ? 'chevron-up-solid' : 'chevron-down-solid', 'indicator');
|
|
96
|
-
})));
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const prefix = getPrefix(import.meta.url);
|
|
100
|
-
const dependencies = ['icon', 'focus'];
|
|
101
|
-
const vividAccordionItem = AccordionItem.compose({
|
|
102
|
-
baseName: 'accordion-item',
|
|
103
|
-
template: AccordionItemTemplate,
|
|
104
|
-
styles: css_248z,
|
|
105
|
-
shadowOptions: {
|
|
106
|
-
delegatesFocus: true
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
(async () => {
|
|
110
|
-
await loadComponentsModules(dependencies, prefix);
|
|
111
|
-
designSystem.withPrefix(prefix).register(vividAccordionItem());
|
|
112
|
-
})();
|
|
113
|
-
|
|
114
|
-
export { vividAccordionItem };
|
|
16
|
+
registerAccordionItem();
|
package/action-group/index.js
CHANGED
|
@@ -1,37 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { r as registerActionGroup } from '../shared/definition5.js';
|
|
2
|
+
import '../shared/index.js';
|
|
3
|
+
import '../shared/class-names.js';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ActionGroup extends FoundationElement {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.tight = false;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
__decorate([attr, __metadata("design:type", String)], ActionGroup.prototype, "shape", void 0);
|
|
13
|
-
__decorate([attr, __metadata("design:type", String)], ActionGroup.prototype, "appearance", void 0);
|
|
14
|
-
__decorate([attr({
|
|
15
|
-
mode: 'boolean'
|
|
16
|
-
}), __metadata("design:type", Object)], ActionGroup.prototype, "tight", void 0);
|
|
17
|
-
|
|
18
|
-
let _ = t => t,
|
|
19
|
-
_t;
|
|
20
|
-
const getClasses = ({
|
|
21
|
-
appearance,
|
|
22
|
-
shape,
|
|
23
|
-
tight
|
|
24
|
-
}) => classNames('base', [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], ['tight', tight]);
|
|
25
|
-
const ActionGroupTemplate = () => html(_t || (_t = _`
|
|
26
|
-
<div class="${0}">
|
|
27
|
-
<slot></slot>
|
|
28
|
-
</div>`), getClasses);
|
|
29
|
-
|
|
30
|
-
const vividActionGroup = ActionGroup.compose({
|
|
31
|
-
baseName: 'action-group',
|
|
32
|
-
template: ActionGroupTemplate,
|
|
33
|
-
styles: css_248z
|
|
34
|
-
});
|
|
35
|
-
designSystem.withPrefix(getPrefix(import.meta.url)).register(vividActionGroup());
|
|
36
|
-
|
|
37
|
-
export { vividActionGroup };
|
|
5
|
+
registerActionGroup();
|
package/avatar/index.js
CHANGED
|
@@ -1,67 +1,11 @@
|
|
|
1
|
-
import '../shared/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { c as classNames } from '../shared/class-names.js';
|
|
1
|
+
import { r as registerAvatar } from '../shared/definition6.js';
|
|
2
|
+
import '../shared/index.js';
|
|
3
|
+
import '../shared/definition3.js';
|
|
4
|
+
import '../shared/icon.js';
|
|
5
|
+
import '../shared/to-string.js';
|
|
7
6
|
import '../shared/string-trim.js';
|
|
8
7
|
import '../shared/_has.js';
|
|
8
|
+
import '../shared/when.js';
|
|
9
|
+
import '../shared/class-names.js';
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class Avatar extends FoundationElement {}
|
|
13
|
-
__decorate([attr, __metadata("design:type", String)], Avatar.prototype, "connotation", void 0);
|
|
14
|
-
__decorate([attr, __metadata("design:type", String)], Avatar.prototype, "shape", void 0);
|
|
15
|
-
__decorate([attr, __metadata("design:type", String)], Avatar.prototype, "appearance", void 0);
|
|
16
|
-
__decorate([attr, __metadata("design:type", String)], Avatar.prototype, "size", void 0);
|
|
17
|
-
__decorate([attr, __metadata("design:type", String)], Avatar.prototype, "icon", void 0);
|
|
18
|
-
__decorate([attr, __metadata("design:type", String)], Avatar.prototype, "name", void 0);
|
|
19
|
-
|
|
20
|
-
let _ = t => t,
|
|
21
|
-
_t,
|
|
22
|
-
_t2,
|
|
23
|
-
_t3;
|
|
24
|
-
const getClasses = ({
|
|
25
|
-
appearance,
|
|
26
|
-
connotation,
|
|
27
|
-
shape,
|
|
28
|
-
size
|
|
29
|
-
}) => classNames('base', [`connotation-${connotation}`, Boolean(connotation)], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], [`size-${size}`, Boolean(size)]);
|
|
30
|
-
function renderIcon(iconTag) {
|
|
31
|
-
return html(_t || (_t = _`
|
|
32
|
-
<span class="icon">
|
|
33
|
-
<${0} name="${0}"></${0}>
|
|
34
|
-
</span>
|
|
35
|
-
`), iconTag, x => x.icon ? `${x.icon}` : 'user-line', iconTag);
|
|
36
|
-
}
|
|
37
|
-
function renderInitials() {
|
|
38
|
-
return html(_t2 || (_t2 = _`
|
|
39
|
-
<span class="initials">${0}</span>
|
|
40
|
-
`), ({
|
|
41
|
-
name
|
|
42
|
-
}) => name.substring(0, 2));
|
|
43
|
-
}
|
|
44
|
-
const AvatarTemplate = context => {
|
|
45
|
-
const iconTag = context.tagFor(Icon);
|
|
46
|
-
return html(_t3 || (_t3 = _`
|
|
47
|
-
<span class="${0}">
|
|
48
|
-
<slot name="graphic">
|
|
49
|
-
${0}
|
|
50
|
-
${0}
|
|
51
|
-
</slot>
|
|
52
|
-
</span>`), getClasses, when(x => x.name, renderInitials()), when(x => !x.name, renderIcon(iconTag)));
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const prefix = getPrefix(import.meta.url);
|
|
56
|
-
const dependencies = ['icon'];
|
|
57
|
-
const vividAvatar = Avatar.compose({
|
|
58
|
-
baseName: 'avatar',
|
|
59
|
-
template: AvatarTemplate,
|
|
60
|
-
styles: css_248z
|
|
61
|
-
});
|
|
62
|
-
(async () => {
|
|
63
|
-
await loadComponentsModules(dependencies, prefix);
|
|
64
|
-
designSystem.withPrefix(prefix).register(vividAvatar());
|
|
65
|
-
})();
|
|
66
|
-
|
|
67
|
-
export { vividAvatar };
|
|
11
|
+
registerAvatar();
|
package/badge/index.js
CHANGED
|
@@ -1,52 +1,13 @@
|
|
|
1
|
-
import '../shared/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { A as AffixIconWithTrailing, a as affixIconTemplateFactory } from '../shared/affix.js';
|
|
5
|
-
import { a as applyMixins } from '../shared/apply-mixins.js';
|
|
6
|
-
import { w as when } from '../shared/when.js';
|
|
7
|
-
import { c as classNames } from '../shared/class-names.js';
|
|
1
|
+
import { r as registerBadge } from '../shared/definition7.js';
|
|
2
|
+
import '../shared/index.js';
|
|
3
|
+
import '../shared/definition3.js';
|
|
8
4
|
import '../shared/icon.js';
|
|
5
|
+
import '../shared/to-string.js';
|
|
9
6
|
import '../shared/string-trim.js';
|
|
10
7
|
import '../shared/_has.js';
|
|
8
|
+
import '../shared/when.js';
|
|
9
|
+
import '../shared/class-names.js';
|
|
10
|
+
import '../shared/affix.js';
|
|
11
|
+
import '../shared/apply-mixins.js';
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
__decorate([attr, __metadata("design:type", String)], Badge.prototype, "connotation", void 0);
|
|
14
|
-
__decorate([attr, __metadata("design:type", String)], Badge.prototype, "shape", void 0);
|
|
15
|
-
__decorate([attr, __metadata("design:type", String)], Badge.prototype, "appearance", void 0);
|
|
16
|
-
__decorate([attr, __metadata("design:type", String)], Badge.prototype, "text", void 0);
|
|
17
|
-
applyMixins(Badge, AffixIconWithTrailing);
|
|
18
|
-
|
|
19
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 14 Dec 2022 14:20:57 GMT\n */\n.base {\n --_badge-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n display: inline-flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n block-size: var(--_badge-block-size);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n column-gap: 8px;\n font: var(--vvd-typography-base-condensed-bold);\n max-inline-size: 100%;\n padding-inline: 8px;\n vertical-align: middle;\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-intermediate: var(--vvd-color-cta-500);\n --_connotation-color-soft: var(--vvd-color-cta-100);\n --_connotation-color-contrast: var(--vvd-color-cta-800);\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-intermediate: var(--vvd-color-success-500);\n --_connotation-color-soft: var(--vvd-color-success-100);\n --_connotation-color-contrast: var(--vvd-color-success-800);\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-intermediate: var(--vvd-color-alert-500);\n --_connotation-color-soft: var(--vvd-color-alert-100);\n --_connotation-color-contrast: var(--vvd-color-alert-800);\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-intermediate: var(--vvd-color-warning-300);\n --_connotation-color-soft: var(--vvd-color-warning-100);\n --_connotation-color-contrast: var(--vvd-color-warning-800);\n}\n.base.connotation-information {\n --_connotation-color-primary: var(--vvd-color-information-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-intermediate: var(--vvd-color-information-500);\n --_connotation-color-soft: var(--vvd-color-information-100);\n --_connotation-color-contrast: var(--vvd-color-information-800);\n}\n.base:not(.connotation-cta, .connotation-success, .connotation-alert, .connotation-warning, .connotation-information) {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-intermediate: var(--vvd-color-neutral-500);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n --_connotation-color-contrast: var(--vvd-color-neutral-800);\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-duotone {\n --_appearance-color-text: var(--_connotation-color-contrast);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: var(--_connotation-color-intermediate);\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.base.icon-only {\n contain: size;\n padding-inline: 0;\n place-content: center;\n}\n@supports (aspect-ratio: 1) {\n .base.icon-only {\n aspect-ratio: 1;\n }\n}\n@supports not (aspect-ratio: 1) {\n .base.icon-only {\n inline-size: var(--_badge-block-size);\n }\n}\n\n.text {\n overflow: hidden;\n max-inline-size: 100%;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Shape */\n.base:not(.shape-pill) {\n border-radius: 4px;\n}\n\n.base.shape-pill {\n border-radius: 14px;\n}\n\n/* Icon */\n.icon-trailing .icon {\n order: 1;\n}";
|
|
20
|
-
|
|
21
|
-
let _ = t => t,
|
|
22
|
-
_t,
|
|
23
|
-
_t2;
|
|
24
|
-
const getClasses = ({
|
|
25
|
-
connotation,
|
|
26
|
-
appearance,
|
|
27
|
-
shape,
|
|
28
|
-
iconTrailing,
|
|
29
|
-
text,
|
|
30
|
-
icon
|
|
31
|
-
}) => classNames('base', [`connotation-${connotation}`, Boolean(connotation)], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], ['icon-trailing', iconTrailing], ['icon-only', !text && Boolean(icon)]);
|
|
32
|
-
const badgeTemplate = context => {
|
|
33
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
34
|
-
return html(_t || (_t = _`
|
|
35
|
-
<span class="${0}">
|
|
36
|
-
${0}
|
|
37
|
-
${0}
|
|
38
|
-
</span>`), getClasses, x => affixIconTemplate(x.icon), when(x => x.text, x => html(_t2 || (_t2 = _`<span class="text">${0}</span>`), x.text)));
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const prefix = getPrefix(import.meta.url);
|
|
42
|
-
const vividBadge = Badge.compose({
|
|
43
|
-
baseName: 'badge',
|
|
44
|
-
template: badgeTemplate,
|
|
45
|
-
styles: css_248z
|
|
46
|
-
});
|
|
47
|
-
(async () => {
|
|
48
|
-
await loadComponentsModules(['icon'], prefix);
|
|
49
|
-
designSystem.withPrefix(prefix).register(vividBadge());
|
|
50
|
-
})();
|
|
51
|
-
|
|
52
|
-
export { vividBadge };
|
|
13
|
+
registerBadge();
|
package/banner/index.js
CHANGED
|
@@ -1,126 +1,24 @@
|
|
|
1
|
-
import '../shared/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { b as AffixIcon, a as affixIconTemplateFactory } from '../shared/affix.js';
|
|
6
|
-
import { a as applyMixins } from '../shared/apply-mixins.js';
|
|
7
|
-
import { B as Button } from '../shared/button.js';
|
|
8
|
-
import { w as when } from '../shared/when.js';
|
|
9
|
-
import { c as classNames } from '../shared/class-names.js';
|
|
1
|
+
import { r as registerBanner } from '../shared/definition8.js';
|
|
2
|
+
import '../shared/index.js';
|
|
3
|
+
import '../shared/definition9.js';
|
|
4
|
+
import '../shared/definition3.js';
|
|
10
5
|
import '../shared/icon.js';
|
|
6
|
+
import '../shared/to-string.js';
|
|
11
7
|
import '../shared/string-trim.js';
|
|
12
8
|
import '../shared/_has.js';
|
|
13
|
-
import '../shared/
|
|
9
|
+
import '../shared/when.js';
|
|
10
|
+
import '../shared/class-names.js';
|
|
11
|
+
import '../shared/definition4.js';
|
|
12
|
+
import '../shared/focus.js';
|
|
13
|
+
import '../shared/affix.js';
|
|
14
|
+
import '../shared/button.js';
|
|
15
|
+
import '../shared/apply-mixins.js';
|
|
14
16
|
import '../shared/form-associated.js';
|
|
15
17
|
import '../shared/key-codes.js';
|
|
16
18
|
import '../shared/aria-global.js';
|
|
17
19
|
import '../shared/start-end.js';
|
|
18
20
|
import '../shared/ref.js';
|
|
21
|
+
import '../shared/focus2.js';
|
|
22
|
+
import '../shared/enums.js';
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var _Banner_handleRemoveEnd, _Banner_closeOnKeyDown;
|
|
23
|
-
const connotationIconMap = new Map([[Connotation.Information, 'info-solid'], [Connotation.Announcement, 'megaphone-solid'], [Connotation.Success, 'check-circle-solid'], [Connotation.Warning, 'warning-solid'], [Connotation.Alert, 'error-solid']]);
|
|
24
|
-
const defaultConnotation = (connotation = Connotation.Information) => connotationIconMap.get(connotation);
|
|
25
|
-
class Banner extends FoundationElement {
|
|
26
|
-
constructor() {
|
|
27
|
-
super(...arguments);
|
|
28
|
-
this.removable = false;
|
|
29
|
-
_Banner_handleRemoveEnd.set(this, () => {
|
|
30
|
-
this.$emit('removed');
|
|
31
|
-
this.parentElement && this.parentElement.removeChild(this);
|
|
32
|
-
});
|
|
33
|
-
_Banner_closeOnKeyDown.set(this, e => {
|
|
34
|
-
if (e.key !== 'Escape' || !this.removable) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
this.remove();
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
get conditionedIcon() {
|
|
41
|
-
var _a;
|
|
42
|
-
return (_a = this.icon) !== null && _a !== void 0 ? _a : defaultConnotation(this.connotation);
|
|
43
|
-
}
|
|
44
|
-
connectedCallback() {
|
|
45
|
-
super.connectedCallback();
|
|
46
|
-
this.addEventListener('keydown', __classPrivateFieldGet(this, _Banner_closeOnKeyDown, "f"));
|
|
47
|
-
}
|
|
48
|
-
disconnectedCallback() {
|
|
49
|
-
super.disconnectedCallback();
|
|
50
|
-
this.removeEventListener('keydown', __classPrivateFieldGet(this, _Banner_closeOnKeyDown, "f"));
|
|
51
|
-
}
|
|
52
|
-
remove() {
|
|
53
|
-
this.$emit('removing');
|
|
54
|
-
const banner = this.shadowRoot && this.shadowRoot.querySelector('.banner');
|
|
55
|
-
if (banner) {
|
|
56
|
-
banner.classList.add('removing');
|
|
57
|
-
banner.addEventListener('transitionend', __classPrivateFieldGet(this, _Banner_handleRemoveEnd, "f"));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
_Banner_handleRemoveEnd = new WeakMap(), _Banner_closeOnKeyDown = new WeakMap();
|
|
62
|
-
__decorate([attr({
|
|
63
|
-
attribute: 'action-href'
|
|
64
|
-
}), __metadata("design:type", Object)], Banner.prototype, "actionHref", void 0);
|
|
65
|
-
__decorate([attr({
|
|
66
|
-
attribute: 'action-text'
|
|
67
|
-
}), __metadata("design:type", Object)], Banner.prototype, "actionText", void 0);
|
|
68
|
-
__decorate([attr({
|
|
69
|
-
mode: 'boolean'
|
|
70
|
-
}), __metadata("design:type", Object)], Banner.prototype, "removable", void 0);
|
|
71
|
-
__decorate([attr({
|
|
72
|
-
attribute: 'aria-live'
|
|
73
|
-
}), __metadata("design:type", Object)], Banner.prototype, "ariaLive", void 0);
|
|
74
|
-
__decorate([attr(), __metadata("design:type", Object)], Banner.prototype, "role", void 0);
|
|
75
|
-
__decorate([attr(), __metadata("design:type", Object)], Banner.prototype, "text", void 0);
|
|
76
|
-
__decorate([attr(), __metadata("design:type", Object)], Banner.prototype, "connotation", void 0);
|
|
77
|
-
applyMixins(Banner, AffixIcon);
|
|
78
|
-
|
|
79
|
-
let _2 = t => t,
|
|
80
|
-
_t,
|
|
81
|
-
_t2;
|
|
82
|
-
const getClasses = _ => classNames('control', [`connotation-${_.connotation}`, !!_.connotation]);
|
|
83
|
-
function renderDismissButton(buttonTag) {
|
|
84
|
-
return html(_t || (_t = _2`
|
|
85
|
-
<${0}
|
|
86
|
-
part="vvd-theme-alternate"
|
|
87
|
-
size="condensed"
|
|
88
|
-
class="dismiss-button"
|
|
89
|
-
icon="close-line"
|
|
90
|
-
@click="${0}">
|
|
91
|
-
</${0}>`), buttonTag, x => x.remove(), buttonTag);
|
|
92
|
-
}
|
|
93
|
-
const BannerTemplate = context => {
|
|
94
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
95
|
-
const buttonTag = context.tagFor(Button);
|
|
96
|
-
return html(_t2 || (_t2 = _2`
|
|
97
|
-
<div class="banner ${0}" tabindex="0">
|
|
98
|
-
<header class="header">
|
|
99
|
-
<div class="user-content">
|
|
100
|
-
${0}
|
|
101
|
-
<div class="banner--message"
|
|
102
|
-
role="${0}"
|
|
103
|
-
aria-live="${0}">
|
|
104
|
-
${0}
|
|
105
|
-
</div>
|
|
106
|
-
<slot class="action-items" name="action-items"></slot>
|
|
107
|
-
</div>
|
|
108
|
-
|
|
109
|
-
${0}
|
|
110
|
-
</header>
|
|
111
|
-
</div>
|
|
112
|
-
`), getClasses, x => affixIconTemplate(x.conditionedIcon), x => x.role ? x.role : 'status', x => x.ariaLive ? x.ariaLive : 'polite', x => x.text, when(x => x.removable, renderDismissButton(buttonTag)));
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const prefix = getPrefix(import.meta.url);
|
|
116
|
-
const vividBanner = Banner.compose({
|
|
117
|
-
baseName: 'banner',
|
|
118
|
-
template: BannerTemplate,
|
|
119
|
-
styles: css_248z
|
|
120
|
-
});
|
|
121
|
-
(async () => {
|
|
122
|
-
await loadComponentsModules(['button'], prefix);
|
|
123
|
-
designSystem.withPrefix(prefix).register(vividBanner());
|
|
124
|
-
})();
|
|
125
|
-
|
|
126
|
-
export { vividBanner };
|
|
24
|
+
registerBanner();
|