@vonage/vivid 3.39.0 → 3.41.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 (182) hide show
  1. package/accordion/index.js +2 -2
  2. package/accordion-item/index.js +2 -2
  3. package/alert/index.js +7 -5
  4. package/audio-player/index.js +33 -0
  5. package/avatar/index.js +2 -2
  6. package/badge/index.js +2 -2
  7. package/banner/index.js +9 -5
  8. package/breadcrumb/index.js +1 -1
  9. package/breadcrumb-item/index.js +3 -3
  10. package/button/index.js +5 -4
  11. package/calendar/index.js +1 -1
  12. package/calendar-event/index.js +1 -1
  13. package/card/index.js +4 -3
  14. package/checkbox/index.js +3 -3
  15. package/combobox/index.js +9 -7
  16. package/custom-elements.json +809 -5
  17. package/data-grid/index.js +3 -2
  18. package/date-picker/index.js +11 -9
  19. package/date-range-picker/index.js +11 -9
  20. package/dialog/index.js +10 -6
  21. package/divider/index.js +1 -1
  22. package/elevation/index.js +1 -1
  23. package/empty-state/index.js +2 -2
  24. package/fab/index.js +3 -3
  25. package/file-picker/index.js +6 -5
  26. package/focus/index.js +1 -1
  27. package/header/index.js +2 -2
  28. package/icon/index.js +1 -1
  29. package/index.js +60 -55
  30. package/layout/index.js +1 -1
  31. package/lib/alert/alert.d.ts +3 -1
  32. package/lib/alert/locale.d.ts +3 -0
  33. package/lib/audio-player/audio-player.d.ts +17 -0
  34. package/lib/audio-player/audio-player.template.d.ts +4 -0
  35. package/lib/audio-player/definition.d.ts +4 -0
  36. package/lib/audio-player/locale.d.ts +5 -0
  37. package/lib/banner/banner.d.ts +3 -1
  38. package/lib/banner/locale.d.ts +3 -0
  39. package/lib/card/card.d.ts +3 -0
  40. package/lib/card/card.template.d.ts +1 -1
  41. package/lib/card/definition.d.ts +1 -0
  42. package/lib/checkbox/checkbox.d.ts +2 -0
  43. package/lib/components.d.ts +2 -0
  44. package/lib/dialog/dialog.d.ts +4 -0
  45. package/lib/dialog/locale.d.ts +3 -0
  46. package/lib/enums.d.ts +2 -1
  47. package/lib/menu/menu.d.ts +1 -0
  48. package/lib/number-field/locale.d.ts +4 -0
  49. package/lib/number-field/number-field.d.ts +4 -2
  50. package/lib/progress/progress.d.ts +1 -0
  51. package/lib/progress-ring/progress-ring.d.ts +1 -0
  52. package/lib/radio/radio.d.ts +1 -0
  53. package/lib/selectable-box/definition.d.ts +3 -0
  54. package/lib/selectable-box/selectable-box.d.ts +12 -0
  55. package/lib/selectable-box/selectable-box.template.d.ts +4 -0
  56. package/lib/slider/definition.d.ts +1 -0
  57. package/lib/slider/slider.d.ts +5 -0
  58. package/lib/split-button/locale.d.ts +3 -0
  59. package/lib/split-button/split-button.d.ts +3 -1
  60. package/lib/text-area/text-area.d.ts +3 -0
  61. package/lib/text-field/text-field.d.ts +5 -2
  62. package/listbox/index.js +5 -4
  63. package/locales/en-GB.js +21 -0
  64. package/locales/en-US.js +21 -0
  65. package/locales/ja-JP.js +21 -0
  66. package/locales/zh-CN.js +21 -0
  67. package/menu/index.js +9 -8
  68. package/menu-item/index.js +3 -3
  69. package/nav/index.js +1 -1
  70. package/nav-disclosure/index.js +3 -3
  71. package/nav-item/index.js +3 -3
  72. package/note/index.js +2 -2
  73. package/number-field/index.js +8 -6
  74. package/option/index.js +3 -3
  75. package/package.json +1 -1
  76. package/pagination/index.js +6 -5
  77. package/popup/index.js +7 -6
  78. package/progress/index.js +1 -1
  79. package/progress-ring/index.js +1 -1
  80. package/radio/index.js +2 -2
  81. package/radio-group/index.js +2 -2
  82. package/select/index.js +10 -8
  83. package/selectable-box/index.js +23 -0
  84. package/shared/Reflector.js +65 -0
  85. package/shared/date-picker/calendar/segment.d.ts +21 -0
  86. package/shared/date-picker/date-picker-base.d.ts +1 -0
  87. package/shared/definition.js +3 -3
  88. package/shared/definition10.js +89 -227
  89. package/shared/definition11.js +151 -29
  90. package/shared/definition12.js +37 -766
  91. package/shared/definition13.js +747 -106
  92. package/shared/definition14.js +122 -192
  93. package/shared/definition15.js +156 -664
  94. package/shared/definition16.js +576 -1123
  95. package/shared/definition17.js +1278 -143
  96. package/shared/definition18.js +64 -298
  97. package/shared/definition19.js +358 -211
  98. package/shared/definition2.js +2 -2
  99. package/shared/definition20.js +259 -67
  100. package/shared/definition21.js +66 -58
  101. package/shared/definition22.js +43 -84
  102. package/shared/definition23.js +76 -2352
  103. package/shared/definition24.js +2362 -45
  104. package/shared/definition25.js +63 -27
  105. package/shared/definition26.js +24 -51
  106. package/shared/definition27.js +36 -813
  107. package/shared/definition28.js +837 -49
  108. package/shared/definition29.js +52 -89
  109. package/shared/definition3.js +1 -1
  110. package/shared/definition30.js +88 -24
  111. package/shared/definition31.js +25 -12
  112. package/shared/definition32.js +12 -52
  113. package/shared/definition33.js +28 -487
  114. package/shared/definition34.js +442 -197
  115. package/shared/definition35.js +260 -185
  116. package/shared/definition36.js +188 -69
  117. package/shared/definition37.js +72 -52
  118. package/shared/definition38.js +65 -421
  119. package/shared/definition39.js +435 -35
  120. package/shared/definition4.js +44 -16
  121. package/shared/definition40.js +32 -680
  122. package/shared/definition41.js +661 -77
  123. package/shared/definition42.js +103 -555
  124. package/shared/definition43.js +76 -103
  125. package/shared/definition44.js +522 -87
  126. package/shared/definition45.js +133 -22
  127. package/shared/definition46.js +131 -58
  128. package/shared/definition47.js +16 -501
  129. package/shared/definition48.js +69 -23
  130. package/shared/definition49.js +477 -108
  131. package/shared/definition5.js +160 -44
  132. package/shared/definition50.js +25 -271
  133. package/shared/definition51.js +103 -122
  134. package/shared/definition52.js +277 -122
  135. package/shared/definition53.js +274 -103
  136. package/shared/definition54.js +126 -71
  137. package/shared/definition55.js +128 -294
  138. package/shared/definition56.js +91 -13
  139. package/shared/definition57.js +298 -39
  140. package/shared/definition58.js +11 -175
  141. package/shared/definition59.js +47 -0
  142. package/shared/definition6.js +43 -33
  143. package/shared/definition60.js +181 -0
  144. package/shared/definition7.js +39 -105
  145. package/shared/definition8.js +122 -38
  146. package/shared/definition9.js +56 -89
  147. package/shared/enums.js +72 -0
  148. package/shared/icon.js +2 -2
  149. package/shared/index2.js +28 -1
  150. package/shared/key-codes.js +1 -1
  151. package/shared/key-codes2.js +9 -0
  152. package/shared/listbox.js +3 -8
  153. package/shared/localization/Locale.d.ts +12 -0
  154. package/shared/patterns/form-elements/form-elements.d.ts +6 -6
  155. package/shared/presentationDate.js +196 -143
  156. package/shared/radio.js +7 -0
  157. package/shared/text-field.js +1 -1
  158. package/shared/utils/Reflector.d.ts +8 -0
  159. package/shared/utils/randomId.d.ts +1 -0
  160. package/side-drawer/index.js +1 -1
  161. package/slider/index.js +3 -3
  162. package/split-button/index.js +6 -3
  163. package/style.css +889 -722
  164. package/styles/core/all.css +1 -1
  165. package/styles/core/theme.css +1 -1
  166. package/styles/core/typography.css +1 -1
  167. package/styles/tokens/theme-dark.css +4 -4
  168. package/styles/tokens/theme-light.css +4 -4
  169. package/styles/tokens/vivid-2-compat.css +1 -1
  170. package/switch/index.js +3 -3
  171. package/tab/index.js +3 -3
  172. package/tab-panel/index.js +1 -1
  173. package/tabs/index.js +5 -5
  174. package/tag/index.js +3 -3
  175. package/tag-group/index.js +1 -1
  176. package/text-area/index.js +4 -3
  177. package/text-field/index.js +4 -3
  178. package/toggletip/index.js +8 -7
  179. package/tooltip/index.js +8 -7
  180. package/tree-item/index.js +3 -3
  181. package/tree-view/index.js +1 -1
  182. package/vivid.api.json +392 -0
