@italia/globals 0.1.0-alpha.1 → 0.1.0-alpha.2

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 (54) hide show
  1. package/custom-elements.json +1608 -179
  2. package/dist/src/base-component/base-component.d.ts +9 -6
  3. package/dist/src/base-component/base-component.d.ts.map +1 -1
  4. package/dist/src/base-component/base-component.js +27 -17
  5. package/dist/src/base-component/base-component.js.map +1 -1
  6. package/dist/src/controllers/aria-keyboard-accordion-controller.d.ts +15 -0
  7. package/dist/src/controllers/aria-keyboard-accordion-controller.d.ts.map +1 -0
  8. package/dist/src/controllers/aria-keyboard-accordion-controller.js +52 -0
  9. package/dist/src/controllers/aria-keyboard-accordion-controller.js.map +1 -0
  10. package/dist/src/controllers/aria-keyboard-list-controller.d.ts +18 -0
  11. package/dist/src/controllers/aria-keyboard-list-controller.d.ts.map +1 -0
  12. package/dist/src/controllers/aria-keyboard-list-controller.js +58 -0
  13. package/dist/src/controllers/aria-keyboard-list-controller.js.map +1 -0
  14. package/dist/src/controllers/collapse-controller.d.ts +12 -0
  15. package/dist/src/controllers/collapse-controller.d.ts.map +1 -0
  16. package/dist/src/controllers/collapse-controller.js +95 -0
  17. package/dist/src/controllers/collapse-controller.js.map +1 -0
  18. package/dist/src/controllers/roving-tabindex-controller.d.ts +85 -0
  19. package/dist/src/controllers/roving-tabindex-controller.d.ts.map +1 -0
  20. package/dist/src/controllers/roving-tabindex-controller.js +200 -0
  21. package/dist/src/controllers/roving-tabindex-controller.js.map +1 -0
  22. package/dist/src/form/form-control.d.ts +60 -0
  23. package/dist/src/form/form-control.d.ts.map +1 -0
  24. package/dist/src/form/form-control.js +251 -0
  25. package/dist/src/form/form-control.js.map +1 -0
  26. package/dist/src/form/form-controller.d.ts +66 -0
  27. package/dist/src/form/form-controller.d.ts.map +1 -0
  28. package/dist/src/form/form-controller.js +364 -0
  29. package/dist/src/form/form-controller.js.map +1 -0
  30. package/dist/src/form/locales/it.d.ts +4 -0
  31. package/dist/src/form/locales/it.d.ts.map +1 -0
  32. package/dist/src/form/locales/it.js +11 -0
  33. package/dist/src/form/locales/it.js.map +1 -0
  34. package/dist/src/index.d.ts +12 -4
  35. package/dist/src/index.d.ts.map +1 -1
  36. package/dist/src/index.js +10 -4
  37. package/dist/src/index.js.map +1 -1
  38. package/dist/src/mixins/validity.d.ts +1 -13
  39. package/dist/src/mixins/validity.d.ts.map +1 -1
  40. package/dist/src/mixins/validity.js +6 -68
  41. package/dist/src/mixins/validity.js.map +1 -1
  42. package/dist/src/stories/formControlReusableStories.d.ts +19 -0
  43. package/dist/src/stories/formControlReusableStories.d.ts.map +1 -0
  44. package/dist/src/stories/formControlReusableStories.js +63 -0
  45. package/dist/src/stories/formControlReusableStories.js.map +1 -0
  46. package/dist/src/window-manager.d.ts +20 -0
  47. package/dist/src/window-manager.d.ts.map +1 -0
  48. package/dist/src/window-manager.js +47 -0
  49. package/dist/src/window-manager.js.map +1 -0
  50. package/package.json +10 -8
  51. package/dist/src/mixins/form.d.ts +0 -363
  52. package/dist/src/mixins/form.d.ts.map +0 -1
  53. package/dist/src/mixins/form.js +0 -36
  54. package/dist/src/mixins/form.js.map +0 -1
