fomantic-ui 2.9.3-beta.45 → 2.9.3-beta.47

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 (186) hide show
  1. package/README.md +5 -2
  2. package/SECURITY.md +2 -1
  3. package/dist/components/accordion.css +1 -1
  4. package/dist/components/accordion.js +1 -1
  5. package/dist/components/accordion.min.css +1 -1
  6. package/dist/components/accordion.min.js +1 -1
  7. package/dist/components/ad.css +1 -1
  8. package/dist/components/ad.min.css +1 -1
  9. package/dist/components/api.js +1 -1
  10. package/dist/components/api.min.js +1 -1
  11. package/dist/components/breadcrumb.css +1 -1
  12. package/dist/components/breadcrumb.min.css +1 -1
  13. package/dist/components/button.css +1 -1
  14. package/dist/components/button.min.css +1 -1
  15. package/dist/components/calendar.css +1 -1
  16. package/dist/components/calendar.js +1 -1
  17. package/dist/components/calendar.min.css +1 -1
  18. package/dist/components/calendar.min.js +1 -1
  19. package/dist/components/card.css +1 -1
  20. package/dist/components/card.min.css +1 -1
  21. package/dist/components/checkbox.css +1 -1
  22. package/dist/components/checkbox.js +1 -1
  23. package/dist/components/checkbox.min.css +1 -1
  24. package/dist/components/checkbox.min.js +1 -1
  25. package/dist/components/comment.css +1 -1
  26. package/dist/components/comment.min.css +1 -1
  27. package/dist/components/container.css +1 -1
  28. package/dist/components/container.min.css +1 -1
  29. package/dist/components/dimmer.css +1 -1
  30. package/dist/components/dimmer.js +1 -1
  31. package/dist/components/dimmer.min.css +1 -1
  32. package/dist/components/dimmer.min.js +1 -1
  33. package/dist/components/divider.css +1 -1
  34. package/dist/components/divider.min.css +1 -1
  35. package/dist/components/dropdown.css +1 -1
  36. package/dist/components/dropdown.js +1 -1
  37. package/dist/components/dropdown.min.css +1 -1
  38. package/dist/components/dropdown.min.js +1 -1
  39. package/dist/components/embed.css +1 -1
  40. package/dist/components/embed.js +1 -1
  41. package/dist/components/embed.min.css +1 -1
  42. package/dist/components/embed.min.js +1 -1
  43. package/dist/components/emoji.css +1 -1
  44. package/dist/components/emoji.min.css +1 -1
  45. package/dist/components/feed.css +1 -1
  46. package/dist/components/feed.min.css +1 -1
  47. package/dist/components/flag.css +1 -1
  48. package/dist/components/flag.min.css +1 -1
  49. package/dist/components/flyout.css +1 -1
  50. package/dist/components/flyout.js +1 -1
  51. package/dist/components/flyout.min.css +1 -1
  52. package/dist/components/flyout.min.js +1 -1
  53. package/dist/components/form.css +1 -1
  54. package/dist/components/form.js +1 -1
  55. package/dist/components/form.min.css +1 -1
  56. package/dist/components/form.min.js +1 -1
  57. package/dist/components/grid.css +1 -1
  58. package/dist/components/grid.min.css +1 -1
  59. package/dist/components/header.css +1 -1
  60. package/dist/components/header.min.css +1 -1
  61. package/dist/components/icon.css +1 -1
  62. package/dist/components/icon.min.css +1 -1
  63. package/dist/components/image.css +1 -1
  64. package/dist/components/image.min.css +1 -1
  65. package/dist/components/input.css +1 -1
  66. package/dist/components/input.min.css +1 -1
  67. package/dist/components/item.css +1 -1
  68. package/dist/components/item.min.css +1 -1
  69. package/dist/components/label.css +1 -1
  70. package/dist/components/label.min.css +1 -1
  71. package/dist/components/list.css +1 -1
  72. package/dist/components/list.min.css +1 -1
  73. package/dist/components/loader.css +1 -1
  74. package/dist/components/loader.min.css +1 -1
  75. package/dist/components/menu.css +1 -1
  76. package/dist/components/menu.min.css +1 -1
  77. package/dist/components/message.css +1 -1
  78. package/dist/components/message.min.css +1 -1
  79. package/dist/components/modal.css +1 -1
  80. package/dist/components/modal.js +1 -1
  81. package/dist/components/modal.min.css +1 -1
  82. package/dist/components/modal.min.js +1 -1
  83. package/dist/components/nag.css +1 -1
  84. package/dist/components/nag.js +1 -1
  85. package/dist/components/nag.min.css +1 -1
  86. package/dist/components/nag.min.js +1 -1
  87. package/dist/components/placeholder.css +1 -1
  88. package/dist/components/placeholder.min.css +1 -1
  89. package/dist/components/popup.css +1 -1
  90. package/dist/components/popup.js +1 -1
  91. package/dist/components/popup.min.css +1 -1
  92. package/dist/components/popup.min.js +1 -1
  93. package/dist/components/progress.css +1 -1
  94. package/dist/components/progress.js +1 -1
  95. package/dist/components/progress.min.css +1 -1
  96. package/dist/components/progress.min.js +1 -1
  97. package/dist/components/rail.css +1 -1
  98. package/dist/components/rail.min.css +1 -1
  99. package/dist/components/rating.css +1 -1
  100. package/dist/components/rating.js +1 -1
  101. package/dist/components/rating.min.css +1 -1
  102. package/dist/components/rating.min.js +1 -1
  103. package/dist/components/reset.css +1 -1
  104. package/dist/components/reset.min.css +1 -1
  105. package/dist/components/reveal.css +1 -1
  106. package/dist/components/reveal.min.css +1 -1
  107. package/dist/components/search.css +1 -1
  108. package/dist/components/search.js +1 -1
  109. package/dist/components/search.min.css +1 -1
  110. package/dist/components/search.min.js +1 -1
  111. package/dist/components/segment.css +1 -1
  112. package/dist/components/segment.min.css +1 -1
  113. package/dist/components/shape.css +1 -1
  114. package/dist/components/shape.js +1 -1
  115. package/dist/components/shape.min.css +1 -1
  116. package/dist/components/shape.min.js +1 -1
  117. package/dist/components/sidebar.css +1 -1
  118. package/dist/components/sidebar.js +1 -1
  119. package/dist/components/sidebar.min.css +1 -1
  120. package/dist/components/sidebar.min.js +1 -1
  121. package/dist/components/site.css +1 -1
  122. package/dist/components/site.js +1 -1
  123. package/dist/components/site.min.css +1 -1
  124. package/dist/components/site.min.js +1 -1
  125. package/dist/components/slider.css +1 -1
  126. package/dist/components/slider.js +1 -1
  127. package/dist/components/slider.min.css +1 -1
  128. package/dist/components/slider.min.js +1 -1
  129. package/dist/components/state.js +1 -1
  130. package/dist/components/state.min.js +1 -1
  131. package/dist/components/statistic.css +1 -1
  132. package/dist/components/statistic.min.css +1 -1
  133. package/dist/components/step.css +1 -1
  134. package/dist/components/step.min.css +1 -1
  135. package/dist/components/sticky.css +1 -1
  136. package/dist/components/sticky.js +1 -1
  137. package/dist/components/sticky.min.css +1 -1
  138. package/dist/components/sticky.min.js +1 -1
  139. package/dist/components/tab.css +1 -1
  140. package/dist/components/tab.js +1 -1
  141. package/dist/components/tab.min.css +1 -1
  142. package/dist/components/tab.min.js +1 -1
  143. package/dist/components/table.css +1 -1
  144. package/dist/components/table.min.css +1 -1
  145. package/dist/components/text.css +1 -1
  146. package/dist/components/text.min.css +1 -1
  147. package/dist/components/toast.css +1 -1
  148. package/dist/components/toast.js +1 -1
  149. package/dist/components/toast.min.css +1 -1
  150. package/dist/components/toast.min.js +1 -1
  151. package/dist/components/transition.css +1 -1
  152. package/dist/components/transition.js +1 -1
  153. package/dist/components/transition.min.css +1 -1
  154. package/dist/components/transition.min.js +1 -1
  155. package/dist/components/visibility.js +1 -1
  156. package/dist/components/visibility.min.js +1 -1
  157. package/dist/semantic.css +53 -53
  158. package/dist/semantic.js +26 -26
  159. package/dist/semantic.min.css +1 -1
  160. package/dist/semantic.min.js +1 -1
  161. package/package.json +1 -1
  162. package/types/fomantic-ui-accordion.d.ts +166 -172
  163. package/types/fomantic-ui-api.d.ts +418 -470
  164. package/types/fomantic-ui-calendar.d.ts +425 -479
  165. package/types/fomantic-ui-checkbox.d.ts +148 -194
  166. package/types/fomantic-ui-dimmer.d.ts +188 -265
  167. package/types/fomantic-ui-dropdown.d.ts +447 -666
  168. package/types/fomantic-ui-embed.d.ts +243 -289
  169. package/types/fomantic-ui-flyout.d.ts +259 -292
  170. package/types/fomantic-ui-form.d.ts +478 -607
  171. package/types/fomantic-ui-modal.d.ts +389 -471
  172. package/types/fomantic-ui-nag.d.ts +228 -277
  173. package/types/fomantic-ui-popup.d.ts +438 -534
  174. package/types/fomantic-ui-progress.d.ts +278 -352
  175. package/types/fomantic-ui-rating.d.ts +137 -168
  176. package/types/fomantic-ui-search.d.ts +359 -453
  177. package/types/fomantic-ui-shape.d.ts +152 -194
  178. package/types/fomantic-ui-sidebar.d.ts +315 -391
  179. package/types/fomantic-ui-slider.d.ts +259 -322
  180. package/types/fomantic-ui-sticky.d.ts +198 -244
  181. package/types/fomantic-ui-tab.d.ts +284 -350
  182. package/types/fomantic-ui-tests.ts +4 -2
  183. package/types/fomantic-ui-toast.d.ts +318 -424
  184. package/types/fomantic-ui-transition.d.ts +223 -273
  185. package/types/fomantic-ui-visibility.d.ts +286 -353
  186. package/types/index.d.ts +0 -1
