@vonage/vivid 3.0.0-test.0 → 3.0.1
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 +176 -4
- package/accordion/index.js +22 -61
- package/accordion-item/index.js +16 -123
- package/action-group/index.js +5 -0
- package/avatar/index.js +11 -0
- package/badge/index.js +9 -60
- package/banner/index.js +20 -208
- package/breadcrumb/index.js +7 -96
- package/breadcrumb-item/index.js +15 -48
- package/button/index.js +19 -758
- package/calendar/index.js +5 -1519
- package/calendar-event/index.js +9 -0
- package/card/index.js +13 -0
- package/checkbox/index.js +16 -0
- package/combobox/index.js +35 -0
- package/dialog/index.js +24 -0
- package/divider/index.js +6 -0
- package/elevation/index.js +4 -30
- package/fab/index.js +22 -0
- package/focus/index.js +4 -2
- package/header/index.js +6 -0
- package/icon/index.js +8 -32
- package/index.js +76 -25
- package/layout/index.js +4 -52
- package/lib/accordion/accordion.d.ts +3 -7
- package/lib/accordion/accordion.template.d.ts +1 -2
- package/lib/accordion/definition.d.ts +1 -0
- package/lib/accordion/index.d.ts +1 -2
- package/lib/accordion-item/accordion-item.d.ts +4 -8
- package/lib/accordion-item/accordion-item.template.d.ts +4 -4
- package/lib/accordion-item/definition.d.ts +1 -0
- package/lib/accordion-item/index.d.ts +1 -3
- package/lib/action-group/action-group.d.ts +10 -0
- package/lib/{sidenav-item/sidenav-item.template.d.ts → action-group/action-group.template.d.ts} +2 -2
- package/lib/action-group/definition.d.ts +1 -0
- package/lib/action-group/index.d.ts +1 -0
- package/lib/avatar/avatar.d.ts +15 -0
- package/lib/avatar/avatar.template.d.ts +4 -0
- package/lib/avatar/definition.d.ts +1 -0
- package/lib/avatar/index.d.ts +1 -0
- package/lib/badge/badge.d.ts +4 -6
- package/lib/badge/definition.d.ts +3 -0
- package/lib/badge/index.d.ts +1 -3
- package/lib/banner/banner.d.ts +1 -1
- package/lib/banner/banner.template.d.ts +0 -2
- package/lib/banner/definition.d.ts +1 -0
- package/lib/banner/index.d.ts +1 -2
- package/lib/breadcrumb/breadcrumb.template.d.ts +4 -0
- package/lib/breadcrumb/definition.d.ts +1 -0
- package/lib/breadcrumb/index.d.ts +1 -2
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
- package/lib/breadcrumb-item/definition.d.ts +1 -0
- package/lib/breadcrumb-item/index.d.ts +1 -3
- package/lib/button/button.d.ts +4 -3
- package/lib/button/definition.d.ts +1 -0
- package/lib/button/index.d.ts +1 -21
- package/lib/calendar/calendar.d.ts +3 -1
- package/lib/calendar/definition.d.ts +1 -0
- package/lib/calendar/index.d.ts +1 -3
- package/lib/calendar-event/calendar-event.d.ts +14 -0
- package/lib/calendar-event/calendar-event.template.d.ts +4 -0
- package/lib/calendar-event/definition.d.ts +1 -0
- package/lib/calendar-event/index.d.ts +1 -0
- package/lib/card/card.d.ts +10 -0
- package/lib/{text/text.template.d.ts → card/card.template.d.ts} +2 -2
- package/lib/card/definition.d.ts +1 -0
- package/lib/card/index.d.ts +1 -0
- package/lib/checkbox/checkbox.d.ts +5 -0
- package/lib/checkbox/checkbox.template.d.ts +4 -0
- package/lib/checkbox/definition.d.ts +1 -0
- package/lib/checkbox/index.d.ts +1 -0
- package/lib/combobox/combobox.d.ts +14 -0
- package/lib/combobox/combobox.template.d.ts +4 -0
- package/lib/combobox/definition.d.ts +3 -0
- package/lib/combobox/index.d.ts +1 -0
- package/lib/components.d.ts +44 -16
- package/lib/dialog/definition.d.ts +1 -0
- package/lib/dialog/dialog.d.ts +23 -0
- package/lib/dialog/dialog.template.d.ts +4 -0
- package/lib/dialog/index.d.ts +1 -0
- package/lib/divider/definition.d.ts +1 -0
- package/lib/divider/divider.d.ts +3 -0
- package/lib/divider/divider.template.d.ts +4 -0
- package/lib/divider/index.d.ts +1 -0
- package/lib/elevation/definition.d.ts +1 -0
- package/lib/elevation/elevation.d.ts +1 -0
- package/lib/elevation/index.d.ts +1 -2
- package/lib/enums.d.ts +20 -6
- package/lib/fab/definition.d.ts +3 -0
- package/lib/fab/fab.d.ts +13 -0
- package/lib/fab/fab.template.d.ts +4 -0
- package/lib/fab/index.d.ts +1 -0
- package/lib/focus/definition.d.ts +3 -0
- package/lib/focus/index.d.ts +1 -2
- package/lib/{sidenav-item/index.d.ts → header/definition.d.ts} +2 -2
- package/lib/header/header.d.ts +5 -0
- package/lib/header/header.template.d.ts +4 -0
- package/lib/header/index.d.ts +1 -0
- package/lib/icon/definition.d.ts +3 -0
- package/lib/icon/icon.d.ts +5 -6
- 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/layout/layout.d.ts +4 -4
- package/lib/listbox/definition.d.ts +3 -0
- package/lib/listbox/index.d.ts +1 -0
- package/lib/listbox/listbox.d.ts +6 -0
- package/lib/listbox/listbox.template.d.ts +4 -0
- package/lib/menu/definition.d.ts +11 -0
- package/lib/menu/index.d.ts +1 -0
- package/lib/menu/menu.d.ts +10 -0
- package/lib/menu/menu.template.d.ts +3 -0
- package/lib/menu-item/definition.d.ts +3 -0
- package/lib/menu-item/index.d.ts +1 -0
- package/lib/menu-item/menu-item.d.ts +8 -0
- package/lib/menu-item/menu-item.template.d.ts +5 -0
- package/lib/nav/definition.d.ts +3 -0
- package/lib/nav/index.d.ts +1 -0
- package/lib/nav/nav.d.ts +3 -0
- package/lib/nav/nav.template.d.ts +4 -0
- package/lib/nav-disclosure/definition.d.ts +3 -0
- package/lib/nav-disclosure/index.d.ts +1 -0
- package/lib/nav-disclosure/nav-disclosure.d.ts +10 -0
- package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -0
- package/lib/nav-item/definition.d.ts +3 -0
- package/lib/nav-item/index.d.ts +1 -0
- package/lib/{sidenav-item/sidenav-item.d.ts → nav-item/nav-item.d.ts} +2 -2
- package/lib/nav-item/nav-item.template.d.ts +4 -0
- package/lib/note/definition.d.ts +3 -0
- package/lib/note/index.d.ts +1 -0
- package/lib/note/note.d.ts +10 -0
- package/lib/note/note.template.d.ts +4 -0
- package/lib/number-field/definition.d.ts +4 -0
- package/lib/number-field/index.d.ts +1 -0
- package/lib/number-field/number-field.d.ts +14 -0
- package/lib/number-field/number-field.template.d.ts +4 -0
- package/lib/option/definition.d.ts +3 -0
- package/lib/option/index.d.ts +1 -0
- package/lib/option/option.d.ts +9 -0
- package/lib/option/option.template.d.ts +4 -0
- package/lib/popup/definition.d.ts +4 -0
- package/lib/popup/index.d.ts +1 -4
- package/lib/popup/popup.d.ts +8 -4
- package/lib/progress/definition.d.ts +3 -0
- package/lib/progress/index.d.ts +1 -2
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress-ring/definition.d.ts +3 -0
- package/lib/progress-ring/index.d.ts +1 -2
- package/lib/progress-ring/progress-ring.d.ts +2 -1
- package/lib/radio/definition.d.ts +3 -0
- package/lib/radio/index.d.ts +1 -0
- package/lib/radio/radio.d.ts +4 -0
- package/lib/radio/radio.template.d.ts +4 -0
- package/lib/radio-group/definition.d.ts +11 -0
- package/lib/radio-group/index.d.ts +1 -0
- package/lib/radio-group/radio-group.d.ts +4 -0
- package/lib/radio-group/radio-group.template.d.ts +4 -0
- package/lib/select/definition.d.ts +3 -0
- package/lib/select/index.d.ts +1 -0
- package/lib/select/select.d.ts +17 -0
- package/lib/select/select.template.d.ts +4 -0
- package/lib/side-drawer/definition.d.ts +3 -0
- package/lib/side-drawer/index.d.ts +1 -2
- package/lib/side-drawer/side-drawer.d.ts +3 -2
- package/lib/slider/definition.d.ts +3 -0
- package/lib/slider/index.d.ts +1 -0
- package/lib/slider/slider.d.ts +4 -0
- package/lib/slider/slider.template.d.ts +4 -0
- package/lib/switch/definition.d.ts +3 -0
- package/lib/switch/index.d.ts +1 -0
- package/lib/switch/switch.d.ts +7 -0
- package/lib/switch/switch.template.d.ts +4 -0
- package/lib/tab/definition.d.ts +3 -0
- package/lib/tab/index.d.ts +1 -0
- package/lib/tab/tab.d.ts +9 -0
- package/lib/tab/tab.template.d.ts +3 -0
- package/lib/tab-panel/definition.d.ts +3 -0
- package/lib/tab-panel/index.d.ts +1 -0
- package/lib/tab-panel/tab-panel.d.ts +3 -0
- package/lib/tab-panel/tab-panel.template.d.ts +2 -0
- package/lib/tabs/definition.d.ts +3 -0
- package/lib/tabs/index.d.ts +1 -0
- package/lib/tabs/tabs.d.ts +10 -0
- package/lib/tabs/tabs.template.d.ts +2 -0
- package/lib/text-anchor/definition.d.ts +3 -0
- package/lib/text-anchor/index.d.ts +1 -2
- package/lib/text-anchor/text-anchor.d.ts +1 -1
- package/lib/text-area/definition.d.ts +3 -0
- package/lib/text-area/index.d.ts +1 -0
- package/lib/text-area/text-area.d.ts +9 -0
- package/lib/text-area/text-area.template.d.ts +4 -0
- package/lib/text-field/definition.d.ts +3 -0
- package/lib/text-field/index.d.ts +1 -0
- package/lib/text-field/text-field.d.ts +14 -0
- package/lib/text-field/text-field.template.d.ts +4 -0
- package/lib/tooltip/definition.d.ts +3 -0
- package/lib/tooltip/index.d.ts +1 -3
- package/lib/tooltip/tooltip.d.ts +7 -7
- package/listbox/index.js +27 -0
- package/menu/index.js +30 -0
- package/menu-item/index.js +20 -0
- package/nav/index.js +4 -0
- package/nav-disclosure/index.js +17 -0
- package/nav-item/index.js +22 -0
- package/note/index.js +15 -0
- package/number-field/index.js +459 -0
- package/option/index.js +21 -0
- package/package.json +29 -19
- package/popup/index.js +21 -2061
- package/progress/index.js +6 -97
- package/progress-ring/index.js +6 -75
- package/radio/index.js +12 -0
- package/radio-group/index.js +11 -0
- package/select/index.js +34 -0
- package/shared/affix.js +2 -8
- package/shared/anchor.js +10 -2
- package/shared/apply-mixins.js +5 -4
- package/shared/aria-global.js +2 -86
- package/shared/aria.js +9 -0
- package/shared/base-progress.js +5 -0
- package/shared/breadcrumb-item.js +1 -1
- package/shared/button.js +200 -0
- package/shared/calendar-event.js +19 -0
- package/shared/definition.js +225 -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 +727 -0
- package/shared/definition18.js +1842 -0
- package/shared/definition19.js +261 -0
- package/shared/definition2.js +150 -0
- package/shared/definition20.js +221 -0
- package/shared/definition21.js +78 -0
- package/shared/definition22.js +87 -0
- package/shared/definition23.js +58 -0
- package/shared/definition24.js +44 -0
- package/shared/definition25.js +58 -0
- package/shared/definition26.js +348 -0
- package/shared/definition27.js +363 -0
- package/shared/definition28.js +21 -0
- package/shared/definition29.js +75 -0
- package/shared/definition3.js +29 -0
- package/shared/definition30.js +31 -0
- package/shared/definition31.js +49 -0
- package/shared/definition32.js +94 -0
- package/shared/definition33.js +77 -0
- package/shared/definition34.js +45 -0
- package/shared/definition35.js +435 -0
- package/shared/definition36.js +634 -0
- package/shared/definition37.js +86 -0
- package/shared/definition38.js +592 -0
- package/shared/definition39.js +147 -0
- package/shared/definition4.js +19 -0
- package/shared/definition40.js +67 -0
- package/shared/definition41.js +32 -0
- package/shared/definition42.js +440 -0
- package/shared/definition43.js +282 -0
- package/shared/definition44.js +119 -0
- package/shared/definition45.js +77 -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 -1
- package/shared/dialog-polyfill.esm.js +858 -0
- package/shared/direction.js +20 -0
- package/shared/dom.js +8 -0
- package/shared/enums.js +70 -0
- package/shared/es.object.assign.js +2 -2
- package/shared/es.regexp.to-string.js +59 -0
- package/shared/focus.js +5 -0
- package/shared/focus2.js +11 -0
- package/shared/form-associated.js +466 -0
- package/shared/form-elements.js +127 -0
- package/shared/icon.js +538 -572
- package/shared/index.js +1664 -83
- package/shared/key-codes.js +97 -0
- package/shared/listbox.js +995 -0
- package/shared/numbers.js +34 -0
- package/shared/patterns/affix.d.ts +1 -1
- package/shared/patterns/focus.d.ts +3 -0
- package/shared/patterns/form-elements/form-elements.d.ts +43 -0
- package/shared/patterns/form-elements/index.d.ts +1 -0
- package/shared/patterns/index.d.ts +2 -0
- package/shared/radio.js +127 -0
- package/shared/ref.js +41 -0
- package/shared/select.options.js +10 -0
- package/shared/start-end.js +50 -0
- package/shared/string-trim.js +40 -0
- package/shared/strings.js +9 -0
- package/shared/text-anchor.js +2 -13
- package/shared/text-anchor.template.js +6 -5
- package/shared/text-field.js +3 -0
- package/shared/text-field2.js +225 -0
- package/shared/to-string.js +51 -0
- package/side-drawer/index.js +5 -80
- package/slider/index.js +17 -0
- package/styles/core/all.css +83 -0
- package/styles/core/theme.css +11 -0
- package/styles/core/typography.css +77 -0
- package/styles/tokens/theme-dark.css +228 -0
- package/styles/tokens/theme-light.css +228 -0
- package/switch/index.js +18 -0
- package/tab/index.js +16 -0
- package/tab-panel/index.js +4 -0
- package/tabs/index.js +24 -0
- package/text-anchor/index.js +11 -5
- package/text-area/index.js +23 -0
- package/text-field/index.js +24 -0
- package/tooltip/index.js +18 -57
- package/lib/text/index.d.ts +0 -2
- package/lib/text/text.d.ts +0 -10
- package/shared/index2.js +0 -21
- package/shared/style-inject.es.js +0 -28
- package/shared/web.dom-collections.iterator.js +0 -1479
- package/sidenav-item/index.js +0 -38
- package/styles/fonts/spezia.css +0 -23
- package/styles/themes/dark.css +0 -205
- package/styles/themes/light.css +0 -205
- package/text/index.js +0 -45
package/README.md
CHANGED
|
@@ -1,7 +1,179 @@
|
|
|
1
|
-
# components
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
# Vivid UI
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
Essential UI **web components** for building modern web applications, bound to provide a **safe**, **simple** and **intuitive** interface.
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+