@@ -0,0 +1,364 @@
1
+ //
2
+ // We store a WeakMap of forms + controls so we can keep references to all FormControl within a given form. As
3
+ // elements connect and disconnect to/from the DOM, their containing form is used as the key and the form control is
4
+ // added and removed from the form's set, respectively.
5
+ //
6
+ export const formCollections = new WeakMap();
7
+ //
8
+ // We store a WeakMap of reportValidity() overloads so we can override it when form controls connect to the DOM and
9
+ // restore the original behavior when they disconnect.
10
+ //
11
+ const reportValidityOverloads = new WeakMap();
12
+ const checkValidityOverloads = new WeakMap();
13
+ //
14
+ // We store a Set of controls that users have interacted with. This allows us to determine the interaction state
15
+ // without littering the DOM with additional data attributes.
16
+ //
17
+ const userInteractedControls = new WeakSet();
18
+ //
19
+ // We store a WeakMap of interactions for each form control so we can track when all conditions are met for validation.
20
+ //
21
+ const interactions = new WeakMap();
22
+ /** A reactive controller to allow form controls to participate in form submission, validation, etc. */
23
+ export class FormControlController {
24
+ constructor(host, options) {
25
+ this.handleFormData = (event) => {
26
+ // console.log('handleFormData');
27
+ const disabled = this.options.disabled(this.host);
28
+ const name = this.options.name(this.host);
29
+ const value = this.options.value(this.host);
30
+ const tagName = this.host.tagName.toLowerCase();
31
+ // For buttons, we only submit the value if they were the submitter. This is currently done in doAction() by
32
+ // injecting the name/value on a temporary button, so we can just skip them here.
33
+ const isButton = tagName === 'it-button';
34
+ if (this.host.isConnected &&
35
+ !disabled &&
36
+ !isButton &&
37
+ typeof name === 'string' &&
38
+ name.length > 0 &&
39
+ typeof value !== 'undefined') {
40
+ switch (tagName) {
41
+ case 'it-radio':
42
+ if (this.host.checked) {
43
+ event.formData.append(name, value);
44
+ }
45
+ break;
46
+ default:
47
+ if (Array.isArray(value)) {
48
+ value.forEach((val) => {
49
+ event.formData.append(name, val.toString());
50
+ });
51
+ }
52
+ else {
53
+ event.formData.append(name, value.toString());
54
+ }
55
+ }
56
+ }
57
+ };
58
+ this.handleFormSubmit = (event) => {
59
+ const disabled = this.options.disabled(this.host);
60
+ const reportValidity = this.options.reportValidity;
61
+ // Update the interacted state for all controls when the form is submitted
62
+ if (this.form && !this.form.noValidate) {
63
+ formCollections.get(this.form)?.forEach((control) => {
64
+ this.setUserInteracted(control, true);
65
+ });
66
+ }
67
+ if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {
68
+ event.preventDefault();
69
+ // event.stopImmediatePropagation(); // se lo attiviamo, valida un campo alla volta
70
+ }
71
+ };
72
+ this.handleFormReset = () => {
73
+ this.options.setValue(this.host, '');
74
+ this.setUserInteracted(this.host, false);
75
+ interactions.set(this.host, []);
76
+ };
77
+ this.handleInteraction = (event) => {
78
+ const emittedEvents = interactions.get(this.host);
79
+ if (!emittedEvents.includes(event.type)) {
80
+ emittedEvents.push(event.type);
81
+ }
82
+ // Mark it as user-interacted as soon as all associated events have been emitted
83
+ if (emittedEvents.length === this.options.assumeInteractionOn.length) {
84
+ this.setUserInteracted(this.host, true);
85
+ }
86
+ };
87
+ this.checkFormValidity = () => {
88
+ // console.log('checkFormValidity');
89
+ //
90
+ // This is very similar to the `reportFormValidity` function, but it does not trigger native constraint validation
91
+ // Allow the user to simply check if the form is valid and handling validity in their own way.
92
+ //
93
+ // We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger
94
+ // validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't
95
+ // be necessary once we can use ElementInternals.
96
+ //
97
+ // Note that we're also honoring the form's novalidate attribute.
98
+ //
99
+ if (this.form && !this.form.noValidate) {
100
+ // This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom
101
+ // elements that support the constraint validation API.
102
+ const elements = this.form.querySelectorAll('*');
103
+ for (const element of elements) {
104
+ if (typeof element.checkValidity === 'function') {
105
+ if (!element.checkValidity()) {
106
+ return false;
107
+ }
108
+ }
109
+ }
110
+ }
111
+ return true;
112
+ };
113
+ this.reportFormValidity = () => {
114
+ // console.log('reportFormValidity');
115
+ //
116
+ // FormControl work hard to act like regular form controls. They support the Constraint Validation API
117
+ // and its associated methods such as setCustomValidity() and reportValidity(). However, the HTMLFormElement also
118
+ // has a reportValidity() method that will trigger validation on all child controls. Since we're not yet using
119
+ // ElementInternals, we need to overload this method so it looks for any element with the reportValidity() method.
120
+ //
121
+ // We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger
122
+ // validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't
123
+ // be necessary once we can use ElementInternals.
124
+ //
125
+ // Note that we're also honoring the form's novalidate attribute.
126
+ //
127
+ if (this.form && !this.form.noValidate) {
128
+ // This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom
129
+ // elements that support the constraint validation API.
130
+ const elements = this.form.querySelectorAll('*');
131
+ for (const element of elements) {
132
+ if (typeof element.reportValidity === 'function') {
133
+ if (!element.reportValidity()) {
134
+ return false;
135
+ }
136
+ }
137
+ }
138
+ }
139
+ return true;
140
+ };
141
+ (this.host = host).addController(this);
142
+ this.options = {
143
+ form: (input) => {
144
+ // If there's a form attribute, use it to find the target form by id
145
+ // Controls may not always reflect the 'form' property. For example, `<it-button>` doesn't reflect.
146
+ const formId = input.form;
147
+ if (formId) {
148
+ const root = input.getRootNode();
149
+ const form = root.querySelector(`#${formId}`);
150
+ if (form) {
151
+ return form;
152
+ }
153
+ }
154
+ return input.closest('form');
155
+ },
156
+ name: (input) => input.name,
157
+ value: (input) => input.value,
158
+ disabled: (input) => input.disabled ?? false,
159
+ reportValidity: (input) => typeof input.reportValidity === 'function' ? input.reportValidity() : true,
160
+ checkValidity: (input) => (typeof input.checkValidity === 'function' ? input.checkValidity() : true),
161
+ setValue: (input, value) => {
162
+ // eslint-disable-next-line no-param-reassign
163
+ input.value = value;
164
+ },
165
+ assumeInteractionOn: ['it-input'],
166
+ ...options,
167
+ };
168
+ }
169
+ hostConnected() {
170
+ const form = this.options.form(this.host);
171
+ if (form) {
172
+ this.attachForm(form);
173
+ }
174
+ // Listen for interactions
175
+ interactions.set(this.host, []);
176
+ this.options.assumeInteractionOn.forEach((event) => {
177
+ this.host.addEventListener(event, this.handleInteraction);
178
+ });
179
+ }
180
+ hostDisconnected() {
181
+ this.detachForm();
182
+ // Clean up interactions
183
+ interactions.delete(this.host);
184
+ this.options.assumeInteractionOn.forEach((event) => {
185
+ this.host.removeEventListener(event, this.handleInteraction);
186
+ });
187
+ }
188
+ hostUpdated() {
189
+ const form = this.options.form(this.host);
190
+ // Detach if the form no longer exists
191
+ if (!form) {
192
+ this.detachForm();
193
+ }
194
+ // If the form has changed, reattach it
195
+ if (form && this.form !== form) {
196
+ this.detachForm();
197
+ this.attachForm(form);
198
+ }
199
+ if (this.host.hasUpdated) {
200
+ this.setValidity(this.host.validity.valid);
201
+ }
202
+ }
203
+ attachForm(form) {
204
+ if (form) {
205
+ this.form = form;
206
+ // Add this element to the form's collection
207
+ if (formCollections.has(this.form)) {
208
+ formCollections.get(this.form).add(this.host);
209
+ }
210
+ else {
211
+ formCollections.set(this.form, new Set([this.host]));
212
+ }
213
+ this.form.addEventListener('formdata', this.handleFormData);
214
+ this.form.addEventListener('submit', this.handleFormSubmit);
215
+ this.form.addEventListener('reset', this.handleFormReset);
216
+ // Overload the form's reportValidity() method so it looks at FormControl
217
+ if (!reportValidityOverloads.has(this.form)) {
218
+ reportValidityOverloads.set(this.form, this.form.reportValidity);
219
+ this.form.reportValidity = () => this.reportFormValidity();
220
+ }
221
+ // Overload the form's checkValidity() method so it looks at FormControl
222
+ if (!checkValidityOverloads.has(this.form)) {
223
+ checkValidityOverloads.set(this.form, this.form.checkValidity);
224
+ this.form.checkValidity = () => this.checkFormValidity();
225
+ }
226
+ }
227
+ else {
228
+ this.form = undefined;
229
+ }
230
+ }
231
+ detachForm() {
232
+ if (!this.form)
233
+ return;
234
+ const formCollection = formCollections.get(this.form);
235
+ if (!formCollection) {
236
+ return;
237
+ }
238
+ // Remove this host from the form's collection
239
+ formCollection.delete(this.host);
240
+ // Check to make sure there's no other form controls in the collection. If we do this
241
+ // without checking if any other controls are still in the collection, then we will wipe out the
242
+ // validity checks for all other elements.
243
+ // see: https://github.com/shoelace-style/shoelace/issues/1703
244
+ if (formCollection.size <= 0) {
245
+ this.form.removeEventListener('formdata', this.handleFormData);
246
+ this.form.removeEventListener('submit', this.handleFormSubmit);
247
+ this.form.removeEventListener('reset', this.handleFormReset);
248
+ // Remove the overload and restore the original method
249
+ if (reportValidityOverloads.has(this.form)) {
250
+ this.form.reportValidity = reportValidityOverloads.get(this.form);
251
+ reportValidityOverloads.delete(this.form);
252
+ }
253
+ if (checkValidityOverloads.has(this.form)) {
254
+ this.form.checkValidity = checkValidityOverloads.get(this.form);
255
+ checkValidityOverloads.delete(this.form);
256
+ }
257
+ // So it looks weird here to not always set the form to undefined. But I _think_ if we unattach this.form here,
258
+ // we end up in this fun spot where future validity checks don't have a reference to the form validity handler.
259
+ // First form element in sets the validity handler. So we can't clean up `this.form` until there are no other form elements in the form.
260
+ this.form = undefined;
261
+ }
262
+ }
263
+ // eslint-disable-next-line class-methods-use-this
264
+ setUserInteracted(el, hasInteracted) {
265
+ if (hasInteracted) {
266
+ userInteractedControls.add(el);
267
+ }
268
+ else {
269
+ userInteractedControls.delete(el);
270
+ }
271
+ el.requestUpdate();
272
+ }
273
+ doAction(type, submitter) {
274
+ // console.log('doaction', type);
275
+ if (this.form) {
276
+ const button = document.createElement('button');
277
+ button.type = type;
278
+ button.style.position = 'absolute';
279
+ button.style.width = '0';
280
+ button.style.height = '0';
281
+ button.style.clipPath = 'inset(50%)';
282
+ button.style.overflow = 'hidden';
283
+ button.style.whiteSpace = 'nowrap';
284
+ // Pass name, value, and form attributes through to the temporary button
285
+ if (submitter) {
286
+ button.name = submitter.name;
287
+ button.value = submitter.value;
288
+ ['formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget'].forEach((attr) => {
289
+ if (submitter.hasAttribute(attr)) {
290
+ button.setAttribute(attr, submitter.getAttribute(attr));
291
+ }
292
+ });
293
+ }
294
+ this.form.append(button);
295
+ button.click();
296
+ button.remove();
297
+ }
298
+ }
299
+ /** Returns the associated `<form>` element, if one exists. */
300
+ getForm() {
301
+ return this.form ?? null;
302
+ }
303
+ /** Resets the form, restoring all the control to their default value */
304
+ reset(submitter) {
305
+ this.doAction('reset', submitter);
306
+ }
307
+ /** Submits the form, triggering validation and form data injection. */
308
+ submit(submitter) {
309
+ // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a
310
+ // native submit button into the form, "click" it, then remove it to simulate a standard form submission.
311
+ this.doAction('submit', submitter);
312
+ }
313
+ /**
314
+ * Synchronously sets the form control's validity. Call this when you know the future validity but need to update
315
+ * the host element immediately, i.e. before Lit updates the component in the next update.
316
+ */
317
+ setValidity(isValid) {
318
+ const host = this.host;
319
+ const hasInteracted = Boolean(userInteractedControls.has(host));
320
+ const required = Boolean(host.required);
321
+ //
322
+ // We're mapping the following "states" to data attributes. In the future, we can use ElementInternals.states to
323
+ // create a similar mapping, but instead of [data-invalid] it will look like :--invalid.
324
+ //
325
+ // See this RFC for more details: https://github.com/shoelace-style/shoelace/issues/1011
326
+ //
327
+ host.toggleAttribute('data-required', required);
328
+ host.toggleAttribute('data-optional', !required);
329
+ host.toggleAttribute('data-invalid', !isValid);
330
+ host.toggleAttribute('data-valid', isValid);
331
+ host.toggleAttribute('data-user-invalid', !isValid && hasInteracted);
332
+ host.toggleAttribute('data-user-valid', isValid && hasInteracted);
333
+ }
334
+ /**
335
+ * Updates the form control's validity based on the current value of `host.validity.valid`. Call this when anything
336
+ * that affects constraint validation changes so the component receives the correct validity states.
337
+ */
338
+ updateValidity() {
339
+ const host = this.host;
340
+ this.setValidity(host.validity.valid);
341
+ }
342
+ /**
343
+ * Dispatches a non-bubbling, cancelable custom event of type `it-invalid`.
344
+ * If the `it-invalid` event will be cancelled then the original `invalid`
345
+ * event (which may have been passed as argument) will also be cancelled.
346
+ * If no original `invalid` event has been passed then the `it-invalid`
347
+ * event will be cancelled before being dispatched.
348
+ */
349
+ emitInvalidEvent(originalInvalidEvent) {
350
+ const itInvalidEvent = new CustomEvent('it-invalid', {
351
+ bubbles: false,
352
+ composed: false,
353
+ cancelable: true,
354
+ detail: {},
355
+ });
356
+ if (!originalInvalidEvent) {
357
+ itInvalidEvent.preventDefault();
358
+ }
359
+ if (!this.host.dispatchEvent(itInvalidEvent)) {
360
+ originalInvalidEvent?.preventDefault();
361
+ }
362
+ }
363
+ }
364
+ //# sourceMappingURL=form-controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-controller.js","sourceRoot":"","sources":["../../../src/form/form-controller.ts"],"names":[],"mappings":"AAIA,EAAE;AACF,8GAA8G;AAC9G,oHAAoH;AACpH,uDAAuD;AACvD,EAAE;AACF,MAAM,CAAC,MAAM,eAAe,GAA+C,IAAI,OAAO,EAAE,CAAC;AAEzF,EAAE;AACF,mHAAmH;AACnH,sDAAsD;AACt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rE,IAAI,CAAC,eAAe,CAAC,iBAAiB,EAAE,OAAO,IAAI,aAAa,CAAC,CAAC;IACpE,CAAC;IAED;;;OAGG;IACH,cAAc;QACZ,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,gBAAgB,CAAC,oBAA4B;QAC3C,MAAM,cAAc,GAAG,IAAI,WAAW,CAA6B,YAAY,EAAE;YAC/E,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,EAAE;SACX,CAAC,CAAC;QAEH,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC1B,cAAc,CAAC,cAAc,EAAE,CAAC;QAClC,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,CAAC;YAC7C,oBAAoB,EAAE,cAAc,EAAE,CAAC;QACzC,CAAC;IACH,CAAC;CACF","sourcesContent":["/* eslint-disable prefer-destructuring */\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport { FormControl } from './form-control.js';\n\n//\n// We store a WeakMap of forms + controls so we can keep references to all FormControl within a given form. As\n// elements connect and disconnect to/from the DOM, their containing form is used as the key and the form control is\n// added and removed from the form's set, respectively.\n//\nexport const formCollections: WeakMap<HTMLFormElement, Set<FormControl>> = new WeakMap();\n\n//\n// We store a WeakMap of reportValidity() overloads so we can override it when form controls connect to the DOM and\n// restore the original behavior when they disconnect.\n//\nconst reportValidityOverloads: WeakMap<HTMLFormElement, () => boolean> = new WeakMap();\nconst checkValidityOverloads: WeakMap<HTMLFormElement, () => boolean> = new WeakMap();\n\n//\n// We store a Set of controls that users have interacted with. This allows us to determine the interaction state\n// without littering the DOM with additional data attributes.\n//\nconst userInteractedControls: WeakSet<FormControl> = new WeakSet();\n\n//\n// We store a WeakMap of interactions for each form control so we can track when all conditions are met for validation.\n//\nconst interactions = new WeakMap<FormControl, string[]>();\n\nexport interface FormControlControllerOptions {\n /** A function that returns the form containing the form control. */\n form: (input: FormControl) => HTMLFormElement | null;\n /** A function that returns the form control's name, which will be submitted with the form data. */\n name: (input: FormControl) => string;\n /** A function that returns the form control's current value. */\n value: (input: FormControl) => unknown | unknown[];\n /** A function that returns the form control's current disabled state. If disabled, the value won't be submitted. */\n disabled: (input: FormControl) => boolean;\n // /**\n // * A function that maps to the form control's reportValidity() function. When the control is invalid, this will\n // * prevent submission and trigger the browser's constraint violation warning.\n // */\n reportValidity: (input: FormControl) => boolean;\n\n // /**\n // * A function that maps to the form control's `checkValidity()` function. When the control is invalid, this will return false.\n // * this is helpful is you want to check validation without triggering the native browser constraint violation warning.\n // */\n checkValidity: (input: FormControl) => boolean;\n /** A function that sets the form control's value */\n setValue: (input: FormControl, value: unknown) => void;\n /**\n * An array of event names to listen to. When all events in the list are emitted, the control will receive validity\n * states such as user-valid and user-invalid.user interacted validity states. */\n assumeInteractionOn: string[];\n}\n\n/** A reactive controller to allow form controls to participate in form submission, validation, etc. */\nexport class FormControlController implements ReactiveController {\n host: FormControl & ReactiveControllerHost;\n\n form?: HTMLFormElement | null;\n\n options: FormControlControllerOptions;\n\n constructor(host: ReactiveControllerHost & FormControl, options?: Partial<FormControlControllerOptions>) {\n (this.host = host).addController(this);\n this.options = {\n form: (input) => {\n // If there's a form attribute, use it to find the target form by id\n // Controls may not always reflect the 'form' property. For example, `<it-button>` doesn't reflect.\n const formId = input.form;\n\n if (formId) {\n const root = input.getRootNode() as Document | ShadowRoot | HTMLElement;\n const form = root.querySelector(`#${formId}`);\n\n if (form) {\n return form as HTMLFormElement;\n }\n }\n\n return input.closest('form');\n },\n name: (input) => input.name,\n value: (input) => input.value,\n disabled: (input) => input.disabled ?? false,\n reportValidity: (input: FormControl) =>\n typeof input.reportValidity === 'function' ? input.reportValidity() : true,\n checkValidity: (input: FormControl) => (typeof input.checkValidity === 'function' ? input.checkValidity() : true),\n setValue: (input, value) => {\n // eslint-disable-next-line no-param-reassign\n input.value = value as string;\n },\n assumeInteractionOn: ['it-input'],\n ...options,\n };\n }\n\n hostConnected() {\n const form = this.options.form(this.host);\n if (form) {\n this.attachForm(form);\n }\n\n // Listen for interactions\n interactions.set(this.host, []);\n this.options.assumeInteractionOn.forEach((event) => {\n this.host.addEventListener(event, this.handleInteraction);\n });\n }\n\n hostDisconnected() {\n this.detachForm();\n\n // Clean up interactions\n interactions.delete(this.host);\n this.options.assumeInteractionOn.forEach((event) => {\n this.host.removeEventListener(event, this.handleInteraction);\n });\n }\n\n hostUpdated() {\n const form = this.options.form(this.host);\n\n // Detach if the form no longer exists\n if (!form) {\n this.detachForm();\n }\n\n // If the form has changed, reattach it\n if (form && this.form !== form) {\n this.detachForm();\n this.attachForm(form);\n }\n\n if (this.host.hasUpdated) {\n this.setValidity(this.host.validity.valid);\n }\n }\n\n private attachForm(form?: HTMLFormElement) {\n if (form) {\n this.form = form;\n\n // Add this element to the form's collection\n if (formCollections.has(this.form)) {\n formCollections.get(this.form)!.add(this.host);\n } else {\n formCollections.set(this.form, new Set<FormControl>([this.host]));\n }\n\n this.form.addEventListener('formdata', this.handleFormData);\n this.form.addEventListener('submit', this.handleFormSubmit);\n this.form.addEventListener('reset', this.handleFormReset);\n\n // Overload the form's reportValidity() method so it looks at FormControl\n if (!reportValidityOverloads.has(this.form)) {\n reportValidityOverloads.set(this.form, this.form.reportValidity);\n this.form.reportValidity = () => this.reportFormValidity();\n }\n\n // Overload the form's checkValidity() method so it looks at FormControl\n if (!checkValidityOverloads.has(this.form)) {\n checkValidityOverloads.set(this.form, this.form.checkValidity);\n this.form.checkValidity = () => this.checkFormValidity();\n }\n } else {\n this.form = undefined;\n }\n }\n\n private detachForm() {\n if (!this.form) return;\n\n const formCollection = formCollections.get(this.form);\n\n if (!formCollection) {\n return;\n }\n\n // Remove this host from the form's collection\n formCollection.delete(this.host);\n\n // Check to make sure there's no other form controls in the collection. If we do this\n // without checking if any other controls are still in the collection, then we will wipe out the\n // validity checks for all other elements.\n // see: https://github.com/shoelace-style/shoelace/issues/1703\n if (formCollection.size <= 0) {\n this.form.removeEventListener('formdata', this.handleFormData);\n this.form.removeEventListener('submit', this.handleFormSubmit);\n this.form.removeEventListener('reset', this.handleFormReset);\n\n // Remove the overload and restore the original method\n if (reportValidityOverloads.has(this.form)) {\n this.form.reportValidity = reportValidityOverloads.get(this.form)!;\n reportValidityOverloads.delete(this.form);\n }\n\n if (checkValidityOverloads.has(this.form)) {\n this.form.checkValidity = checkValidityOverloads.get(this.form)!;\n checkValidityOverloads.delete(this.form);\n }\n\n // So it looks weird here to not always set the form to undefined. But I _think_ if we unattach this.form here,\n // we end up in this fun spot where future validity checks don't have a reference to the form validity handler.\n // First form element in sets the validity handler. So we can't clean up `this.form` until there are no other form elements in the form.\n this.form = undefined;\n }\n }\n\n private handleFormData = (event: FormDataEvent) => {\n // console.log('handleFormData');\n const disabled = this.options.disabled(this.host);\n const name = this.options.name(this.host);\n const value = this.options.value(this.host);\n const tagName = this.host.tagName.toLowerCase();\n\n // For buttons, we only submit the value if they were the submitter. This is currently done in doAction() by\n // injecting the name/value on a temporary button, so we can just skip them here.\n const isButton = tagName === 'it-button';\n\n if (\n this.host.isConnected &&\n !disabled &&\n !isButton &&\n typeof name === 'string' &&\n name.length > 0 &&\n typeof value !== 'undefined'\n ) {\n switch (tagName) {\n case 'it-radio':\n if ((this.host as any).checked) {\n event.formData.append(name, value as string);\n }\n break;\n default:\n if (Array.isArray(value)) {\n (value as unknown[]).forEach((val) => {\n event.formData.append(name, (val as string | number | boolean).toString());\n });\n } else {\n event.formData.append(name, (value as string | number | boolean).toString());\n }\n }\n }\n };\n\n private handleFormSubmit = (event: Event) => {\n const disabled = this.options.disabled(this.host);\n const reportValidity = this.options.reportValidity;\n\n // Update the interacted state for all controls when the form is submitted\n if (this.form && !this.form.noValidate) {\n formCollections.get(this.form)?.forEach((control) => {\n this.setUserInteracted(control, true);\n });\n }\n\n if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {\n event.preventDefault();\n // event.stopImmediatePropagation(); // se lo attiviamo, valida un campo alla volta\n }\n };\n\n private handleFormReset = () => {\n this.options.setValue(this.host, '');\n this.setUserInteracted(this.host, false);\n interactions.set(this.host, []);\n };\n\n private handleInteraction = (event: Event) => {\n const emittedEvents = interactions.get(this.host)!;\n\n if (!emittedEvents.includes(event.type)) {\n emittedEvents.push(event.type);\n }\n\n // Mark it as user-interacted as soon as all associated events have been emitted\n if (emittedEvents.length === this.options.assumeInteractionOn.length) {\n this.setUserInteracted(this.host, true);\n }\n };\n\n private checkFormValidity = () => {\n // console.log('checkFormValidity');\n //\n // This is very similar to the `reportFormValidity` function, but it does not trigger native constraint validation\n // Allow the user to simply check if the form is valid and handling validity in their own way.\n //\n // We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger\n // validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't\n // be necessary once we can use ElementInternals.\n //\n // Note that we're also honoring the form's novalidate attribute.\n //\n if (this.form && !this.form.noValidate) {\n // This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom\n // elements that support the constraint validation API.\n const elements = this.form.querySelectorAll<HTMLInputElement>('*');\n\n for (const element of elements) {\n if (typeof element.checkValidity === 'function') {\n if (!element.checkValidity()) {\n return false;\n }\n }\n }\n }\n\n return true;\n };\n\n private reportFormValidity = () => {\n // console.log('reportFormValidity');\n //\n // FormControl work hard to act like regular form controls. They support the Constraint Validation API\n // and its associated methods such as setCustomValidity() and reportValidity(). However, the HTMLFormElement also\n // has a reportValidity() method that will trigger validation on all child controls. Since we're not yet using\n // ElementInternals, we need to overload this method so it looks for any element with the reportValidity() method.\n //\n // We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger\n // validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't\n // be necessary once we can use ElementInternals.\n //\n // Note that we're also honoring the form's novalidate attribute.\n //\n if (this.form && !this.form.noValidate) {\n // This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom\n // elements that support the constraint validation API.\n const elements = this.form.querySelectorAll<HTMLInputElement>('*');\n\n for (const element of elements) {\n if (typeof element.reportValidity === 'function') {\n if (!element.reportValidity()) {\n return false;\n }\n }\n }\n }\n\n return true;\n };\n\n // eslint-disable-next-line class-methods-use-this\n private setUserInteracted(el: FormControl, hasInteracted: boolean) {\n if (hasInteracted) {\n userInteractedControls.add(el);\n } else {\n userInteractedControls.delete(el);\n }\n\n el.requestUpdate();\n }\n\n private doAction(type: 'submit' | 'reset', submitter?: HTMLInputElement | any) {\n // console.log('doaction', type);\n if (this.form) {\n const button = document.createElement('button');\n button.type = type;\n button.style.position = 'absolute';\n button.style.width = '0';\n button.style.height = '0';\n button.style.clipPath = 'inset(50%)';\n button.style.overflow = 'hidden';\n button.style.whiteSpace = 'nowrap';\n\n // Pass name, value, and form attributes through to the temporary button\n if (submitter) {\n button.name = submitter.name;\n button.value = submitter.value;\n\n ['formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget'].forEach((attr) => {\n if (submitter.hasAttribute(attr)) {\n button.setAttribute(attr, submitter.getAttribute(attr)!);\n }\n });\n }\n\n this.form.append(button);\n button.click();\n button.remove();\n }\n }\n\n /** Returns the associated `<form>` element, if one exists. */\n getForm() {\n return this.form ?? null;\n }\n\n /** Resets the form, restoring all the control to their default value */\n reset(submitter?: HTMLInputElement | any) {\n this.doAction('reset', submitter);\n }\n\n /** Submits the form, triggering validation and form data injection. */\n submit(submitter?: HTMLInputElement | any) {\n // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a\n // native submit button into the form, \"click\" it, then remove it to simulate a standard form submission.\n this.doAction('submit', submitter);\n }\n\n /**\n * Synchronously sets the form control's validity. Call this when you know the future validity but need to update\n * the host element immediately, i.e. before Lit updates the component in the next update.\n */\n setValidity(isValid: boolean) {\n const host = this.host;\n const hasInteracted = Boolean(userInteractedControls.has(host));\n const required = Boolean(host.required);\n\n //\n // We're mapping the following \"states\" to data attributes. In the future, we can use ElementInternals.states to\n // create a similar mapping, but instead of [data-invalid] it will look like :--invalid.\n //\n // See this RFC for more details: https://github.com/shoelace-style/shoelace/issues/1011\n //\n host.toggleAttribute('data-required', required);\n host.toggleAttribute('data-optional', !required);\n host.toggleAttribute('data-invalid', !isValid);\n host.toggleAttribute('data-valid', isValid);\n host.toggleAttribute('data-user-invalid', !isValid && hasInteracted);\n host.toggleAttribute('data-user-valid', isValid && hasInteracted);\n }\n\n /**\n * Updates the form control's validity based on the current value of `host.validity.valid`. Call this when anything\n * that affects constraint validation changes so the component receives the correct validity states.\n */\n updateValidity() {\n const host = this.host;\n this.setValidity(host.validity.valid);\n }\n\n /**\n * Dispatches a non-bubbling, cancelable custom event of type `it-invalid`.\n * If the `it-invalid` event will be cancelled then the original `invalid`\n * event (which may have been passed as argument) will also be cancelled.\n * If no original `invalid` event has been passed then the `it-invalid`\n * event will be cancelled before being dispatched.\n */\n emitInvalidEvent(originalInvalidEvent?: Event) {\n const itInvalidEvent = new CustomEvent<Record<PropertyKey, never>>('it-invalid', {\n bubbles: false,\n composed: false,\n cancelable: true,\n detail: {},\n });\n\n if (!originalInvalidEvent) {\n itInvalidEvent.preventDefault();\n }\n\n if (!this.host.dispatchEvent(itInvalidEvent)) {\n originalInvalidEvent?.preventDefault();\n }\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { DefaultTranslation } from '@italia/i18n';
2
+ declare const translation: DefaultTranslation;
3
+ export default translation;
4
+ //# sourceMappingURL=it.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"it.d.ts","sourceRoot":"","sources":["../../../../src/form/locales/it.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,QAAA,MAAM,WAAW,EAAE,kBASlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,11 @@
1
+ const translation = {
2
+ $code: 'it',
3
+ $name: 'Italiano',
4
+ $dir: 'ltr',
5
+ validityRequired: 'Questo campo è obbligatorio.',
6
+ validityPattern: 'Il valore non corrisponde al formato richiesto.',
7
+ validityMinlength: 'Il valore deve essere lungo almeno {minlength} caratteri.',
8
+ validityMaxlength: 'Il valore deve essere lungo al massimo {maxlength} caratteri.',
9
+ };
10
+ export default translation;
11
+ //# sourceMappingURL=it.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"it.js","sourceRoot":"","sources":["../../../../src/form/locales/it.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAuB;IACtC,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,KAAK;IAEX,gBAAgB,EAAE,8BAA8B;IAChD,eAAe,EAAE,iDAAiD;IAClE,iBAAiB,EAAE,2DAA2D;IAC9E,iBAAiB,EAAE,+DAA+D;CACnF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import type { DefaultTranslation } from '@italia/i18n';\n\nconst translation: DefaultTranslation = {\n $code: 'it',\n $name: 'Italiano',\n $dir: 'ltr',\n\n validityRequired: 'Questo campo è obbligatorio.',\n validityPattern: 'Il valore non corrisponde al formato richiesto.',\n validityMinlength: 'Il valore deve essere lungo almeno {minlength} caratteri.',\n validityMaxlength: 'Il valore deve essere lungo al massimo {maxlength} caratteri.',\n};\n\nexport default translation;\n"]}
@@ -1,10 +1,18 @@
1
1
  import TrackFocus from './utils/track-focus.js';
