@vonage/vivid 3.4.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +22 -9
  2. package/banner/index.js +2 -0
  3. package/breadcrumb/index.js +1 -1
  4. package/breadcrumb-item/index.js +1 -1
  5. package/button/index.js +2 -0
  6. package/calendar/index.js +1 -1
  7. package/calendar-event/index.js +1 -1
  8. package/card/index.js +2 -2
  9. package/checkbox/index.js +1 -1
  10. package/combobox/index.js +6 -4
  11. package/custom-elements.json +124 -0
  12. package/data-grid/index.js +1 -1
  13. package/dialog/index.js +5 -2
  14. package/divider/index.js +1 -1
  15. package/elevation/index.js +1 -1
  16. package/fab/index.js +1 -1
  17. package/header/index.js +2 -2
  18. package/index.js +26 -26
  19. package/layout/index.js +1 -1
  20. package/lib/action-group/action-group.d.ts +2 -0
  21. package/lib/button/button.d.ts +1 -0
  22. package/lib/button/button.template.d.ts +1 -1
  23. package/lib/data-grid/data-grid.d.ts +8 -0
  24. package/lib/dialog/dialog.d.ts +2 -0
  25. package/lib/menu/menu.d.ts +1 -0
  26. package/lib/select/select.d.ts +2 -3
  27. package/listbox/index.js +2 -2
  28. package/menu/index.js +6 -4
  29. package/menu-item/index.js +1 -1
  30. package/nav/index.js +1 -1
  31. package/nav-disclosure/index.js +1 -1
  32. package/nav-item/index.js +1 -1
  33. package/note/index.js +1 -1
  34. package/number-field/index.js +4 -2
  35. package/option/index.js +1 -1
  36. package/package.json +1 -1
  37. package/popup/index.js +4 -2
  38. package/progress/index.js +1 -1
  39. package/progress-ring/index.js +1 -1
  40. package/select/index.js +5 -3
  41. package/shared/definition.js +1 -1
  42. package/shared/definition10.js +69 -91
  43. package/shared/definition11.js +91 -40
  44. package/shared/definition12.js +31 -755
  45. package/shared/definition13.js +754 -93
  46. package/shared/definition14.js +100 -103
  47. package/shared/definition15.js +106 -24
  48. package/shared/definition16.js +24 -164
  49. package/shared/definition17.js +108 -663
  50. package/shared/definition18.js +667 -1533
  51. package/shared/definition19.js +1545 -223
  52. package/shared/definition2.js +1 -1
  53. package/shared/definition20.js +183 -961
  54. package/shared/definition21.js +1038 -203
  55. package/shared/definition22.js +226 -67
  56. package/shared/definition23.js +68 -77
  57. package/shared/definition24.js +76 -47
  58. package/shared/definition25.js +46 -32
  59. package/shared/definition26.js +35 -49
  60. package/shared/definition27.js +48 -338
  61. package/shared/definition28.js +273 -282
  62. package/shared/definition29.js +356 -14
  63. package/shared/definition30.js +13 -67
  64. package/shared/definition31.js +65 -21
  65. package/shared/definition32.js +21 -39
  66. package/shared/definition33.js +31 -432
  67. package/shared/definition34.js +432 -76
  68. package/shared/definition35.js +76 -59
  69. package/shared/definition36.js +1 -1
  70. package/shared/definition37.js +1 -1
  71. package/shared/definition38.js +7 -6
  72. package/shared/definition39.js +1 -1
  73. package/shared/definition4.js +1 -1
  74. package/shared/definition41.js +1 -1
  75. package/shared/definition42.js +1 -1
  76. package/shared/definition44.js +1 -1
  77. package/shared/definition45.js +1 -1
  78. package/shared/definition47.js +2 -2
  79. package/shared/definition48.js +1 -1
  80. package/shared/definition5.js +10 -3
  81. package/shared/definition6.js +1 -1
  82. package/shared/definition7.js +1 -1
  83. package/shared/definition8.js +1 -1
  84. package/shared/definition9.js +14 -4
  85. package/shared/form-elements.js +1 -1
  86. package/shared/icon.js +1 -1
  87. package/shared/listbox.js +1 -1
  88. package/shared/patterns/form-elements/form-elements.d.ts +2 -2
  89. package/shared/text-field.js +1 -1
  90. package/styles/core/all.css +1 -1
  91. package/styles/core/theme.css +1 -1
  92. package/styles/core/typography.css +1 -1
  93. package/styles/tokens/theme-dark.css +4 -4
  94. package/styles/tokens/theme-light.css +4 -4
  95. package/tooltip/index.js +4 -2
