@vonage/vivid 3.48.0 → 3.49.0-preview.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.
Files changed (182) hide show
  1. package/accordion/index.cjs +21 -0
  2. package/accordion-item/index.cjs +18 -0
  3. package/action-group/index.cjs +7 -0
  4. package/alert/index.cjs +30 -0
  5. package/appearance-ui/index.cjs +96 -0
  6. package/audio-player/index.cjs +34 -0
  7. package/avatar/index.cjs +11 -0
  8. package/badge/index.cjs +14 -0
  9. package/banner/index.cjs +29 -0
  10. package/breadcrumb/index.cjs +13 -0
  11. package/breadcrumb-item/index.cjs +22 -0
  12. package/button/index.cjs +25 -0
  13. package/calendar/index.cjs +9 -0
  14. package/calendar-event/index.cjs +9 -0
  15. package/card/index.cjs +14 -0
  16. package/checkbox/index.cjs +21 -0
  17. package/combobox/index.cjs +39 -0
  18. package/data-grid/index.cjs +18 -0
  19. package/date-picker/index.cjs +40 -0
  20. package/date-range-picker/index.cjs +40 -0
  21. package/dialog/index.cjs +31 -0
  22. package/divider/index.cjs +8 -0
  23. package/elevation/index.cjs +7 -0
  24. package/empty-state/index.cjs +12 -0
  25. package/fab/index.cjs +22 -0
  26. package/file-picker/index.cjs +30 -0
  27. package/focus/index.cjs +7 -0
  28. package/header/index.cjs +8 -0
  29. package/icon/index.cjs +10 -0
  30. package/index.cjs +296 -0
  31. package/layout/index.cjs +7 -0
  32. package/listbox/index.cjs +77 -0
  33. package/locales/en-GB.cjs +106 -0
  34. package/locales/en-US.cjs +106 -0
  35. package/locales/ja-JP.cjs +106 -0
  36. package/locales/zh-CN.cjs +106 -0
  37. package/menu/index.cjs +32 -0
  38. package/menu-item/index.cjs +22 -0
  39. package/nav/index.cjs +6 -0
  40. package/nav-disclosure/index.cjs +17 -0
  41. package/nav-item/index.cjs +22 -0
  42. package/note/index.cjs +16 -0
  43. package/number-field/index.cjs +33 -0
  44. package/option/index.cjs +23 -0
  45. package/package.json +20 -2
  46. package/pagination/index.cjs +28 -0
  47. package/popup/index.cjs +27 -0
  48. package/progress/index.cjs +9 -0
  49. package/progress-ring/index.cjs +9 -0
  50. package/radio/index.cjs +14 -0
  51. package/radio-group/index.cjs +14 -0
  52. package/select/index.cjs +38 -0
  53. package/selectable-box/index.cjs +25 -0
  54. package/shared/Reflector.cjs +67 -0
  55. package/shared/_has.cjs +62 -0
  56. package/shared/affix.cjs +64 -0
  57. package/shared/affix.js +8 -4
  58. package/shared/anchor.cjs +90 -0
  59. package/shared/anchored.cjs +78 -0
  60. package/shared/apply-mixins.cjs +25 -0
  61. package/shared/aria-global.cjs +74 -0
  62. package/shared/aria.cjs +11 -0
  63. package/shared/aria2.cjs +11 -0
  64. package/shared/base-progress.cjs +72 -0
  65. package/shared/breadcrumb-item.cjs +27 -0
  66. package/shared/button.cjs +202 -0
  67. package/shared/calendar-event.cjs +41 -0
  68. package/shared/children.cjs +61 -0
  69. package/shared/class-names.cjs +17 -0
  70. package/shared/definition.cjs +165 -0
  71. package/shared/definition10.cjs +102 -0
  72. package/shared/definition11.cjs +164 -0
  73. package/shared/definition11.js +38 -36
  74. package/shared/definition12.cjs +50 -0
  75. package/shared/definition13.cjs +779 -0
  76. package/shared/definition14.cjs +157 -0
  77. package/shared/definition15.cjs +249 -0
  78. package/shared/definition16.cjs +746 -0
  79. package/shared/definition17.cjs +1372 -0
  80. package/shared/definition18.cjs +175 -0
  81. package/shared/definition19.cjs +416 -0
  82. package/shared/definition2.cjs +232 -0
  83. package/shared/definition20.cjs +278 -0
  84. package/shared/definition21.cjs +83 -0
  85. package/shared/definition22.cjs +74 -0
  86. package/shared/definition23.cjs +106 -0
  87. package/shared/definition24.cjs +2392 -0
  88. package/shared/definition25.cjs +75 -0
  89. package/shared/definition26.cjs +39 -0
  90. package/shared/definition27.cjs +66 -0
  91. package/shared/definition28.cjs +849 -0
  92. package/shared/definition29.cjs +72 -0
  93. package/shared/definition3.cjs +72 -0
  94. package/shared/definition30.cjs +98 -0
  95. package/shared/definition31.cjs +37 -0
  96. package/shared/definition32.cjs +24 -0
  97. package/shared/definition33.cjs +64 -0
  98. package/shared/definition34.cjs +533 -0
  99. package/shared/definition35.cjs +295 -0
  100. package/shared/definition36.cjs +219 -0
  101. package/shared/definition37.cjs +109 -0
  102. package/shared/definition38.cjs +92 -0
  103. package/shared/definition39.cjs +448 -0
  104. package/shared/definition4.cjs +198 -0
  105. package/shared/definition40.cjs +49 -0
  106. package/shared/definition41.cjs +694 -0
  107. package/shared/definition42.cjs +152 -0
  108. package/shared/definition43.cjs +113 -0
  109. package/shared/definition44.cjs +607 -0
  110. package/shared/definition45.cjs +152 -0
  111. package/shared/definition46.cjs +166 -0
  112. package/shared/definition47.cjs +35 -0
  113. package/shared/definition48.cjs +98 -0
  114. package/shared/definition49.cjs +543 -0
  115. package/shared/definition5.cjs +199 -0
  116. package/shared/definition50.cjs +52 -0
  117. package/shared/definition51.cjs +150 -0
  118. package/shared/definition52.cjs +304 -0
  119. package/shared/definition53.cjs +309 -0
  120. package/shared/definition54.cjs +146 -0
  121. package/shared/definition55.cjs +128 -0
  122. package/shared/definition56.cjs +99 -0
  123. package/shared/definition57.cjs +310 -0
  124. package/shared/definition58.cjs +20 -0
  125. package/shared/definition59.cjs +51 -0
  126. package/shared/definition6.cjs +83 -0
  127. package/shared/definition60.cjs +1810 -0
  128. package/shared/definition7.cjs +72 -0
  129. package/shared/definition8.cjs +152 -0
  130. package/shared/definition9.cjs +69 -0
  131. package/shared/dialog-polyfill.esm.cjs +862 -0
  132. package/shared/direction.cjs +22 -0
  133. package/shared/dom.cjs +23 -0
  134. package/shared/enums.cjs +87 -0
  135. package/shared/focus.cjs +8 -0
  136. package/shared/focus2.cjs +11 -0
  137. package/shared/form-associated.cjs +470 -0
  138. package/shared/icon.cjs +237 -0
  139. package/shared/index.cjs +5061 -0
  140. package/shared/index2.cjs +231 -0
  141. package/shared/key-codes.cjs +115 -0
  142. package/shared/key-codes2.cjs +14 -0
  143. package/shared/listbox.cjs +1072 -0
  144. package/shared/localized.cjs +11 -0
  145. package/shared/numbers.cjs +38 -0
  146. package/shared/patterns/affix.d.ts +5 -1
  147. package/shared/presentationDate.cjs +6192 -0
  148. package/shared/radio.cjs +153 -0
  149. package/shared/ref.cjs +43 -0
  150. package/shared/repeat.cjs +767 -0
  151. package/shared/select.options.cjs +12 -0
  152. package/shared/slotted.cjs +123 -0
  153. package/shared/start-end.cjs +52 -0
  154. package/shared/strings.cjs +11 -0
  155. package/shared/text-anchor.cjs +33 -0
  156. package/shared/text-anchor.template.cjs +48 -0
  157. package/shared/text-field.cjs +5 -0
  158. package/shared/text-field2.cjs +228 -0
  159. package/shared/tree-item.cjs +154 -0
  160. package/shared/when.cjs +31 -0
  161. package/side-drawer/index.cjs +8 -0
  162. package/slider/index.cjs +16 -0
  163. package/split-button/index.cjs +20 -0
  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.cjs +15 -0
  171. package/tab/index.cjs +17 -0
  172. package/tab-panel/index.cjs +6 -0
  173. package/tabs/index.cjs +24 -0
  174. package/tag/index.cjs +17 -0
  175. package/tag-group/index.cjs +7 -0
  176. package/text-anchor/index.cjs +24 -0
  177. package/text-area/index.cjs +25 -0
  178. package/text-field/index.cjs +27 -0
  179. package/toggletip/index.cjs +29 -0
  180. package/tooltip/index.cjs +29 -0
  181. package/tree-item/index.cjs +22 -0
  182. package/tree-view/index.cjs +14 -0