2
- import FormMixin from './mixins/form.js';
3
- import ValidityMixin from './mixins/validity.js';
4
2
  import setAttributes from './directives/setAttributes.js';
5
- export { TrackFocus, FormMixin, ValidityMixin, setAttributes };
3
+ import AriaKeyboardListController from './controllers/aria-keyboard-list-controller.js';
4
+ import { StoryFormControlMethodAndProps } from './stories/formControlReusableStories.js';
5
+ export { TrackFocus, setAttributes, AriaKeyboardListController };
6
+ export type { AriaKeyboardConfig } from './controllers/aria-keyboard-list-controller.js';
7
+ export { RovingTabindexController } from './controllers/roving-tabindex-controller.js';
8
+ export type { RovingTabindexConfig } from './controllers/roving-tabindex-controller.js';
6
9
  export { BaseComponent, BaseComponentInterface, BaseComponentType, BaseLocalizedComponent, } from './base-component/base-component.js';
7
- export { VALIDATION_STATUS } from './mixins/validity.js';
10
+ export { AriaKeyboardAccordionController, type AriaKeyboardAccordionConfig, } from './controllers/aria-keyboard-accordion-controller.js';
11
+ export { CollapseAnimationController } from './controllers/collapse-controller.js';
12
+ export { FormControl } from './form/form-control.js';
13
+ export { formCollections, FormControlControllerOptions, FormControlController } from './form/form-controller.js';
8
14
  export { cookies } from './utils/cookies.js';