package/menu/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { r as registerMenu } from '../shared/definition27.js';
1
+ import { r as registerMenu } from '../shared/definition28.js';
2
2
  import '../shared/index.js';
3
- import '../shared/definition18.js';
3
+ import '../shared/definition19.js';
4
4
  import '../shared/definition9.js';
5
5
  import '../shared/definition3.js';
6
6
  import '../shared/icon.js';
@@ -11,6 +11,8 @@ import '../shared/class-names.js';
11
11
  import '../shared/when.js';
12
12
  import '../shared/definition4.js';
13
13
  import '../shared/focus.js';
14
+ import '../shared/definition10.js';
15
+ import '../shared/base-progress.js';
14
16
  import '../shared/affix.js';
15
17
  import '../shared/button.js';
16
18
  import '../shared/apply-mixins.js';
@@ -20,9 +22,9 @@ import '../shared/aria-global.js';
20
22
  import '../shared/start-end.js';
21
23
  import '../shared/ref.js';
22
24
  import '../shared/focus2.js';
23
- import '../shared/definition15.js';
25
+ import '../shared/definition16.js';
24
26
  import '../shared/es.object.assign.js';
25
- import '../shared/definition28.js';
27
+ import '../shared/definition29.js';
26
28
  import '../shared/direction.js';
27
29
  import '../shared/dom.js';
28
30
  import '../shared/slotted.js';
@@ -1,4 +1,4 @@
1
- import { b as registerMenuItem } from '../shared/definition28.js';
1
+ import { b as registerMenuItem } from '../shared/definition29.js';
2
2
  import '../shared/index.js';
3
3
  import '../shared/definition3.js';
4
4
  import '../shared/icon.js';
package/nav/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as registerNav } from '../shared/definition29.js';
1
+ import { r as registerNav } from '../shared/definition30.js';
2
2
  import '../shared/index.js';
3
3
 
4
4
  registerNav();
@@ -1,4 +1,4 @@
1
- import { r as registerNavDisclosure } from '../shared/definition30.js';
1
+ import { r as registerNavDisclosure } from '../shared/definition31.js';
2
2
  import '../shared/index.js';
3
3
  import '../shared/definition3.js';
4
4
  import '../shared/icon.js';
package/nav-item/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as registerNavItem } from '../shared/definition31.js';
1
+ import { r as registerNavItem } from '../shared/definition32.js';
2
2
  import '../shared/index.js';
3
3
  import '../shared/definition3.js';
4
4
  import '../shared/icon.js';
package/note/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as registerNote } from '../shared/definition32.js';
1
+ import { r as registerNote } from '../shared/definition33.js';
2
2
  import '../shared/index.js';
3
3
  import '../shared/definition3.js';
4
4
  import '../shared/icon.js';
@@ -1,4 +1,4 @@
1
- import { r as registerNumberField } from '../shared/definition33.js';
1
+ import { r as registerNumberField } from '../shared/definition34.js';
2
2
  import '../shared/index.js';
3
3
  import '../shared/definition9.js';
4
4
  import '../shared/definition3.js';
@@ -10,6 +10,8 @@ import '../shared/class-names.js';
10
10
  import '../shared/when.js';
11
11
  import '../shared/definition4.js';
12
12
  import '../shared/focus.js';
13
+ import '../shared/definition10.js';
14
+ import '../shared/base-progress.js';
13
15
  import '../shared/affix.js';
14
16
  import '../shared/button.js';
15
17
  import '../shared/apply-mixins.js';
@@ -19,7 +21,7 @@ import '../shared/aria-global.js';
19
21
  import '../shared/start-end.js';
20
22
  import '../shared/ref.js';
21
23
  import '../shared/focus2.js';
22
- import '../shared/definition22.js';
24
+ import '../shared/definition23.js';
23
25
  import '../shared/aria.js';
