@vonage/vivid 2.36.3 → 3.0.0-next.100

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.
Files changed (237) hide show
  1. package/README.md +144 -0
  2. package/accordion/index.js +52 -0
  3. package/accordion-item/index.js +118 -0
  4. package/action-group/index.js +41 -0
  5. package/avatar/index.js +61 -0
  6. package/badge/index.js +51 -0
  7. package/banner/index.js +128 -0
  8. package/breadcrumb/index.js +103 -0
  9. package/breadcrumb-item/index.js +59 -0
  10. package/button/index.js +24 -0
  11. package/calendar/index.js +1526 -0
  12. package/calendar-event/index.js +112 -0
  13. package/card/index.js +114 -0
  14. package/checkbox/index.js +179 -0
  15. package/dialog/index.js +230 -0
  16. package/divider/index.js +4 -0
  17. package/elevation/index.js +3 -0
  18. package/fab/index.js +100 -0
  19. package/focus/index.js +18 -0
  20. package/header/index.js +61 -0
  21. package/icon/index.js +36 -0
  22. package/index.d.ts +2 -0
  23. package/index.js +76 -64
  24. package/layout/index.js +43 -0
  25. package/lib/accordion/accordion.d.ts +9 -0
  26. package/lib/accordion/accordion.template.d.ts +4 -0
  27. package/lib/accordion/index.d.ts +2 -0
  28. package/lib/accordion-item/accordion-item.d.ts +13 -0
  29. package/lib/accordion-item/accordion-item.template.d.ts +4 -0
  30. package/lib/accordion-item/index.d.ts +4 -0
  31. package/lib/action-group/action-group.d.ts +10 -0
  32. package/lib/action-group/action-group.template.d.ts +4 -0
  33. package/lib/action-group/index.d.ts +2 -0
  34. package/lib/avatar/avatar.d.ts +15 -0
  35. package/lib/avatar/avatar.template.d.ts +4 -0
  36. package/lib/avatar/index.d.ts +3 -0
  37. package/lib/badge/badge.d.ts +15 -0
  38. package/lib/badge/badge.template.d.ts +4 -0
  39. package/lib/badge/index.d.ts +3 -0
  40. package/lib/banner/banner.d.ts +20 -0
  41. package/lib/banner/banner.template.d.ts +4 -0
  42. package/lib/banner/index.d.ts +3 -0
  43. package/lib/breadcrumb/breadcrumb.d.ts +3 -0
  44. package/lib/breadcrumb/breadcrumb.template.d.ts +4 -0
  45. package/lib/breadcrumb/index.d.ts +2 -0
  46. package/lib/breadcrumb-item/breadcrumb-item.d.ts +5 -0
  47. package/lib/breadcrumb-item/breadcrumb-item.template.d.ts +4 -0
  48. package/lib/breadcrumb-item/index.d.ts +4 -0
  49. package/lib/button/button.d.ts +18 -0
  50. package/lib/button/button.template.d.ts +4 -0
  51. package/lib/button/index.d.ts +4 -0
  52. package/lib/calendar/calendar.d.ts +13 -0
  53. package/lib/calendar/calendar.template.d.ts +4 -0
  54. package/lib/calendar/helpers/calendar.date-functions.d.ts +2 -0
  55. package/lib/calendar/helpers/calendar.event-context.d.ts +6 -0
  56. package/lib/calendar/helpers/calendar.keyboard-interactions.d.ts +9 -0
  57. package/lib/calendar/index.d.ts +2 -0
  58. package/lib/calendar-event/calendar-event.d.ts +14 -0
  59. package/lib/calendar-event/calendar-event.template.d.ts +4 -0
  60. package/lib/calendar-event/index.d.ts +2 -0
  61. package/lib/card/card.d.ts +10 -0
  62. package/lib/card/card.template.d.ts +4 -0
  63. package/lib/card/index.d.ts +4 -0
  64. package/lib/checkbox/checkbox.d.ts +5 -0
  65. package/lib/checkbox/checkbox.template.d.ts +4 -0
  66. package/lib/checkbox/index.d.ts +4 -0
  67. package/lib/components.d.ts +38 -0
  68. package/lib/dialog/dialog.d.ts +20 -0
  69. package/lib/dialog/dialog.template.d.ts +4 -0
  70. package/lib/dialog/index.d.ts +5 -0
  71. package/lib/divider/divider.d.ts +3 -0
  72. package/lib/divider/divider.template.d.ts +4 -0
  73. package/lib/divider/index.d.ts +2 -0
  74. package/lib/elevation/elevation.d.ts +5 -0
  75. package/lib/elevation/elevation.template.d.ts +4 -0
  76. package/lib/elevation/index.d.ts +2 -0
  77. package/lib/enums.d.ts +59 -0
  78. package/lib/fab/fab.d.ts +13 -0
  79. package/lib/fab/fab.template.d.ts +4 -0
  80. package/lib/fab/index.d.ts +4 -0
  81. package/lib/focus/focus.d.ts +3 -0
  82. package/lib/focus/focus.template.d.ts +4 -0
  83. package/lib/focus/index.d.ts +2 -0
  84. package/lib/header/header.d.ts +5 -0
  85. package/lib/header/header.template.d.ts +4 -0
  86. package/lib/header/index.d.ts +3 -0
  87. package/lib/icon/icon.d.ts +12 -0
  88. package/lib/icon/icon.placeholder.d.ts +1 -0
  89. package/lib/icon/icon.template.d.ts +4 -0
  90. package/lib/icon/index.d.ts +2 -0
  91. package/lib/layout/index.d.ts +2 -0
  92. package/lib/layout/layout.d.ts +16 -0
  93. package/lib/layout/layout.template.d.ts +4 -0
  94. package/lib/listbox/index.d.ts +4 -0
  95. package/lib/listbox/listbox.d.ts +9 -0
  96. package/lib/listbox/listbox.template.d.ts +4 -0
  97. package/lib/listbox-option/index.d.ts +4 -0
  98. package/lib/listbox-option/listbox-option.d.ts +9 -0
  99. package/lib/listbox-option/listbox-option.template.d.ts +4 -0
  100. package/lib/menu/index.d.ts +12 -0
  101. package/lib/menu/menu.d.ts +10 -0
  102. package/lib/menu/menu.template.d.ts +3 -0
  103. package/lib/menu-item/index.d.ts +3 -0
  104. package/lib/menu-item/menu-item.d.ts +7 -0
  105. package/lib/menu-item/menu-item.template.d.ts +5 -0
  106. package/lib/nav/index.d.ts +2 -0
  107. package/lib/nav/nav.d.ts +3 -0
  108. package/lib/nav/nav.template.d.ts +4 -0
  109. package/lib/nav-disclosure/index.d.ts +4 -0
  110. package/lib/nav-disclosure/nav-disclosure.d.ts +10 -0
  111. package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -0
  112. package/lib/nav-item/index.d.ts +4 -0
  113. package/lib/nav-item/nav-item.d.ts +6 -0
  114. package/lib/nav-item/nav-item.template.d.ts +4 -0
  115. package/lib/note/index.d.ts +2 -0
  116. package/lib/note/note.d.ts +10 -0
  117. package/lib/note/note.template.d.ts +5 -0
  118. package/lib/number-field/index.d.ts +4 -0
  119. package/lib/number-field/number-field.d.ts +14 -0
  120. package/lib/number-field/number-field.template.d.ts +4 -0
  121. package/lib/popup/index.d.ts +4 -0
  122. package/lib/popup/popup.d.ts +18 -0
  123. package/lib/popup/popup.template.d.ts +4 -0
  124. package/lib/progress/index.d.ts +2 -0
  125. package/lib/progress/progress.d.ts +9 -0
  126. package/lib/progress/progress.template.d.ts +5 -0
  127. package/lib/progress-ring/index.d.ts +2 -0
  128. package/lib/progress-ring/progress-ring.d.ts +7 -0
  129. package/lib/progress-ring/progress-ring.template.d.ts +4 -0
  130. package/lib/radio/index.d.ts +3 -0
  131. package/lib/radio/radio.d.ts +4 -0
  132. package/lib/radio/radio.template.d.ts +4 -0
  133. package/lib/radio-group/index.d.ts +10 -0
  134. package/lib/radio-group/radio-group.d.ts +4 -0
  135. package/lib/radio-group/radio-group.template.d.ts +4 -0
  136. package/lib/side-drawer/index.d.ts +2 -0
  137. package/lib/side-drawer/side-drawer.d.ts +9 -0
  138. package/lib/side-drawer/side-drawer.template.d.ts +4 -0
  139. package/lib/slider/index.d.ts +3 -0
  140. package/lib/slider/slider.d.ts +4 -0
  141. package/lib/slider/slider.template.d.ts +4 -0
  142. package/lib/switch/index.d.ts +4 -0
  143. package/lib/switch/switch.d.ts +7 -0
  144. package/lib/switch/switch.template.d.ts +4 -0
  145. package/lib/text-anchor/index.d.ts +2 -0
  146. package/lib/text-anchor/text-anchor.d.ts +7 -0
  147. package/lib/text-anchor/text-anchor.template.d.ts +4 -0
  148. package/lib/text-area/index.d.ts +4 -0
  149. package/lib/text-area/text-area.d.ts +9 -0
  150. package/lib/text-area/text-area.template.d.ts +4 -0
  151. package/lib/text-field/index.d.ts +4 -0
  152. package/lib/text-field/text-field.d.ts +14 -0
  153. package/lib/text-field/text-field.template.d.ts +5 -0
  154. package/lib/tooltip/index.d.ts +3 -0
  155. package/lib/tooltip/tooltip.d.ts +8 -0
  156. package/lib/tooltip/tooltip.template.d.ts +4 -0
  157. package/listbox/index.js +1090 -0
  158. package/listbox-option/index.js +22 -0
  159. package/menu/index.js +371 -0
  160. package/menu-item/index.js +21 -0
  161. package/nav/index.js +17 -0
  162. package/nav-disclosure/index.js +82 -0
  163. package/nav-item/index.js +46 -0
  164. package/note/index.js +59 -0
  165. package/number-field/index.js +461 -0
  166. package/package.json +65 -323
  167. package/popup/index.js +27 -0
  168. package/progress/index.js +97 -0
  169. package/progress-ring/index.js +76 -0
  170. package/radio/index.js +47 -0
  171. package/radio-group/index.js +435 -0
  172. package/shared/_has.js +58 -0
  173. package/shared/affix.js +24 -0
  174. package/shared/anchor.js +86 -0
  175. package/shared/apply-mixins.js +23 -0
  176. package/shared/aria-global.js +72 -0
  177. package/shared/aria.js +9 -0
  178. package/shared/base-progress.js +70 -0
  179. package/shared/breadcrumb-item.js +25 -0
  180. package/shared/button.js +200 -0
  181. package/shared/calendar-event.js +19 -0
  182. package/shared/class-names.js +15 -0
  183. package/shared/design-system/index.d.ts +3 -0
  184. package/shared/dialog-polyfill.esm.js +858 -0
  185. package/shared/direction.js +20 -0
  186. package/shared/dom.js +8 -0
  187. package/shared/enums.js +70 -0
  188. package/shared/es.object.assign.js +69 -0
  189. package/shared/es.regexp.to-string.js +59 -0
  190. package/shared/export.js +1017 -0
  191. package/shared/focus.js +5 -0
  192. package/shared/focus2.js +11 -0
  193. package/shared/form-associated.js +466 -0
  194. package/shared/form-elements.js +331 -0
  195. package/shared/icon.js +1361 -0
  196. package/shared/index.js +5027 -0
  197. package/shared/index2.js +107 -0
  198. package/shared/index3.js +31 -0
  199. package/shared/index4.js +77 -0
  200. package/shared/index5.js +261 -0
  201. package/shared/index6.js +1525 -0
  202. package/shared/index7.js +349 -0
  203. package/shared/iterators.js +61 -0
  204. package/shared/key-codes.js +97 -0
  205. package/shared/numbers.js +25 -0
  206. package/shared/object-keys.js +13 -0
  207. package/shared/patterns/affix.d.ts +9 -0
  208. package/shared/patterns/focus.d.ts +3 -0
  209. package/shared/patterns/form-elements/form-elements.d.ts +28 -0
  210. package/shared/patterns/form-elements/index.d.ts +1 -0
  211. package/shared/patterns/index.d.ts +3 -0
  212. package/shared/radio.js +127 -0
  213. package/shared/ref.js +41 -0
  214. package/shared/slotted.js +119 -0
  215. package/shared/start-end.js +50 -0
  216. package/shared/string-trim.js +40 -0
  217. package/shared/text-anchor.js +10 -0
  218. package/shared/text-anchor.template.js +55 -0
  219. package/shared/to-string.js +51 -0
  220. package/shared/web.dom-collections.iterator.js +472 -0
  221. package/shared/when.js +15 -0
  222. package/side-drawer/index.js +89 -0
  223. package/slider/index.js +596 -0
  224. package/styles/core/all.css +75 -0
  225. package/styles/core/theme.css +11 -0
  226. package/styles/core/typography.css +69 -0
  227. package/styles/fonts/SpeziaCompleteVariableItalicWeb.woff2 +0 -0
  228. package/styles/fonts/SpeziaCompleteVariableUprightWeb.woff2 +0 -0
  229. package/styles/fonts/SpeziaMonoCompleteVariableWeb.woff2 +0 -0
  230. package/styles/fonts/spezia.css +20 -0
  231. package/styles/tokens/theme-dark.css +230 -0
  232. package/styles/tokens/theme-light.css +230 -0
  233. package/switch/index.js +153 -0
  234. package/text-anchor/index.js +28 -0
  235. package/text-area/index.js +289 -0
  236. package/text-field/index.js +130 -0
  237. package/tooltip/index.js +65 -0