@@ -1,9 +1,14 @@
1
- import { a as attr, 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';
1
+ import { B as Button, a as buttonRegistries } from './definition11.js';
2
+ import { a as attr, F as FoundationElement, o as observable, v as volatile, h as html, r as registerFactory } from './index.js';
3
+ import { b as Size, S as Shape } from './enums.js';
4
+ import { e as elements } from './slotted.js';
5
+ import { r as ref } from './ref.js';
6
+ import { c as children } from './children.js';
7
+ import { r as repeat } from './repeat.js';
4
8
  import { c as classNames } from './class-names.js';
9
+ import { w as when } from './when.js';
5
10
 
6
- const styles = "/**\n * Do not edit directly\n * Generated on Tue, 17 Oct 2023 15:27:52 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 /* @cssprop [--vvd-progress-ring-cta-primary=var(--vvd-color-cta-500)] */\n --_connotation-color-primary: var(--vvd-progress-ring-cta-primary, var(--vvd-color-cta-500));\n}\n.base.connotation-alert {\n /* @cssprop [--vvd-progress-ring-alert-primary=var(--vvd-color-alert-500)] */\n --_connotation-color-primary: var(--vvd-progress-ring-alert-primary, var(--vvd-color-alert-500));\n}\n.base.connotation-success {\n /* @cssprop [--vvd-progress-ring-success-primary=var(--vvd-color-success-500)] */\n --_connotation-color-primary: var(--vvd-progress-ring-success-primary, var(--vvd-color-success-500));\n}\n.base:not(.connotation-cta, .connotation-alert, .connotation-success) {\n /* @cssprop [--vvd-progress-ring-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-progress-ring-accent-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-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base.size--6 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)) - 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.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--6, .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}";
11
+ const styles = "/**\n * Do not edit directly\n * Generated on Wed, 22 Nov 2023 16:09:43 GMT\n */\n.control {\n display: inline-flex;\n justify-content: space-between;\n}\n.control:not(.shape-pill) {\n border-radius: 4px;\n}\n.control.shape-pill {\n border-radius: 14px;\n}\n\n.buttons-wrapper {\n display: flex;\n column-gap: 4px;\n}\n\n.vwc-pagination-button[size=super-condensed] {\n --base-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n}\n.vwc-pagination-button[size=condensed] {\n --base-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n}\n.vwc-pagination-button[size=normal] {\n --base-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}\n.vwc-pagination-button::part(button) {\n padding-inline: 0;\n}\n\n.dots {\n align-self: center;\n text-align: center;\n}\n.dots:not(.size-super-condensed) {\n font: var(--vvd-typography-base-bold);\n}\n.dots.size-super-condensed {\n font: var(--vvd-typography-base-condensed-bold);\n inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n}\n.dots.size-condensed {\n inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n}\n.dots.size-normal {\n inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}";
7
12
 
8
13
  var __defProp = Object.defineProperty;
9
14
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -16,81 +21,195 @@ var __decorateClass = (decorators, target, key, kind) => {
16
21
  __defProp(target, key, result);
17
22
  return result;
18
23
  };
19
- class ProgressRing extends BaseProgress {
24
+ const MAX_DIGITS_AND_PLACEHOLDERS = 7;
25
+ const totalConverter = {
26
+ fromView: (value) => parseInt(value, 10),
27
+ toView: (value) => value.toString()
28
+ };
29
+ class Pagination extends FoundationElement {
30
+ constructor() {
31
+ super();
32
+ this.navIcons = false;
33
+ this.total = 0;
34
+ this.selectedIndex = 0;
35
+ this.addEventListener("tabpressed", (e) => {
36
+ const { value: currentLabel, shiftKey } = e.detail;
37
+ const index = this.paginationButtons.findIndex((button) => Number(button.label) === currentLabel);
38
+ const focusDirection = shiftKey ? -1 : 1;
39
+ const newIndex = index + focusDirection;
40
+ if (newIndex < 0) {
41
+ return this.prevButton.focus();
42
+ }
43
+ if (newIndex > this.paginationButtons.length - 1) {
44
+ return this.nextButton.focus();
45
+ }
46
+ this.paginationButtons && this.paginationButtons[index + focusDirection].focus();
47
+ });
48
+ }
49
+ get pagesList() {
50
+ return new Array(this.total < MAX_DIGITS_AND_PLACEHOLDERS ? this.total : MAX_DIGITS_AND_PLACEHOLDERS).fill(0).map((_, i, arr) => {
51
+ if (i === 0)
52
+ return 1;
53
+ if (i === arr.length - 1)
54
+ return this.total;
55
+ if (this.selectedIndex !== void 0 && this.total > MAX_DIGITS_AND_PLACEHOLDERS) {
56
+ if (this.selectedIndex < 4) {
57
+ if (i === MAX_DIGITS_AND_PLACEHOLDERS - 2)
58
+ return "...";
59
+ }
60
+ if (this.selectedIndex >= 4 && this.selectedIndex <= this.total - 5) {
61
+ if (i > 1 && i < MAX_DIGITS_AND_PLACEHOLDERS - 2)
62
+ return this.selectedIndex + (i - 2);
63
+ if (i === 1 || i === MAX_DIGITS_AND_PLACEHOLDERS - 2)
64
+ return "...";
65
+ }
66
+ if (this.selectedIndex > this.total - 5) {
67
+ if (i > 1)
68
+ return this.total - (6 - i);
69
+ if (i === 1)
70
+ return "...";
71
+ }
72
+ }
73
+ return i + 1;
74
+ });
75
+ }
76
+ totalChanged(_, newValue) {
77
+ if (newValue < 0) {
78
+ this.total = 0;
79
+ }
80
+ this.selectedIndex = 0;
81
+ }
82
+ selectedIndexChanged(oldValue, newValue) {
83
+ if (oldValue === void 0)
84
+ return;
85
+ this.$emit("pagination-change", { selectedIndex: newValue, total: this.total, oldIndex: oldValue });
86
+ }
87
+ paginationButtonsChanged(_, newValue) {
88
+ newValue.forEach((button) => {
89
+ button.shadowRoot.querySelector("button").setAttribute("part", "button");
90
+ });
91
+ }
20
92
  }
21
93
  __decorateClass([
22
94
  attr
23
- ], ProgressRing.prototype, "connotation", 2);
95
+ ], Pagination.prototype, "size", 2);
24
96
  __decorateClass([
25
97
  attr
26
- ], ProgressRing.prototype, "size", 2);
98
+ ], Pagination.prototype, "shape", 2);
99
+ __decorateClass([
100
+ observable
101
+ ], Pagination.prototype, "paginationButtons", 2);
102
+ __decorateClass([
103
+ observable
104
+ ], Pagination.prototype, "prevButton", 2);
105
+ __decorateClass([
106
+ observable
107
+ ], Pagination.prototype, "nextButton", 2);
108
+ __decorateClass([
109
+ attr({ attribute: "nav-icons", mode: "boolean" })
110
+ ], Pagination.prototype, "navIcons", 2);
111
+ __decorateClass([
112
+ volatile
113
+ ], Pagination.prototype, "pagesList", 1);
114
+ __decorateClass([
115
+ attr({ mode: "reflect", converter: totalConverter })
116
+ ], Pagination.prototype, "total", 2);
117
+ __decorateClass([
118
+ attr({ mode: "reflect", converter: totalConverter, attribute: "selected-index" })
119
+ ], Pagination.prototype, "selectedIndex", 2);
27
120
 