24
26
  import '../shared/form-elements.js';
25
27
  import '../shared/text-field2.js';
package/option/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as registerOption } from '../shared/definition19.js';
1
+ import { r as registerOption } from '../shared/definition20.js';
2
2
  import '../shared/index.js';
3
3
  import '../shared/definition3.js';
4
4
  import '../shared/icon.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vonage/vivid",
3
- "version": "3.4.0",
3
+ "version": "3.6.0",
4
4
  "type": "module",
5
5
  "module": "./index.js",
6
6
  "main": "./index.js",
package/popup/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as registerPopup } from '../shared/definition18.js';
1
+ import { r as registerPopup } from '../shared/definition19.js';
2
2
  import '../shared/index.js';
3
3
  import '../shared/definition9.js';
4
4
  import '../shared/definition3.js';
@@ -10,6 +10,8 @@ import '../shared/class-names.js';
10
10
  import '../shared/when.js';
11
11
  import '../shared/definition4.js';
12
12
  import '../shared/focus.js';
13
+ import '../shared/definition10.js';
14
+ import '../shared/base-progress.js';
13
15
  import '../shared/affix.js';
14
16
  import '../shared/button.js';
15
17
  import '../shared/apply-mixins.js';
@@ -19,7 +21,7 @@ import '../shared/aria-global.js';
19
21
  import '../shared/start-end.js';
20
22
  import '../shared/ref.js';
21
23
  import '../shared/focus2.js';
22
- import '../shared/definition15.js';
24
+ import '../shared/definition16.js';
23
25
  import '../shared/es.object.assign.js';
24
26
 
25
27
  registerPopup();
package/progress/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as registerProgress } from '../shared/definition34.js';
1
+ import { r as registerProgress } from '../shared/definition35.js';
2
2
  import '../shared/index.js';
3
3
  import '../shared/base-progress.js';
4
4
  import '../shared/when.js';
@@ -1,4 +1,4 @@
1
- import { r as registerProgressRing } from '../shared/definition35.js';
1
+ import { r as registerProgressRing } from '../shared/definition10.js';
2
2
  import '../shared/index.js';
3
3
  import '../shared/base-progress.js';
4
4
  import '../shared/when.js';
package/select/index.js CHANGED
@@ -2,7 +2,7 @@ import { r as registerSelect } from '../shared/definition38.js';
2
2
  import '../shared/index.js';
3
3
  import '../shared/definition4.js';
4
4
  import '../shared/focus.js';
5
- import '../shared/definition18.js';
5
+ import '../shared/definition19.js';
6
6
  import '../shared/definition9.js';
7
7
  import '../shared/definition3.js';
8
8
  import '../shared/icon.js';
@@ -11,6 +11,8 @@ import '../shared/string-trim.js';
11
11
  import '../shared/_has.js';
12
12
  import '../shared/class-names.js';
13
13
  import '../shared/when.js';
14
+ import '../shared/definition10.js';
15
+ import '../shared/base-progress.js';
14
16
  import '../shared/affix.js';
15
17
  import '../shared/button.js';
16
18
  import '../shared/apply-mixins.js';
@@ -20,9 +22,9 @@ import '../shared/aria-global.js';
20
22
  import '../shared/start-end.js';
21
23
  import '../shared/ref.js';
22
24
  import '../shared/focus2.js';
23
- import '../shared/definition15.js';
25
+ import '../shared/definition16.js';
24
26
  import '../shared/es.object.assign.js';
25
- import '../shared/definition19.js';
27
+ import '../shared/definition20.js';
26
28
  import '../shared/dom.js';
27
29
  import '../shared/form-elements.js';
28
30
  import '../shared/listbox.js';
@@ -186,7 +186,7 @@ __decorate([
186
186
  observable
187
187
  ], Accordion$1.prototype, "accordionItems", void 0);
188
188
 
189
- var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 16 Mar 2023 08:36:16 GMT\n */\n.base {\n display: flex;\n box-sizing: border-box;\n flex-direction: column;\n}\n\n::slotted(:not(:only-of-type)) {\n border-bottom: 1px solid var(--vvd-color-neutral-200);\n}";
189
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 30 Mar 2023 16:21:30 GMT\n */\n.base {\n display: flex;\n box-sizing: border-box;\n flex-direction: column;\n}\n\n::slotted(:not(:only-of-type)) {\n border-bottom: 1px solid var(--vvd-color-neutral-200);\n}";
190
190
 
