@vonage/vivid 4.4.0 → 4.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 (235) hide show
  1. package/custom-elements.json +7181 -6876
  2. package/elevation/index.cjs +1 -1
  3. package/elevation/index.js +1 -1
  4. package/index.cjs +80 -74
  5. package/index.js +23 -22
  6. package/lib/components.d.ts +1 -0
  7. package/lib/fab/fab.d.ts +1 -1
  8. package/lib/icon/icon.d.ts +1 -1
  9. package/lib/menu/menu.d.ts +2 -1
  10. package/lib/number-field/number-field.d.ts +3 -1
  11. package/lib/searchable-select/definition.d.ts +4 -0
  12. package/lib/searchable-select/locale.d.ts +6 -0
  13. package/lib/searchable-select/option-tag.d.ts +14 -0
  14. package/lib/searchable-select/option-tag.template.d.ts +4 -0
  15. package/lib/searchable-select/searchable-select.d.ts +29 -0
  16. package/lib/searchable-select/searchable-select.form-associated.d.ts +10 -0
  17. package/lib/searchable-select/searchable-select.template.d.ts +4 -0
  18. package/lib/select/select.d.ts +4 -1
  19. package/lib/tab/locale.d.ts +3 -0
  20. package/lib/tab/tab.d.ts +5 -1
  21. package/lib/tabs/tabs.d.ts +2 -0
  22. package/lib/tag/definition.d.ts +1 -0
  23. package/lib/text-field/text-field.d.ts +3 -1
  24. package/lib/video-player/video-player.d.ts +0 -1
  25. package/listbox/index.cjs +1 -1
  26. package/listbox/index.js +1 -1
  27. package/locales/de-DE.cjs +12 -0
  28. package/locales/de-DE.js +12 -0
  29. package/locales/en-GB.cjs +12 -0
  30. package/locales/en-GB.js +12 -0
  31. package/locales/en-US.cjs +12 -0
  32. package/locales/en-US.js +12 -0
  33. package/locales/ja-JP.cjs +12 -0
  34. package/locales/ja-JP.js +12 -0
  35. package/locales/zh-CN.cjs +12 -0
  36. package/locales/zh-CN.js +12 -0
  37. package/package.json +6 -1
  38. package/popup/index.cjs +1 -1
  39. package/popup/index.js +1 -1
  40. package/searchable-select/index.cjs +5 -0
  41. package/searchable-select/index.js +3 -0
  42. package/select/index.cjs +1 -1
  43. package/select/index.js +1 -1
  44. package/selectable-box/index.cjs +1 -1
  45. package/selectable-box/index.js +1 -1
  46. package/shared/anchored.js +1 -1
  47. package/shared/calendar-event.js +1 -1
  48. package/shared/definition.cjs +2 -2
  49. package/shared/definition.js +2 -2
  50. package/shared/definition11.cjs +1 -1
  51. package/shared/definition11.js +1 -1
  52. package/shared/definition12.cjs +1 -1
  53. package/shared/definition12.js +1 -1
  54. package/shared/definition13.js +1 -1
  55. package/shared/definition14.cjs +1 -1
  56. package/shared/definition14.js +1 -1
  57. package/shared/definition15.cjs +7 -8
  58. package/shared/definition15.js +2 -3
  59. package/shared/definition16.cjs +11 -7
  60. package/shared/definition16.js +10 -6
  61. package/shared/definition17.cjs +2 -2
  62. package/shared/definition17.js +2 -2
  63. package/shared/definition18.cjs +5 -6
  64. package/shared/definition18.js +3 -4
  65. package/shared/definition19.cjs +5 -6
  66. package/shared/definition19.js +3 -4
  67. package/shared/definition20.cjs +16 -38
  68. package/shared/definition20.js +17 -39
  69. package/shared/definition21.cjs +7 -6
  70. package/shared/definition21.js +8 -7
  71. package/shared/definition23.cjs +1 -1
  72. package/shared/definition23.js +2 -2
  73. package/shared/definition24.cjs +2 -2
  74. package/shared/definition24.js +2 -2
  75. package/shared/definition25.cjs +6 -7
  76. package/shared/definition25.js +2 -3
  77. package/shared/definition26.cjs +1 -1
  78. package/shared/definition26.js +2 -2
  79. package/shared/definition27.cjs +1 -1
  80. package/shared/definition27.js +1 -1
  81. package/shared/definition28.js +1 -1
  82. package/shared/definition29.cjs +8 -4
  83. package/shared/definition29.js +8 -4
  84. package/shared/definition3.cjs +1 -1
  85. package/shared/definition3.js +2 -2
  86. package/shared/definition30.cjs +4 -2
  87. package/shared/definition30.js +4 -2
  88. package/shared/definition31.cjs +1 -1
  89. package/shared/definition31.js +2 -2
  90. package/shared/definition32.cjs +1 -1
  91. package/shared/definition32.js +1 -1
  92. package/shared/definition34.cjs +2 -3
  93. package/shared/definition34.js +2 -3
  94. package/shared/definition35.cjs +21 -16
  95. package/shared/definition35.js +16 -11
  96. package/shared/definition36.cjs +50 -207
  97. package/shared/definition36.js +51 -207
  98. package/shared/definition37.js +1 -1
  99. package/shared/definition38.cjs +1 -1
  100. package/shared/definition38.js +1 -1
  101. package/shared/definition4.cjs +6 -4
  102. package/shared/definition4.js +7 -5
  103. package/shared/definition41.cjs +1 -1
  104. package/shared/definition41.js +1 -1
  105. package/shared/definition42.cjs +6 -7
  106. package/shared/definition42.js +6 -7
  107. package/shared/definition43.cjs +998 -643
  108. package/shared/definition43.js +992 -638
  109. package/shared/definition44.cjs +723 -112
  110. package/shared/definition44.js +722 -111
  111. package/shared/definition45.cjs +121 -79
  112. package/shared/definition45.js +120 -78
  113. package/shared/definition46.cjs +81 -616
  114. package/shared/definition46.js +80 -614
  115. package/shared/definition47.cjs +609 -116
  116. package/shared/definition47.js +607 -115
  117. package/shared/definition48.cjs +116 -134
  118. package/shared/definition48.js +115 -133
  119. package/shared/definition49.cjs +149 -19
  120. package/shared/definition49.js +148 -18
  121. package/shared/definition5.cjs +5 -6
  122. package/shared/definition5.js +5 -6
  123. package/shared/definition50.cjs +21 -82
  124. package/shared/definition50.js +20 -81
  125. package/shared/definition51.cjs +78 -494
  126. package/shared/definition51.js +77 -493
  127. package/shared/definition52.cjs +568 -28
  128. package/shared/definition52.js +567 -27
  129. package/shared/definition53.cjs +28 -123
  130. package/shared/definition53.js +27 -123
  131. package/shared/definition54.cjs +115 -296
  132. package/shared/definition54.js +114 -295
  133. package/shared/definition55.cjs +258 -318
  134. package/shared/definition55.js +252 -312
  135. package/shared/definition56.cjs +303 -784
  136. package/shared/definition56.js +298 -779
  137. package/shared/definition57.cjs +802 -95
  138. package/shared/definition57.js +801 -94
  139. package/shared/definition58.cjs +95 -60
  140. package/shared/definition58.js +94 -59
  141. package/shared/definition59.cjs +117 -75
  142. package/shared/definition59.js +116 -74
  143. package/shared/definition6.cjs +1 -1
  144. package/shared/definition6.js +1 -1
  145. package/shared/definition60.cjs +70 -285
  146. package/shared/definition60.js +71 -286
  147. package/shared/definition61.cjs +296 -325
  148. package/shared/definition61.js +295 -324
  149. package/shared/definition62.cjs +66160 -27
  150. package/shared/definition62.js +66159 -26
  151. package/shared/definition63.cjs +24 -1952
  152. package/shared/definition63.js +23 -1950
  153. package/shared/definition64.cjs +1976 -0
  154. package/shared/definition64.js +1971 -0
  155. package/shared/definition7.cjs +1 -1
  156. package/shared/definition7.js +1 -1
  157. package/shared/definition8.cjs +2 -3
  158. package/shared/definition8.js +3 -4
  159. package/shared/definition9.cjs +1 -1
  160. package/shared/definition9.js +1 -1
  161. package/shared/dialog/index.d.ts +1 -0
  162. package/shared/form-elements.cjs +236 -0
  163. package/shared/form-elements.js +229 -0
  164. package/shared/icon.js +1 -1
  165. package/shared/index2.cjs +6 -256
  166. package/shared/index2.js +6 -249
  167. package/shared/listbox-option.cjs +204 -0
  168. package/shared/listbox-option.js +201 -0
  169. package/shared/listbox.cjs +3 -3
  170. package/shared/listbox.js +1 -1
  171. package/shared/localization/Locale.d.ts +4 -0
  172. package/shared/localized.cjs +26 -2
  173. package/shared/localized.js +25 -2
  174. package/shared/playbackRates.cjs +13 -0
  175. package/shared/playbackRates.js +11 -0
  176. package/shared/presentationDate.cjs +11 -11
  177. package/shared/presentationDate.js +11 -11
  178. package/shared/scrollIntoView.cjs +51 -0
  179. package/shared/scrollIntoView.js +49 -0
  180. package/shared/slider.template.cjs +1 -1
  181. package/shared/slider.template.js +1 -1
  182. package/shared/text-anchor.cjs +1 -1
  183. package/shared/text-anchor.js +1 -1
  184. package/shared/text-field.cjs +1 -1
  185. package/shared/text-field.js +1 -1
  186. package/shared/utils/playbackRates.d.ts +1 -0
  187. package/shared/utils/scrollIntoView.d.ts +1 -0
  188. package/side-drawer/index.cjs +1 -1
  189. package/side-drawer/index.js +1 -1
  190. package/slider/index.cjs +1 -1
  191. package/slider/index.js +1 -1
  192. package/split-button/index.cjs +1 -1
  193. package/split-button/index.js +1 -1
  194. package/styles/core/all.css +1 -1
  195. package/styles/core/theme.css +1 -1
  196. package/styles/core/typography.css +1 -1
  197. package/styles/tokens/theme-dark.css +4 -4
  198. package/styles/tokens/theme-light.css +4 -4
  199. package/styles/tokens/vivid-2-compat.css +1 -1
  200. package/switch/index.cjs +1 -1
  201. package/switch/index.js +1 -1
  202. package/tab/index.cjs +1 -1
  203. package/tab/index.js +1 -1
  204. package/tab-panel/index.cjs +1 -1
  205. package/tab-panel/index.js +1 -1
  206. package/tabs/index.cjs +1 -1
  207. package/tabs/index.js +1 -1
  208. package/tag/index.cjs +1 -1
  209. package/tag/index.js +1 -1
  210. package/tag-group/index.cjs +1 -1
  211. package/tag-group/index.js +1 -1
  212. package/text-area/index.cjs +1 -1
  213. package/text-area/index.js +1 -1
  214. package/text-field/index.cjs +1 -1
  215. package/text-field/index.js +1 -1
  216. package/time-picker/index.cjs +1 -1
  217. package/time-picker/index.js +1 -1
  218. package/toggletip/index.cjs +1 -1
  219. package/toggletip/index.js +1 -1
  220. package/tooltip/index.cjs +1 -1
  221. package/tooltip/index.js +1 -1
  222. package/tree-item/index.cjs +1 -1
  223. package/tree-item/index.js +1 -1
  224. package/tree-view/index.cjs +1 -1
  225. package/tree-view/index.js +1 -1
  226. package/video-player/index.cjs +1 -1
  227. package/video-player/index.js +1 -1
  228. package/vivid.api.json +312 -8
  229. package/appearance-ui/index.cjs +0 -102
  230. package/appearance-ui/index.js +0 -100
  231. package/lib/appearance-ui/appearance-ui.d.ts +0 -12
  232. package/lib/appearance-ui/appearance-ui.template.d.ts +0 -4
  233. package/lib/appearance-ui/definition.d.ts +0 -3
  234. package/shared/video-player.cjs +0 -65860
  235. package/shared/video-player.js +0 -65857