@@ -138,642 +138,513 @@ declare namespace FomanticUI {
138
138
  * Destroys instance and removes all events.
139
139
  */
140
140
  (behavior: 'destroy'): JQuery;
141
-
142
- <K extends keyof FormSettings>(behavior: 'setting', name: K, value?: undefined): FormSettings._Impl[K];
143
- <K extends keyof FormSettings>(behavior: 'setting', name: K, value: FormSettings._Impl[K]): JQuery;
144
- (behavior: 'setting', value: FormSettings): JQuery;
145
- (settings?: FormSettings): JQuery;
141
+ <K extends keyof FormSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<FormSettings, keyof FormSettings>>;
142
+ <K extends keyof FormSettings>(behavior: 'setting', name: K, value: FormSettings[K]): JQuery;
143
+ (behavior: 'setting', value: Partial<Pick<FormSettings, keyof FormSettings>>): JQuery;
144
+ (settings?: Partial<Pick<FormSettings, keyof FormSettings>>): JQuery;
146
145
  }
147
146
 
148
147
  /**
149
148
  * @see {@link https://fomantic-ui.com/behaviors/form.html#/settings}
150
149
  */
151
- type FormSettings = FormSettings.Param;
152
-
153
- namespace FormSettings {
154
- type Param = (
155
- | Pick<_Impl, 'keyboardShortcuts'>
156
- | Pick<_Impl, 'on'>
157
- | Pick<_Impl, 'revalidate'>
158
- | Pick<_Impl, 'delay'>
159
- | Pick<_Impl, 'inline'>
160
- | Pick<_Impl, 'shouldTrim'>
161
- | Pick<_Impl, 'dateHandling'>
162
- | Pick<_Impl, 'transition'>
163
- | Pick<_Impl, 'duration'>
164
- | Pick<_Impl, 'preventLeaving'>
165
- | Pick<_Impl, 'autoCheckRequired'>
166
- | Pick<_Impl, 'errorFocus'>
167
- | Pick<_Impl, 'text'>
168
- | Pick<_Impl, 'prompt'>
169
- | Pick<_Impl, 'formatter'>
170
- | Pick<_Impl, 'onValid'>
171
- | Pick<_Impl, 'onInvalid'>
172
- | Pick<_Impl, 'onSuccess'>
173
- | Pick<_Impl, 'onFailure'>
174
- | Pick<_Impl, 'onDirty'>
175
- | Pick<_Impl, 'onClean'>
176
- | Pick<_Impl, 'selector'>
177
- | Pick<_Impl, 'metadata'>
178
- | Pick<_Impl, 'className'>
179
- | Pick<_Impl, 'name'>
180
- | Pick<_Impl, 'namespace'>
181
- | Pick<_Impl, 'silent'>
182
- | Pick<_Impl, 'debug'>
183
- | Pick<_Impl, 'performance'>
184
- | Pick<_Impl, 'verbose'>
185
- | Pick<_Impl, 'errors'>
186
- ) &
187
- Partial<Pick<_Impl, keyof _Impl>>;
188
-
189
- interface _Impl {
190
- // region Form Settings
191
-
192
- /**
193
- * Adds keyboard shortcuts for enter and escape keys to submit form and blur fields respectively.
194
- * @default true
195
- */
196
- keyboardShortcuts: boolean;
197
-
198
- /**
199
- * Event used to trigger validation.
200
- * Can be either 'submit', 'blur' or 'change'.
201
- * @default 'submit'
202
- */
203
- on: 'submit' | 'blur' | 'change';
204
-
205
- /**
206
- * If set to true will revalidate fields with errors on input change.
207
- * @default true
208
- */
209
- revalidate: boolean;
210
-
211
- /**
212
- * Delay from last typed letter to validate a field when using 'on: change' or when revalidating a field.
213
- * @default true
214
- */
215
- delay: boolean;
216
-
217
- /**
218
- * Adds inline error on field validation error.
219
- * @default false
220
- */
221
- inline: boolean;
222
-
223
- /**
224
- * Whether or not the form should trim the value before validating.
225
- * @default false
226
- */
227
- shouldTrim: boolean;
228
-
229
- /**
230
- * Define how calendar values will be returned.
231
- * Can be either 'date', 'input' or 'formatter'.
232
- * @default 'date'
233
- */
234
- dateHandling: 'date' | 'input' | 'formatter';
235
-
236
- /**
237
- * Named transition to use when animating validation errors.
238
- * Fade and slide down are available without including 'ui transitions'.
239
- * @see {@link https://fomantic-ui.com/modules/transition.html}
240
- * @default 'scale'
241
- */
242
- transition: string;
243
-
244
- /**
245
- * Animation speed for inline prompt.
246
- * @default 150
247
- */
248
- duration: number;
249
-
250
- /**
251
- * Prevent user from leaving the page if the form has a 'dirty' state by displaying a prompt.
252
- * @default false
253
- */
254
- preventLeaving: boolean;
255
-
256
- /**
257
- * Whether fields with classname or attribute 'required' should automatically add the "empty" rule or automatically checks checkbox fields.
258
- * @default false
259
- */
260
- autoCheckRequired: boolean;
261
-
262
- /**
263
- * Whether, on an invalid form validation, it should automatically focus either the first error field ('true') or a specific dom node (Use a unique selector string such as '.ui.error.message' or '#myelement') or nothing ('false').
264
- * @default false
265
- */
266
- errorFocus: boolean | string;
267
-
268
- // endregion
269
-
270
- // region Form Prompts
271
-
272
- text: Form.TextSettings;
273
-
274
- prompt: Form.PromptSettings;
275
-
276
- // endregion
277
-
278
- // region Formatters
279
-
280
- formatter: Form.FormatterSettings;
281
-
282
- // endregion
283
-
284
- // region Callbacks
285
-
286
- /**
287
- * Callback on each valid field.
288
- */
289
- onValid(this: JQuery): void;
290
-
291
- /**
292
- * Callback on each invalid field.
293
- */
294
- onInvalid(this: JQuery): void;
295
-
296
- /**
297
- * Callback if a form is all valid.
298
- */
299
- onSuccess(this: JQuery, event: Event, fields: object[]): void;
300
-
301
- /**
302
- * Callback if any form field is invalid.
303
- */
304
- onFailure(this: JQuery, formErrors: object[], fields: object[]): void;
305
-
306
- /**
307
- * Callback if form state is modified to 'dirty'.
308
- * Triggered when at least on field has been modified.
309
- */
310
- onDirty(this: JQuery): void;
311
-
312
- /**
313
- * Callback if form state is modified to 'clean'.
314
- * Triggered when all fields are set to default values.
315
- */
316
- onClean(this: JQuery): void;
317
-
318
- // endregion
319
-
320
- // region DOM Settings
321
-
322
- /**
323
- * DOM Selectors used internally.
324
- * Selectors used to find parts of a module.
325
- */
326
- selector: Form.SelectorSettings;
327
-
328
- /**
329
- * Class names used to determine element state.
330
- */
331
- metadata: Form.MetadataSettings;
150
+ interface FormSettings {
151
+ // region Form Settings
332
152
 
333
- /**
334
- * Class names used to determine element state.
335
- */
336
- className: Form.ClassNameSettings;
153
+ /**
154
+ * Adds keyboard shortcuts for enter and escape keys to submit form and blur fields respectively.
155
+ * @default true
156
+ */
157
+ keyboardShortcuts: boolean;
337
158
 
338
- // endregion
159
+ /**
160
+ * Event used to trigger validation.
161
+ * Can be either 'submit', 'blur' or 'change'.
162
+ * @default 'submit'
163
+ */
164
+ on: 'submit' | 'blur' | 'change';
339
165
 
340
- // region Debug Settings
166
+ /**
167
+ * If set to true will revalidate fields with errors on input change.
168
+ * @default true
169
+ */
170
+ revalidate: boolean;
341
171
 
342
- /**
343
- * Name used in log statements
344
- */
345
- name: string;
172
+ /**
173
+ * Delay from last typed letter to validate a field when using 'on: change' or when revalidating a field.
174
+ * @default true
175
+ */
176
+ delay: boolean;
346
177
 
347
- /**
348
- * Event namespace. Makes sure module teardown does not effect other events attached to an element.
349
- */
350
- namespace: string;
178
+ /**
179
+ * Adds inline error on field validation error.
180
+ * @default false
181
+ */
182
+ inline: boolean;
351
183
 
352
- /**
353
- * Silences all console output including error messages, regardless of other debug settings.
354
- */
355
- silent: boolean;
184
+ /**
185
+ * Whether or not the form should trim the value before validating.
186
+ * @default false
187
+ */
188
+ shouldTrim: boolean;
356
189
 
357
- /**
358
- * Debug output to console
359
- */
360
- debug: boolean;
190
+ /**
191
+ * Define how calendar values will be returned.
192
+ * Can be either 'date', 'input' or 'formatter'.
193
+ * @default 'date'
194
+ */
195
+ dateHandling: 'date' | 'input' | 'formatter';
361
196
 
362
- /**
363
- * Show console.table output with performance metrics
364
- */
365
- performance: boolean;
197
+ /**
198
+ * Named transition to use when animating validation errors.
199
+ * Fade and slide down are available without including 'ui transitions'.
200
+ * @see {@link https://fomantic-ui.com/modules/transition.html}
201
+ * @default 'scale'
202
+ */
203
+ transition: string;
366
204
 
367
- /**
368
- * Debug output includes all internal behaviors
369
- */
370
- verbose: boolean;
205
+ /**
206
+ * Animation speed for inline prompt.
207
+ * @default 150
208
+ */
209
+ duration: number;
371
210
 
372
- errors: Form.ErrorSettings;
211
+ /**
212
+ * Prevent user from leaving the page if the form has a 'dirty' state by displaying a prompt.
213
+ * @default false
214
+ */
215
+ preventLeaving: boolean;
373
216
 
374
- // endregion
375
- }
217
+ /**
218
+ * Whether fields with classname or attribute 'required' should automatically add the "empty" rule or automatically checks checkbox fields.
219
+ * @default false
220
+ */
221
+ autoCheckRequired: boolean;
376
222
 
377
- namespace Form {
378
- type TextSettings = TextSettings.Param;
379
-
380
- namespace TextSettings {
381
- type Param = (
382
- | Pick<_Impl, 'unspecifiedRule'>
383
- | Pick<_Impl, 'unspecifiedField'>
384
- | Pick<_Impl, 'leavingMessage'>
385
- ) &
386
- Partial<Pick<_Impl, keyof _Impl>>;
387
-
388
- interface _Impl {
389
- /**
390
- * @default 'Please enter a valid value'
391
- */
392
- unspecifiedRule: string;
393
-
394
- /**
395
- * @default 'This field'
396
- */
397
- unspecifiedField: string;
398
-
399
- /**
400
- * @default 'There are unsaved changes on this page which will be discarded if you continue.'
401
- */
402
- leavingMessage: string;
403
- }
404
- }
223
+ /**
224
+ * Whether, on an invalid form validation, it should automatically focus either the first error field ('true') or a specific dom node (Use a unique selector string such as '.ui.error.message' or '#myelement') or nothing ('false').
225
+ * @default false
226
+ */
227
+ errorFocus: boolean | string;
405
228
 
406
- type PromptSettings = PromptSettings.Param;
407
-
408
- namespace PromptSettings {
409
- type Param = (
410
- | Pick<_Impl, 'empty'>
411
- | Pick<_Impl, 'checked'>
412
- | Pick<_Impl, 'email'>
413
- | Pick<_Impl, 'url'>
414
- | Pick<_Impl, 'regExp'>
415
- | Pick<_Impl, 'integer'>
416
- | Pick<_Impl, 'decimal'>
417
- | Pick<_Impl, 'number'>
418
- | Pick<_Impl, 'is'>
419
- | Pick<_Impl, 'isExactly'>
420
- | Pick<_Impl, 'not'>
421
- | Pick<_Impl, 'notExactly'>
422
- | Pick<_Impl, 'contain'>
423
- | Pick<_Impl, 'containExactly'>
424
- | Pick<_Impl, 'doesntContain'>
425
- | Pick<_Impl, 'doesntContainExactly'>
426
- | Pick<_Impl, 'minLength'>
427
- | Pick<_Impl, 'exactLength'>
428
- | Pick<_Impl, 'maxLength'>
429
- | Pick<_Impl, 'match'>
430
- | Pick<_Impl, 'different'>
431
- | Pick<_Impl, 'creditCard'>
432
- | Pick<_Impl, 'minCount'>
433
- | Pick<_Impl, 'exactCount'>
434
- | Pick<_Impl, 'maxCount'>
435
- ) &
436
- Partial<Pick<_Impl, keyof _Impl>>;
437
-
438
- interface _Impl {
439
- /**
440
- * @default '{name} must have a value'
441
- */
442
- empty: string;
443
-
444
- /**
445
- * @default '{name} must be checked'
446
- */
447
- checked: string;
448
-
449
- /**
450
- * @default '{name} must be a valid e-mail'
451
- */
452
- email: string;
453
-
454
- /**
455
- * @default '{name} must be a valid url'
456
- */
457
- url: string;
458
-
459
- /**
460
- * @default '{name} is not formatted correctly'
461
- */
462
- regExp: string;
463
-
464
- /**
465
- * @default '{name} must be an integer'
466
- */
467
- integer: string;
468
-
469
- /**
470
- * @default '{name} must be a decimal number'
471
- */
472
- decimal: string;
473
-
474
- /**
475
- * @default '{name} must be set to a number'
476
- */
477
- number: string;
478
-
479
- /**
480
- * @default "{name} must be '{ruleValue}'"
481
- */
482
- is: string;
483
-
484
- /**
485
- * @default "{name} must be exactly '{ruleValue}'"
486
- */
487
- isExactly: string;
488
-
489
- /**
490
- * @default "{name} cannot be set to '{ruleValue}'"
491
- */
492
- not: string;
493
-
494
- /**
495
- * @default "{name} cannot be set to exactly '{ruleValue}'"
496
- */
497
- notExactly: string;
498
-
499
- /**
500
- * @default "{name} cannot contain '{ruleValue}'"
501
- */
502
- contain: string;
503
-
504
- /**
505
- * @default "{name} cannot contain exactly '{ruleValue}'"
506
- */
507
- containExactly: string;
508
-
509
- /**
510
- * @default "{name} must contain '{ruleValue}'"
511
- */
512
- doesntContain: string;
513
-
514
- /**
515
- * @default "{name} must contain exactly '{ruleValue}'"
516
- */
517
- doesntContainExactly: string;
518
-
519
- /**
520
- * @default '{name} must be at least {ruleValue} characters'
521
- */
522
- minLength: string;
523
-
524
- /**
525
- * @default '{name} must be exactly {ruleValue} characters'
526
- */
527
- exactLength: string;
528
-
529
- /**
530
- * @default '{name} cannot be longer than {ruleValue} characters'
531
- */
532
- maxLength: string;
533
-
534
- /**
535
- * @default '{name} must match {ruleValue} field'
536
- */
537
- match: string;
538
-
539
- /**
540
- * @default '{name} must have a different value than {ruleValue} field'
541
- */
542
- different: string;
543
-
544
- /**
545
- * @default '{name} must be a valid credit card number'
546
- */
547
- creditCard: string;
548
-
549
- /**
550
- * @default '{name} must have at least {ruleValue} choices'
551
- */
552
- minCount: string;
553
-
554
- /**
555
- * @default '{name} must have exactly {ruleValue} choices'
556
- */
557
- exactCount: string;
558
-
559
- /**
560
- * @default '{name} must have {ruleValue} or less choices'
561
- */
562
- maxCount: string;
563
- }
564
- }
229
+ /**
230
+ *
231
+ * @default 0
232
+ */
233
+ errorLimit: number;
565
234
 
566
- type FormatterSettings = FormatterSettings.Param;
567
-
568
- namespace FormatterSettings {
569
- type Param = (
570
- | Pick<_Impl, 'date'>
571
- | Pick<_Impl, 'datetime'>
572
- | Pick<_Impl, 'time'>
573
- | Pick<_Impl, 'month'>
574
- | Pick<_Impl, 'year'>
575
- ) &
576
- Partial<Pick<_Impl, keyof _Impl>>;
577
-
578
- interface _Impl {
579
- date(date: string): string;
580
- datetime(date: string): string;
581
- time(date: string): string;
582
- month(date: string): string;
583
- year(date: string): string;
584
- }
585
- }
235
+ // endregion
586
236
 
587
- type SelectorSettings = SelectorSettings.Param;
588
-
589
- namespace SelectorSettings {
590
- type Param = (
591
- | Pick<_Impl, 'checkbox'>
592
- | Pick<_Impl, 'clear'>
593
- | Pick<_Impl, 'field'>
594
- | Pick<_Impl, 'group'>
595
- | Pick<_Impl, 'input'>
596
- | Pick<_Impl, 'message'>
597
- | Pick<_Impl, 'prompt'>
598
- | Pick<_Impl, 'radio'>
599
- | Pick<_Impl, 'reset'>
600
- | Pick<_Impl, 'submit'>
601
- | Pick<_Impl, 'uiCheckbox'>
602
- | Pick<_Impl, 'uiDropdown'>
603
- | Pick<_Impl, 'uiCalendar'>
604
- ) &
605
- Partial<Pick<_Impl, keyof _Impl>>;
606
-
607
- interface _Impl {
608
- /**
609
- * @default 'input[type="checkbox"], input[type="radio"]'
610
- */
611
- checkbox: string;
612
-
613
- /**
614
- * @default '.clear'
615
- */
616
- clear: string;
617
-
618
- /**
619
- * @default 'input, textarea, select'
620
- */
621
- field: string;
622
-
623
- /**
624
- * @default '.field'
625
- */
626
- group: string;
627
-
628
- /**
629
- * @default 'input'
630
- */
631
- input: string;
632
-
633
- /**
634
- * @default '.error.message'
635
- */
636
- message: string;
637
-
638
- /**
639
- * @default '.prompt.label'
640
- */
641
- prompt: string;
642
-
643
- /**
644
- * @default 'input[type="radio"]'
645
- */
646
- radio: string;
647
-
648
- /**
649
- * @default '.reset:not([type="reset"])'
650
- */
651
- reset: string;
652
-
653
- /**
654
- * @default '.submit:not([type="submit"])'
655
- */
656
- submit: string;
657
-
658
- /**
659
- * @default '.ui.checkbox'
660
- */
661
- uiCheckbox: string;
662
-
663
- /**
664
- * @default '.ui.dropdown'
665
- */
666
- uiDropdown: string;
667
-
668
- /**
669
- * @default '.ui.calendar'
670
- */
671
- uiCalendar: string;
672
- }
673
- }
237
+ // region Form Prompts
238
+
239
+ text: Form.TextSettings;
240
+
241
+ prompt: Form.PromptSettings;
242
+
243
+ // endregion
244
+
245
+ // region Formatters
674
246
 
675
- type MetadataSettings = MetadataSettings.Param;
247
+ formatter: Form.FormatterSettings;
676
248
 
677
- namespace MetadataSettings {
678
- type Param = (Pick<_Impl, 'defaultValue'> | Pick<_Impl, 'validate'> | Pick<_Impl, 'isDirty'>) &
679
- Partial<Pick<_Impl, keyof _Impl>>;
249
+ // endregion
680
250
 
681
- interface _Impl {
682
- /**
683
- * @default 'default'
684
- */
685
- defaultValue: string;
251
+ // region Callbacks
686
252
 
687
- /**
688
- * @default 'validate'
689
- */
690
- validate: string;
253
+ /**
254
+ * Callback on each valid field.
255
+ */
256
+ onValid(this: JQuery): void;
257
+
258
+ /**
259
+ * Callback on each invalid field.
260
+ */
261
+ onInvalid(this: JQuery): void;
262
+
263
+ /**
264
+ * Callback if a form is all valid.
265
+ */
266
+ onSuccess(this: JQuery, event: Event, fields: object[]): void;
267
+
268
+ /**
269
+ * Callback if any form field is invalid.
270
+ */
271
+ onFailure(this: JQuery, formErrors: object[], fields: object[]): void;
272
+
273
+ /**
274
+ * Callback if form state is modified to 'dirty'.
275
+ * Triggered when at least on field has been modified.
276
+ */
277
+ onDirty(this: JQuery): void;
278
+
279
+ /**
280
+ * Callback if form state is modified to 'clean'.
281
+ * Triggered when all fields are set to default values.
282
+ */
283
+ onClean(this: JQuery): void;
284
+
285
+ // endregion
286
+
287
+ // region DOM Settings
288
+
289
+ /**
290
+ * DOM Selectors used internally.
291
+ * Selectors used to find parts of a module.
292
+ */
293
+ selector: Form.SelectorSettings;
294
+
295
+ /**
296
+ * Class names used to determine element state.
297
+ */
298
+ metadata: Form.MetadataSettings;
299
+
300
+ /**
301
+ * Class names used to determine element state.
302
+ */
303
+ className: Form.ClassNameSettings;
304
+
305
+ // endregion
306
+
307
+ // region Debug Settings
308
+
309
+ /**
310
+ * Name used in log statements
311
+ * @default 'Form'
312
+ */
313
+ name: string;
314
+
315
+ /**
316
+ * Event namespace. Makes sure module teardown does not effect other events attached to an element.
317
+ * @default 'form'
318
+ */
319
+ namespace: string;
320
+
321
+ /**
322
+ * Silences all console output including error messages, regardless of other debug settings.
323
+ * @default false
324
+ */
325
+ silent: boolean;
326
+
327
+ /**
328
+ * Debug output to console
329
+ * @default false
330
+ */
331
+ debug: boolean;
332
+
333
+ /**
334
+ * Show console.table output with performance metrics
335
+ * @default true
336
+ */
337
+ performance: boolean;
338
+
339
+ /**
340
+ * Debug output includes all internal behaviors
341
+ * @default false
342
+ */
343
+ verbose: boolean;
344
+
345
+ errors: Form.ErrorSettings;
346
+
347
+ // endregion
348
+ }
349
+
350
+ namespace Form {
351
+ type TextSettings = Partial<Pick<Settings.Texts, keyof Settings.Texts>>;
352
+ type PromptSettings = Partial<Pick<Settings.Prompts, keyof Settings.Prompts>>;
353
+ type FormatterSettings = Partial<Pick<Settings.Formatters, keyof Settings.Formatters>>;
354
+ type SelectorSettings = Partial<Pick<Settings.Selectors, keyof Settings.Selectors>>;
355
+ type MetadataSettings = Partial<Pick<Settings.Metadatas, keyof Settings.Metadatas>>;
356
+ type ClassNameSettings = Partial<Pick<Settings.ClassNames, keyof Settings.ClassNames>>;
357
+ type ErrorSettings = Partial<Pick<Settings.Errors, keyof Settings.Errors>>;
358
+
359
+ namespace Settings {
360
+ interface Texts {
361
+ /**
362
+ * @default 'Please enter a valid value'
363
+ */
364
+ unspecifiedRule: string;
365
+
366
+ /**
367
+ * @default 'This field'
368
+ */
369
+ unspecifiedField: string;
370
+
371
+ /**
372
+ * @default 'There are unsaved changes on this page which will be discarded if you continue.'
373
+ */
374
+ leavingMessage: string;
375
+ }
376
+
377
+ interface Prompts {
378
+ /**
379
+ * @default '{name} must have a value'
380
+ */
381
+ empty: string;
382
+
383
+ /**
384
+ * @default '{name} must be checked'
385
+ */
386
+ checked: string;
387
+
388
+ /**
389
+ * @default '{name} must be a valid e-mail'
390
+ */
391
+ email: string;
392
+
393
+ /**
394
+ * @default '{name} must be a valid url'
395
+ */
396
+ url: string;
397
+
398
+ /**
399
+ * @default '{name} is not formatted correctly'
400
+ */
401
+ regExp: string;
402
+
403
+ /**
404
+ * @default '{name} must be an integer'
405
+ */
406
+ integer: string;
407
+
408
+ /**
409
+ * @default '{name} must be a decimal number'
410
+ */
411
+ decimal: string;
412
+
413
+ /**
414
+ * @default '{name} must be set to a number'
415
+ */
416
+ number: string;
417
+
418
+ /**
419
+ * @default "{name} must be '{ruleValue}'"
420
+ */
421
+ is: string;
422
+
423
+ /**
424
+ * @default "{name} must be exactly '{ruleValue}'"
425
+ */
426
+ isExactly: string;
427
+
428
+ /**
429
+ * @default "{name} cannot be set to '{ruleValue}'"
430
+ */
431
+ not: string;
432
+
433
+ /**
434
+ * @default "{name} cannot be set to exactly '{ruleValue}'"
435
+ */
436
+ notExactly: string;
437
+
438
+ /**
439
+ * @default "{name} cannot contain '{ruleValue}'"
440
+ */
441
+ contain: string;
442
+
443
+ /**
444
+ * @default "{name} cannot contain exactly '{ruleValue}'"
445
+ */
446
+ containExactly: string;
447
+
448
+ /**
449
+ * @default "{name} must contain '{ruleValue}'"
450
+ */
451
+ doesntContain: string;
452
+
453
+ /**
454
+ * @default "{name} must contain exactly '{ruleValue}'"
455
+ */
456
+ doesntContainExactly: string;
457
+
458
+ /**
459
+ * @default '{name} must be at least {ruleValue} characters'
460
+ */
461
+ minLength: string;
462
+
463
+ /**
464
+ * @default '{name} must be exactly {ruleValue} characters'
465
+ */
466
+ exactLength: string;
467
+
468
+ /**
469
+ * @default '{name} cannot be longer than {ruleValue} characters'
470
+ */
471
+ maxLength: string;
472
+
473
+ /**
474
+ * @default '{name} must match {ruleValue} field'
475
+ */
476
+ match: string;
477
+
478
+ /**
479
+ * @default '{name} must have a different value than {ruleValue} field'
480
+ */
481
+ different: string;
482
+
483
+ /**
484
+ * @default '{name} must be a valid credit card number'
485
+ */
486
+ creditCard: string;
487
+
488
+ /**
489
+ * @default '{name} must have at least {ruleValue} choices'
490
+ */
491
+ minCount: string;
492
+
493
+ /**
494
+ * @default '{name} must have exactly {ruleValue} choices'
495
+ */
496
+ exactCount: string;
497
+
498
+ /**
499
+ * @default '{name} must have {ruleValue} or less choices'
500
+ */
501
+ maxCount: string;
502
+ }
503
+
504
+ interface Formatters {
505
+ date(date: string): string;
506
+ datetime(date: string): string;
507
+ time(date: string): string;
508
+ month(date: string): string;
509
+ year(date: string): string;
510
+ }
511
+
512
+ interface Selectors {
513
+ /**
514
+ * @default 'input[type="checkbox"], input[type="radio"]'
515
+ */
516
+ checkbox: string;
517
+
518
+ /**
519
+ * @default '.clear'
520
+ */
521
+ clear: string;
522
+
523
+ /**
524
+ * @default 'input, textarea, select'
525
+ */
526
+ field: string;
527
+
528
+ /**
529
+ * @default '.field'
530
+ */
531
+ group: string;
532
+
533
+ /**
534
+ * @default 'input'
535
+ */
536
+ input: string;
537
+
538
+ /**
539
+ * @default '.error.message'
540
+ */
541
+ message: string;
542
+
543
+ /**
544
+ * @default '.prompt.label'
545
+ */
546
+ prompt: string;
547
+
548
+ /**
549
+ * @default 'input[type="radio"]'
550
+ */
551
+ radio: string;
552
+
553
+ /**
554
+ * @default '.reset:not([type="reset"])'
555
+ */
556
+ reset: string;
557
+
558
+ /**
559
+ * @default '.submit:not([type="submit"])'
560
+ */
561
+ submit: string;
562
+
563
+ /**
564
+ * @default '.ui.checkbox'
565
+ */
566
+ uiCheckbox: string;
567
+
568
+ /**
569
+ * @default '.ui.dropdown'
570
+ */
571
+ uiDropdown: string;
572
+
573
+ /**
574
+ * @default '.ui.calendar'
575
+ */
576
+ uiCalendar: string;
577
+ }
691
578
 
692
- /**
693
- * @default 'isDirty'
694
- */
695
- isDirty: string;
696
- }
579
+ interface Metadatas {
580
+ /**
581
+ * @default 'default'
582
+ */
583
+ defaultValue: string;
584
+
585
+ /**
586
+ * @default 'validate'
587
+ */
588
+ validate: string;
589
+
590
+ /**
591
+ * @default 'isDirty'
592
+ */
593
+ isDirty: string;
697
594
  }
698
595
 
699
- type ClassNameSettings = ClassNameSettings.Param;
700
-
701
- namespace ClassNameSettings {
702
- type Param = (
703
- | Pick<_Impl, 'error'>
704
- | Pick<_Impl, 'label'>
705
- | Pick<_Impl, 'pressed'>
706
- | Pick<_Impl, 'success'>
707
- ) &
708
- Partial<Pick<_Impl, keyof _Impl>>;
709
-
710
- interface _Impl {
711
- /**
712
- * @default 'error'
713
- */
714
- error: string;
715
-
716
- /**
717
- * @default 'ui basic red pointing prompt label'
718
- */
719
- label: string;
720
-
721
- /**
722
- * @default 'down'
723
- */
724
- pressed: string;
725
-
726
- /**
727
- * @default 'success'
728
- */
729
- success: string;
730
- }
596
+ interface ClassNames {
597
+ /**
598
+ * @default 'error'
599
+ */
600
+ error: string;
601
+
602
+ /**
603
+ * @default 'ui basic red pointing prompt label'
604
+ */
605
+ label: string;
606
+
607
+ /**
608
+ * @default 'down'
609
+ */
610
+ pressed: string;
611
+
612
+ /**
613
+ * @default 'success'
614
+ */
615
+ success: string;
731
616
  }
732
617
 
733
- type ErrorSettings = ErrorSettings.Param;
734
-
735
- namespace ErrorSettings {
736
- type Param = (
737
- | Pick<_Impl, 'identifier'>
738
- | Pick<_Impl, 'method'>
739
- | Pick<_Impl, 'noRule'>
740
- | Pick<_Impl, 'oldSyntax'>
741
- | Pick<_Impl, 'noField'>
742
- | Pick<_Impl, 'noElement'>
743
- ) &
744
- Partial<Pick<_Impl, keyof _Impl>>;
745
-
746
- interface _Impl {
747
- /**
748
- * @default 'You must specify a string identifier for each field'
749
- */
750
- identifier: string;
751
-
752
- /**
753
- * @default 'The method you called is not defined'
754
- */
755
- method: string;
756
-
757
- /**
758
- * @default 'There is no rule matching the one you specified'
759
- */
760
- noRule: string;
761
-
762
- /**
763
- * @default 'Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically.'
764
- */
765
- oldSyntax: string;
766
-
767
- /**
768
- * @default 'Field identifier {identifier} not found'
769
- */
770
- noField: string;
771
-
772
- /**
773
- * @default 'This module requires ui {element}'
774
- */
775
- noElement: string;
776
- }
618
+ interface Errors {
619
+ /**
620
+ * @default 'You must specify a string identifier for each field'
621
+ */
622
+ identifier: string;
623
+
624
+ /**
625
+ * @default 'The method you called is not defined'
626
+ */
627
+ method: string;
628
+
629
+ /**
630
+ * @default 'There is no rule matching the one you specified'
631
+ */
632
+ noRule: string;
633
+
634
+ /**
635
+ * @default 'Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically.'
636
+ */
637
+ oldSyntax: string;
638
+
639
+ /**
640
+ * @default 'Field identifier {identifier} not found'
641
+ */
642
+ noField: string;
643
+
644
+ /**
645
+ * @default 'This module requires ui {element}'
646
+ */
647
+ noElement: string;
777
648
  }
778
649
  }
779
650
  }