191
191
  class Accordion extends Accordion$1 {
192
192
  constructor() {
@@ -1,99 +1,77 @@
1
- import { F as FoundationElement, _ as __decorate, o as observable, h as html, r as registerFactory } from './index.js';
2
- import { s as slotted, e as elements } from './slotted.js';
3
- import { B as BreadcrumbItem } from './breadcrumb-item.js';
1
+ import { _ as __decorate, a as attr, b as __metadata, h as html, r as registerFactory } from './index.js';
2
+ import { B as BaseProgress } from './base-progress.js';
3
+ import { w as when } from './when.js';
4
+ import { c as classNames } from './class-names.js';
4
5
 
5
- /**
6
- * A Breadcrumb Custom HTML Element.
7
- * @slot - The default slot for the breadcrumb items
8
- * @csspart list - The element wrapping the slotted items
9
- *
10
- * @public
11
- */
12
- class Breadcrumb$1 extends FoundationElement {
13
- slottedBreadcrumbItemsChanged() {
14
- if (this.$fastController.isConnected) {
15
- if (this.slottedBreadcrumbItems === undefined ||
16
- this.slottedBreadcrumbItems.length === 0) {
17
- return;
18
- }
19
- const lastNode = this.slottedBreadcrumbItems[this.slottedBreadcrumbItems.length - 1];
20
- this.slottedBreadcrumbItems.forEach((item) => {
21
- const itemIsLastNode = item === lastNode;
22
- this.setItemSeparator(item, itemIsLastNode);
23
- this.setAriaCurrent(item, itemIsLastNode);
24
- });
25
- }
26
- }
27
- setItemSeparator(item, isLastNode) {
28
- if (item instanceof BreadcrumbItem) {
29
- item.separator = !isLastNode;
30
- }
31
- }
32
- /**
33
- * Finds href on childnodes in the light DOM or shadow DOM.
34
- * We look in the shadow DOM because we insert an anchor when breadcrumb-item has an href.
35
- */
36
- findChildWithHref(node) {
37
- var _a, _b;
38
- if (node.childElementCount > 0) {
39
- return node.querySelector("a[href]");
40
- }
41
- else if ((_a = node.shadowRoot) === null || _a === void 0 ? void 0 : _a.childElementCount) {
42
- return (_b = node.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("a[href]");
43
- }
44
- else
45
- return null;
46
- }
47
- /**
48
- * Sets ARIA Current for the current node
49
- * If child node with an anchor tag and with href is found then set aria-current to correct value for the child node,
50
- * otherwise apply aria-current to the host element, with an href
51
- */
52
- setAriaCurrent(item, isLastNode) {
53
- const childNodeWithHref = this.findChildWithHref(item);
54
- if (childNodeWithHref === null &&
55
- item.hasAttribute("href") &&
56
- item instanceof BreadcrumbItem) {
57
- isLastNode
58
- ? item.setAttribute("aria-current", "page")
59
- : item.removeAttribute("aria-current");
60
- }
61
- else if (childNodeWithHref !== null) {
62
- isLastNode
63
- ? childNodeWithHref.setAttribute("aria-current", "page")
64
- : childNodeWithHref.removeAttribute("aria-current");
65
- }
66
- }
67
- }
68
- __decorate([
69
- observable
70
- ], Breadcrumb$1.prototype, "slottedBreadcrumbItems", void 0);
6
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 30 Mar 2023 16:21:30 GMT\n */\n.base {\n align-items: center;\n block-size: var(--_size);\n color: var(--_appearance-color-text);\n inline-size: var(--_size);\n outline: none;\n}\n.base.connotation-cta {\n --_connotation-color-primary: var(--vvd-color-cta-500);\n}\n.base.connotation-alert {\n --_connotation-color-primary: var(--vvd-color-alert-500);\n}\n.base.connotation-success {\n --_connotation-color-primary: var(--vvd-color-success-500);\n}\n.base:not(.connotation-cta, .connotation-alert, .connotation-success) {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n}\n.base {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base.size--5 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n}\n.base.size--4 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n}\n.base.size--3 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 12));\n}\n.base.size--2 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n}\n.base.size--1 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 4));\n}\n.base.size-1 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 4));\n}\n.base.size-2 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 8));\n}\n.base.size-3 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 12));\n}\n.base.size-4 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 16));\n}\n.base.size-5 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 20));\n}\n.base:not(.size--5, .size--4, .size--3, .size--2, .size--1, .size-1, .size-2, .size-3, .size-4, .size-5) {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}\n\n.progress {\n width: 100%;\n height: 100%;\n}\n\n.background {\n fill: none;\n stroke: transparent;\n stroke-width: 1px;\n}\n\n.determinate {\n fill: none;\n stroke: currentColor;\n stroke-linecap: round;\n stroke-width: 1px;\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n transition: all 0.2s ease-in-out;\n}\n\n.indeterminate-indicator-1 {\n animation: spin-infinite 2s linear infinite;\n fill: none;\n stroke: currentColor;\n stroke-linecap: round;\n stroke-width: 1px;\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n transition: all 0.2s ease-in-out;\n}\n\n.base.paused .indeterminate-indicator-1 {\n animation-play-state: paused;\n}\n\n@keyframes spin-infinite {\n 0% {\n stroke-dasharray: 0.01px 43.97px;\n transform: rotate(0deg);\n }\n 50% {\n stroke-dasharray: 21.99px 21.99px;\n transform: rotate(450deg);\n }\n 100% {\n stroke-dasharray: 0.01px 43.97px;\n transform: rotate(1080deg);\n }\n}";
71
7
 