package/README.md ADDED
@@ -0,0 +1,144 @@
1
+
2
+ # Vivid UI
3
+
4
+ Essential UI **web components** for building modern web applications, bound to provide a **safe**, **simple** and **intuitive** interface.
5
+
6
+ ![image](https://user-images.githubusercontent.com/10883919/189522882-968358df-ee7c-4256-b61b-550cf369a087.png)
7
+
8
+ ## Installation
9
+
10
+ To integrate Vivid components into your project, run:
11
+
12
+ ```bash
13
+ npm install @vonage/vivid # or yarn add @vonage/vivid
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ Import components in your project via [side effect imports](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#import_a_module_for_its_side_effects_only):
19
+
20
+ ```js
21
+ import '@vonage/vivid/button';
22
+ ```
23
+
24
+ And include in HTML:
25
+
26
+ ```html
27
+ <vwc-button label="Click me"></vwc-button>
28
+ ```
29
+
30
+ For a full list of components and API, explore the [components docs](https://vivid.deno.dev/components/accordion/) 📚.
31
+
32
+ ### Tokens (Prerequisite)
33
+
34
+ The Vivid components library rely on a set of **design tokens** (in the form of css custom properties).
35
+
36
+ Tokens should not affect the look of the application rather just provide a common set of identities (such as colors, typography, spacing etc') to be used by the components to look as intended.
37
+
38
+ As the task of loading css is not trivial, and may vary from project to project, this library does not provide any way to load the css. It is up to the author to load the css in the most appropriate manner for their project.
39
+
40
+ To **include the tokens**, its css files must be loaded into the project from the `node_modules/@vonage/vivid/styles/tokens` folder and *require a `vvd-root` class* selector to be present on a wrapping element (advisably the `:root`).
41
+
42
+ Tokens folder contains the following files:
43
+
44
+ - `theme-light.css` - Light theme
45
+
46
+ - `theme-dark.css` - Dark theme
47
+
48
+ Only one theme is required to be loaded.
49
+
50
+ ### Fonts (Prerequisite)
51
+
52
+ - `node_modules/@vonage/vivid/styles/fonts/spezia.css` - Loads the *Spezia* variable font and defines its font face values. *Spezia* is Vonage's branded font and is required by most Vivid components. folder also contains the font files.
53
+
54
+ Note that font files are not included within the css file, and must be copied to application assets separately (within the same parsed css folder). This is to allow the author to choose the most appropriate way to load the font files based on their project.
55
+
56
+ ### Core (Optional)
57
+
58
+ In Addition, this library provides a set of styles (combined with the tokens and fonts) that can be used to embody the Vivid design system into an application.
59
+
60
+ These styles are not required by vivid components directly. however, native HTML tags do.
61
+
62
+ These **core styles** rely on the tokens and fonts 👆 to be loaded.
63
+
64
+ To **include the core styles**, its css files must be loaded into the project from the `node_modules/@vonage/vivid/styles/core` folder and *require a `vvd-root` class* selector to be present on a wrapping element (advisably the `:root`).
65
+
66
+ - `theme.css` - Sets theme related styles
67
+
68
+ - `typography.css` - Sets typography related styles
69
+
70
+ - `all.css` - Sets all the above styles
71
+
72
+ Note: scss users can simply [forward](https://sass-lang.com/documentation/at-rules/forward) the styles to their scss project:
73
+
74
+ ```css
75
+ @forward 'node_modules/@vonage/vivid/styles/[path to file].css';
76
+ ```
77
+
78
+ ## Support
79
+
80
+ This library is open source, developed and maintained by the [Vonage Vivid team](Vonage/vivid).
81
+
82
+ For any questions, please open a [bug report](https://github.com/Vonage/vivid-3/issues/new?assignees=&labels=&template=bug_report.md&title=) or [feature request](https://github.com/Vonage/vivid-3/issues/new?assignees=&labels=&template=feature_request.md&title=).
83
+
84
+ ## Roadmap
85
+
86
+ - View [components status](https://github.com/orgs/Vonage/projects/6)
87
+
88
+ - [What's on our plate](https://github.com/orgs/Vonage/projects/3/views/7)
89
+
90
+ - See the [open issues](https://github.com/vonage/vivid-3/issues) for a full list of proposed features (and known issues).
91
+
92
+ We publish a *next* release on every successful merge to main, so you never need to wait for a new stable version to make use of any updates.
93
+
94
+ ## Contributing
95
+
96
+ Please read [CONTRIBUTING.md](.github/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
97
+
98
+ ## Versioning
99
+
100
+ We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [npm page](https://www.npmjs.com/package/@vonage/vivid).
101
+
102
+ ## Authors
103
+
104
+ See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
105
+
106
+ ## License
107
+
108
+ This project is licensed under the Apache 2.0 License - see the [LICENSE.md](LICENSE.md) file for details
109
+
110
+ <!-- ## Acknowledgments
111
+
112
+ - Hat tip to anyone whose code was used
113
+ - Inspiration
114
+ - etc -->
115
+
116
+ ## Built With
117
+
118
+ - [Fast](https://www.fast.design) - to extend element classes and compile code to native web components
119
+ - [Typescript](https://www.typescriptlang.org) - for ergonomic and type-safe code
120
+ - [Sass](https://sass-lang.com) - for styles authoring extensibility and consistency
121
+
122
+ ## Quickstart
123
+
124
+ Global content delivery networks can help quickly integrate content within html pages, fetching content from an URL, skipping local builds entirely.
125
+ Such practice is often used when working on POCs or reproduction environments.
126
+ Tools like [UNPKG](https://unpkg.com), [jsDeliver](https://www.jsdelivr.com), [Skypack](https://www.skypack.dev) etc' are bound to deliver any content registered in the npm registry.
127
+
128
+ The following snippet fully renders a Vivid button component
129
+
130
+ ```html
131
+ <!-- import spezia font -->
132
+ <link rel="stylesheet" href="https://unpkg.com/@vonage/vivid@next/styles/fonts/spezia.css">
133
+
134
+ <!-- import light theme style tokens -->
135
+ <link rel="stylesheet" href="https://unpkg.com/@vonage/vivid@next/styles/tokens/theme-light.css">
136
+
137
+ <!-- import Vivid button component -->
138
+ <script type="module" src="https://unpkg.com/@vonage/vivid@next/button/index.js"></script>
139
+
140
+ <!-- Part of the app (or a whole app) that contains vivid components -->
141
+ <div class="vvd-root">
142
+ <vwc-button label="Click me" appearance="filled" connotation="cta"></vwc-button>
143
+ </div>
144
+ ```
@@ -0,0 +1,52 @@
1
+ import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
2
+ import { c as classNames } from '../shared/class-names.js';
3
+
4
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 15 Nov 2022 13:39:19 GMT\n */\n.base {\n display: flex;\n flex-direction: column;\n}\n\n::slotted(vwc-accordion-item:not(:only-of-type)) {\n border-bottom: 1px solid var(--vvd-color-neutral-200);\n}";
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.register(vividAccordion());
51
+
52
+ export { vividAccordion };
@@ -0,0 +1,118 @@
1
+ import '../icon/index.js';
2
+ import '../focus/index.js';
3
+ import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
4
+ import '../shared/web.dom-collections.iterator.js';
5
+ import { A as AffixIconWithTrailing, a as affixIconTemplateFactory } from '../shared/affix.js';
6
+ import { a as applyMixins } from '../shared/apply-mixins.js';
7
+ import { f as focusTemplateFactory } from '../shared/focus2.js';
8
+ import { w as when } from '../shared/when.js';
9
+ import { c as classNames } from '../shared/class-names.js';
10
+ import '../shared/icon.js';
11
+ import '../shared/export.js';
12
+ import '../shared/iterators.js';
13
+ import '../shared/to-string.js';
14
+ import '../shared/string-trim.js';
15
+ import '../shared/_has.js';
16
+ import '../shared/focus.js';
17
+ import '../shared/object-keys.js';
18
+
19
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 15 Nov 2022 13:39:19 GMT\n */\n.body {\n padding: 8px 32px 24px 16px;\n font: var(--vvd-typography-base);\n}\n.icon:not(.icon-trailing) .body {\n padding-left: 48px;\n}\n\n.base {\n display: flex;\n flex-direction: column;\n}\n.base:not(.open) .body {\n display: none;\n}\n\n.header {\n padding: 0;\n margin: 0;\n}\n\n.button {\n position: relative;\n display: flex;\n width: 100%;\n align-items: center;\n padding: 16px;\n border: 0 none;\n margin: 0;\n background-color: var(--_appearance-color-fill);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n cursor: pointer;\n font: var(--vvd-typography-heading-4);\n}\n.button {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.button:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.button:where(:active, .active):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transparent;\n}\n.button {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-faint: var(--vvd-color-neutral-50);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n}\n@supports selector(:focus-visible) {\n .button:focus {\n outline: none;\n }\n}\n@supports (user-select: none) {\n .button {\n user-select: none;\n }\n}\n.button .heading-text {\n flex-grow: 1;\n margin-inline-end: auto;\n text-align: left;\n}\n.button .meta {\n overflow: hidden;\n max-width: 20%;\n flex-shrink: 0;\n color: var(--vvd-color-neutral-600);\n font: var(--vvd-typography-base-bold);\n margin-inline-start: 16px;\n text-align: end;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.button .indicator {\n display: flex;\n}\n.button .indicator vwc-icon,\n.button .indicator slot[name=indicator i]::slotted(vwc-icon) {\n margin-inline-start: 16px;\n}\n.button .icon {\n color: var(--vvd-color-neutral-600);\n margin-inline-end: 16px;\n}\n\n/* Icon */\n.icon-trailing .icon {\n order: 1;\n}\n\n.button:not(:focus-visible) > .focus-indicator {\n display: none;\n}";
20
+
21
+ class AccordionItem extends FoundationElement {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.noIndicator = false;
25
+ this.open = false;
26
+ }
27
+ attributeChangedCallback(name, oldValue, newValue) {
28
+ super.attributeChangedCallback(name, oldValue, newValue);
29
+ if (name === 'open') {
30
+ newValue === null ? this.emitEvent('closed') : this.emitEvent('opened');
31
+ }
32
+ }
33
+ emitEvent(name) {
34
+ const init = {
35
+ bubbles: true,
36
+ composed: true
37
+ };
38
+ const ev = new CustomEvent(name, init);
39
+ this.dispatchEvent(ev);
40
+ }
41
+ }
42
+ __decorate([attr, __metadata("design:type", String)], AccordionItem.prototype, "heading", void 0);
43
+ __decorate([attr({
44
+ attribute: 'heading-level'
45
+ }), __metadata("design:type", Number)], AccordionItem.prototype, "headingLevel", void 0);
46
+ __decorate([attr({
47
+ mode: 'boolean',
48
+ attribute: 'no-indicator'
49
+ }), __metadata("design:type", Object)], AccordionItem.prototype, "noIndicator", void 0);
50
+ __decorate([attr, __metadata("design:type", String)], AccordionItem.prototype, "meta", void 0);
51
+ __decorate([attr({
52
+ mode: 'boolean'
53
+ }), __metadata("design:type", Object)], AccordionItem.prototype, "open", void 0);
54
+ applyMixins(AccordionItem, AffixIconWithTrailing);
55
+
56
+ let _ = t => t,
57
+ _t,
58
+ _t2,
59
+ _t3,
60
+ _t4,
61
+ _t5,
62
+ _t6,
63
+ _t7;
64
+ const PANEL = 'panel';
65
+ const getClasses = ({
66
+ open,
67
+ iconTrailing,
68
+ icon,
69
+ noIndicator
70
+ }) => classNames('base', ['open', open], ['icon', Boolean(icon)], ['icon-trailing', iconTrailing], ['no-indicator', noIndicator]);
71
+ const AccordionItemTemplate = context => html(_t || (_t = _`
72
+ <div class="${0}">
73
+ ${0}
74
+ <div class="body" id="${0}" role="region" aria-labelledby="header">
75
+ <slot></slot>
76
+ </div>
77
+ </div>
78
+ `), getClasses, x => renderPanelHeader(context, x.headingLevel), PANEL);
79
+ const renderPanelHeader = (context, headingLevel) => {
80
+ const header = headingLevel ? 'h' + headingLevel : 'h3';
81
+ return html(_t2 || (_t2 = _`
82
+ <${0} class="header">
83
+ ${0}
84
+ </${0}>
85
+ `), header, renderHeaderButton(context), header);
86
+ };
87
+ const renderHeaderButton = context => {
88
+ const affixIconTemplate = affixIconTemplateFactory(context);
89
+ const focusTemplate = focusTemplateFactory(context);
90
+ return html(_t3 || (_t3 = _`
91
+ <button class="button" id="header" @click=${0}
92
+ aria-expanded=${0}
93
+ aria-controls="${0}">
94
+ ${0}
95
+ ${0}
96
+ <span class="heading-text">${0}</span>
97
+ ${0}
98
+ <span class="indicator">
99
+ ${0}
100
+ </span>
101
+ </button>
102
+ `), 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 = _`
103
+ ${0}
104
+ ${0}
105
+ `), when(x => !x.open, html(_t6 || (_t6 = _`<vwc-icon type='chevron-down-solid'></vwc-icon>`))), when(x => x.open, html(_t7 || (_t7 = _`<vwc-icon type='chevron-up-solid'></vwc-icon>`))))));
106
+ };
107
+
108
+ const vividAccordionItem = AccordionItem.compose({
109
+ baseName: 'accordion-item',
110
+ template: AccordionItemTemplate,
111
+ styles: css_248z,
112
+ shadowOptions: {
113
+ delegatesFocus: true
114
+ }
115
+ });
116
+ designSystem.register(vividAccordionItem());
117
+
118
+ export { vividAccordionItem };
@@ -0,0 +1,41 @@
1
+ import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
2
+ import '../shared/web.dom-collections.iterator.js';
3
+ import { c as classNames } from '../shared/class-names.js';
4
+ import '../shared/export.js';
5
+ import '../shared/object-keys.js';
6
+ import '../shared/iterators.js';
7
+
8
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 15 Nov 2022 13:39:19 GMT\n */\n:host {\n display: inline-block;\n}\n\n.base {\n position: relative;\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n inline-size: inherit;\n vertical-align: middle;\n}\n.base {\n --_connotation-color-backdrop: var(--vvd-color-canvas);\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-intermediate: var(--vvd-color-neutral-500);\n --_connotation-color-faint: var(--vvd-color-neutral-50);\n}\n.base {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.base.appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base::before {\n position: absolute;\n z-index: 1;\n border-radius: inherit;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n content: \"\";\n inset: 0;\n pointer-events: none;\n}\n.base:not(.tight) {\n padding: 4px;\n column-gap: 4px;\n}\n\n/* Shape */\n.base:not(.shape-pill) {\n border-radius: 6px;\n}\n\n.base.shape-pill {\n border-radius: 24px;\n}\n\n/* Separator */\n::slotted(vwc-divider) {\n align-self: stretch;\n margin-block: 4px;\n}";
9
+
10
+ class ActionGroup extends FoundationElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.tight = false;
14
+ }
15
+ }
16
+ __decorate([attr, __metadata("design:type", String)], ActionGroup.prototype, "shape", void 0);
17
+ __decorate([attr, __metadata("design:type", String)], ActionGroup.prototype, "appearance", void 0);
18
+ __decorate([attr({
19
+ mode: 'boolean'
20
+ }), __metadata("design:type", Object)], ActionGroup.prototype, "tight", void 0);
21
+
22
+ let _ = t => t,
23
+ _t;
24
+ const getClasses = ({
25
+ appearance,
26
+ shape,
27
+ tight
28
+ }) => classNames('base', [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], ['tight', tight]);
29
+ const ActionGroupTemplate = () => html(_t || (_t = _`
30
+ <div class="${0}">
31
+ <slot></slot>
32
+ </div>`), getClasses);
33
+
34
+ const vividActionGroup = ActionGroup.compose({
35
+ baseName: 'action-group',
36
+ template: ActionGroupTemplate,
37
+ styles: css_248z
38
+ });
39
+ designSystem.register(vividActionGroup());
40
+
41
+ export { vividActionGroup };
@@ -0,0 +1,61 @@
1
+ import '../icon/index.js';
2
+ import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
3
+ import { w as when } from '../shared/when.js';
4
+ import { c as classNames } from '../shared/class-names.js';
5
+ import '../shared/icon.js';
6
+ import '../shared/export.js';
7
+ import '../shared/iterators.js';
8
+ import '../shared/to-string.js';
9
+ import '../shared/string-trim.js';
10
+ import '../shared/_has.js';
11
+
12
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 15 Nov 2022 13:39:19 GMT\n */\n.base {\n display: inline-flex;\n overflow: hidden;\n align-items: center;\n justify-content: center;\n background-color: var(--_appearance-color-fill);\n block-size: var(--_size);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n inline-size: var(--_size);\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-firm: var(--vvd-color-cta-600);\n}\n.base:not(.connotation-cta) {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-firm: var(--vvd-color-canvas-text);\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-outlined {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.base.appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base.size-condensed {\n --_size: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) - 8));\n}\n.base.size-condensed .initials {\n font: var(--vvd-typography-base-condensed-bold);\n}\n.base.size-condensed .icon {\n font-size: calc(calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) - 8)) / 2);\n}\n.base.size-expanded {\n --_size: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) + 8));\n}\n.base.size-expanded .initials {\n font: var(--vvd-typography-heading-4);\n}\n.base.size-expanded .icon {\n font-size: calc(calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) + 8)) / 2);\n}\n.base:not(.size-condensed, .size-expanded) {\n --_size: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1)));\n}\n.base:not(.size-condensed, .size-expanded) .initials {\n font: var(--vvd-typography-base-extended-bold);\n}\n.base:not(.size-condensed, .size-expanded) .icon {\n font-size: calc(calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1))) / 2);\n}\n.base:not(.shape-pill) {\n border-radius: 6px;\n}\n.base.shape-pill {\n border-radius: 50%;\n}\n.base .initials {\n text-transform: uppercase;\n}\n.base ::slotted(*) {\n block-size: 100%;\n inline-size: 100%;\n object-fit: cover;\n}";
13
+
14
+ class Avatar extends FoundationElement {}
15
+ __decorate([attr, __metadata("design:type", String)], Avatar.prototype, "connotation", void 0);
16
+ __decorate([attr, __metadata("design:type", String)], Avatar.prototype, "shape", void 0);
17
+ __decorate([attr, __metadata("design:type", String)], Avatar.prototype, "appearance", void 0);
18
+ __decorate([attr, __metadata("design:type", String)], Avatar.prototype, "size", void 0);
19
+ __decorate([attr, __metadata("design:type", String)], Avatar.prototype, "icon", void 0);
20
+ __decorate([attr, __metadata("design:type", String)], Avatar.prototype, "name", void 0);
21
+
22
+ let _ = t => t,
23
+ _t,
24
+ _t2,
25
+ _t3;
26
+ const getClasses = ({
27
+ appearance,
28
+ connotation,
29
+ shape,
30
+ size
31
+ }) => classNames('base', [`connotation-${connotation}`, Boolean(connotation)], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], [`size-${size}`, Boolean(size)]);
32
+ function renderIcon() {
33
+ return html(_t || (_t = _`
34
+ <span class="icon">
35
+ <vwc-icon type="${0}"></vwc-icon>
36
+ </span>
37
+ `), x => x.icon ? `${x.icon}` : 'user-line');
38
+ }
39
+ function renderInitials() {
40
+ return html(_t2 || (_t2 = _`
41
+ <span class="initials">${0}</span>
42
+ `), ({
43
+ name
44
+ }) => name.substring(0, 2));
45
+ }
46
+ const AvatarTemplate = () => html(_t3 || (_t3 = _`
47
+ <span class="${0}">
48
+ <slot>
49
+ ${0}
50
+ ${0}
51
+ </slot>
52
+ </span>`), getClasses, when(x => x.name, renderInitials()), when(x => !x.name, renderIcon()));
53
+
54
+ const vividAvatar = Avatar.compose({
55
+ baseName: 'avatar',
56
+ template: AvatarTemplate,
57
+ styles: css_248z
58
+ });
59
+ designSystem.register(vividAvatar());
60
+
61
+ export { vividAvatar };
package/badge/index.js ADDED
@@ -0,0 +1,51 @@
1
+ import '../icon/index.js';
2
+ import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
3
+ import { A as AffixIconWithTrailing, a as affixIconTemplateFactory } from '../shared/affix.js';
4
+ import { a as applyMixins } from '../shared/apply-mixins.js';
5
+ import { c as classNames } from '../shared/class-names.js';
6
+ import '../shared/icon.js';
7
+ import '../shared/export.js';
8
+ import '../shared/iterators.js';
9
+ import '../shared/to-string.js';
10
+ import '../shared/string-trim.js';
11
+ import '../shared/_has.js';
12
+ import '../shared/when.js';
13
+ import '../shared/web.dom-collections.iterator.js';
14
+ import '../shared/object-keys.js';
15
+
16
+ class Badge extends FoundationElement {}
17
+ __decorate([attr, __metadata("design:type", String)], Badge.prototype, "connotation", void 0);
18
+ __decorate([attr, __metadata("design:type", String)], Badge.prototype, "shape", void 0);
19
+ __decorate([attr, __metadata("design:type", String)], Badge.prototype, "appearance", void 0);
20
+ __decorate([attr, __metadata("design:type", String)], Badge.prototype, "text", void 0);
21
+ applyMixins(Badge, AffixIconWithTrailing);
22
+
23
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 15 Nov 2022 13:39:19 GMT\n */\n.base {\n --_badge-block-size: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1) - 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 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-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-intermediate: var(--vvd-color-warning-500);\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/* 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}";
24
+
25
+ let _ = t => t,
26
+ _t;
27
+ const getClasses = ({
28
+ connotation,
29
+ appearance,
30
+ shape,
31
+ iconTrailing,
32
+ text,
33
+ icon
34
+ }) => classNames('base', [`connotation-${connotation}`, Boolean(connotation)], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], ['icon-trailing', iconTrailing], ['icon-only', !text && Boolean(icon)]);
35
+ const badgeTemplate = context => {
36
+ const affixIconTemplate = affixIconTemplateFactory(context);
37
+ return html(_t || (_t = _`
38
+ <span class="${0}">
39
+ ${0}
40
+ ${0}
41
+ </span>`), getClasses, x => affixIconTemplate(x.icon), x => x.text);
42
+ };
43
+
44
+ const vividBadge = Badge.compose({
45
+ baseName: 'badge',
46
+ template: badgeTemplate,
47
+ styles: css_248z
48
+ });
49
+ designSystem.register(vividBadge());
50
+
51
+ export { vividBadge };
@@ -0,0 +1,128 @@
1
+ import '../shared/index2.js';
2
+ import { F as FoundationElement, c as __classPrivateFieldGet, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
3
+ import '../shared/web.dom-collections.iterator.js';
4
+ import { C as Connotation } from '../shared/enums.js';
5
+ import { b as AffixIcon, a as affixIconTemplateFactory } from '../shared/affix.js';
6
+ import { a as applyMixins } from '../shared/apply-mixins.js';
7
+ import { w as when } from '../shared/when.js';
8
+ import { c as classNames } from '../shared/class-names.js';
9
+ import '../icon/index.js';
10
+ import '../shared/icon.js';
11
+ import '../shared/export.js';
12
+ import '../shared/iterators.js';
13
+ import '../shared/to-string.js';
14
+ import '../shared/string-trim.js';
15
+ import '../shared/_has.js';
16
+ import '../focus/index.js';
17
+ import '../shared/focus.js';
18
+ import '../shared/button.js';
19
+ import '../shared/form-associated.js';
20
+ import '../shared/key-codes.js';
21
+ import '../shared/aria-global.js';
22
+ import '../shared/start-end.js';
23
+ import '../shared/ref.js';
24
+ import '../shared/focus2.js';
25
+ import '../shared/object-keys.js';
26
+
27
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 15 Nov 2022 13:39:19 GMT\n */\n.control {\n overflow: hidden;\n max-height: 160px;\n background-color: var(--_appearance-color-fill);\n color: var(--_appearance-color-text);\n transition: max-height var(--transition-delay, 200ms);\n}\n.control.connotation-success {\n --_connotation-color-primary: var(--vvd-color-success-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n}\n.control.connotation-alert {\n --_connotation-color-primary: var(--vvd-color-alert-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n}\n.control.connotation-announcement {\n --_connotation-color-primary: var(--vvd-color-announcement-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n}\n.control.connotation-warning {\n --_connotation-color-primary: var(--vvd-color-warning-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n}\n.control:not(.connotation-success, .connotation-alert, .connotation-announcement, .connotation-warning) {\n --_connotation-color-primary: var(--vvd-color-information-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n}\n.control {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.control.removing {\n max-height: 0;\n}\n.control > .header {\n display: flex;\n min-height: 60px;\n align-items: center;\n justify-content: flex-start;\n font: var(--vvd-typography-base-bold);\n}\n.control > .header > .user-content {\n display: flex;\n flex: 1 0;\n align-items: center;\n justify-content: center;\n padding-inline: 16px;\n}\n.control > .header > .user-content > .icon {\n flex: 0 0 auto;\n font-size: 20px;\n margin-inline-end: 15px;\n}\n.control > .header > .user-content > .action-items {\n display: inline-block;\n flex: 0 0 auto;\n padding-inline-start: 15px;\n}\n.control > .header > .user-content > .message {\n padding: 20px 0;\n}\n.control > .header > .dismiss-button {\n --vvd-icon-button-color: inherit;\n flex: 0 0 auto;\n margin-inline-end: 8px;\n}";
28
+
29
+ var _Banner_handleRemoveEnd, _Banner_closeOnKeyDown;
30
+ 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']]);
31
+ const defaultConnotation = (connotation = Connotation.Information) => connotationIconMap.get(connotation);
32
+ class Banner extends FoundationElement {
33
+ constructor() {
34
+ super(...arguments);
35
+ this.removable = false;
36
+ _Banner_handleRemoveEnd.set(this, () => {
37
+ this.$emit('removed');
38
+ this.parentElement && this.parentElement.removeChild(this);
39
+ });
40
+ _Banner_closeOnKeyDown.set(this, e => {
41
+ if (e.key !== 'Escape' || !this.removable) {
42
+ return;
43
+ }
44
+ this.remove();
45
+ });
46
+ }
47
+ get conditionedIcon() {
48
+ var _a;
49
+ return (_a = this.icon) !== null && _a !== void 0 ? _a : defaultConnotation(this.connotation);
50
+ }
51
+ connectedCallback() {
52
+ super.connectedCallback();
53
+ this.addEventListener('keydown', __classPrivateFieldGet(this, _Banner_closeOnKeyDown, "f"));
54
+ }
55
+ disconnectedCallback() {
56
+ super.disconnectedCallback();
57
+ this.removeEventListener('keydown', __classPrivateFieldGet(this, _Banner_closeOnKeyDown, "f"));
58
+ }
59
+ remove() {
60
+ this.$emit('removing');
61
+ const banner = this.shadowRoot && this.shadowRoot.querySelector('.banner');
62
+ if (banner) {
63
+ banner.classList.add('removing');
64
+ banner.addEventListener('transitionend', __classPrivateFieldGet(this, _Banner_handleRemoveEnd, "f"));
65
+ }
66
+ }
67
+ }
68
+ _Banner_handleRemoveEnd = new WeakMap(), _Banner_closeOnKeyDown = new WeakMap();
69
+ __decorate([attr({
70
+ attribute: 'action-href'
71
+ }), __metadata("design:type", Object)], Banner.prototype, "actionHref", void 0);
72
+ __decorate([attr({
73
+ attribute: 'action-text'
74
+ }), __metadata("design:type", Object)], Banner.prototype, "actionText", void 0);
75
+ __decorate([attr({
76
+ mode: 'boolean'
77
+ }), __metadata("design:type", Object)], Banner.prototype, "removable", void 0);
78
+ __decorate([attr({
79
+ attribute: 'aria-live'
80
+ }), __metadata("design:type", Object)], Banner.prototype, "ariaLive", void 0);
81
+ __decorate([attr(), __metadata("design:type", Object)], Banner.prototype, "role", void 0);
82
+ __decorate([attr(), __metadata("design:type", Object)], Banner.prototype, "text", void 0);
83
+ __decorate([attr(), __metadata("design:type", Object)], Banner.prototype, "connotation", void 0);
84
+ applyMixins(Banner, AffixIcon);
85
+
86
+ let _2 = t => t,
87
+ _t,
88
+ _t2;
89
+ const getClasses = _ => classNames('control', [`connotation-${_.connotation}`, !!_.connotation]);
90
+ function renderDismissButton() {
91
+ return html(_t || (_t = _2`
92
+ <vwc-button
93
+ part="vvd-theme-alternate"
94
+ size="condensed"
95
+ class="dismiss-button"
96
+ icon="close-line"
97
+ @click="${0}">
98
+ </vwc-button>`), x => x.remove());
99
+ }
100
+ const BannerTemplate = context => {
101
+ const affixIconTemplate = affixIconTemplateFactory(context);
102
+ return html(_t2 || (_t2 = _2`
103
+ <div class="banner ${0}" tabindex="0">
104
+ <header class="header">
105
+ <div class="user-content">
106
+ ${0}
107
+ <div class="banner--message"
108
+ role="${0}"
109
+ aria-live="${0}">
110
+ ${0}
111
+ </div>
112
+ <slot class="action-items" name="action-items"></slot>
113
+ </div>
114
+
115
+ ${0}
116
+ </header>
117
+ </div>
118
+ `), 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()));
119
+ };
120
+
121
+ const vividBanner = Banner.compose({
122
+ baseName: 'banner',
123
+ template: BannerTemplate,
124
+ styles: css_248z
125
+ });
126
+ designSystem.register(vividBanner());
127
+
128
+ export { vividBanner };