9
15
  export type Constructor<T = {}> = new (...args: any[]) => T;
16
+ export { WindowManager, type ScrollCallback, type ScrollState } from './window-manager.js';
17
+ export { StoryFormControlMethodAndProps };
10
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;AAC/D,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAEhD,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAC1D,OAAO,0BAA0B,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAEzF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,0BAA0B,EAAE,CAAC;AACjE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AACvF,YAAY,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,+BAA+B,EAC/B,KAAK,2BAA2B,GACjC,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAEnF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACjH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE3F,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
package/dist/src/index.js CHANGED
@@ -1,9 +1,15 @@
1
1
  import TrackFocus from './utils/track-focus.js';
2
- import FormMixin from './mixins/form.js';
3
- import ValidityMixin from './mixins/validity.js';
4
2
  import setAttributes from './directives/setAttributes.js';
5
- export { TrackFocus, FormMixin, ValidityMixin, setAttributes };
3
+ import AriaKeyboardListController from './controllers/aria-keyboard-list-controller.js';
4
+ import { StoryFormControlMethodAndProps } from './stories/formControlReusableStories.js';
5
+ export { TrackFocus, setAttributes, AriaKeyboardListController };
6
+ export { RovingTabindexController } from './controllers/roving-tabindex-controller.js';
6
7
  export { BaseComponent, BaseLocalizedComponent, } from './base-component/base-component.js';