@@ -0,0 +1,232 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ const definition = require('./definition.cjs');
5
+ const keyCodes = require('./key-codes.cjs');
6
+ const numbers = require('./numbers.cjs');
7
+ const slotted = require('./slotted.cjs');
8
+ const classNames = require('./class-names.cjs');
9
+
10
+ /**
11
+ * Expand mode for {@link Accordion}
12
+ * @public
13
+ */
14
+ const AccordionExpandMode = {
15
+ /**
16
+ * Designates only a single {@link @microsoft/fast-foundation#(AccordionItem:class) } can be open a time.
17
+ */
18
+ single: "single",
19
+ /**
20
+ * Designates multiple {@link @microsoft/fast-foundation#(AccordionItem:class) | AccordionItems} can be open simultaneously.
21
+ */
22
+ multi: "multi",
23
+ };
24
+ /**
25
+ * An Accordion Custom HTML Element
26
+ * Implements {@link https://www.w3.org/TR/wai-aria-practices-1.1/#accordion | ARIA Accordion}.
27
+ *
28
+ * @fires change - Fires a custom 'change' event when the active item changes
29
+ * @csspart item - The slot for the accordion items
30
+ * @public
31
+ *
32
+ * @remarks
33
+ * Designed to be used with {@link @microsoft/fast-foundation#accordionTemplate} and {@link @microsoft/fast-foundation#(AccordionItem:class)}.
34
+ */
35
+ let Accordion$1 = class Accordion extends index.FoundationElement {
36
+ constructor() {
37
+ super(...arguments);
38
+ /**
39
+ * Controls the expand mode of the Accordion, either allowing
40
+ * single or multiple item expansion.
41
+ * @public
42
+ *
43
+ * @remarks
44
+ * HTML attribute: expand-mode
45
+ */
46
+ this.expandmode = AccordionExpandMode.multi;
47
+ this.activeItemIndex = 0;
48
+ this.change = () => {
49
+ this.$emit("change", this.activeid);
50
+ };
51
+ this.setItems = () => {
52
+ var _a;
53
+ if (this.accordionItems.length === 0) {
54
+ return;
55
+ }
56
+ this.accordionIds = this.getItemIds();
57
+ this.accordionItems.forEach((item, index) => {
58
+ if (item instanceof definition.AccordionItem) {
59
+ item.addEventListener("change", this.activeItemChange);
60
+ if (this.isSingleExpandMode()) {
61
+ this.activeItemIndex !== index
62
+ ? (item.expanded = false)
63
+ : (item.expanded = true);
64
+ }
65
+ }
66
+ const itemId = this.accordionIds[index];
67
+ item.setAttribute("id", typeof itemId !== "string" ? `accordion-${index + 1}` : itemId);
68
+ this.activeid = this.accordionIds[this.activeItemIndex];
69
+ item.addEventListener("keydown", this.handleItemKeyDown);
70
+ item.addEventListener("focus", this.handleItemFocus);
71
+ });
72
+ if (this.isSingleExpandMode()) {
73
+ const expandedItem = (_a = this.findExpandedItem()) !== null && _a !== void 0 ? _a : this.accordionItems[0];
74
+ expandedItem.setAttribute("aria-disabled", "true");
75
+ }
76
+ };
77
+ this.removeItemListeners = (oldValue) => {
78
+ oldValue.forEach((item, index) => {
79
+ item.removeEventListener("change", this.activeItemChange);
80
+ item.removeEventListener("keydown", this.handleItemKeyDown);
81
+ item.removeEventListener("focus", this.handleItemFocus);
82
+ });
83
+ };
84
+ this.activeItemChange = (event) => {
85
+ if (event.defaultPrevented || event.target !== event.currentTarget) {
86
+ return;
87
+ }
88
+ event.preventDefault();
89
+ const selectedItem = event.target;
90
+ this.activeid = selectedItem.getAttribute("id");
91
+ if (this.isSingleExpandMode()) {
92
+ this.resetItems();
93
+ selectedItem.expanded = true;
94
+ selectedItem.setAttribute("aria-disabled", "true");
95
+ this.accordionItems.forEach((item) => {
96
+ if (!item.hasAttribute("disabled") && item.id !== this.activeid) {
97
+ item.removeAttribute("aria-disabled");
98
+ }
99
+ });
100
+ }
101
+ this.activeItemIndex = Array.from(this.accordionItems).indexOf(selectedItem);
102
+ this.change();
103
+ };
104
+ this.handleItemKeyDown = (event) => {
105
+ // only handle the keydown if the event target is the accordion item
106
+ // prevents arrow keys from moving focus to accordion headers when focus is on accordion item panel content
107
+ if (event.target !== event.currentTarget) {
108
+ return;
109
+ }
110
+ this.accordionIds = this.getItemIds();
111
+ switch (event.key) {
112
+ case keyCodes.keyArrowUp:
113
+ event.preventDefault();
114
+ this.adjust(-1);
115
+ break;
116
+ case keyCodes.keyArrowDown:
117
+ event.preventDefault();
118
+ this.adjust(1);
119
+ break;
120
+ case keyCodes.keyHome:
121
+ this.activeItemIndex = 0;
122
+ this.focusItem();
123
+ break;
124
+ case keyCodes.keyEnd:
125
+ this.activeItemIndex = this.accordionItems.length - 1;
126
+ this.focusItem();
127
+ break;
128
+ }
129
+ };
130
+ this.handleItemFocus = (event) => {
131
+ // update the active item index if the focus moves to an accordion item via a different method other than the up and down arrow key actions
132
+ // only do so if the focus is actually on the accordion item and not on any of its children
133
+ if (event.target === event.currentTarget) {
134
+ const focusedItem = event.target;
135
+ const focusedIndex = (this.activeItemIndex = Array.from(this.accordionItems).indexOf(focusedItem));
136
+ if (this.activeItemIndex !== focusedIndex && focusedIndex !== -1) {
137
+ this.activeItemIndex = focusedIndex;
138
+ this.activeid = this.accordionIds[this.activeItemIndex];
139
+ }
140
+ }
141
+ };
142
+ }
143
+ /**
144
+ * @internal
145
+ */
146
+ accordionItemsChanged(oldValue, newValue) {
147
+ if (this.$fastController.isConnected) {
148
+ this.removeItemListeners(oldValue);
149
+ this.setItems();
150
+ }
151
+ }
152
+ findExpandedItem() {
153
+ for (let item = 0; item < this.accordionItems.length; item++) {
154
+ if (this.accordionItems[item].getAttribute("expanded") === "true") {
155
+ return this.accordionItems[item];
156
+ }
157
+ }
158
+ return null;
159
+ }
160
+ resetItems() {
161
+ this.accordionItems.forEach((item, index) => {
162
+ item.expanded = false;
163
+ });
164
+ }
165
+ getItemIds() {
166
+ return this.accordionItems.map((accordionItem) => {
167
+ return accordionItem.getAttribute("id");
168
+ });
169
+ }
170
+ isSingleExpandMode() {
171
+ return this.expandmode === AccordionExpandMode.single;
172
+ }
173
+ adjust(adjustment) {
174
+ this.activeItemIndex = numbers.wrapInBounds(0, this.accordionItems.length - 1, this.activeItemIndex + adjustment);
175
+ this.focusItem();
176
+ }
177
+ focusItem() {
178
+ const element = this.accordionItems[this.activeItemIndex];
179
+ if (element instanceof definition.AccordionItem) {
180
+ element.expandbutton.focus();
181
+ }
182
+ }
183
+ };
184
+ index.__decorate([
185
+ index.attr({ attribute: "expand-mode" })
186
+ ], Accordion$1.prototype, "expandmode", void 0);
187
+ index.__decorate([
188
+ index.observable
189
+ ], Accordion$1.prototype, "accordionItems", void 0);
190
+
191
+ const styles = ".base{display:flex;box-sizing:border-box;flex-direction:column}::slotted(:not(:only-of-type)){border-bottom:1px solid var(--vvd-color-neutral-200)}\n";
192
+
193
+ class Accordion extends Accordion$1 {
194
+ constructor() {
195
+ super(...arguments);
196
+ /**
197
+ * Controls the expand mode of the Accordion, either allowing
198
+ * single or multiple item expansion.
199
+ * @public
200
+ *
201
+ * @remarks
202
+ * HTML attribute: expand-mode
203
+ */
204
+ this.expandmode = AccordionExpandMode.single;
205
+ }
206
+ closeAll() {
207
+ if (this.expandmode === AccordionExpandMode.multi) {
208
+ this.accordionItems.forEach((item) => {
209
+ item.expanded = false;
210
+ });
211
+ }
212
+ }
213
+ }
214
+
215
+ const getClasses = (_) => classNames.classNames("base");
216
+ const AccordionTemplate = () => index.html`
217
+ <div class="${getClasses}">
218
+ <slot ${slotted.slotted({ property: "accordionItems", filter: slotted.elements() })}></slot>
219
+ </div>
220
+ `;
221
+
222
+ const accordionDefinition = Accordion.compose({
223
+ baseName: "accordion",
224
+ template: AccordionTemplate,
225
+ styles
226
+ });
227
+ const accordionRegistries = [accordionDefinition(), ...definition.accordionItemRegistries];
228
+ const registerAccordion = index.registerFactory(accordionRegistries);
229
+
230
+ exports.accordionDefinition = accordionDefinition;
231
+ exports.accordionRegistries = accordionRegistries;
232
+ exports.registerAccordion = registerAccordion;
@@ -0,0 +1,278 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ const definition$2 = require('./definition26.cjs');
5
+ const definition$1 = require('./definition11.cjs');
6
+ const definition = require('./definition59.cjs');
7
+ require('./affix.cjs');
8
+ require('./index2.cjs');
9
+ const localized = require('./localized.cjs');
10
+ const applyMixins = require('./apply-mixins.cjs');
11
+ const icon$1 = require('./icon.cjs');
12
+ const focus = require('./focus2.cjs');
13
+ const when = require('./when.cjs');
14
+ const slotted = require('./slotted.cjs');
15
+ const classNames = require('./class-names.cjs');
16
+
17
+ const dialogPolyfillStyles = "dialog{position:absolute;left:0;right:0;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;height:-moz-fit-content;height:-webkit-fit-content;height:fit-content;margin:auto;border:solid;padding:1em;background:white;color:#000;display:block}dialog:not([open]){display:none}dialog+.backdrop{position:fixed;inset:0;background:rgba(0,0,0,.1)}._dialog_overlay{position:fixed;inset:0}dialog.fixed{position:fixed;top:50%;transform:translateY(-50%)}\n";
18
+
19
+ const styles = ".base{box-sizing:border-box;padding:0;border:none;background-color:transparent;border-radius:8px;color:var(--vvd-color-canvas-text);max-block-size:var(--dialog-max-block-size, calc(100vh - 64px));max-inline-size:var(--dialog-max-inline-size, var(--_dialog-default-max-inline-size));min-inline-size:var(--dialog-min-inline-size, 280px)}@media not all and (min-width: 600px){.base{--_dialog-default-max-inline-size: 90vw}}@media (min-width: 600px){.base{--_dialog-default-max-inline-size: 560px}}.base:not(.modal){z-index:var(--dialog-z-index, 1)}.base.modal{position:fixed;box-shadow:0 4px 20px #00000059}.base.modal::backdrop{background-color:var(--vvd-color-canvas-text, currentColor);opacity:.5}.base:focus-visible{outline:none}.base .focus-indicator{pointer-events:none}.base:not(:focus-visible) .focus-indicator{display:none}.main-wrapper{display:flex;box-sizing:border-box;flex-direction:column;gap:24px;padding-block:24px}.main-wrapper>*{box-sizing:border-box}.header{display:grid;align-items:flex-start;justify-content:space-between;inline-size:100%;padding-inline:24px}.base:not(.icon-placement-side) .header{grid-template-columns:1fr auto;grid-template-rows:auto auto auto}.base:not(.icon-placement-side) .header .icon{font-size:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2)));grid-column:1/2;grid-row:1/2;line-height:1;margin-block-end:calc(1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}.base.icon-placement-side .header{grid-template-columns:auto 1fr auto;grid-template-rows:auto auto}.base.icon-placement-side .header .icon{font-size:calc(1px*(28 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}.base.icon-placement-side .header ::slotted(*),.base.icon-placement-side .header .icon{grid-column:1/2;grid-row:1/-1;margin-inline-end:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2))/2)}.header.border{position:relative}.header.border:after{position:absolute;bottom:-24px;left:0;background-color:var(--vvd-color-neutral-200);block-size:1px;content:\"\";inline-size:100%}.base.hide-body .header.border:after{content:none}.body:not(.full-width){padding-inline:24px}.hide-body .body{display:none}.footer{display:flex;align-items:center;justify-content:space-between;gap:24px;padding-inline:24px}.hide-footer .footer{display:none}.footer .actions{display:flex;align-self:flex-end;gap:8px}.dismiss-button{flex-shrink:0;grid-column:-2/-1;grid-row:1/-1;margin-block-start:-8px;margin-inline-end:-8px;margin-inline-start:4px}.headline{font:var(--vvd-typography-heading-4)}.subtitle{font:var(--vvd-typography-base)}slot[name=main]{display:block;overflow:hidden auto;max-width:inherit;max-height:inherit;border-radius:inherit}\n";
20
+
21
+ var __defProp = Object.defineProperty;
22
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
23
+ var __decorateClass = (decorators, target, key, kind) => {
24
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
25
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
26
+ if (decorator = decorators[i])
27
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
28
+ if (kind && result)
29
+ __defProp(target, key, result);
30
+ return result;
31
+ };
32
+ const isDialogSupported = Boolean(window.HTMLDialogElement && window.HTMLDialogElement.prototype.showModal);
33
+ let dialogPolyfill;
34
+ (async () => {
35
+ if (!isDialogSupported) {
36
+ delete window.HTMLDialogElement;
37
+ dialogPolyfill = await Promise.resolve().then(() => require('./dialog-polyfill.esm.cjs'));
38
+ }
39
+ })();
40
+ class Dialog extends index.FoundationElement {
41
+ constructor() {
42
+ super(...arguments);
43
+ this.open = false;
44
+ this.fullWidthBody = false;
45
+ this.ariaLabel = null;
46
+ this.dismissButtonAriaLabel = null;
47
+ this.noLightDismiss = false;
48
+ this.#modal = false;
49
+ this.#handleScrimClick = (event) => {
50
+ if (event.target !== this.#dialog || this.noLightDismiss) {
51
+ return;
52
+ }
53
+ const rect = this.#dialog.getBoundingClientRect();
54
+ const clickedInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
55
+ this.open = clickedInDialog;
56
+ };
57
+ this.#handleInternalFormSubmit = (event) => {
58
+ if (event.target.method !== "dialog") {
59
+ return;
60
+ }
61
+ this.open = false;
62
+ };
63
+ }
64
+ #modal;
65
+ set returnValue(value) {
66
+ this.#dialog.returnValue = value;
67
+ }
68
+ get returnValue() {
69
+ return this.#dialog?.returnValue;
70
+ }
71
+ /**
72
+ * @internal
73
+ */
74
+ get modal() {
75
+ return this.#modal;
76
+ }
77
+ #dialogElement;
78
+ get #dialog() {
79
+ if (!this.#dialogElement) {
80
+ this.#dialogElement = this.shadowRoot.querySelector("dialog");
81
+ if (this.#dialogElement) {
82
+ this.#dialogElement.open = this.open;
83
+ if (dialogPolyfill) {
84
+ dialogPolyfill.registerDialog(this.#dialogElement);
85
+ }
86
+ }
87
+ }
88
+ return this.#dialogElement;
89
+ }
90
+ /**
91
+ * @internal
92
+ */
93
+ openChanged(oldValue, newValue) {
94
+ if (oldValue === void 0) {
95
+ return;
96
+ }
97
+ if (!newValue) {
98
+ this.close();
99
+ } else {
100
+ if (this.#dialog) {
101
+ this.#dialog.open = true;
102
+ }
103
+ }
104
+ }
105
+ #handleScrimClick;
106
+ #handleInternalFormSubmit;
107
+ close() {
108
+ if (this.#dialog.open) {
109
+ this.#dialog.close();
110
+ this.$emit("close", this.returnValue, { bubbles: false });
111
+ }
112
+ this.open = false;
113
+ this.#handleModal(false);
114
+ }
115
+ #handleModal(show) {
116
+ this.#modal = show;
117
+ this.#dialog.toggleAttribute("aria-modal", show);
118
+ this.#dialog.classList.toggle("modal", show);
119
+ }
120
+ show() {
121
+ this.#dialog.show();
122
+ this.open = true;
123
+ }
124
+ showModal() {
125
+ this.#handleModal(true);
126
+ this.#dialog.showModal();
127
+ this.open = true;
128
+ }
129
+ connectedCallback() {
130
+ super.connectedCallback();
131
+ this.#dialog.addEventListener("mousedown", this.#handleScrimClick);
132
+ this.#dialog.addEventListener("submit", this.#handleInternalFormSubmit);
133
+ }
134
+ disconnectedCallback() {
135
+ super.disconnectedCallback();
136
+ this.#dialog.removeEventListener("mousedown", this.#handleScrimClick);
137
+ this.#dialog.removeEventListener("submit", this.#handleInternalFormSubmit);
138
+ }
139
+ }
140
+ __decorateClass([
141
+ index.attr({ mode: "boolean" })
142
+ ], Dialog.prototype, "open", 2);
143
+ __decorateClass([
144
+ index.attr
145
+ ], Dialog.prototype, "icon", 2);
146
+ __decorateClass([
147
+ index.attr({ attribute: "icon-placement" })
148
+ ], Dialog.prototype, "iconPlacement", 2);
149
+ __decorateClass([
150
+ index.attr
151
+ ], Dialog.prototype, "subtitle", 2);
152
+ __decorateClass([
153
+ index.attr
154
+ ], Dialog.prototype, "headline", 2);
155
+ __decorateClass([
156
+ index.attr({ attribute: "full-width-body", mode: "boolean" })
157
+ ], Dialog.prototype, "fullWidthBody", 2);
158
+ __decorateClass([
159
+ index.attr({ attribute: "aria-label" })
160
+ ], Dialog.prototype, "ariaLabel", 2);
161
+ __decorateClass([
162
+ index.attr({ attribute: "dismiss-button-aria-label" })
163
+ ], Dialog.prototype, "dismissButtonAriaLabel", 2);
164
+ __decorateClass([
165
+ index.attr({ attribute: "no-light-dismiss", mode: "boolean" })
166
+ ], Dialog.prototype, "noLightDismiss", 2);
167
+ __decorateClass([
168
+ index.observable
169
+ ], Dialog.prototype, "bodySlottedContent", 2);
170
+ __decorateClass([
171
+ index.observable
172
+ ], Dialog.prototype, "footerSlottedContent", 2);
173
+ __decorateClass([
174
+ index.observable
175
+ ], Dialog.prototype, "actionItemsSlottedContent", 2);
176
+ applyMixins.applyMixins(Dialog, localized.Localized);
177
+
178
+ const getClasses = ({
179
+ iconPlacement,
180
+ bodySlottedContent,
181
+ footerSlottedContent,
182
+ actionItemsSlottedContent
183
+ }) => classNames.classNames(
184
+ "base",
185
+ [`icon-placement-${iconPlacement}`, Boolean(iconPlacement)],
186
+ ["hide-body", !bodySlottedContent?.length],
187
+ [
188
+ "hide-footer",
189
+ !(footerSlottedContent?.length || actionItemsSlottedContent?.length)
190
+ ]
191
+ );
192
+ function icon(iconTag) {
193
+ return index.html`
194
+ <${iconTag} class="icon" name="${(x) => x.icon}"></${iconTag}>
195
+ `;
196
+ }
197
+ function headline() {
198
+ return index.html`
199
+ <div class="headline">
200
+ ${(x) => x.headline}
201
+ </div>
202
+ `;
203
+ }
204
+ function subtitle() {
205
+ return index.html`
206
+ <div class="subtitle">
207
+ ${(x) => x.subtitle}
208
+ </div>
209
+ `;
210
+ }
211
+ function renderDismissButton(buttonTag) {
212
+ return index.html`
213
+ <${buttonTag}
214
+ aria-label="${(x) => x.dismissButtonAriaLabel || x.locale.dialog.dismissButtonLabel}"
215
+ size="condensed"
216
+ class="dismiss-button"
217
+ icon="close-line"
218
+ @click="${(x) => x.open = false}"
219
+ ></${buttonTag}>`;
220
+ }
221
+ function handleEscapeKey(dialog, event) {
222
+ if (event.key === "Escape" && dialog.modal) {
223
+ dialog.open = false;
224
+ }
225
+ return true;
226
+ }
227
+ const DialogTemplate = (context) => {
228
+ const elevationTag = context.tagFor(definition.Elevation);
229
+ const iconTag = context.tagFor(icon$1.Icon);
230
+ const buttonTag = context.tagFor(definition$1.Button);
231
+ const focusTemplate = focus.focusTemplateFactory(context);
232
+ return index.html`
233
+ <${elevationTag} dp="8">
234
+ <dialog class="${getClasses}"
235
+ @keydown="${(x, c) => handleEscapeKey(x, c.event)}"
236
+ @cancel="${(_, c) => c.event.preventDefault()}"
237
+ returnValue="${(x) => x.returnValue}"
238
+ aria-label="${(x) => x.ariaLabel}"
239
+ >
240
+ ${() => focusTemplate}
241
+ <slot name="main">
242
+ <div class="main-wrapper">
243
+ <div class="header ${(x) => x.subtitle ? "border" : ""}">
244
+ <slot name="graphic">
245
+ ${when.when((x) => x.icon, icon(iconTag))}
246
+ </slot>
247
+ ${when.when((x) => x.headline, headline())}
248
+ ${when.when((x) => x.subtitle, subtitle())}
249
+ ${renderDismissButton(buttonTag)}
250
+ </div>
251
+ <div class="body ${(x) => x.fullWidthBody ? "full-width" : ""}" >
252
+ <slot name="body" ${slotted.slotted("bodySlottedContent")}></slot>
253
+ </div>
254
+ <div class="footer">
255
+ <div>
256
+ <slot name="footer" ${slotted.slotted("footerSlottedContent")}></slot>
257
+ </div>
258
+ <div class="actions">
259
+ <slot name="action-items" ${slotted.slotted("actionItemsSlottedContent")}></slot>
260
+ </div>
261
+ </div>
262
+ </div>
263
+ </slot>
264
+ </dialog>
265
+ </${elevationTag}>`;
266
+ };
267
+
268
+ const dialogDefinition = Dialog.compose({
269
+ baseName: "dialog",
270
+ template: DialogTemplate,
271
+ styles: isDialogSupported ? [styles] : [styles, dialogPolyfillStyles]
272
+ });
273
+ const dialogRegistries = [dialogDefinition(), ...definition$2.iconRegistries, ...definition$1.buttonRegistries, ...definition.elevationRegistries];
274
+ const registerDialog = index.registerFactory(dialogRegistries);
275
+
276
+ exports.dialogDefinition = dialogDefinition;
277
+ exports.dialogRegistries = dialogRegistries;
278
+ exports.registerDialog = registerDialog;
@@ -0,0 +1,83 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ const aria = require('./aria.cjs');
5
+ const classNames = require('./class-names.cjs');
6
+
7
+ /**
8
+ * Divider roles
9
+ * @public
10
+ */
11
+ const DividerRole = {
12
+ /**
13
+ * The divider semantically separates content
14
+ */
15
+ separator: "separator",
16
+ /**
17
+ * The divider has no semantic value and is for visual presentation only.
18
+ */
19
+ presentation: "presentation",
20
+ };
21
+
22
+ /**
23
+ * A Divider Custom HTML Element.
24
+ * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#separator | ARIA separator } or {@link https://www.w3.org/TR/wai-aria-1.1/#presentation | ARIA presentation}.
25
+ *
26
+ * @public
27
+ */
28
+ let Divider$1 = class Divider extends index.FoundationElement {
29
+ constructor() {
30
+ super(...arguments);
31
+ /**
32
+ * The role of the element.
33
+ *
34
+ * @public
35
+ * @remarks
36
+ * HTML Attribute: role
37
+ */
38
+ this.role = DividerRole.separator;
39
+ /**
40
+ * The orientation of the divider.
41
+ *
42
+ * @public
43
+ * @remarks
44
+ * HTML Attribute: orientation
45
+ */
46
+ this.orientation = aria.Orientation.horizontal;
47
+ }
48
+ };
49
+ index.__decorate([
50
+ index.attr
51
+ ], Divider$1.prototype, "role", void 0);
52
+ index.__decorate([
53
+ index.attr
54
+ ], Divider$1.prototype, "orientation", void 0);
55
+
56
+ const styles = ":host{display:block}.base{display:block;background-color:var(--vvd-color-neutral-200)}.base:not(.vertical){block-size:1px;inline-size:100%}.base.vertical{block-size:100%;inline-size:1px}\n";
57
+
58
+ class Divider extends Divider$1 {
59
+ }
60
+
61
+ const getClasses = ({ orientation }) => classNames.classNames(
62
+ "base",
63
+ [`${orientation}`, Boolean(orientation)]
64
+ );
65
+ const DividerTemplate = () => index.html`
66
+ <span
67
+ class="${getClasses}"
68
+ orientation="${(x) => x.orientation}"
69
+ role="${(x) => x.role}"
70
+ ></span>`;
71
+
72
+ const dividerDefinition = Divider.compose({
73
+ baseName: "divider",
74
+ template: DividerTemplate,
75
+ styles
76
+ });
77
+ const dividerRegistries = [dividerDefinition()];
78
+ const registerDivider = index.registerFactory(dividerRegistries);
79
+
80
+ exports.Divider = Divider;
81
+ exports.dividerDefinition = dividerDefinition;
82
+ exports.dividerRegistries = dividerRegistries;
83
+ exports.registerDivider = registerDivider;
@@ -0,0 +1,74 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ const definition = require('./definition26.cjs');
5
+ const icon = require('./icon.cjs');
6
+ const when = require('./when.cjs');
7
+ const slotted = require('./slotted.cjs');
8
+ const classNames = require('./class-names.cjs');
9
+
10
+ const styles = ":host{display:block}.base{display:flex;box-sizing:border-box;flex-direction:column;align-items:center;justify-content:center;block-size:100%;gap:24px}.icon-container{display:flex;align-items:center;justify-content:center;background-color:var(--vvd-color-neutral-100);block-size:120px;border-radius:50%;inline-size:120px}.content{display:flex;flex-direction:column;font:var(--vvd-typography-base);gap:8px;text-align:center}header{font:var(--vvd-typography-base-bold)}.actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:8px}.base.no-actions .actions{display:none}\n";
11
+
12
+ var __defProp = Object.defineProperty;
13
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14
+ var __decorateClass = (decorators, target, key, kind) => {
15
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
16
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
17
+ if (decorator = decorators[i])
18
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
19
+ if (kind && result)
20
+ __defProp(target, key, result);
21
+ return result;
22
+ };
23
+ class EmptyState extends index.FoundationElement {
24
+ }
25
+ __decorateClass([
26
+ index.attr
27
+ ], EmptyState.prototype, "headline", 2);
28
+ __decorateClass([
29
+ index.attr
30
+ ], EmptyState.prototype, "icon", 2);
31
+ __decorateClass([
32
+ index.observable
33
+ ], EmptyState.prototype, "slottedActionItems", 2);
34
+
35
+ const getClasses = (x) => classNames.classNames(
36
+ "base",
37
+ ["no-actions", x.slottedActionItems?.length === 0]
38
+ );
39
+ const EmptyStateTemplate = (context) => {
40
+ const iconTag = context.tagFor(icon.Icon);
41
+ return index.html`
42
+ <div class="${getClasses}">
43
+ <slot name="graphic">
44
+ ${when.when(
45
+ (x) => x.icon,
46
+ index.html`<div class="icon-container">
47
+ <${iconTag} class="icon" name="${(x) => x.icon}" size="5"></${iconTag}>
48
+ </div>`
49
+ )}
50
+ </slot>
51
+ <div class="content">
52
+ ${when.when(
53
+ (x) => x.headline,
54
+ index.html`<header>${(x) => x.headline}</header>`
55
+ )}
56
+ <slot></slot>
57
+ </div>
58
+ <div class="actions">
59
+ <slot name="action-items" ${slotted.slotted("slottedActionItems")}></slot>
60
+ </div>
61
+ </div>`;
62
+ };
63
+
64
+ const emptyStateDefinition = EmptyState.compose({
65
+ baseName: "empty-state",
66
+ template: EmptyStateTemplate,
67
+ styles
68
+ });
69
+ const emptyStateRegistries = [emptyStateDefinition(), ...definition.iconRegistries];
70
+ const registerEmptyState = index.registerFactory(emptyStateRegistries);
71
+
72
+ exports.emptyStateDefinition = emptyStateDefinition;
73
+ exports.emptyStateRegistries = emptyStateRegistries;
74
+ exports.registerEmptyState = registerEmptyState;