72
- let _ = t => t,
73
- _t;
74
- const breadcrumbTemplate = () => html(_t || (_t = _`
75
- <nav aria-label="breadcrumbs" class="base">
76
- <div role="list" class="list">
77
- <slot
8
+ class ProgressRing extends BaseProgress {}
9
+ __decorate([attr, __metadata("design:type", String)], ProgressRing.prototype, "connotation", void 0);
10
+ __decorate([attr, __metadata("design:type", Number)], ProgressRing.prototype, "size", void 0);
11
+
12
+ let _2 = t => t,
13
+ _t,
14
+ _t2,
15
+ _t3;
16
+ const getClasses = ({
17
+ connotation,
18
+ size,
19
+ paused
20
+ }) => classNames('base', ['disabled', !!paused], [`connotation-${connotation}`, !!connotation], [`size-${size}`, !!size]);
21
+ const progressSegments = 44;
22
+ const ProgressRingTemplate = _ => html(_t || (_t = _2`
23
+ <div
24
+ role="progressbar"
25
+ aria-valuenow="${0}"
26
+ aria-valuemin="${0}"
27
+ aria-valuemax="${0}"
28
+ class="${0} ${0}"
29
+ >
30
+ ${0}
78
31
  ${0}
79
- ></slot>
80
32
  </div>
81
- </nav>
82
- `), slotted({
83
- property: 'slottedBreadcrumbItems',
84
- filter: elements()
85
- }));
86
-
87
- var css_248z = ".list {\n display: flex;\n}";
88
-
89
- class Breadcrumb extends Breadcrumb$1 {}
33
+ `), x => x.value, x => x.min, x => x.max, x => x.paused ? 'paused' : '', getClasses, when(x => typeof x.value === 'number', html(_t2 || (_t2 = _2`
34
+ <svg
35
+ class="progress"
36
+ viewBox="0 0 16 16"
37
+ >
38
+ <circle
39
+ class="background"
40
+ cx="8px"
41
+ cy="8px"
42
+ r="7px"
43
+ ></circle>
44
+ <circle
45
+ class="determinate"
46
+ style="stroke-dasharray: ${0}px ${0}px"
47
+ cx="8px"
48
+ cy="8px"
49
+ r="7px"
50
+ ></circle>
51
+ </svg>
52
+ `), x => progressSegments * x.percentComplete / 100, progressSegments)), when(x => typeof x.value !== 'number', html(_t3 || (_t3 = _2`
53
+ <svg class="progress" viewBox="0 0 16 16">
54
+ <circle
55
+ class="background"
56
+ cx="8px"
57
+ cy="8px"
58
+ r="7px"
59
+ ></circle>
60
+ <circle
61
+ class="indeterminate-indicator-1"
62
+ cx="8px"
63
+ cy="8px"
64
+ r="7px"
65
+ ></circle>
66
+ </svg>
67
+ `))));
90
68
 