|
|
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
|
+
Vivid uses `Montserrat` and `Roboto Mono` Google fonts.
|
|
53
|
+
Learn how to load fonts into your application [with google-fonts](https://fonts.google.com/knowledge/using_type/using_web_fonts_from_a_font_delivery_service#loading-web-fonts)
|
|
54
|
+
|
|
55
|
+
** Unless explicitly stated otherwise, *Vonage products* should use the brand specified `Spezia` font families.
|
|
56
|
+
Vonage teams may review guidelines at the [Spezia webfont kit](https://github.com/Vonage/spezia-webfont-kit).
|
|
57
|
+
|
|
58
|
+
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).
|
|
59
|
+
This is to allow the author to choose the most appropriate way to load the font files based on their project.
|
|
60
|
+
|
|
61
|
+
### Core (Optional)
|
|
62
|
+
|
|
63
|
+
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.
|
|
64
|
+
|
|
65
|
+
These styles are not required by vivid components directly. however, native HTML tags do.
|
|
66
|
+
|
|
67
|
+
These **core styles** rely on the tokens and fonts 👆 to be loaded.
|
|
68
|
+
|
|
69
|
+
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`. When set on the `:root` (html element), typeface sizes are able to descend from the root font-size, thus comply with the [WCAG 1.4.4](https://www.w3.org/WAI/WCAG21/Understanding/resize-text)).
|
|
70
|
+
|
|
71
|
+
- `theme.css` - Sets theme related styles
|
|
72
|
+
|
|
73
|
+
- `typography.css` - Sets typography related styles
|
|
74
|
+
|
|
75
|
+
- `all.css` - Sets all the above styles
|
|
76
|
+
|
|
77
|
+
Note: scss users can simply [forward](https://sass-lang.com/documentation/at-rules/forward) the styles to their scss project:
|
|
78
|
+
|
|
79
|
+
```css
|
|
80
|
+
@forward 'node_modules/@vonage/vivid/styles/[path to file].css';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Advanced Usage
|
|
84
|
+
|
|
85
|
+
### Scoped Elements (🧪 Alpha)
|
|
86
|
+
|
|
87
|
+
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.
|
|
88
|
+
|
|
89
|
+
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.
|
|
90
|
+
Also, in a micro-frontend architecture, this can be a major bottleneck as each micro-frontend may use a different version of the library.
|
|
91
|
+
|
|
92
|
+
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.
|
|
93
|
+
|
|
94
|
+
The following example will register *badge* custom element as `dashboard-badge`:
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
import { registerBadge } from '@vonage/vivid';
|
|
98
|
+
|
|
99
|
+
registerBadge('dashboard');
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
then use it as:
|
|
103
|
+
|
|
104
|
+
```html
|
|
105
|
+
<dashboard-badge text="dashboard scoped badge"></dashboard-badge>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Remember to not include the default side-effect import (`import '@vonage/vivid/button';`) when using scoped elements as it will register the default namespace.
|
|
109
|
+
|
|
110
|
+
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.
|
|
111
|
+
|
|
112
|
+
## Support
|
|
113
|
+
|
|
114
|
+
This library is open source, developed and maintained by the [Vonage Vivid teams](https://github.com/orgs/Vonage/teams/vivid/teams).
|
|
115
|
+
|
|
116
|
+
For any questions, please open a [bug report](https://github.com/Vonage/vivid-3/issues/new?assignees=yonatankra%2C+rachelbt%2C+rinaok%2C+yinonov&labels=bug&template=bug_report.yml&title=%5BYOUR+TITLE%5D%3A+Brief+description) or [feature request](https://github.com/Vonage/vivid-3/issues/new?assignees=yonatankra%2C+rachelbt%2C+rinaok%2C+yinonov&labels=Feature+request&template=feature_request.yml&title=%5BYOUR+TITLE%5D%3A+Brief+description).
|
|
117
|
+
|
|
118
|
+
## Roadmap
|
|
119
|
+
|
|
120
|
+
- View [components status](https://github.com/orgs/Vonage/projects/6)
|
|
121
|
+
|
|
122
|
+
- [What's on our plate](https://github.com/orgs/Vonage/projects/3/views/7)
|
|
123
|
+
|
|
124
|
+
- See the [open issues](https://github.com/vonage/vivid-3/issues) for a full list of proposed features (and known issues).
|
|
125
|
+
|
|
126
|
+
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.
|
|
127
|
+
|
|
128
|
+
## Contributing
|
|
129
|
+
|
|
130
|
+
Please read [CONTRIBUTING.md](https://github.com/Vonage/vivid-3/blob/main/.github/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
|
|
131
|
+
|
|
132
|
+
## Versioning
|
|
133
|
+
|
|
134
|
+
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [npm page](https://www.npmjs.com/package/@vonage/vivid).
|
|
135
|
+
|
|
136
|
+
## Authors
|
|
137
|
+
|
|
138
|
+
See also the list of [contributors](https://github.com/Vonage/vivid-3/graphs/contributors) who participated in this project.
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
This project is licensed under the Apache 2.0 License - see the [LICENSE.md](https://github.com/Vonage/vivid-3/blob/main/LICENSE.md) file for details
|
|
143
|
+
|
|
144
|
+
<!-- ## Acknowledgments
|
|
145
|
+
|
|
146
|
+
- Hat tip to anyone whose code was used
|
|
147
|
+
- Inspiration
|
|
148
|
+
- etc -->
|
|
149
|
+
|
|
150
|
+
## Built With
|
|
151
|
+
|
|
152
|
+
- [Fast](https://www.fast.design) - to extend element classes and compile code to native web components
|
|
153
|
+
- [Typescript](https://www.typescriptlang.org) - for ergonomic and type-safe code
|
|
154
|
+
- [Sass](https://sass-lang.com) - for styles authoring extensibility and consistency
|
|
155
|
+
|
|
156
|
+
## Quickstart
|
|
157
|
+
|
|
158
|
+
Global content delivery networks can help quickly integrate content within html pages, fetching content from an URL, skipping local builds entirely.
|
|
159
|
+
Such practice is often used when working on POCs or reproduction environments.
|
|
160
|
+
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.
|
|
161
|
+
|
|
162
|
+
The following snippet fully renders a Vivid button component
|
|
163
|
+
|
|
164
|
+
```html
|
|
165
|
+
<!-- import Montserrat & Roboto-Mono fonts -->
|
|
166
|
+
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
167
|
+
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600&family=Roboto+Mono:wght@400;500&display=swap" rel="stylesheet">
|
|
168
|
+
|
|
169
|
+
<!-- import light theme style tokens -->
|
|
170
|
+
<link rel="stylesheet" href="https://unpkg.com/@vonage/vivid@next/styles/tokens/theme-light.css">
|
|
171
|
+
|
|
172
|
+
<!-- import Vivid button component -->
|
|
173
|
+
<script type="module" src="https://unpkg.com/@vonage/vivid@next/button/index.js"></script>
|
|
174
|
+
|
|
175
|
+
<!-- Part of the app (or a whole app) that contains vivid components -->
|
|
176
|
+
<div class="vvd-root">
|
|
177
|
+
<vwc-button label="Click me" appearance="filled" connotation="cta"></vwc-button>
|
|
178
|
+
</div>
|
|
179
|
+
```
|
package/accordion/index.js
CHANGED
|
@@ -1,61 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
for (let i = 0; i < this.accordionItems.length; i++) {
|
|
24
|
-
if (this.accordionItems[i] !== e.target) {
|
|
25
|
-
this.accordionItems[i].open = false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
closeAll() {
|
|
32
|
-
if (this.accordionItems) {
|
|
33
|
-
for (let i = 0; i < this.accordionItems.length; i++) {
|
|
34
|
-
this.accordionItems[i].open = false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
__decorate([attr({
|
|
42
|
-
mode: 'boolean'
|
|
43
|
-
}), __metadata("design:type", Object)], Accordion.prototype, "multi", void 0);
|
|
44
|
-
|
|
45
|
-
let _2 = t => t,
|
|
46
|
-
_t;
|
|
47
|
-
|
|
48
|
-
const getClasses = _ => classNames('control');
|
|
49
|
-
|
|
50
|
-
const AccordionTemplate = () => html(_t || (_t = _2`<div class="${0}">
|
|
51
|
-
<slot></slot>
|
|
52
|
-
</div>`), getClasses);
|
|
53
|
-
|
|
54
|
-
const vividAccordion = Accordion.compose({
|
|
55
|
-
baseName: 'accordion',
|
|
56
|
-
template: AccordionTemplate,
|
|
57
|
-
styles: css_248z
|
|
58
|
-
});
|
|
59
|
-
designSystem.register(vividAccordion());
|
|
60
|
-
|
|
61
|
-
export { vividAccordion };
|
|
1
|
+
import { r as registerAccordion } from '../shared/definition.js';
|
|
2
|
+
import '../shared/index.js';
|
|
3
|
+
import '../shared/definition2.js';
|
|
4
|
+
import '../shared/definition3.js';
|
|
5
|
+
import '../shared/icon.js';
|
|
6
|
+
import '../shared/to-string.js';
|
|
7
|
+
import '../shared/string-trim.js';
|
|
8
|
+
import '../shared/_has.js';
|
|
9
|
+
import '../shared/class-names.js';
|
|
10
|
+
import '../shared/when.js';
|
|
11
|
+
import '../shared/definition4.js';
|
|
12
|
+
import '../shared/focus.js';
|
|
13
|
+
import '../shared/affix.js';
|
|
14
|
+
import '../shared/start-end.js';
|
|
15
|
+
import '../shared/ref.js';
|
|
16
|
+
import '../shared/apply-mixins.js';
|
|
17
|
+
import '../shared/focus2.js';
|
|
18
|
+
import '../shared/key-codes.js';
|
|
19
|
+
import '../shared/numbers.js';
|
|
20
|
+
import '../shared/slotted.js';
|
|
21
|
+
|
|
22
|
+
registerAccordion();
|
package/accordion-item/index.js
CHANGED
|
@@ -1,125 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import '../shared/
|
|
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';
|
|
8
|
-
import '../icon/index.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';
|
|
6
|
+
import '../shared/string-trim.js';
|
|
10
7
|
import '../shared/_has.js';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
25
|
-
super.attributeChangedCallback(name, oldValue, newValue);
|
|
26
|
-
|
|
27
|
-
if (name === 'open') {
|
|
28
|
-
newValue === null ? this.emitEvent('closed') : this.emitEvent('opened');
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
emitEvent(name) {
|
|
33
|
-
const init = {
|
|
34
|
-
bubbles: true,
|
|
35
|
-
composed: true
|
|
36
|
-
};
|
|
37
|
-
const ev = new CustomEvent(name, init);
|
|
38
|
-
this.dispatchEvent(ev);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
__decorate([attr({
|
|
44
|
-
mode: 'fromView'
|
|
45
|
-
}), __metadata("design:type", Object)], AccordionItem.prototype, "heading", void 0);
|
|
46
|
-
|
|
47
|
-
__decorate([attr({
|
|
48
|
-
attribute: 'heading-level'
|
|
49
|
-
}), __metadata("design:type", Number)], AccordionItem.prototype, "headingLevel", void 0);
|
|
50
|
-
|
|
51
|
-
__decorate([attr({
|
|
52
|
-
mode: 'boolean',
|
|
53
|
-
attribute: 'no-indicator'
|
|
54
|
-
}), __metadata("design:type", Object)], AccordionItem.prototype, "noIndicator", void 0);
|
|
55
|
-
|
|
56
|
-
__decorate([attr({
|
|
57
|
-
mode: 'fromView'
|
|
58
|
-
}), __metadata("design:type", Object)], AccordionItem.prototype, "meta", void 0);
|
|
59
|
-
|
|
60
|
-
__decorate([attr({
|
|
61
|
-
mode: 'boolean'
|
|
62
|
-
}), __metadata("design:type", Object)], AccordionItem.prototype, "open", void 0);
|
|
63
|
-
|
|
64
|
-
applyMixins(AccordionItem, AffixIconWithTrailing);
|
|
65
|
-
|
|
66
|
-
let _ = t => t,
|
|
67
|
-
_t,
|
|
68
|
-
_t2,
|
|
69
|
-
_t3,
|
|
70
|
-
_t4,
|
|
71
|
-
_t5;
|
|
72
|
-
const PANEL = 'panel';
|
|
73
|
-
|
|
74
|
-
const getClasses = ({
|
|
75
|
-
open,
|
|
76
|
-
iconTrailing,
|
|
77
|
-
icon,
|
|
78
|
-
noIndicator
|
|
79
|
-
}) => classNames('control', ['open', open], ['icon', Boolean(icon)], ['icon-trailing', iconTrailing], ['no-indicator', noIndicator]);
|
|
80
|
-
|
|
81
|
-
const AccordionItemTemplate = context => html(_t || (_t = _`
|
|
82
|
-
<div class="${0}">
|
|
83
|
-
${0}
|
|
84
|
-
<div class="body" id="${0}" role="region" aria-labelledby="header">
|
|
85
|
-
<slot></slot>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
`), getClasses, x => renderPanelHeader(context, x.headingLevel), PANEL);
|
|
89
|
-
|
|
90
|
-
const renderPanelHeader = (context, headingLevel) => {
|
|
91
|
-
const header = headingLevel ? 'h' + headingLevel : 'h3';
|
|
92
|
-
return html(_t2 || (_t2 = _`
|
|
93
|
-
<${0} class="header">
|
|
94
|
-
${0}
|
|
95
|
-
</${0}>
|
|
96
|
-
`), header, renderHeaderButton(context), header);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const renderHeaderButton = context => {
|
|
100
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
101
|
-
return html(_t3 || (_t3 = _`
|
|
102
|
-
<button class="button" id="header" @click=${0}
|
|
103
|
-
?aria-expanded=${0}
|
|
104
|
-
aria-controls="${0}">
|
|
105
|
-
${0}
|
|
106
|
-
<span class="heading-text">${0}</span>
|
|
107
|
-
${0}
|
|
108
|
-
<span class="indicator">
|
|
109
|
-
${0}
|
|
110
|
-
</span>
|
|
111
|
-
</button>
|
|
112
|
-
`), x => x.open = !x.open, x => x.open, PANEL, 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 = _`
|
|
113
|
-
<vwc-icon class="toggle-open" type='chevron-down-solid'></vwc-icon>
|
|
114
|
-
<vwc-icon class="toggle-close" type='chevron-up-solid'></vwc-icon>
|
|
115
|
-
`))));
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const vividAccordionItem = AccordionItem.compose({
|
|
119
|
-
baseName: 'accordion-item',
|
|
120
|
-
template: AccordionItemTemplate,
|
|
121
|
-
styles: css_248z
|
|
122
|
-
});
|
|
123
|
-
designSystem.register(vividAccordionItem());
|
|
124
|
-
|
|
125
|
-
export { vividAccordionItem };
|
|
8
|
+
import '../shared/class-names.js';
|
|
9
|
+
import '../shared/when.js';
|
|
10
|
+
import '../shared/definition4.js';
|
|
11
|
+
import '../shared/focus.js';
|
|
12
|
+
import '../shared/affix.js';
|
|
13
|
+
import '../shared/start-end.js';
|
|
14
|
+
import '../shared/ref.js';
|
|
15
|
+
import '../shared/apply-mixins.js';
|
|
16
|
+
import '../shared/focus2.js';
|
|
17
|
+
|
|
18
|
+
registerAccordionItem();
|
package/avatar/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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';
|
|
6
|
+
import '../shared/string-trim.js';
|
|
7
|
+
import '../shared/_has.js';
|
|
8
|
+
import '../shared/class-names.js';
|
|
9
|
+
import '../shared/when.js';
|
|
10
|
+
|
|
11
|
+
registerAvatar();
|
package/badge/index.js
CHANGED
|
@@ -1,64 +1,13 @@
|
|
|
1
|
-
import '../
|
|
2
|
-
import
|
|
3
|
-
import '../shared/
|
|
4
|
-
import { A as AffixIconWithTrailing, a as affixIconTemplateFactory } from '../shared/affix.js';
|
|
5
|
-
import { a as applyMixins } from '../shared/apply-mixins.js';
|
|
6
|
-
import { s as styleInject } from '../shared/style-inject.es.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';
|
|
6
|
+
import '../shared/string-trim.js';
|
|
9
7
|
import '../shared/_has.js';
|
|
8
|
+
import '../shared/class-names.js';
|
|
10
9
|
import '../shared/when.js';
|
|
10
|
+
import '../shared/affix.js';
|
|
11
|
+
import '../shared/apply-mixins.js';
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
constructor() {
|
|
14
|
-
super(...arguments);
|
|
15
|
-
this.text = '';
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
__decorate([attr, __metadata("design:type", String)], Badge.prototype, "connotation", void 0);
|
|
21
|
-
|
|
22
|
-
__decorate([attr, __metadata("design:type", String)], Badge.prototype, "shape", void 0);
|
|
23
|
-
|
|
24
|
-
__decorate([attr, __metadata("design:type", String)], Badge.prototype, "appearance", void 0);
|
|
25
|
-
|
|
26
|
-
__decorate([attr, __metadata("design:type", String)], Badge.prototype, "size", void 0);
|
|
27
|
-
|
|
28
|
-
__decorate([attr({
|
|
29
|
-
mode: 'fromView'
|
|
30
|
-
}), __metadata("design:type", Object)], Badge.prototype, "text", void 0);
|
|
31
|
-
|
|
32
|
-
applyMixins(Badge, AffixIconWithTrailing);
|
|
33
|
-
|
|
34
|
-
var css_248z = "/*\n Do not edit directly\n Generated on Wed, 27 Apr 2022 11:58:36 GMT\n*/\n.control {\n font: 600 ultra-condensed 12px / 16px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n display: inline-flex;\n box-sizing: border-box;\n align-items: center;\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 column-gap: 8px;\n vertical-align: middle;\n}\n.control:not(.connotation-cta):not(.connotation-success):not(.connotation-alert):not(.connotation-warning):not(.connotation-info) {\n --connotation: var(--vvd-color-primary);\n --on-connotation: var(--vvd-color-on-primary);\n --connotation-soft: var(--vvd-color-neutral-20);\n --connotation-contrast: var(--vvd-color-neutral-90);\n}\n\n.control.connotation-cta {\n --connotation: var(--vvd-color-cta);\n --on-connotation: var(--vvd-color-on-cta);\n --connotation-soft: var(--vvd-color-cta-20);\n --connotation-contrast: var(--vvd-color-cta-90);\n}\n\n.control.connotation-success {\n --connotation: var(--vvd-color-success);\n --on-connotation: var(--vvd-color-on-success);\n --connotation-soft: var(--vvd-color-success-20);\n --connotation-contrast: var(--vvd-color-success-90);\n}\n\n.control.connotation-alert {\n --connotation: var(--vvd-color-alert);\n --on-connotation: var(--vvd-color-on-alert);\n --connotation-soft: var(--vvd-color-alert-20);\n --connotation-contrast: var(--vvd-color-alert-90);\n}\n\n.control.connotation-warning {\n --connotation: var(--vvd-color-warning);\n --on-connotation: var(--vvd-color-on-warning);\n --connotation-soft: var(--vvd-color-warning-20);\n --connotation-contrast: var(--vvd-color-warning-90);\n}\n\n.control.connotation-info {\n --connotation: var(--vvd-color-info);\n --on-connotation: var(--vvd-color-on-info);\n --connotation-soft: var(--vvd-color-info-20);\n --connotation-contrast: var(--vvd-color-info-90);\n}\n\n.control {\n --_appearance-color-text: var(--on-connotation);\n --_appearance-color-fill: var(--connotation);\n --_appearance-color-outline: transaprent;\n}\n.control.appearance-outlined {\n --_appearance-color-text: var(--connotation);\n --_appearance-color-fill: transaprent;\n --_appearance-color-outline: var(--connotation);\n}\n.control.appearance-subtle {\n --_appearance-color-text: var(--connotation-contrast);\n --_appearance-color-fill: var(--connotation-soft);\n --_appearance-color-outline: transaprent;\n}\n\n/* Size */\n.control:not(.size-base-small):not(.size-base-large) {\n block-size: 24px;\n padding-inline: 10px;\n}\n\n.control.size-base-small {\n block-size: 20px;\n padding-inline: 8px;\n}\n\n.control.size-base-large {\n block-size: 28px;\n padding-inline: 12px;\n}\n\n/* Shape */\n.control:not(.shape-pill) {\n border-radius: 4px;\n}\n\n.control.shape-pill {\n border-radius: 14px;\n}\n\n/* Icon */\n.icon-trailing .icon {\n order: 1;\n}";
|
|
35
|
-
styleInject(css_248z);
|
|
36
|
-
|
|
37
|
-
let _ = t => t,
|
|
38
|
-
_t;
|
|
39
|
-
|
|
40
|
-
const getClasses = ({
|
|
41
|
-
connotation,
|
|
42
|
-
appearance,
|
|
43
|
-
shape,
|
|
44
|
-
size,
|
|
45
|
-
iconTrailing
|
|
46
|
-
}) => classNames('control', [`connotation-${connotation}`, Boolean(connotation)], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], [`size-${size}`, Boolean(size)], ['icon-trailing', iconTrailing]);
|
|
47
|
-
|
|
48
|
-
const badgeTemplate = context => {
|
|
49
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
50
|
-
return html(_t || (_t = _`
|
|
51
|
-
<span class="${0}">
|
|
52
|
-
${0}
|
|
53
|
-
${0}
|
|
54
|
-
</span>`), getClasses, x => affixIconTemplate(x.icon), x => x.text);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const VIVIDBadge = Badge.compose({
|
|
58
|
-
baseName: 'badge',
|
|
59
|
-
template: badgeTemplate,
|
|
60
|
-
styles: css_248z
|
|
61
|
-
});
|
|
62
|
-
designSystem.register(VIVIDBadge());
|
|
63
|
-
|
|
64
|
-
export { VIVIDBadge };
|
|
13
|
+
registerBadge();
|