7
- export { VALIDATION_STATUS } from './mixins/validity.js';
8
+ export { AriaKeyboardAccordionController, } from './controllers/aria-keyboard-accordion-controller.js';
9
+ export { CollapseAnimationController } from './controllers/collapse-controller.js';
10
+ export { FormControl } from './form/form-control.js';
11
+ export { formCollections, FormControlController } from './form/form-controller.js';
8
12
  export { cookies } from './utils/cookies.js';
13
+ export { WindowManager } from './window-manager.js';
14
+ export { StoryFormControlMethodAndProps };
9
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;AAC/D,OAAO,EACL,aAAa,EAGb,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["import TrackFocus from './utils/track-focus.js';\nimport FormMixin from './mixins/form.js';\nimport ValidityMixin from './mixins/validity.js';\nimport setAttributes from './directives/setAttributes.js';\n\nexport { TrackFocus, FormMixin, ValidityMixin, setAttributes };\nexport {\n BaseComponent,\n BaseComponentInterface,\n BaseComponentType,\n BaseLocalizedComponent,\n} from './base-component/base-component.js';\nexport { VALIDATION_STATUS } from './mixins/validity.js';\nexport { cookies } from './utils/cookies.js';\nexport type Constructor<T = {}> = new (...args: any[]) => T;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAEhD,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAC1D,OAAO,0BAA0B,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAEzF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,0BAA0B,EAAE,CAAC;AAEjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AAEvF,OAAO,EACL,aAAa,EAGb,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,+BAA+B,GAEhC,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAEnF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAgC,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACjH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAyC,MAAM,qBAAqB,CAAC;AAE3F,OAAO,EAAE,8BAA8B,EAAE,CAAC","sourcesContent":["import TrackFocus from './utils/track-focus.js';\n\nimport setAttributes from './directives/setAttributes.js';\nimport AriaKeyboardListController from './controllers/aria-keyboard-list-controller.js';\nimport { StoryFormControlMethodAndProps } from './stories/formControlReusableStories.js';\n\nexport { TrackFocus, setAttributes, AriaKeyboardListController };\nexport type { AriaKeyboardConfig } from './controllers/aria-keyboard-list-controller.js';\nexport { RovingTabindexController } from './controllers/roving-tabindex-controller.js';\nexport type { RovingTabindexConfig } from './controllers/roving-tabindex-controller.js';\nexport {\n BaseComponent,\n BaseComponentInterface,\n BaseComponentType,\n BaseLocalizedComponent,\n} from './base-component/base-component.js';\nexport {\n AriaKeyboardAccordionController,\n type AriaKeyboardAccordionConfig,\n} from './controllers/aria-keyboard-accordion-controller.js';\nexport { CollapseAnimationController } from './controllers/collapse-controller.js';\n\nexport { FormControl } from './form/form-control.js';\nexport { formCollections, FormControlControllerOptions, FormControlController } from './form/form-controller.js';\nexport { cookies } from './utils/cookies.js';\nexport type Constructor<T = {}> = new (...args: any[]) => T;\nexport { WindowManager, type ScrollCallback, type ScrollState } from './window-manager.js';\n\nexport { StoryFormControlMethodAndProps };\n"]}
@@ -30,11 +30,7 @@ export declare enum VALIDATION_STATUS {
30
30
  /**
31
31
  * One indicating that the value is shorter than the minimum length.
32
32
  */
33
- MINLENGTH = "minlength",
34
- /**
35
- * One indicating that the value is less than the maximum length.
36
- */
37
- MAXLENGTH = "maxlength"
33
+ MINLENGTH = "minlength"
38
34
  }
39
35
  /**
40
36
  * @param Base The base class.
@@ -83,10 +79,6 @@ declare const ValidityMixin: <T extends Constructor<HTMLElement>>(Base: T) => (a
83
79
  * External validation.
84
80
  */
85
81
  customValidation: boolean;
86
- /**
87
- * Field is touched
88
- */
89
- _touched: boolean;
90
82
  /**
91
83
  * Checks if the value meets the constraints.
92
84
  *
@@ -99,10 +91,6 @@ declare const ValidityMixin: <T extends Constructor<HTMLElement>>(Base: T) => (a
99
91
  * @param validityMessage The custom validity message
100
92
  */
101
93
  setCustomValidity(validityMessage: string): void;
102
- _handleBlur(): void;
103
- _handleFocus(): void;
104
- _handleClick(): void;
105
- _handleChange(e: Event): void;
106
94
  accessKey: string;
107
95
  readonly accessKeyLabel: string;
108
96
  autocapitalize: string;
@@ -1 +1 @@
1
- {"version":3,"file":"validity.d.ts","sourceRoot":"","sources":["../../../src/mixins/validity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C;;;;;;;GAOG;AAEH;;GAEG;AACH,oBAAY,iBAAiB;IAC3B;;OAEG;IACH,QAAQ,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