91
- const breadcrumbDefinition = Breadcrumb.compose({
92
- baseName: 'breadcrumb',
93
- template: breadcrumbTemplate,
69
+ const progressRingDefinition = ProgressRing.compose({
70
+ baseName: 'progress-ring',
71
+ template: ProgressRingTemplate,
94
72
  styles: css_248z
95
73
  });
96
- const breadcrumbRegistries = [breadcrumbDefinition()];
97
- const registerBreadcrumb = registerFactory(breadcrumbRegistries);
74
+ const progressRingRegistries = [progressRingDefinition()];
75
+ const registerProgressRing = registerFactory(progressRingRegistries);
98
76
 
99
- export { breadcrumbRegistries as a, breadcrumbDefinition as b, registerBreadcrumb as r };
77
+ export { ProgressRing as P, progressRingDefinition as a, progressRingRegistries as p, registerProgressRing as r };
@@ -1,48 +1,99 @@
1
- import { _ as __decorate, a as attr, b as __metadata, h as html, r as registerFactory } from './index.js';
2
- import { i as iconRegistries } from './definition3.js';
3
- import { f as focusRegistries } from './definition4.js';
4
- import { B as BreadcrumbItem$1 } from './breadcrumb-item.js';
5
- import { t as textAnchorTemplate } from './text-anchor.template.js';
6
- import { I as Icon } from './icon.js';
7
- import { w as when } from './when.js';
8
- import { c as classNames } from './class-names.js';
1
+ import { F as FoundationElement, _ as __decorate, o as observable, h as html, r as registerFactory } from './index.js';
2
+ import { s as slotted, e as elements } from './slotted.js';
3
+ import { B as BreadcrumbItem } from './breadcrumb-item.js';
9
4
 
10
- var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 16 Mar 2023 08:36:16 GMT\n */\n.base {\n display: flex;\n align-items: center;\n color: var(--vvd-color-canvas-text);\n font: var(--vvd-typography-base);\n}\n.base .separator {\n margin: 0 16px;\n color: var(--vvd-color-neutral-600);\n font-size: 12px;\n}\n\n.control {\n position: relative;\n font: inherit;\n}\n@supports selector(:focus-visible) {\n .control:focus {\n outline: none;\n }\n}\n.control:any-link {\n color: var(--vvd-color-cta-600);\n text-decoration: none;\n}\n.control:any-link:hover {\n text-decoration: underline;\n}\n\n.focus-indicator {\n --focus-inset: -4px -8px;\n --focus-stroke-gap-color: transparent;\n border-radius: 6px;\n}\n.control:not(:focus-visible) > .focus-indicator {\n display: none;\n}";
11
-
12
- class BreadcrumbItem extends BreadcrumbItem$1 {
13
- constructor() {
14
- super();
15
- }
5
+ /**
6
+ * A Breadcrumb Custom HTML Element.
7
+ * @slot - The default slot for the breadcrumb items
8
+ * @csspart list - The element wrapping the slotted items
9
+ *
10
+ * @public
11
+ */
12
+ class Breadcrumb$1 extends FoundationElement {
13
+ slottedBreadcrumbItemsChanged() {
14
+ if (this.$fastController.isConnected) {
15
+ if (this.slottedBreadcrumbItems === undefined ||
16
+ this.slottedBreadcrumbItems.length === 0) {
17
+ return;
18
+ }
19
+ const lastNode = this.slottedBreadcrumbItems[this.slottedBreadcrumbItems.length - 1];
20
+ this.slottedBreadcrumbItems.forEach((item) => {
21
+ const itemIsLastNode = item === lastNode;
22
+ this.setItemSeparator(item, itemIsLastNode);
23
+ this.setAriaCurrent(item, itemIsLastNode);
24
+ });
25
+ }
26
+ }
27
+ setItemSeparator(item, isLastNode) {
28
+ if (item instanceof BreadcrumbItem) {
29
+ item.separator = !isLastNode;
30
+ }
31
+ }
32
+ /**
33
+ * Finds href on childnodes in the light DOM or shadow DOM.
34
+ * We look in the shadow DOM because we insert an anchor when breadcrumb-item has an href.
35
+ */
36
+ findChildWithHref(node) {
37
+ var _a, _b;
38
+ if (node.childElementCount > 0) {
39
+ return node.querySelector("a[href]");
40
+ }
41
+ else if ((_a = node.shadowRoot) === null || _a === void 0 ? void 0 : _a.childElementCount) {
42
+ return (_b = node.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("a[href]");
43
+ }
44
+ else
45
+ return null;
46
+ }
47
+ /**
48
+ * Sets ARIA Current for the current node
49
+ * If child node with an anchor tag and with href is found then set aria-current to correct value for the child node,
50
+ * otherwise apply aria-current to the host element, with an href
51
+ */
52
+ setAriaCurrent(item, isLastNode) {
53
+ const childNodeWithHref = this.findChildWithHref(item);
54
+ if (childNodeWithHref === null &&
55
+ item.hasAttribute("href") &&
56
+ item instanceof BreadcrumbItem) {
57
+ isLastNode
58
+ ? item.setAttribute("aria-current", "page")
59
+ : item.removeAttribute("aria-current");
60
+ }
61
+ else if (childNodeWithHref !== null) {
62
+ isLastNode
63
+ ? childNodeWithHref.setAttribute("aria-current", "page")
64
+ : childNodeWithHref.removeAttribute("aria-current");
65
+ }
66
+ }
16
67
  }
17
- __decorate([attr, __metadata("design:type", String)], BreadcrumbItem.prototype, "text", void 0);
68
+ __decorate([
69
+ observable
70
+ ], Breadcrumb$1.prototype, "slottedBreadcrumbItems", void 0);
18
71
 
19
- let _2 = t => t,
20
- _t,
21
- _t2,
22
- _t3,
23
- _t4;
24
- const getClasses = _ => classNames('base');
25
- const BreadcrumbItemTemplate = (context, definition) => {
26
- const iconTag = context.tagFor(Icon);
27
- return html(_t || (_t = _2`
28
- <div role="listitem" class="${0}">
29
- ${0}
72
+ let _ = t => t,
73
+ _t;
74
+ const breadcrumbTemplate = () => html(_t || (_t = _`
75
+ <nav aria-label="breadcrumbs" class="base">
76
+ <div role="list" class="list">
77
+ <slot
78
+ ${0}
79
+ ></slot>
80
+ </div>
81
+ </nav>
82
+ `), slotted({
83
+ property: 'slottedBreadcrumbItems',
84
+ filter: elements()
85
+ }));
30
86
 
31
- ${0}
87
+ var css_248z = ".list {\n display: flex;\n}";
32
88
 
33
- ${0}
34
- </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(context))), when(x => x.separator, html(_t4 || (_t4 = _2`<${0} class="separator" name="chevron-right-solid"></${0}>`), iconTag, iconTag)));
35
- };
89
+ class Breadcrumb extends Breadcrumb$1 {}
36
90
 
37
- const breadcrumbItemDefinition = BreadcrumbItem.compose({
38
- baseName: 'breadcrumb-item',
39
- template: BreadcrumbItemTemplate,
40
- styles: css_248z,
41
- shadowOptions: {
42
- delegatesFocus: true
43
- }
91
+ const breadcrumbDefinition = Breadcrumb.compose({
92
+ baseName: 'breadcrumb',
93
+ template: breadcrumbTemplate,
94
+ styles: css_248z
44
95
  });
45
- const breadcrumbItemRegistries = [breadcrumbItemDefinition(), ...iconRegistries, ...focusRegistries];
46
- const registerBreadcrumbItem = registerFactory(breadcrumbItemRegistries);
96
+ const breadcrumbRegistries = [breadcrumbDefinition()];
97
+ const registerBreadcrumb = registerFactory(breadcrumbRegistries);
47
98
 
48
- export { breadcrumbItemRegistries as a, breadcrumbItemDefinition as b, registerBreadcrumbItem as r };
99
+ export { breadcrumbRegistries as a, breadcrumbDefinition as b, registerBreadcrumb as r };