@vonage/vivid 2.25.10 → 3.0.0-next.3

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 (64) hide show
  1. package/README.md +7 -0
  2. package/badge/index.js +55 -0
  3. package/breadcrumb/index.js +212 -0
  4. package/breadcrumb-item/index.js +49 -0
  5. package/button/index.js +752 -0
  6. package/elevation/index.js +38 -0
  7. package/focus/index.js +3 -0
  8. package/icon/index.js +5 -0
  9. package/index.d.ts +1 -0
  10. package/index.js +19 -63
  11. package/layout/index.js +53 -0
  12. package/lib/badge/badge.d.ts +17 -0
  13. package/lib/badge/badge.template.d.ts +4 -0
  14. package/lib/badge/index.d.ts +3 -0
  15. package/lib/breadcrumb/breadcrumb.d.ts +3 -0
  16. package/lib/breadcrumb/index.d.ts +2 -0
  17. package/lib/breadcrumb-item/breadcrumb-item.d.ts +5 -0
  18. package/lib/breadcrumb-item/breadcrumb-item.template.d.ts +5 -0
  19. package/lib/breadcrumb-item/index.d.ts +2 -0
  20. package/lib/button/button.d.ts +17 -0
  21. package/lib/button/button.template.d.ts +4 -0
  22. package/lib/button/index.d.ts +21 -0
  23. package/lib/components.d.ts +9 -0
  24. package/lib/elevation/elevation.d.ts +4 -0
  25. package/lib/elevation/elevation.template.d.ts +4 -0
  26. package/lib/elevation/index.d.ts +2 -0
  27. package/lib/enums.d.ts +44 -0
  28. package/lib/focus/focus.d.ts +3 -0
  29. package/lib/focus/focus.template.d.ts +4 -0
  30. package/lib/focus/index.d.ts +2 -0
  31. package/lib/icon/icon.d.ts +13 -0
  32. package/lib/icon/icon.placeholder.d.ts +1 -0
  33. package/lib/icon/icon.template.d.ts +4 -0
  34. package/lib/icon/index.d.ts +2 -0
  35. package/lib/layout/index.d.ts +2 -0
  36. package/lib/layout/layout.d.ts +16 -0
  37. package/lib/layout/layout.template.d.ts +4 -0
  38. package/lib/sidenav-item/index.d.ts +3 -0
  39. package/lib/sidenav-item/sidenav-item.d.ts +7 -0
  40. package/lib/sidenav-item/sidenav-item.template.d.ts +4 -0
  41. package/lib/text-anchor/index.d.ts +2 -0
  42. package/lib/text-anchor/text-anchor.d.ts +4 -0
  43. package/lib/text-anchor/text-anchor.template.d.ts +4 -0
  44. package/package.json +10 -317
  45. package/shared/affix.js +44 -0
  46. package/shared/anchor.js +78 -0
  47. package/shared/apply-mixins.js +22 -0
  48. package/shared/aria-global.js +156 -0
  49. package/shared/breadcrumb-item.js +25 -0
  50. package/shared/class-names.js +15 -0
  51. package/shared/design-system/index.d.ts +3 -0
  52. package/shared/index.js +1500 -0
  53. package/shared/index2.js +4911 -0
  54. package/shared/index3.js +21 -0
  55. package/shared/patterns/affix.d.ts +10 -0
  56. package/shared/patterns/index.d.ts +1 -0
  57. package/shared/style-inject.es.js +28 -0
  58. package/shared/text-anchor.template.js +47 -0
  59. package/shared/web.dom-collections.iterator.js +1479 -0
  60. package/sidenav-item/index.js +79 -0
  61. package/styles/fonts/spezia.css +23 -0
  62. package/styles/themes/dark.css +193 -0
  63. package/styles/themes/light.css +193 -0
  64. package/text-anchor/index.js +25 -0
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # components
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Running unit tests
6
+
7
+ Run `nx test components` to execute the unit tests via [Jest](https://jestjs.io).
package/badge/index.js ADDED
@@ -0,0 +1,55 @@
1
+ import '../shared/index.js';
2
+ import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index2.js';
3
+ import '../shared/web.dom-collections.iterator.js';
4
+ import { P as PrefixOrSuffix, p as prefixOrSuffixTemplate } 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';
8
+
9
+ class Badge extends FoundationElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.text = '';
13
+ }
14
+
15
+ }
16
+
17
+ __decorate([attr, __metadata("design:type", String)], Badge.prototype, "connotation", void 0);
18
+
19
+ __decorate([attr, __metadata("design:type", String)], Badge.prototype, "shape", void 0);
20
+
21
+ __decorate([attr, __metadata("design:type", String)], Badge.prototype, "appearance", void 0);
22
+
23
+ __decorate([attr, __metadata("design:type", String)], Badge.prototype, "size", void 0);
24
+
25
+ __decorate([attr, __metadata("design:type", Object)], Badge.prototype, "text", void 0);
26
+
27
+ applyMixins(Badge, PrefixOrSuffix);
28
+
29
+ var css_248z = "/*\n Do not edit directly\n Generated on Sun, 23 Jan 2022 11:15:05 GMT\n*/\n.control.appearance-filled, .control:not(.appearance-outlined):not(.appearance-soft) {\n --appearance-color-fill: var(--connotation);\n --appearance-color-text: var(--on-connotation);\n}\n\n.control.appearance-outlined {\n --appearance-color-fill: transparent;\n --appearance-color-outline: var(--connotation);\n --appearance-color-text: var(--connotation-contrast);\n}\n\n.control.appearance-soft {\n --appearance-color-fill: var(--connotation-soft);\n --appearance-color-text: var(--connotation-contrast);\n}\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-primary);\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/* 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.icon-trailing {\n order: 1;\n}";
30
+ styleInject(css_248z);
31
+
32
+ let _ = t => t,
33
+ _t;
34
+
35
+ const getClasses = ({
36
+ connotation,
37
+ appearance,
38
+ shape,
39
+ size
40
+ }) => classNames('control', [`connotation-${connotation}`, Boolean(connotation)], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], [`size-${size}`, Boolean(size)]);
41
+
42
+ const badgeTemplate = context => html(_t || (_t = _`
43
+ <span class="${0}">
44
+ ${0}
45
+ ${0}
46
+ </span>`), getClasses, () => prefixOrSuffixTemplate(context), x => x.text);
47
+
48
+ const VIVIDBadge = Badge.compose({
49
+ baseName: 'badge',
50
+ template: badgeTemplate,
51
+ styles: css_248z
52
+ });
53
+ designSystem.register(VIVIDBadge());
54
+
55
+ export { VIVIDBadge };
@@ -0,0 +1,212 @@
1
+ import { O as Observable, e as emptyArray, A as AttachedBehaviorHTMLDirective, h as html, F as FoundationElement, _ as __decorate, o as observable, d as designSystem } from '../shared/index2.js';
2
+ import { s as styleInject } from '../shared/style-inject.es.js';
3
+ import { B as BreadcrumbItem } from '../shared/breadcrumb-item.js';
4
+ import '../shared/apply-mixins.js';
5
+ import '../shared/anchor.js';
6
+ import '../shared/aria-global.js';
7
+
8
+ /**
9
+ * Creates a function that can be used to filter a Node array, selecting only elements.
10
+ * @param selector - An optional selector to restrict the filter to.
11
+ * @public
12
+ */
13
+ function elements(selector) {
14
+ if (selector) {
15
+ return function (value, index, array) {
16
+ return value.nodeType === 1 && value.matches(selector);
17
+ };
18
+ }
19
+ return function (value, index, array) {
20
+ return value.nodeType === 1;
21
+ };
22
+ }
23
+ /**
24
+ * A base class for node observation.
25
+ * @internal
26
+ */
27
+ class NodeObservationBehavior {
28
+ /**
29
+ * Creates an instance of NodeObservationBehavior.
30
+ * @param target - The target to assign the nodes property on.
31
+ * @param options - The options to use in configuring node observation.
32
+ */
33
+ constructor(target, options) {
34
+ this.target = target;
35
+ this.options = options;
36
+ this.source = null;
37
+ }
38
+ /**
39
+ * Bind this behavior to the source.
40
+ * @param source - The source to bind to.
41
+ * @param context - The execution context that the binding is operating within.
42
+ */
43
+ bind(source) {
44
+ const name = this.options.property;
45
+ this.shouldUpdate = Observable.getAccessors(source).some((x) => x.name === name);
46
+ this.source = source;
47
+ this.updateTarget(this.computeNodes());
48
+ if (this.shouldUpdate) {
49
+ this.observe();
50
+ }
51
+ }
52
+ /**
53
+ * Unbinds this behavior from the source.
54
+ * @param source - The source to unbind from.
55
+ */
56
+ unbind() {
57
+ this.updateTarget(emptyArray);
58
+ this.source = null;
59
+ if (this.shouldUpdate) {
60
+ this.disconnect();
61
+ }
62
+ }
63
+ /** @internal */
64
+ handleEvent() {
65
+ this.updateTarget(this.computeNodes());
66
+ }
67
+ computeNodes() {
68
+ let nodes = this.getNodes();
69
+ if (this.options.filter !== void 0) {
70
+ nodes = nodes.filter(this.options.filter);
71
+ }
72
+ return nodes;
73
+ }
74
+ updateTarget(value) {
75
+ this.source[this.options.property] = value;
76
+ }
77
+ }
78
+
79
+ /**
80
+ * The runtime behavior for slotted node observation.
81
+ * @public
82
+ */
83
+ class SlottedBehavior extends NodeObservationBehavior {
84
+ /**
85
+ * Creates an instance of SlottedBehavior.
86
+ * @param target - The slot element target to observe.
87
+ * @param options - The options to use when observing the slot.
88
+ */
89
+ constructor(target, options) {
90
+ super(target, options);
91
+ }
92
+ /**
93
+ * Begins observation of the nodes.
94
+ */
95
+ observe() {
96
+ this.target.addEventListener("slotchange", this);
97
+ }
98
+ /**
99
+ * Disconnects observation of the nodes.
100
+ */
101
+ disconnect() {
102
+ this.target.removeEventListener("slotchange", this);
103
+ }
104
+ /**
105
+ * Retrieves the nodes that should be assigned to the target.
106
+ */
107
+ getNodes() {
108
+ return this.target.assignedNodes(this.options);
109
+ }
110
+ }
111
+ /**
112
+ * A directive that observes the `assignedNodes()` of a slot and updates a property
113
+ * whenever they change.
114
+ * @param propertyOrOptions - The options used to configure slotted node observation.
115
+ * @public
116
+ */
117
+ function slotted(propertyOrOptions) {
118
+ if (typeof propertyOrOptions === "string") {
119
+ propertyOrOptions = { property: propertyOrOptions };
120
+ }
121
+ return new AttachedBehaviorHTMLDirective("fast-slotted", SlottedBehavior, propertyOrOptions);
122
+ }
123
+
124
+ /**
125
+ * The template for the {@link @microsoft/fast-foundation#Breadcrumb} component.
126
+ * @public
127
+ */
128
+ const breadcrumbTemplate = (context, definition) => html `
129
+ <template role="navigation">
130
+ <div role="list" class="list" part="list">
131
+ <slot
132
+ ${slotted({ property: "slottedBreadcrumbItems", filter: elements() })}
133
+ ></slot>
134
+ </div>
135
+ </template>
136
+ `;
137
+
138
+ /**
139
+ * A Breadcrumb Custom HTML Element.
140
+ *
141
+ * @public
142
+ */
143
+ class Breadcrumb$1 extends FoundationElement {
144
+ slottedBreadcrumbItemsChanged() {
145
+ if (this.$fastController.isConnected) {
146
+ if (this.slottedBreadcrumbItems === undefined ||
147
+ this.slottedBreadcrumbItems.length === 0) {
148
+ return;
149
+ }
150
+ const lastNode = this.slottedBreadcrumbItems[this.slottedBreadcrumbItems.length - 1];
151
+ this.setItemSeparator(lastNode);
152
+ this.setLastItemAriaCurrent(lastNode);
153
+ }
154
+ }
155
+ setItemSeparator(lastNode) {
156
+ this.slottedBreadcrumbItems.forEach((item) => {
157
+ if (item instanceof BreadcrumbItem) {
158
+ item.separator = true;
159
+ }
160
+ });
161
+ if (lastNode instanceof BreadcrumbItem) {
162
+ lastNode.separator = false;
163
+ }
164
+ }
165
+ /**
166
+ * @internal
167
+ * Finds href on childnodes in the light DOM or shadow DOM.
168
+ * We look in the shadow DOM because we insert an anchor when breadcrumb-item has an href.
169
+ */
170
+ findChildWithHref(node) {
171
+ var _a, _b;
172
+ if (node.childElementCount > 0) {
173
+ return node.querySelector("a[href]");
174
+ }
175
+ else if ((_a = node.shadowRoot) === null || _a === void 0 ? void 0 : _a.childElementCount) {
176
+ return (_b = node.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("a[href]");
177
+ }
178
+ else
179
+ return null;
180
+ }
181
+ /**
182
+ * If child node with an anchor tag and with href is found then apply aria-current to child node otherwise apply aria-current to the host element, with an href
183
+ */
184
+ setLastItemAriaCurrent(lastNode) {
185
+ const childNodeWithHref = this.findChildWithHref(lastNode);
186
+ if (childNodeWithHref === null &&
187
+ lastNode.hasAttribute("href") &&
188
+ lastNode instanceof BreadcrumbItem) {
189
+ lastNode.ariaCurrent = "page";
190
+ }
191
+ else if (childNodeWithHref !== null) {
192
+ childNodeWithHref.setAttribute("aria-current", "page");
193
+ }
194
+ }
195
+ }
196
+ __decorate([
197
+ observable
198
+ ], Breadcrumb$1.prototype, "slottedBreadcrumbItems", void 0);
199
+
200
+ var css_248z = ".list {\n display: flex;\n}";
201
+ styleInject(css_248z);
202
+
203
+ class Breadcrumb extends Breadcrumb$1 {}
204
+
205
+ const vividBreadcrumb = Breadcrumb.compose({
206
+ baseName: 'breadcrumb',
207
+ template: breadcrumbTemplate,
208
+ styles: css_248z
209
+ });
210
+ designSystem.register(vividBreadcrumb());
211
+
212
+ export { vividBreadcrumb };
@@ -0,0 +1,49 @@
1
+ import { _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index2.js';
2
+ import { s as styleInject } from '../shared/style-inject.es.js';
3
+ import { B as BreadcrumbItem$1 } from '../shared/breadcrumb-item.js';
4
+ import { t as textAnchorTemplate } from '../shared/text-anchor.template.js';
5
+ import { w as when } from '../shared/index.js';
6
+ import { c as classNames } from '../shared/class-names.js';
7
+ import '../shared/apply-mixins.js';
8
+ import '../shared/anchor.js';
9
+ import '../shared/aria-global.js';
10
+ import '../shared/web.dom-collections.iterator.js';
11
+
12
+ var css_248z = "/*\n Do not edit directly\n Generated on Sun, 23 Jan 2022 11:15:05 GMT\n*/\n.breadcrumb-item {\n font: 400 ultra-condensed 14px / 20px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n display: flex;\n align-items: center;\n color: var(--vvd-color-neutral-70);\n}\n.breadcrumb-item a {\n color: var(--vvd-color-cta-70);\n text-decoration: none;\n}\n.breadcrumb-item a:hover {\n text-decoration: underline;\n}\n.breadcrumb-item vwc-icon {\n margin: 0 16px;\n color: var(--vvd-color-on-canvas);\n}";
13
+ styleInject(css_248z);
14
+
15
+ class BreadcrumbItem extends BreadcrumbItem$1 {
16
+ constructor() {
17
+ super();
18
+ this.text = '';
19
+ }
20
+
21
+ }
22
+
23
+ __decorate([attr, __metadata("design:type", String)], BreadcrumbItem.prototype, "text", void 0);
24
+
25
+ let _2 = t => t,
26
+ _t,
27
+ _t2,
28
+ _t3,
29
+ _t4;
30
+
31
+ const getClasses = _ => classNames('control', 'breadcrumb-item');
32
+
33
+ const BreadcrumbItemTemplate = (context, definition) => html(_t || (_t = _2`
34
+ <div roll="listitem" part="listitem" class="${0}">
35
+ ${0}
36
+
37
+ ${0}
38
+
39
+ ${0}
40
+ </div>`), getClasses, when(x => x.text && !x.href, html(_t2 || (_t2 = _2`${0}`), x => x.text)), when(x => x.text && x.href && x.href.length > 0, html(_t3 || (_t3 = _2`${0}`), textAnchorTemplate())), when(x => x.separator, html(_t4 || (_t4 = _2`<vwc-icon type="chevron-right-line"></vwc-icon>`))));
41
+
42
+ const vividBreadcrumbItem = BreadcrumbItem.compose({
43
+ baseName: 'breadcrumb-item',
44
+ template: BreadcrumbItemTemplate,
45
+ styles: css_248z
46
+ });
47
+ designSystem.register(vividBreadcrumbItem());
48
+
49
+ export { vividBreadcrumbItem };