28
- const getClasses = ({ connotation, size, paused }) => classNames(
29
- "base",
30
- ["disabled", !!paused],
31
- [`connotation-${connotation}`, !!connotation],
32
- [`size-${size}`, !!size]
33
- );
34
- const progressSegments = 44;
35
- const ProgressRingTemplate = (_) => html`
36
- <div
37
- role="progressbar"
38
- aria-valuenow="${(x) => x.value}"
39
- aria-valuemin="${(x) => x.min}"
40
- aria-valuemax="${(x) => x.max}"
41
- class="${(x) => x.paused ? "paused" : ""} ${getClasses}"
42
- >
43
- ${when(
44
- (x) => typeof x.value === "number",
121
+ const ALLOWED_SIZES = [Size.SuperCondensed, Size.Condensed, Size.Normal];
122
+ const ALLOWED_SHAPES = [Shape.Rounded, Shape.Pill];
123
+ const handleSelection = (value, { parent: x }) => {
124
+ return x.selectedIndex = Number(value) - 1;
125
+ };
126
+ const handleKeyDown = (value, { event, parent }) => {
127
+ if (event.key === " " || event.key === "Enter") {
128
+ handleSelection(value, { parent });
129
+ }
130
+ if (event.key === "Tab") {
131
+ event.target.dispatchEvent(
132
+ new CustomEvent("tabpressed", { detail: { value, shiftKey: event.shiftKey }, bubbles: true, composed: true })
133
+ );
134
+ }
135
+ };
136
+ const getClasses = (_) => classNames("control");
137
+ function getButtonAppearance(value, { parent }) {
138
+ return parent.selectedIndex === Number(value) - 1 ? "filled" : "ghost";
139
+ }
140
+ const paginationButtonRenderer = (buttonTag) => html`
141
+ ${when(
142
+ (value) => value !== "...",
45
143
  html`
46
- <svg
47
- class="progress"
48
- viewBox="0 0 16 16"
49
- >
50
- <circle
51
- class="background"
52
- cx="8px"
53
- cy="8px"
54
- r="7px"
55
- ></circle>
56
- <circle
57
- class="determinate"
58
- style="stroke-dasharray: ${(x) => progressSegments * x.percentComplete / 100}px ${progressSegments}px"
59
- cx="8px"
60
- cy="8px"
61
- r="7px"
62
- ></circle>
63
- </svg>
64
- `
144
+ <${buttonTag} class="vwc-pagination-button"
145
+ label="${(value) => value}"
146
+ appearance="${getButtonAppearance}"
147
+ size="${(_, { parent: x }) => getPaginationSize(x)}"
148
+ shape="${(_, { parent: x }) => getPaginationShape(x)}"
149
+ style="inline-size: ${(value) => getPaginationButtonWidth(value)};"
150
+ tabindex="0"
151
+ aria-current="${(value, { parent }) => parent.selectedIndex === Number(value) - 1}"
152
+ @click="${handleSelection}"
153
+ @keydown="${handleKeyDown}">
154
+ </${buttonTag}>
155
+ `
65
156
  )}
66
- ${when(
67
- (x) => typeof x.value !== "number",
157
+ ${when(
158
+ (value) => value === "...",
68
159
  html`
69
- <svg class="progress" viewBox="0 0 16 16">
70
- <circle
71
- class="background"
72
- cx="8px"
73
- cy="8px"
74
- r="7px"
75
- ></circle>
76
- <circle
77
- class="indeterminate-indicator-1"
78
- cx="8px"
79
- cy="8px"
80
- r="7px"
81
- ></circle>
82
- </svg>
83
- `
84
- )}
85
- </div>
86
- `;
160
+ <div
161
+ class="dots size-${(_, { parent: x }) => getPaginationSize(x)}">
162
+ ...
163
+ </div>`
164
+ )}`;
165
+ const getPaginationSize = (x) => {
166
+ if (!x.size || !ALLOWED_SIZES.includes(x.size)) {
167
+ return Size.SuperCondensed;
168
+ }
169
+ return x.size;
170
+ };
171
+ const getPaginationShape = (x) => {
172
+ if (!x.shape || !ALLOWED_SHAPES.includes(x.shape)) {
173
+ return Shape.Rounded;
174
+ }
175
+ return x.shape;
176
+ };
177
+ const getPaginationButtonWidth = (value) => {
178
+ return `calc(var(--base-size) + ${String(value).length - 1}ch)`;
179
+ };
180
+ const PaginationTemplate = (context) => {
181
+ const buttonTag = context.tagFor(Button);
182
+ const paginationButtonTemplate = paginationButtonRenderer(buttonTag);
183
+ return html`
184
+ <div class="${getClasses}">
185
+ <${buttonTag} class="prev-button" ${ref("prevButton")}
186
+ label="${(x) => !x.navIcons ? "Previous" : null}"
187
+ icon="${(x) => x.navIcons ? "chevron-left-line" : null}"
188
+ size="${getPaginationSize}"
189
+ shape="${getPaginationShape}"
190
+ ?disabled="${(x) => x.total === 0 || x.selectedIndex === 0}"
191
+ @click="${(x) => x.selectedIndex !== void 0 && x.selectedIndex--}"
192
+ ></${buttonTag}>
193
+ <div id="buttons-wrapper" class="buttons-wrapper" ${children({ property: "paginationButtons", filter: elements(buttonTag) })}>
194
+ ${repeat((x) => x.pagesList, paginationButtonTemplate, { positioning: true })}
195
+ </div>
196
+ <${buttonTag} class="next-button" ${ref("nextButton")}
197
+ label="${(x) => !x.navIcons ? "Next" : null}"
198
+ icon="${(x) => x.navIcons ? "chevron-right-line" : null}"
199
+ size="${getPaginationSize}"
200
+ shape="${getPaginationShape}"
201
+ ?disabled="${(x) => x.total === 0 || x.selectedIndex === x.total - 1}"
202
+ @click="${(x) => x.selectedIndex !== void 0 && x.selectedIndex++}"
203
+ ></${buttonTag}>
204
+ </div>`;
205
+ };
87
206
 
88
- const progressRingDefinition = ProgressRing.compose({
89
- baseName: "progress-ring",
90
- template: ProgressRingTemplate,
207
+ const paginationDefinition = Pagination.compose({
208
+ baseName: "pagination",
209
+ template: PaginationTemplate,
91
210
  styles
92
211
  });
93
- const progressRingRegistries = [progressRingDefinition()];
94
- const registerProgressRing = registerFactory(progressRingRegistries);
212
+ const paginationRegistries = [paginationDefinition(), buttonRegistries];
213
+ const registerPagination = registerFactory(paginationRegistries);
95
214
 
96
- export { ProgressRing as P, progressRingRegistries as a, progressRingDefinition as p, registerProgressRing as r };
215
+ export { paginationRegistries as a, paginationDefinition as p, registerPagination as r };
@@ -3,7 +3,7 @@ import { B as BaseProgress } from './base-progress.js';
3
3
  import { w as when } from './when.js';
4
4
  import { c as classNames } from './class-names.js';
5
5
 
6
- const styles = "/**\n * Do not edit directly\n * Generated on Tue, 17 Oct 2023 15:27:52 GMT\n */\n.base {\n height: 6px;\n align-items: center;\n margin: 0;\n outline: none;\n}\n.base:not(.connotation-pacific).connotation-cta {\n /* @cssprop [--vvd-progress-cta-primary=var(--vvd-color-cta-500)] */\n --_connotation-color-primary: var(--vvd-progress-cta-primary, var(--vvd-color-cta-500));\n /* @cssprop [--vvd-progress-cta-soft=var(--vvd-color-cta-100)] */\n --_connotation-color-soft: var(--vvd-progress-cta-soft, var(--vvd-color-cta-100));\n}\n.base:not(.connotation-pacific).connotation-alert {\n /* @cssprop [--vvd-progress-alert-primary=var(--vvd-color-alert-500)] */\n --_connotation-color-primary: var(--vvd-progress-alert-primary, var(--vvd-color-alert-500));\n /* @cssprop [--vvd-progress-alert-soft=var(--vvd-color-alert-100)] */\n --_connotation-color-soft: var(--vvd-progress-alert-soft, var(--vvd-color-alert-100));\n}\n.base:not(.connotation-pacific).connotation-success {\n /* @cssprop [--vvd-progress-success-primary=var(--vvd-color-success-500)] */\n --_connotation-color-primary: var(--vvd-progress-success-primary, var(--vvd-color-success-500));\n /* @cssprop [--vvd-progress-success-soft=var(--vvd-color-success-100)] */\n --_connotation-color-soft: var(--vvd-progress-success-soft, var(--vvd-color-success-100));\n}\n.base:not(.connotation-pacific):not(.connotation-cta, .connotation-alert, .connotation-success) {\n /* @cssprop [--vvd-progress-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-progress-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-progress-accent-soft=var(--vvd-color-neutral-100)] */\n --_connotation-color-soft: var(--vvd-progress-accent-soft, var(--vvd-color-neutral-100));\n}\n.base:not(.connotation-pacific) {\n --_appearance-color-text: var(--_connotation-color-contrast);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transparent;\n}\n.base.connotation-pacific {\n --_connotation-color-primary: linear-gradient(to right, var(--vvd-color-information-200), var(--vvd-color-cta-600));\n}\n\n.progress {\n position: relative;\n display: flex;\n overflow: hidden;\n align-items: center;\n block-size: 100%;\n inline-size: 100%;\n /* Shape */\n}\n.base:not(.connotation-pacific) .progress {\n background-color: var(--_appearance-color-fill);\n}\n.base.connotation-pacific .progress {\n background-color: var(--vvd-color-neutral-100);\n}\n.base:not(.shape-sharp) .progress {\n border-radius: 3px;\n}\n\n.indeterminate {\n display: flex;\n background-color: var(--_connotation-color-primary);\n block-size: 100%;\n border-radius: inherit;\n inline-size: 100%;\n}\n\n.determinate {\n background-color: var(--_connotation-color-primary);\n block-size: 100%;\n border-radius: inherit;\n transition: all 0.2s ease-in-out;\n}\n.connotation-pacific .determinate {\n background-image: var(--_connotation-color-primary);\n}\n.reverse .determinate {\n position: absolute;\n right: 0;\n}\n.paused .determinate {\n background: var(--vvd-color-neutral-300);\n}\n\n.indicator-1 {\n animation: indeterminate-1 2s infinite;\n inline-size: 30%;\n}\n\n.indicator-2 {\n animation: indeterminate-2 2s infinite;\n inline-size: 60%;\n}\n\n.indicator-1,\n.indicator-2 {\n position: absolute;\n animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);\n background-color: var(--vvd-color-neutral-100);\n block-size: 100%;\n opacity: 0;\n}\n.connotation-pacific .indicator-1,\n.connotation-pacific .indicator-2 {\n background-image: var(--_connotation-color-primary);\n}\n.paused .indicator-1,\n.paused .indicator-2 {\n animation-play-state: paused;\n background-color: var(--_connotation-color-primary);\n}\n.reverse .indicator-1,\n.reverse .indicator-2 {\n animation-direction: reverse;\n}\n\n@keyframes indeterminate-1 {\n 0% {\n opacity: 1;\n transform: translateX(-100%);\n }\n 70% {\n opacity: 1;\n transform: translateX(300%);\n }\n 70.01% {\n opacity: 0;\n }\n 100% {\n opacity: 0;\n transform: translateX(300%);\n }\n}\n@keyframes indeterminate-2 {\n 0% {\n opacity: 0;\n transform: translateX(-150%);\n }\n 29.99% {\n opacity: 0;\n }\n 30% {\n opacity: 1;\n transform: translateX(-150%);\n }\n 100% {\n opacity: 1;\n transform: translateX(166.66%);\n }\n}";
6
+ const styles = "/**\n * Do not edit directly\n * Generated on Wed, 22 Nov 2023 16:09:43 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 /* @cssprop [--vvd-progress-ring-cta-primary=var(--vvd-color-cta-500)] */\n --_connotation-color-primary: var(--vvd-progress-ring-cta-primary, var(--vvd-color-cta-500));\n}\n.base.connotation-alert {\n /* @cssprop [--vvd-progress-ring-alert-primary=var(--vvd-color-alert-500)] */\n --_connotation-color-primary: var(--vvd-progress-ring-alert-primary, var(--vvd-color-alert-500));\n}\n.base.connotation-success {\n /* @cssprop [--vvd-progress-ring-success-primary=var(--vvd-color-success-500)] */\n --_connotation-color-primary: var(--vvd-progress-ring-success-primary, var(--vvd-color-success-500));\n}\n.base:not(.connotation-cta, .connotation-alert, .connotation-success) {\n /* @cssprop [--vvd-progress-ring-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-progress-ring-accent-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-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base.size--6 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)) - 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.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--6, .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}";
7
7
 
8
8
  var __defProp = Object.defineProperty;
9
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -16,69 +16,89 @@ var __decorateClass = (decorators, target, key, kind) => {
16
16
  __defProp(target, key, result);
17
17
  return result;
18
18
  };
19
- class Progress extends BaseProgress {
19
+ class ProgressRing extends BaseProgress {
20
20
  constructor() {
21
21
  super(...arguments);
22
- this.reverse = false;
22
+ this.ariaLabel = null;
23
23
  }
24
24
  }
25
25
  __decorateClass([
26
- attr()
27
- ], Progress.prototype, "shape", 2);
26
+ attr({ attribute: "aria-label" })
27
+ ], ProgressRing.prototype, "ariaLabel", 2);
28
28
  __decorateClass([
29
- attr()
30
- ], Progress.prototype, "connotation", 2);
29
+ attr
30
+ ], ProgressRing.prototype, "connotation", 2);
31
31
  __decorateClass([
32
- attr({ mode: "boolean" })
33
- ], Progress.prototype, "reverse", 2);
32
+ attr
33
+ ], ProgressRing.prototype, "size", 2);
34
34
 