package/shared/index2.cjs CHANGED
@@ -1,261 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const icon = require('./icon.cjs');
4
- const index = require('./index.cjs');
5
- const slotted = require('./slotted.cjs');
6
- const classNames = require('./class-names.cjs');
7
- const when = require('./when.cjs');
8
- const locales_enUS = require('../locales/en-US.cjs');
9
-
10
- const messageStyles = ".sr-only{position:absolute;overflow:hidden;width:1px;height:1px;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}.message{display:none;contain:inline-size;font:var(--vvd-typography-base-condensed);gap:4px;grid-column:1/-1}.message--visible{display:flex}.message-text{color:var(--vvd-color-canvas-text)}.helper-message .message-text{color:var(--_low-ink-color)}.message-icon{font-size:16px}.success-message .message-icon{color:var(--vvd-color-success-500)}.error-message .message-icon{color:var(--vvd-color-alert-500)}";
11
-
12
- var __defProp$1 = Object.defineProperty;
13
- var __decorateClass$1 = (decorators, target, key, kind) => {
14
- var result = void 0 ;
15
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
16
- if (decorator = decorators[i])
17
- result = (decorator(target, key, result) ) || result;
18
- if (result) __defProp$1(target, key, result);
19
- return result;
20
- };
21
- class FormElementHelperText {
22
- }
23
- __decorateClass$1([
24
- index.attr({ attribute: "helper-text" })
25
- ], FormElementHelperText.prototype, "helperText");
26
- __decorateClass$1([
27
- index.observable
28
- ], FormElementHelperText.prototype, "_helperTextSlottedContent");
29
- class FormElementSuccessText {
30
- }
31
- __decorateClass$1([
32
- index.attr({ attribute: "success-text" })
33
- ], FormElementSuccessText.prototype, "successText");
34
- class FormElementCharCount {
35
- constructor() {
36
- this.charCount = false;
37
- }
38
- }
39
- __decorateClass$1([
40
- index.attr({
41
- attribute: "char-count",
42
- mode: "boolean"
43
- })
44
- ], FormElementCharCount.prototype, "charCount");
45
- function formElements(constructor) {
46
- let currentPrototype = constructor.prototype;
47
- while (currentPrototype) {
48
- const parentPrototype = Object.getPrototypeOf(currentPrototype);
49
- if (currentPrototype.validate && !parentPrototype.validate) {
50
- currentPrototype.validate = function(anchor) {
51
- if (this.proxy instanceof HTMLElement && this.elementInternals) {
52
- const isValid = this.proxy.validity.valid;
53
- const controlIsInvalidDueToMinOrMaxLength = this.control && this.control.validity && !this.control.validity.valid && (this.control.validity.tooShort || this.control.validity.tooLong);
54
- if (isValid && controlIsInvalidDueToMinOrMaxLength) {
55
- this.setValidity(
56
- this.control.validity,
57
- this.control.validationMessage,
58
- anchor
59
- );
60
- } else {
61
- this.setValidity(
62
- this.proxy.validity,
63
- this.proxy.validationMessage,
64
- anchor
65
- );
66
- }
67
- }
68
- };
69
- break;
70
- }
71
- currentPrototype = parentPrototype;
72
- }
73
- class Decorated extends constructor {
74
- constructor(...args) {
75
- super(...args);
76
- this.errorValidationMessage = "";
77
- this.#forceErrorDisplay = false;
78
- this.#hasBeenTouched = false;
79
- this.#handleInvalidEvent = () => {
80
- this.#forceErrorDisplay = true;
81
- this.validate();
82
- };
83
- this.validate = () => {
84
- super.validate();
85
- const shouldShowValidationError = this.#forceErrorDisplay || this.#hasBeenTouched && this.dirtyValue;
86
- this.errorValidationMessage = shouldShowValidationError ? this.validationMessage : "";
87
- };
88
- this.addEventListener("blur", () => {
89
- this.#hasBeenTouched = true;
90
- this.#forceErrorDisplay = false;
91
- this.validate();
92
- });
93
- this.addEventListener("focus", () => {
94
- this.#hasBeenTouched = false;
95
- });
96
- this.addEventListener("invalid", () => {
97
- this.proxy.dispatchEvent(new Event("invalid"));
98
- });
99
- }
100
- #forceErrorDisplay;
101
- #hasBeenTouched;
102
- connectedCallback() {
103
- super.connectedCallback();
104
- this.proxy.addEventListener("invalid", this.#handleInvalidEvent);
105
- }
106
- #handleInvalidEvent;
107
- disconnectedCallback() {
108
- super.disconnectedCallback();
109
- this.proxy.removeEventListener("invalid", this.#handleInvalidEvent);
110
- }
111
- formResetCallback() {
112
- this.#forceErrorDisplay = false;
113
- super.formResetCallback();
114
- this.validate();
115
- }
116
- }
117
- __decorateClass$1([
118
- index.attr
119
- ], Decorated.prototype, "label");
120
- __decorateClass$1([
121
- index.observable
122
- ], Decorated.prototype, "errorValidationMessage");
123
- return Decorated;
124
- }
125
- const feedback = {
126
- helper: {
127
- messageProperty: "helperText",
128
- className: "helper",
129
- slot: {
130
- name: "helper-text",
131
- slottedContentProperty: "_helperTextSlottedContent"
132
- },
133
- role: "none"
134
- },
135
- error: {
136
- messageProperty: "errorValidationMessage",
137
- className: "error",
138
- iconType: "info-line",
139
- role: "status"
140
- },
141
- success: {
142
- messageProperty: "successText",
143
- className: "success",
144
- iconType: "check-circle-line",
145
- role: "none"
146
- }
147
- };
148
- const isFeedbackAvailable = (config, x) => Boolean(
149
- x[config.messageProperty] || config.slot && x[config.slot.slottedContentProperty]?.length
150
- );
151
- function getFeedbackTemplate(context) {
152
- return index.html`
153
- <style>
154
- ${messageStyles}
155
- </style>
156
- ${getFeedbackTypeTemplate(
157
- context,
158
- feedback.helper,
159
- (x) => isFeedbackAvailable(feedback.helper, x) && !isFeedbackAvailable(feedback.error, x) && !isFeedbackAvailable(feedback.success, x)
160
- )}
161
- ${getFeedbackTypeTemplate(
162
- context,
163
- feedback.error,
164
- (x) => isFeedbackAvailable(feedback.error, x) && !isFeedbackAvailable(feedback.success, x)
165
- )}
166
- ${getFeedbackTypeTemplate(
167
- context,
168
- feedback.success,
169
- (x) => isFeedbackAvailable(feedback.success, x)
170
- )}
171
- `;
172
- }
173
- function getFeedbackTypeTemplate(context, config, shouldShow) {
174
- const iconTag = context.tagFor(icon.Icon);
175
- const messageTemplate = index.html`${(x) => x[config.messageProperty]}`;
176
- const innerTemplate = config.slot ? index.html`<slot
177
- name="${config.slot.name}"
178
- ${slotted.slotted(config.slot.slottedContentProperty)}
179
- >${messageTemplate}</slot
180
- >` : messageTemplate;
181
- return index.html`<div
182
- class="${(x) => classNames.classNames(
183
- "message",
184
- `${config.className}-message`,
185
- ["message--visible", config.role === "status" || shouldShow(x)],
186
- ["sr-only", !shouldShow(x)]
187
- )}"
188
- role="${config.role}"
189
- aria-atomic="false"
190
- >
191
- ${when.when(
192
- (x) => shouldShow(x) && config.iconType,
193
- index.html`<${iconTag} class="message-icon" name="${config.iconType}"></${iconTag}>`
194
- )}
195
- <span class="message-text">${innerTemplate}</span>
196
- </div>`;
197
- }
198
- function errorText(constructor) {
199
- class Decorated extends constructor {
200
- #blockValidateCalls = false;
201
- constructor(...args) {
202
- super(...args);
203
- this._validate = this.validate;
204
- this.validate = () => {
205
- if (!this.#blockValidateCalls) this._validate();
206
- };
207
- }
208
- errorTextChanged(_, newErrorText) {
209
- if (newErrorText) {
210
- this.#forceCustomError(newErrorText);
211
- } else {
212
- this.#clearCustomErrorAndRevalidate();
213
- }
214
- }
215
- #forceCustomError(errorMessage) {
216
- this.setValidity({ customError: true }, errorMessage, this.control);
217
- this.errorValidationMessage = errorMessage;
218
- this.#blockValidateCalls = true;
219
- }
220
- #clearCustomErrorAndRevalidate() {
221
- this.setValidity({}, "", this.control);
222
- this.#blockValidateCalls = false;
223
- this.validate();
224
- }
225
- }
226
- __decorateClass$1([
227
- index.attr({ attribute: "error-text" })
228
- ], Decorated.prototype, "errorText");
229
- return Decorated;
230
- }
231
-
232
- var __defProp = Object.defineProperty;
233
- var __decorateClass = (decorators, target, key, kind) => {
234
- var result = void 0 ;
235
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
236
- if (decorator = decorators[i])
237
- result = (decorator(target, key, result) ) || result;
238
- if (result) __defProp(target, key, result);
239
- return result;
240
- };
241
- class CurrentLocale {
242
- constructor() {
243
- this.locale = locales_enUS;
3
+ function handleEscapeKeyAndStopPropogation(event) {
4
+ if (event.key === "Escape") {
5
+ event.stopPropagation();
6
+ return true;
244
7
  }
8
+ return false;
245
9
  }
246
- __decorateClass([
247
- index.observable
248
- ], CurrentLocale.prototype, "locale");
249
- const currentLocale = new CurrentLocale();
250
- const setLocale = (locale) => {
251
- currentLocale.locale = locale;
252
- };
253
10
 
254
- exports.FormElementCharCount = FormElementCharCount;
255
- exports.FormElementHelperText = FormElementHelperText;
256
- exports.FormElementSuccessText = FormElementSuccessText;
257
- exports.currentLocale = currentLocale;
258
- exports.errorText = errorText;
259
- exports.formElements = formElements;
260
- exports.getFeedbackTemplate = getFeedbackTemplate;
261
- exports.setLocale = setLocale;
11
+ exports.handleEscapeKeyAndStopPropogation = handleEscapeKeyAndStopPropogation;
package/shared/index2.js CHANGED
@@ -1,252 +1,9 @@
1
- import { I as Icon } from './icon.js';
2
- import { a as attr, o as observable, h as html } from './index.js';
3
- import { s as slotted } from './slotted.js';
4
- import { c as classNames } from './class-names.js';
5
- import { w as when } from './when.js';
6
- import enUS from '../locales/en-US.js';
7
-
8
- const messageStyles = ".sr-only{position:absolute;overflow:hidden;width:1px;height:1px;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}.message{display:none;contain:inline-size;font:var(--vvd-typography-base-condensed);gap:4px;grid-column:1/-1}.message--visible{display:flex}.message-text{color:var(--vvd-color-canvas-text)}.helper-message .message-text{color:var(--_low-ink-color)}.message-icon{font-size:16px}.success-message .message-icon{color:var(--vvd-color-success-500)}.error-message .message-icon{color:var(--vvd-color-alert-500)}";
9
-
10
- var __defProp$1 = Object.defineProperty;
11
- var __decorateClass$1 = (decorators, target, key, kind) => {
12
- var result = void 0 ;
13
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
14
- if (decorator = decorators[i])
15
- result = (decorator(target, key, result) ) || result;
16
- if (result) __defProp$1(target, key, result);
17
- return result;
18
- };
19
- class FormElementHelperText {
20
- }
21
- __decorateClass$1([
22
- attr({ attribute: "helper-text" })
23
- ], FormElementHelperText.prototype, "helperText");
24
- __decorateClass$1([
25
- observable
26
- ], FormElementHelperText.prototype, "_helperTextSlottedContent");
27
- class FormElementSuccessText {
28
- }
29
- __decorateClass$1([
30
- attr({ attribute: "success-text" })
31
- ], FormElementSuccessText.prototype, "successText");
32
- class FormElementCharCount {
33
- constructor() {
34
- this.charCount = false;
35
- }
36
- }
37
- __decorateClass$1([
38
- attr({
39
- attribute: "char-count",
40
- mode: "boolean"
41
- })
42
- ], FormElementCharCount.prototype, "charCount");
43
- function formElements(constructor) {
44
- let currentPrototype = constructor.prototype;
45
- while (currentPrototype) {
46
- const parentPrototype = Object.getPrototypeOf(currentPrototype);
47
- if (currentPrototype.validate && !parentPrototype.validate) {
48
- currentPrototype.validate = function(anchor) {
49
- if (this.proxy instanceof HTMLElement && this.elementInternals) {
50
- const isValid = this.proxy.validity.valid;
51
- const controlIsInvalidDueToMinOrMaxLength = this.control && this.control.validity && !this.control.validity.valid && (this.control.validity.tooShort || this.control.validity.tooLong);
52
- if (isValid && controlIsInvalidDueToMinOrMaxLength) {
53
- this.setValidity(
54
- this.control.validity,
55
- this.control.validationMessage,
56
- anchor
57
- );
58
- } else {
59
- this.setValidity(
60
- this.proxy.validity,
61
- this.proxy.validationMessage,
62
- anchor
63
- );
64
- }
65
- }
66
- };
67
- break;
68
- }
69
- currentPrototype = parentPrototype;
70
- }
71
- class Decorated extends constructor {
72
- constructor(...args) {
73
- super(...args);
74
- this.errorValidationMessage = "";
75
- this.#forceErrorDisplay = false;
76
- this.#hasBeenTouched = false;
77
- this.#handleInvalidEvent = () => {
78
- this.#forceErrorDisplay = true;
79
- this.validate();
80
- };
81
- this.validate = () => {
82
- super.validate();
83
- const shouldShowValidationError = this.#forceErrorDisplay || this.#hasBeenTouched && this.dirtyValue;
84
- this.errorValidationMessage = shouldShowValidationError ? this.validationMessage : "";
85
- };
86
- this.addEventListener("blur", () => {
87
- this.#hasBeenTouched = true;
88
- this.#forceErrorDisplay = false;
89
- this.validate();
90
- });
91
- this.addEventListener("focus", () => {
92
- this.#hasBeenTouched = false;
93
- });
94
- this.addEventListener("invalid", () => {
95
- this.proxy.dispatchEvent(new Event("invalid"));
96
- });
97
- }
98
- #forceErrorDisplay;
99
- #hasBeenTouched;
100
- connectedCallback() {
101
- super.connectedCallback();
102
- this.proxy.addEventListener("invalid", this.#handleInvalidEvent);
103
- }
104
- #handleInvalidEvent;
105
- disconnectedCallback() {
106
- super.disconnectedCallback();
107
- this.proxy.removeEventListener("invalid", this.#handleInvalidEvent);
108
- }
109
- formResetCallback() {
110
- this.#forceErrorDisplay = false;
111
- super.formResetCallback();
112
- this.validate();
113
- }
114
- }
115
- __decorateClass$1([
116
- attr
117
- ], Decorated.prototype, "label");
118
- __decorateClass$1([
119
- observable
120
- ], Decorated.prototype, "errorValidationMessage");
121
- return Decorated;
122
- }
123
- const feedback = {
124
- helper: {
125
- messageProperty: "helperText",
126
- className: "helper",
127
- slot: {
128
- name: "helper-text",
129
- slottedContentProperty: "_helperTextSlottedContent"
130
- },
131
- role: "none"
132
- },
133
- error: {
134
- messageProperty: "errorValidationMessage",
135
- className: "error",
136
- iconType: "info-line",
137
- role: "status"
138
- },
139
- success: {
140
- messageProperty: "successText",
141
- className: "success",
142
- iconType: "check-circle-line",
143
- role: "none"
144
- }
145
- };
146
- const isFeedbackAvailable = (config, x) => Boolean(
147
- x[config.messageProperty] || config.slot && x[config.slot.slottedContentProperty]?.length
148
- );
149
- function getFeedbackTemplate(context) {
150
- return html`
151
- <style>
152
- ${messageStyles}
153
- </style>
154
- ${getFeedbackTypeTemplate(
155
- context,
156
- feedback.helper,
157
- (x) => isFeedbackAvailable(feedback.helper, x) && !isFeedbackAvailable(feedback.error, x) && !isFeedbackAvailable(feedback.success, x)
158
- )}
159
- ${getFeedbackTypeTemplate(
160
- context,
161
- feedback.error,
162
- (x) => isFeedbackAvailable(feedback.error, x) && !isFeedbackAvailable(feedback.success, x)
163
- )}
164
- ${getFeedbackTypeTemplate(
165
- context,
166
- feedback.success,
167
- (x) => isFeedbackAvailable(feedback.success, x)
168
- )}
169
- `;
170
- }
171
- function getFeedbackTypeTemplate(context, config, shouldShow) {
172
- const iconTag = context.tagFor(Icon);
173
- const messageTemplate = html`${(x) => x[config.messageProperty]}`;
174
- const innerTemplate = config.slot ? html`<slot
175
- name="${config.slot.name}"
176
- ${slotted(config.slot.slottedContentProperty)}
177
- >${messageTemplate}</slot
178
- >` : messageTemplate;
179
- return html`<div
180
- class="${(x) => classNames(
181
- "message",
182
- `${config.className}-message`,
183
- ["message--visible", config.role === "status" || shouldShow(x)],
184
- ["sr-only", !shouldShow(x)]
185
- )}"
186
- role="${config.role}"
187
- aria-atomic="false"
188
- >
189
- ${when(
190
- (x) => shouldShow(x) && config.iconType,
191
- html`<${iconTag} class="message-icon" name="${config.iconType}"></${iconTag}>`
192
- )}
193
- <span class="message-text">${innerTemplate}</span>
194
- </div>`;
195
- }
196
- function errorText(constructor) {
197
- class Decorated extends constructor {
198
- #blockValidateCalls = false;
199
- constructor(...args) {
200
- super(...args);
201
- this._validate = this.validate;
202
- this.validate = () => {
203
- if (!this.#blockValidateCalls) this._validate();
204
- };
205
- }
206
- errorTextChanged(_, newErrorText) {
207
- if (newErrorText) {
208
- this.#forceCustomError(newErrorText);
209
- } else {
210
- this.#clearCustomErrorAndRevalidate();
211
- }
212
- }
213
- #forceCustomError(errorMessage) {
214
- this.setValidity({ customError: true }, errorMessage, this.control);
215
- this.errorValidationMessage = errorMessage;
216
- this.#blockValidateCalls = true;
217
- }
218
- #clearCustomErrorAndRevalidate() {
219
- this.setValidity({}, "", this.control);
220
- this.#blockValidateCalls = false;
221
- this.validate();
222
- }
223
- }
224
- __decorateClass$1([
225
- attr({ attribute: "error-text" })
226
- ], Decorated.prototype, "errorText");
227
- return Decorated;
228
- }
229
-
230
- var __defProp = Object.defineProperty;
231
- var __decorateClass = (decorators, target, key, kind) => {
232
- var result = void 0 ;
233
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
234
- if (decorator = decorators[i])
235
- result = (decorator(target, key, result) ) || result;
236
- if (result) __defProp(target, key, result);
237
- return result;
238
- };
239
- class CurrentLocale {
240
- constructor() {
241
- this.locale = enUS;
1
+ function handleEscapeKeyAndStopPropogation(event) {
2
+ if (event.key === "Escape") {
3
+ event.stopPropagation();
4
+ return true;
242
5
  }
6
+ return false;
243
7
  }
244
- __decorateClass([
245
- observable
246
- ], CurrentLocale.prototype, "locale");
247
- const currentLocale = new CurrentLocale();
248
- const setLocale = (locale) => {
249
- currentLocale.locale = locale;
250
- };
251
8
 
252
- export { FormElementSuccessText as F, FormElementHelperText as a, FormElementCharCount as b, currentLocale as c, errorText as e, formElements as f, getFeedbackTemplate as g, setLocale as s };
9
+ export { handleEscapeKeyAndStopPropogation as h };