fomantic-ui 2.9.4-beta.1 → 2.9.4-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/dist/components/accordion.css +1 -1
  2. package/dist/components/accordion.js +1 -1
  3. package/dist/components/accordion.min.css +1 -1
  4. package/dist/components/accordion.min.js +1 -1
  5. package/dist/components/ad.css +1 -1
  6. package/dist/components/ad.min.css +1 -1
  7. package/dist/components/api.js +1 -1
  8. package/dist/components/api.min.js +1 -1
  9. package/dist/components/breadcrumb.css +1 -1
  10. package/dist/components/breadcrumb.min.css +1 -1
  11. package/dist/components/button.css +1 -1
  12. package/dist/components/button.min.css +1 -1
  13. package/dist/components/calendar.css +1 -1
  14. package/dist/components/calendar.js +1 -1
  15. package/dist/components/calendar.min.css +1 -1
  16. package/dist/components/calendar.min.js +1 -1
  17. package/dist/components/card.css +1 -1
  18. package/dist/components/card.min.css +1 -1
  19. package/dist/components/checkbox.css +1 -1
  20. package/dist/components/checkbox.js +1 -1
  21. package/dist/components/checkbox.min.css +1 -1
  22. package/dist/components/checkbox.min.js +1 -1
  23. package/dist/components/comment.css +1 -1
  24. package/dist/components/comment.min.css +1 -1
  25. package/dist/components/container.css +1 -1
  26. package/dist/components/container.min.css +1 -1
  27. package/dist/components/dimmer.css +1 -1
  28. package/dist/components/dimmer.js +1 -1
  29. package/dist/components/dimmer.min.css +1 -1
  30. package/dist/components/dimmer.min.js +1 -1
  31. package/dist/components/divider.css +1 -1
  32. package/dist/components/divider.min.css +1 -1
  33. package/dist/components/dropdown.css +1 -3
  34. package/dist/components/dropdown.js +2 -2
  35. package/dist/components/dropdown.min.css +2 -2
  36. package/dist/components/dropdown.min.js +2 -2
  37. package/dist/components/embed.css +1 -1
  38. package/dist/components/embed.js +1 -1
  39. package/dist/components/embed.min.css +1 -1
  40. package/dist/components/embed.min.js +1 -1
  41. package/dist/components/emoji.css +1 -1
  42. package/dist/components/emoji.min.css +1 -1
  43. package/dist/components/feed.css +1 -1
  44. package/dist/components/feed.min.css +1 -1
  45. package/dist/components/flag.css +1 -1
  46. package/dist/components/flag.min.css +1 -1
  47. package/dist/components/flyout.css +1 -1
  48. package/dist/components/flyout.js +1 -1
  49. package/dist/components/flyout.min.css +1 -1
  50. package/dist/components/flyout.min.js +1 -1
  51. package/dist/components/form.css +14 -5
  52. package/dist/components/form.js +9 -7
  53. package/dist/components/form.min.css +2 -2
  54. package/dist/components/form.min.js +2 -2
  55. package/dist/components/grid.css +1 -1
  56. package/dist/components/grid.min.css +1 -1
  57. package/dist/components/header.css +4 -1
  58. package/dist/components/header.min.css +2 -2
  59. package/dist/components/icon.css +1 -1
  60. package/dist/components/icon.min.css +1 -1
  61. package/dist/components/image.css +1 -1
  62. package/dist/components/image.min.css +1 -1
  63. package/dist/components/input.css +30 -10
  64. package/dist/components/input.min.css +2 -2
  65. package/dist/components/item.css +1 -1
  66. package/dist/components/item.min.css +1 -1
  67. package/dist/components/label.css +1 -2
  68. package/dist/components/label.min.css +2 -2
  69. package/dist/components/list.css +1 -1
  70. package/dist/components/list.min.css +1 -1
  71. package/dist/components/loader.css +1 -1
  72. package/dist/components/loader.min.css +1 -1
  73. package/dist/components/menu.css +1 -2
  74. package/dist/components/menu.min.css +2 -2
  75. package/dist/components/message.css +1 -1
  76. package/dist/components/message.min.css +1 -1
  77. package/dist/components/modal.css +1 -1
  78. package/dist/components/modal.js +1 -1
  79. package/dist/components/modal.min.css +1 -1
  80. package/dist/components/modal.min.js +1 -1
  81. package/dist/components/nag.css +1 -1
  82. package/dist/components/nag.js +1 -1
  83. package/dist/components/nag.min.css +1 -1
  84. package/dist/components/nag.min.js +1 -1
  85. package/dist/components/placeholder.css +1 -1
  86. package/dist/components/placeholder.min.css +1 -1
  87. package/dist/components/popup.css +1 -2
  88. package/dist/components/popup.js +1 -1
  89. package/dist/components/popup.min.css +2 -2
  90. package/dist/components/popup.min.js +1 -1
  91. package/dist/components/progress.css +1 -1
  92. package/dist/components/progress.js +1 -1
  93. package/dist/components/progress.min.css +1 -1
  94. package/dist/components/progress.min.js +1 -1
  95. package/dist/components/rail.css +1 -1
  96. package/dist/components/rail.min.css +1 -1
  97. package/dist/components/rating.css +1 -1
  98. package/dist/components/rating.js +1 -1
  99. package/dist/components/rating.min.css +1 -1
  100. package/dist/components/rating.min.js +1 -1
  101. package/dist/components/reset.css +1 -1
  102. package/dist/components/reset.min.css +1 -1
  103. package/dist/components/reveal.css +1 -1
  104. package/dist/components/reveal.min.css +1 -1
  105. package/dist/components/search.css +1 -1
  106. package/dist/components/search.js +1 -1
  107. package/dist/components/search.min.css +1 -1
  108. package/dist/components/search.min.js +1 -1
  109. package/dist/components/segment.css +1 -1
  110. package/dist/components/segment.min.css +1 -1
  111. package/dist/components/shape.css +1 -1
  112. package/dist/components/shape.js +1 -1
  113. package/dist/components/shape.min.css +1 -1
  114. package/dist/components/shape.min.js +1 -1
  115. package/dist/components/sidebar.css +1 -1
  116. package/dist/components/sidebar.js +1 -1
  117. package/dist/components/sidebar.min.css +1 -1
  118. package/dist/components/sidebar.min.js +1 -1
  119. package/dist/components/site.css +1 -1
  120. package/dist/components/site.js +1 -1
  121. package/dist/components/site.min.css +1 -1
  122. package/dist/components/site.min.js +1 -1
  123. package/dist/components/slider.css +1 -1
  124. package/dist/components/slider.js +1 -1
  125. package/dist/components/slider.min.css +1 -1
  126. package/dist/components/slider.min.js +1 -1
  127. package/dist/components/state.js +1 -1
  128. package/dist/components/state.min.js +1 -1
  129. package/dist/components/statistic.css +1 -1
  130. package/dist/components/statistic.min.css +1 -1
  131. package/dist/components/step.css +1 -1
  132. package/dist/components/step.min.css +1 -1
  133. package/dist/components/sticky.css +1 -1
  134. package/dist/components/sticky.js +1 -1
  135. package/dist/components/sticky.min.css +1 -1
  136. package/dist/components/sticky.min.js +1 -1
  137. package/dist/components/tab.css +1 -1
  138. package/dist/components/tab.js +1 -1
  139. package/dist/components/tab.min.css +1 -1
  140. package/dist/components/tab.min.js +1 -1
  141. package/dist/components/table.css +1 -1
  142. package/dist/components/table.min.css +1 -1
  143. package/dist/components/text.css +1 -1
  144. package/dist/components/text.min.css +1 -1
  145. package/dist/components/toast.css +1 -1
  146. package/dist/components/toast.js +1 -1
  147. package/dist/components/toast.min.css +1 -1
  148. package/dist/components/toast.min.js +1 -1
  149. package/dist/components/transition.css +1 -1
  150. package/dist/components/transition.js +1 -1
  151. package/dist/components/transition.min.css +1 -1
  152. package/dist/components/transition.min.js +1 -1
  153. package/dist/components/visibility.js +1 -1
  154. package/dist/components/visibility.min.js +1 -1
  155. package/dist/semantic.css +100 -71
  156. package/dist/semantic.js +35 -33
  157. package/dist/semantic.min.css +2 -2
  158. package/dist/semantic.min.js +2 -2
  159. package/package.json +1 -1
  160. package/src/definitions/behaviors/form.js +8 -6
  161. package/src/definitions/collections/form.less +13 -4
  162. package/src/definitions/elements/header.less +5 -0
  163. package/src/definitions/elements/input.less +14 -6
  164. package/src/definitions/modules/dropdown.js +1 -1
  165. package/src/themes/default/collections/form.variables +1 -0
  166. package/src/themes/default/globals/variation.variables +1 -0
  167. package/types/fomantic-ui-api.d.ts +8 -2
  168. package/types/fomantic-ui-calendar.d.ts +93 -8
  169. package/types/fomantic-ui-checkbox.d.ts +14 -4
  170. package/types/fomantic-ui-dropdown.d.ts +12 -17
  171. package/types/fomantic-ui-flyout.d.ts +21 -7
  172. package/types/fomantic-ui-form.d.ts +112 -17
  173. package/types/fomantic-ui-modal.d.ts +74 -4
  174. package/types/fomantic-ui-nag.d.ts +1 -1
  175. package/types/fomantic-ui-popup.d.ts +8 -8
  176. package/types/fomantic-ui-progress.d.ts +6 -0
  177. package/types/fomantic-ui-search.d.ts +30 -12
  178. package/types/fomantic-ui-tab.d.ts +1 -1
  179. package/types/fomantic-ui-tests.ts +162 -0
  180. package/types/fomantic-ui-toast.d.ts +6 -1
  181. package/types/fomantic-ui-transition.d.ts +28 -0
  182. package/types/fomantic-ui-visibility.d.ts +2 -2