35
- const getClasses = ({
36
- connotation,
37
- shape,
38
- reverse,
39
- paused
40
- }) => classNames(
35
+ const getClasses = ({ connotation, size, paused }) => classNames(
41
36
  "base",
42
- [`connotation-${connotation}`, Boolean(connotation)],
43
- [`shape-${shape}`, Boolean(shape)],
44
- ["reverse", Boolean(reverse)],
45
- ["paused", Boolean(paused)]
37
+ ["disabled", !!paused],
38
+ [`connotation-${connotation}`, !!connotation],
39
+ [`size-${size}`, !!size]
46
40
  );
47
- function determinate() {
48
- return html`
49
- <span class="determinate" style="width: ${(x) => x.percentComplete}%"></span>`;
50
- }
51
- function indeterminate() {
52
- return html`
53
- <span class="indeterminate" name="indeterminate">
54
- <span class="indicator-1"></span>
55
- <span class="indicator-2"></span>
56
- </span>`;
57
- }
58
- const ProgressTemplate = (_) => {
59
- return html`
60
- <div
61
- role="progressbar"
62
- aria-label="${(x) => x.ariaLabel}"
63
- aria-valuenow="${(x) => x.value}"
64
- aria-valuemin="${(x) => x.min}"
65
- aria-valuemax="${(x) => x.max}"
66
- class="${getClasses}"
41
+ const progressSegments = 44;
42
+ const ProgressRingTemplate = (_) => html`<template role="${(x) => x.ariaLabel ? "presentation" : null}">
43
+ <div
44
+ role="progressbar"
45
+ aria-label="${(x) => x.ariaLabel}"
46
+ aria-valuenow="${(x) => x.value}"
47
+ aria-valuemin="${(x) => x.min}"
48
+ aria-valuemax="${(x) => x.max}"
49
+ class="${(x) => x.paused ? "paused" : ""} ${getClasses}"
67
50
  >
68
- <div class="progress">
69
- ${when((x) => typeof x.value === "number", determinate())}
70
- ${when((x) => typeof x.value !== "number", indeterminate())}
71
- </div>
72
- </div>
73
- `;
74
- };
51
+ ${when(
52
+ (x) => typeof x.value === "number",
53
+ html`
54
+ <svg
55
+ class="progress"
56
+ viewBox="0 0 16 16"
57
+ >
58
+ <circle
59
+ class="background"
60
+ cx="8px"
61
+ cy="8px"
62
+ r="7px"
63
+ ></circle>
64
+ <circle
65
+ class="determinate"
66
+ style="stroke-dasharray: ${(x) => progressSegments * x.percentComplete / 100}px ${progressSegments}px"
67
+ cx="8px"
68
+ cy="8px"
69
+ r="7px"
70
+ ></circle>
71
+ </svg>
72
+ `
73
+ )}
74
+ ${when(
75
+ (x) => typeof x.value !== "number",
76
+ html`
77
+ <svg class="progress" viewBox="0 0 16 16">
78
+ <circle
79
+ class="background"
80
+ cx="8px"
81
+ cy="8px"
82
+ r="7px"
83
+ ></circle>
84
+ <circle
85
+ class="indeterminate-indicator-1"
86
+ cx="8px"
87
+ cy="8px"
88
+ r="7px"
89
+ ></circle>
90
+ </svg>
91
+ `
92
+ )}
93
+ </div>
94
+ </template>`;
75
95
 
76
- const progressDefinition = Progress.compose({
77
- baseName: "progress",
78
- template: ProgressTemplate,
96
+ const progressRingDefinition = ProgressRing.compose({
97
+ baseName: "progress-ring",
98
+ template: ProgressRingTemplate,
79
99
  styles
80
100
  });
81
- const progressRegistries = [progressDefinition()];
82
- const registerProgress = registerFactory(progressRegistries);
101
+ const progressRingRegistries = [progressRingDefinition()];
102
+ const registerProgressRing = registerFactory(progressRingRegistries);
83
103
 
84
- export { progressRegistries as a, progressDefinition as p, registerProgress as r };
104
+ export { ProgressRing as P, progressRingRegistries as a, progressRingDefinition as p, registerProgressRing as r };