@@ -15,7 +15,12 @@ declare namespace FomanticUI {
15
15
  /**
16
16
  * Adds rule to existing rules for field, also aliased as 'add field'.
17
17
  */
18
- (behavior: 'add rule', field: string, rules: object[]): void;
18
+ (behavior: 'add rule', field: string, rules: string | string[] | FormField[]): void;
19
+
20
+ /**
21
+ * Adds field object to existing fields.
22
+ */
23
+ (behavior: 'add field', name: string, rules: string | string[] | FormRule[]): void;
19
24
 
20
25
  /**
21
26
  * Adds fields object to existing fields.
@@ -25,13 +30,18 @@ declare namespace FomanticUI {
25
30
  /**
26
31
  * Removes specific rule from field leaving other rules.
27
32
  */
28
- (behavior: 'remove rule', field: string, rules: object[]): void;
33
+ (behavior: 'remove rule', field: string, rules?: object[]): void;
29
34
 
30
35
  /**
31
36
  * Remove all validation for a field.
32
37
  */
33
38
  (behavior: 'remove field', field: string): void;
34
39
 
40
+ /**
41
+ * Remove all validation for an array of fields.
42
+ */
43
+ (behavior: 'remove fields', field: string[]): void;
44
+
35
45
  /**
36
46
  * Returns 'true'/'false' whether a field passes its validation rules.
37
47
  * If you add 'true' as the second parameter, any failed rule will update the UI.
@@ -41,7 +51,7 @@ declare namespace FomanticUI {
41
51
  /**
42
52
  * Validates form, updates UI, and calls 'onSuccess' or 'onFailure'.
43
53
  */
44
- (behavior: 'validate form'): void;
54
+ (behavior: 'validate form'): boolean;
45
55
 
46
56
  /**
47
57
  * Validates field, updates UI, and calls 'onSuccess' or 'onFailure'.
@@ -51,7 +61,7 @@ declare namespace FomanticUI {
51
61
  /**
52
62
  * Returns element with matching name, id, or data-validate metadata to identifier.
53
63
  */
54
- (behavior: 'get field', identifier: string): string;
64
+ (behavior: 'get field', identifier: string, strict?: boolean, ignoreMissing?: boolean): string;
55
65
 
56
66
  /**
57
67
  * Returns value of element with id.
@@ -62,7 +72,7 @@ declare namespace FomanticUI {
62
72
  * Returns object of element values that match array of identifiers.
63
73
  * If no IDS are passed will return all fields.
64
74
  */
65
- (behavior: 'get values', identifiers?: string[]): object;
75
+ (behavior: 'get values', identifiers?: string[]): Record<string, string>;
66
76
 
67
77
  /**
68
78
  * Sets value of element with id.
@@ -82,7 +92,7 @@ declare namespace FomanticUI {
82
92
  /**
83
93
  * Returns whether a field exists.
84
94
  */
85
- (behavior: 'has field', identifier: string): boolean;
95
+ (behavior: 'has field', identifier: string, ignoreMissing?: boolean): boolean;
86
96
 
87
97
  /**
88
98
  * Manually add errors to form, given an array errors.
@@ -97,23 +107,33 @@ declare namespace FomanticUI {
97
107
  /**
98
108
  * Adds a custom user prompt for a given element with identifier.
99
109
  */
100
- (behavior: 'add prompt', identifier: string, errors: object[]): void;
110
+ (behavior: 'add prompt', identifier: string, errors: string | object[]): void;
101
111
 
102
112
  /**
103
113
  * Empty all fields and remove possible errors.
104
114
  */
105
- (behavior: 'clear'): void;
115
+ (behavior: 'clear'): JQuery;
106
116
 
107
117
  /**
108
118
  * Set all fields to their initial value and remove possible errors.
109
119
  */
110
- (behavior: 'reset'): void;
120
+ (behavior: 'reset'): JQuery;
111
121
 
112
122
  /**
113
123
  * Set fields actual values as default values.
114
124
  */
115
125
  (behavior: 'set defaults'): void;
116
126
 
127
+ /**
128
+ * Returns 'true'/'false' whether a form is dirty.
129
+ */
130
+ (behavior: 'is dirty'): boolean;
131
+
132
+ /**
133
+ * Returns 'true'/'false' whether a form is clean.
134
+ */
135
+ (behavior: 'is clean'): boolean;
136
+
117
137
  /**
118
138
  * Return elements which have been modified since form state was changed to 'dirty'.
119
139
  */
@@ -122,7 +142,7 @@ declare namespace FomanticUI {
122
142
  /**
123
143
  * Set the state of the form to 'clean' and set new values as default.
124
144
  */
125
- (behavior: 'set as clean'): void;
145
+ (behavior: 'set as clean'): JQuery;
126
146
 
127
147
  /**
128
148
  * Automatically adds the "empty" rule or automatically checks a checkbox for all fields with classname or attribute 'required'.
@@ -144,12 +164,33 @@ declare namespace FomanticUI {
144
164
  (settings?: Partial<Pick<FormSettings, keyof FormSettings>>): JQuery;
145
165
  }
146
166
 
167
+ type FormFields = Record<string, FormField | string[] | string | {}>;
168
+
169
+ interface FormRule {
170
+ type: string;
171
+ prompt?: string | ((value: string) => void);
172
+ value?: string | RegExp;
173
+ }
174
+
175
+ interface FormField {
176
+ identifier?: string;
177
+ depends?: string;
178
+ optional?: boolean;
179
+ rules: FormRule[];
180
+ }
181
+
147
182
  /**
148
183
  * @see {@link https://fomantic-ui.com/behaviors/form.html#/settings}
149
184
  */
150
185
  interface FormSettings {
151
186
  // region Form Settings
152
187
 
188
+ /**
189
+ * Adds keyboard shortcuts for enter and escape keys to submit form and blur fields respectively.
190
+ * @default false
191
+ */
192
+ fields: false | FormFields;
193
+
153
194
  /**
154
195
  * Adds keyboard shortcuts for enter and escape keys to submit form and blur fields respectively.
155
196
  * @default true
@@ -227,7 +268,7 @@ declare namespace FomanticUI {
227
268
  errorFocus: boolean | string;
228
269
 
229
270
  /**
230
- *
271
+ *
231
272
  * @default 0
232
273
  */
233
274
  errorLimit: number;
@@ -248,6 +289,12 @@ declare namespace FomanticUI {
248
289
 
249
290
  // endregion
250
291
 
292
+ // region Formatters
293
+
294
+ rules: Form.RulesSettings;
295
+
296
+ // endregion
297
+
251
298
  // region Callbacks
252
299
 
253
300
  /**
@@ -258,17 +305,17 @@ declare namespace FomanticUI {
258
305
  /**
259
306
  * Callback on each invalid field.
260
307
  */
261
- onInvalid(this: JQuery): void;
308
+ onInvalid(this: JQuery, fieldErrors: string | string[]): void;
262
309
 
263
310
  /**
264
311
  * Callback if a form is all valid.
265
312
  */
266
- onSuccess(this: JQuery, event: Event, fields: object[]): void;
313
+ onSuccess(this: JQuery, event: Event, fields: {[key: string]: any}): void;
267
314
 
268
315
  /**
269
316
  * Callback if any form field is invalid.
270
317
  */
271
- onFailure(this: JQuery, formErrors: object[], fields: object[]): void;
318
+ onFailure(this: JQuery, formErrors: {[key: string]: any}, fields: {[key: string]: any}): void;
272
319
 
273
320
  /**
274
321
  * Callback if form state is modified to 'dirty'.
@@ -349,8 +396,9 @@ declare namespace FomanticUI {
349
396
 
350
397
  namespace Form {
351
398
  type TextSettings = Partial<Pick<Settings.Texts, keyof Settings.Texts>>;
352
- type PromptSettings = Partial<Pick<Settings.Prompts, keyof Settings.Prompts>>;
399
+ type PromptSettings = Partial<Pick<Settings.Prompts, keyof Settings.Prompts>> & {[key: string]: string | undefined};
353
400
  type FormatterSettings = Partial<Pick<Settings.Formatters, keyof Settings.Formatters>>;
401
+ type RulesSettings = Partial<Pick<Settings.Rules, keyof Settings.Rules>> & {[key: string]: (value?: any, identifier?: string, module?: any) => boolean};
354
402
  type SelectorSettings = Partial<Pick<Settings.Selectors, keyof Settings.Selectors>>;
355
403
  type MetadataSettings = Partial<Pick<Settings.Metadatas, keyof Settings.Metadatas>>;
356
404
  type ClassNameSettings = Partial<Pick<Settings.ClassNames, keyof Settings.ClassNames>>;
@@ -373,8 +421,23 @@ declare namespace FomanticUI {
373
421
  */
374
422
  leavingMessage: string;
375
423
  }
376
-
424
+
377
425
  interface Prompts {
426
+ /**
427
+ * @default '{name} must be in a range from {min} to {max}'
428
+ */
429
+ range: string;
430
+
431
+ /**
432
+ * @default '{name} must have a maximum value of {ruleValue}'
433
+ */
434
+ maxValue: string;
435
+
436
+ /**
437
+ * @default '{name} must have a minimum value of {ruleValue}'
438
+ */
439
+ minValue: string;
440
+
378
441
  /**
379
442
  * @default '{name} must have a value'
380
443
  */
@@ -500,7 +563,7 @@ declare namespace FomanticUI {
500
563
  */
501
564
  maxCount: string;
502
565
  }
503
-
566
+
504
567
  interface Formatters {
505
568
  date(date: string): string;
506
569
  datetime(date: string): string;
@@ -509,6 +572,38 @@ declare namespace FomanticUI {
509
572
  year(date: string): string;
510
573
  }
511
574
 
575
+ interface Rules {
576
+ empty(value: unknown): boolean;
577
+ checked(): boolean;
578
+ email(value: unknown): boolean;
579
+ url(value: unknown): boolean;
580
+ regExp(value: unknown, regExp: RegExp): boolean;
581
+ minValue(value: unknown, range: string): boolean;
582
+ maxValue(value: unknown, range: string): boolean;
583
+ integer(value: unknown, range: string): boolean;
584
+ range(value: unknown, range: string, regExp: RegExp, testLength: boolean): boolean;
585
+ decimal(value: unknown, range: string): boolean;
586
+ number(value: unknown, range: string): boolean;
587
+ is(value: unknown, text: string): boolean;
588
+ isExactly(value: unknown, text: string): boolean;
589
+ not(value: unknown, notValue: unknown): boolean;
590
+ notExactly(value: unknown, notValue: unknown): boolean;
591
+ contains(value: unknown, text: string): boolean;
592
+ containsExactly(value: unknown, text: string): boolean;
593
+ doesntContain(value: unknown, text: string): boolean;
594
+ doesntContainExactly(value: unknown, text: string): boolean;
595
+ minLength(value: unknown, minLength: number): boolean;
596
+ exactLength(value: unknown, requiredLength: number): boolean;
597
+ maxLength(value: unknown, maxLength: number): boolean;
598
+ size(value: unknown, range: string): boolean;
599
+ match(value: unknown, identifier: string, module: unknown): boolean;
600
+ different(value: unknown, identifier: string, module: unknown): boolean;
601
+ creditCard(cardNumber: unknown, cardTypes: string): boolean;
602
+ minCount(value: unknown, minCount: number): boolean;
603
+ exactCount(value: unknown, exactCount: number): boolean;
604
+ maxCount(value: unknown, maxCount: number): boolean;
605
+ }
606
+
512
607
  interface Selectors {
513
608
  /**
514
609
  * @default 'input[type="checkbox"], input[type="radio"]'
@@ -5,12 +5,12 @@ declare namespace FomanticUI {
5
5
  /**
6
6
  * Shows the modal.
7
7
  */
8
- (behavior: 'show'): JQuery;
8
+ (behavior: 'show', callback?: Function): JQuery;
9
9
 
10
10
  /**
11
11
  * Hides the modal.
12
12
  */
13
- (behavior: 'hide'): JQuery;
13
+ (behavior: 'hide', callback?: Function): JQuery;
14
14
 
15
15
  /**
16
16
  * Toggles the modal.
@@ -62,6 +62,11 @@ declare namespace FomanticUI {
62
62
  */
63
63
  (behavior: 'set active'): JQuery;
64
64
 
65
+ /**
66
+ * Templates handling
67
+ */
68
+ (behavior: keyof Modal.TemplatesSettings, ...args: any): Partial<Pick<ModalSettings, keyof ModalSettings>>;
69
+
65
70
  (behavior: 'destroy'): JQuery;
66
71
  <K extends keyof ModalSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<ModalSettings, keyof ModalSettings>>;
67
72
  <K extends keyof ModalSettings>(behavior: 'setting', name: K, value: ModalSettings[K]): JQuery;
@@ -166,13 +171,13 @@ declare namespace FomanticUI {
166
171
  /**
167
172
  * Custom settings to extend UI dimmer.
168
173
  */
169
- dimmerSettings: DimmerSettings;
174
+ dimmerSettings: Partial<Pick<DimmerSettings, keyof DimmerSettings>>;
170
175
 
171
176
  /**
172
177
  * Custom settings to extend UI dimmer.
173
178
  * @default 'scale'
174
179
  */
175
- transition: string | TransitionSettings;
180
+ transition: string | Partial<Pick<TransitionSettings, keyof TransitionSettings>>;
176
181
 
177
182
  /**
178
183
  * Duration of animation.
@@ -194,6 +199,62 @@ declare namespace FomanticUI {
194
199
  */
195
200
  scrollbarWidth: number;
196
201
 
202
+ // dynamic content
203
+
204
+ /**
205
+ * Title of dynamicly created modal.
206
+ * @default ''
207
+ */
208
+ title: string;
209
+
210
+ /**
211
+ * HTML content of dynamicly created modal.
212
+ * @default ''
213
+ */
214
+ content: string;
215
+
216
+ /**
217
+ * CSS classname(s) of dynamicly created modal.
218
+ * @default ''
219
+ */
220
+ class: string;
221
+
222
+ /**
223
+ * CSS classname(s) of dynamicly created modal's title.
224
+ * @default ''
225
+ */
226
+ classTitle: string;
227
+
228
+ /**
229
+ * CSS classname(s) of dynamicly created modal's content.
230
+ * @default ''
231
+ */
232
+ classContent: string;
233
+
234
+ /**
235
+ * CSS classname(s) of dynamicly created modal's actions.
236
+ * @default ''
237
+ */
238
+ classActions: string;
239
+
240
+ /**
241
+ * Determine if a close icon shoud be displayed on dynamicly created modal.
242
+ * @default false
243
+ */
244
+ closeIcon: boolean;
245
+
246
+ /**
247
+ *
248
+ * @default false
249
+ */
250
+ actions: any;
251
+
252
+ /**
253
+ *
254
+ * @default true
255
+ */
256
+ preserveHTML: boolean;
257
+
197
258
  // endregion
198
259
 
199
260
  // region Callbacks
@@ -250,6 +311,8 @@ declare namespace FomanticUI {
250
311
 
251
312
  // region Config Template Settings
252
313
 
314
+ templates: Modal.TemplatesSettings;
315
+
253
316
  // endregion
254
317
 
255
318
  // region Debug Settings
@@ -299,6 +362,7 @@ declare namespace FomanticUI {
299
362
  type SelectorSettings = Partial<Pick<Settings.Selectors, keyof Settings.Selectors>>;
300
363
  type ClassNameSettings = Partial<Pick<Settings.ClassNames, keyof Settings.ClassNames>>;
301
364
  type ErrorSettings = Partial<Pick<Settings.Errors, keyof Settings.Errors>>;
365
+ type TemplatesSettings = Partial<Pick<Settings.Templates, keyof Settings.Templates>> & {[key: string]: (...args: any) => Partial<Pick<ModalSettings, keyof ModalSettings>>};
302
366
 
303
367
  namespace Settings {
304
368
  interface Selectors {
@@ -466,6 +530,12 @@ declare namespace FomanticUI {
466
530
  */
467
531
  notFound: string;
468
532
  }
533
+
534
+ interface Templates {
535
+ alert(): Partial<Pick<ModalSettings, keyof ModalSettings>>;
536
+ confirm(): Partial<Pick<ModalSettings, keyof ModalSettings>>;
537
+ prompt(): Partial<Pick<ModalSettings, keyof ModalSettings>>;
538
+ }
469
539
  }
470
540
  }
471
541
  }
@@ -26,7 +26,7 @@ declare namespace FomanticUI {
26
26
  <K extends keyof NagSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<NagSettings, keyof NagSettings>>;
27
27
  <K extends keyof NagSettings>(behavior: 'setting', name: K, value: NagSettings[K]): JQuery;
28
28
  (behavior: 'setting', value: Partial<Pick<NagSettings, keyof NagSettings>>): JQuery;
29
- (settings?: NagSettings): Partial<Pick<NagSettings, keyof NagSettings>>;
29
+ (settings?: Partial<Pick<NagSettings, keyof NagSettings>>): JQuery;
30
30
  }
31
31
 
32
32
  /**
@@ -84,7 +84,7 @@ declare namespace FomanticUI {
84
84
  * This is useful for including a pre-formatted popup.
85
85
  * @default false
86
86
  */
87
- popup: false | string;
87
+ popup: false | string | JQuery;
88
88
 
89
89
  /**
90
90
  * Whether all other popups should be hidden when this popup is opened.
@@ -266,39 +266,39 @@ declare namespace FomanticUI {
266
266
  /**
267
267
  * Callback on popup element creation, with created popup.
268
268
  */
269
- onCreate(this: JQuery): void;
269
+ onCreate(this: JQuery, element?: JQuery<HTMLElement>): void;
270
270
 
271
271
  /**
272
272
  * Callback immediately before Popup is removed from DOM.
273
273
  */
274
- onRemove(this: JQuery): void;
274
+ onRemove(this: JQuery, element?: JQuery<HTMLElement>): void;
275
275
 
276
276
  /**
277
277
  * Callback before popup is shown.
278
278
  * Returning 'false' from this callback will cancel the popup from showing.
279
279
  */
280
- onShow(this: JQuery): boolean;
280
+ onShow(this: JQuery, element?: JQuery<HTMLElement>): any;
281
281
 
282
282
  /**
283
283
  * Callback after popup is shown.
284
284
  */
285
- onVisible(this: JQuery): void;
285
+ onVisible(this: JQuery, element?: JQuery<HTMLElement>): void;
286
286
 
287
287
  /**
288
288
  * Callback before popup is hidden.
289
289
  * Returning 'false' from this callback will cancel the popup from hiding.
290
290
  */
291
- onHide(this: JQuery): boolean;
291
+ onHide(this: JQuery, element?: JQuery<HTMLElement>): any;
292
292
 
293
293
  /**
294
294
  * Callback after popup is hidden.
295
295
  */
296
- onHidden(this: JQuery): void;
296
+ onHidden(this: JQuery, element?: JQuery<HTMLElement>): void;
297
297
 
298
298
  /**
299
299
  * Callback after popup cannot be placed on screen.
300
300
  */
301
- onUnplaceable(this: JQuery): void;
301
+ onUnplaceable(this: JQuery, element?: JQuery<HTMLElement>): void;
302
302
 
303
303
  // endregion
304
304
 
@@ -208,6 +208,12 @@ declare namespace FomanticUI {
208
208
  */
209
209
  precision: number;
210
210
 
211
+ /**
212
+ * Sets current overall percent.
213
+ * @default false
214
+ */
215
+ percent: false | number;
216
+
211
217
  /**
212
218
  * Setting a total value will make each call to increment get closer to this total (i.e. 1/20, 2/20 etc).
213
219
  * @default false
@@ -10,7 +10,7 @@ declare namespace FomanticUI {
10
10
  /**
11
11
  * Displays message in search results with text, using template matching type.
12
12
  */
13
- (behavior: 'display message', text: string, type: string): JQuery;
13
+ (behavior: 'display message', text: string, type?: string): JQuery;
14
14
 
15
15
  /**
16
16
  * Cancels current remote search query.
@@ -124,7 +124,7 @@ declare namespace FomanticUI {
124
124
  * @see {@link https://fomantic-ui.com/behaviors/api.html#/settings}
125
125
  * @default {}
126
126
  */
127
- apiSettings: APISettings | JQueryAjaxSettings;
127
+ apiSettings: Partial<Pick<APISettings, keyof APISettings>> | JQueryAjaxSettings;
128
128
 
129
129
  /**
130
130
  * Minimum characters to query for results.
@@ -228,6 +228,24 @@ declare namespace FomanticUI {
228
228
  */
229
229
  ignoreDiacritics: boolean;
230
230
 
231
+ /**
232
+ * Template to use (specified in settings.templates)
233
+ * @default 'standard'
234
+ */
235
+ type: 'escape' | 'message' | 'category' | 'standard';
236
+
237
+ /**
238
+ * Field to display in standard results template
239
+ * @default ''
240
+ */
241
+ displayField: string;
242
+
243
+ /**
244
+ * Whether to add events to prompt automatically
245
+ * @default true
246
+ */
247
+ automatic: boolean;
248
+
231
249
  // endregion
232
250
 
233
251
  // region Callbacks
@@ -237,13 +255,13 @@ declare namespace FomanticUI {
237
255
  * The first parameter includes the filtered response results for that element.
238
256
  * The function should return 'false' to prevent default action (closing search results and selecting value).
239
257
  */
240
- onSelect(this: JQuery, result: object, response: object): boolean;
258
+ onSelect(this: JQuery, result: object, response: object): any;
241
259
 
242
260
  /**
243
261
  * Callback after processing element template to add HTML to results.
244
262
  * Function should return 'false' to prevent default actions.
245
263
  */
246
- onResultsAdd(this: JQuery, html: string): boolean;
264
+ onResultsAdd(this: JQuery, html: string): void | boolean;
247
265
 
248
266
  /**
249
267
  * Callback on search query.
@@ -352,24 +370,24 @@ declare namespace FomanticUI {
352
370
  namespace Settings {
353
371
  interface Templates {
354
372
  /**
355
- * @default function(string)
373
+ * @default function(string, preserveHTML)
356
374
  */
357
- escape: Function;
375
+ escape: (string: string, preserveHTML?: boolean) => string;
358
376
 
359
377
  /**
360
- * @default function(message, type)
378
+ * @default function(message, type, header)
361
379
  */
362
- message: Function;
380
+ message: (message: string, type?: string, header?: string) => string;
363
381
 
364
382
  /**
365
- * @default function(response)
383
+ * @default function(response, fields, preserveHTML)
366
384
  */
367
- category: Function;
385
+ category: (response: unknown, fields: {[key: string]: string}, preserveHTML?: boolean) => string;
368
386
 
369
387
  /**
370
- * @default function(response)
388
+ * @default function(response, fields, preserveHTML)
371
389
  */
372
- standard: Function;
390
+ standard: (response: unknown, fields: {[key: string]: string}, preserveHTML?: boolean) => string;
373
391
  }
374
392
 
375
393
  interface Selectors {
@@ -149,7 +149,7 @@ declare namespace FomanticUI {
149
149
  * Tabs are limited to those found inside this context.
150
150
  * @default false
151
151
  */
152
- context: false | string;
152
+ context: JQuery | string | false;
153
153
 
154
154
  /**
155
155
  * If enabled limits tabs to children of passed context.