fomantic-ui 2.9.4-beta.4 → 2.9.4-beta.41

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 (242) hide show
  1. package/.all-contributorsrc +20 -1
  2. package/.eslintrc.js +17 -0
  3. package/.github/FUNDING.yml +1 -1
  4. package/.github/workflows/ci.yml +5 -5
  5. package/.github/workflows/nightly.yml +1 -1
  6. package/.github/workflows/release.yml +1 -1
  7. package/CONTRIBUTORS.md +2 -0
  8. package/dist/components/accordion.css +1 -1
  9. package/dist/components/accordion.js +4 -2
  10. package/dist/components/accordion.min.css +1 -1
  11. package/dist/components/accordion.min.js +2 -2
  12. package/dist/components/ad.css +1 -1
  13. package/dist/components/ad.min.css +1 -1
  14. package/dist/components/api.js +7 -3
  15. package/dist/components/api.min.js +2 -2
  16. package/dist/components/breadcrumb.css +1 -1
  17. package/dist/components/breadcrumb.min.css +1 -1
  18. package/dist/components/button.css +19 -3
  19. package/dist/components/button.min.css +2 -2
  20. package/dist/components/calendar.css +1 -1
  21. package/dist/components/calendar.js +4 -2
  22. package/dist/components/calendar.min.css +1 -1
  23. package/dist/components/calendar.min.js +2 -2
  24. package/dist/components/card.css +1 -1
  25. package/dist/components/card.min.css +1 -1
  26. package/dist/components/checkbox.css +1 -1
  27. package/dist/components/checkbox.js +10 -4
  28. package/dist/components/checkbox.min.css +1 -1
  29. package/dist/components/checkbox.min.js +3 -3
  30. package/dist/components/comment.css +1 -1
  31. package/dist/components/comment.min.css +1 -1
  32. package/dist/components/container.css +1 -1
  33. package/dist/components/container.min.css +1 -1
  34. package/dist/components/dimmer.css +1 -1
  35. package/dist/components/dimmer.js +4 -2
  36. package/dist/components/dimmer.min.css +1 -1
  37. package/dist/components/dimmer.min.js +2 -2
  38. package/dist/components/divider.css +1 -1
  39. package/dist/components/divider.min.css +1 -1
  40. package/dist/components/dropdown.css +18 -20
  41. package/dist/components/dropdown.js +99 -31
  42. package/dist/components/dropdown.min.css +2 -2
  43. package/dist/components/dropdown.min.js +3 -3
  44. package/dist/components/embed.css +1 -1
  45. package/dist/components/embed.js +17 -7
  46. package/dist/components/embed.min.css +1 -1
  47. package/dist/components/embed.min.js +3 -3
  48. package/dist/components/emoji.css +1 -1
  49. package/dist/components/emoji.min.css +1 -1
  50. package/dist/components/feed.css +1 -1
  51. package/dist/components/feed.min.css +1 -1
  52. package/dist/components/flag.css +1 -1
  53. package/dist/components/flag.min.css +1 -1
  54. package/dist/components/flyout.css +1 -1
  55. package/dist/components/flyout.js +4 -2
  56. package/dist/components/flyout.min.css +1 -1
  57. package/dist/components/flyout.min.js +2 -2
  58. package/dist/components/form.css +15 -5
  59. package/dist/components/form.js +42 -17
  60. package/dist/components/form.min.css +2 -2
  61. package/dist/components/form.min.js +3 -3
  62. package/dist/components/grid.css +5 -5
  63. package/dist/components/grid.min.css +2 -2
  64. package/dist/components/header.css +4 -1
  65. package/dist/components/header.min.css +2 -2
  66. package/dist/components/icon.css +1 -1
  67. package/dist/components/icon.min.css +1 -1
  68. package/dist/components/image.css +1 -1
  69. package/dist/components/image.min.css +1 -1
  70. package/dist/components/input.css +30 -10
  71. package/dist/components/input.min.css +2 -2
  72. package/dist/components/item.css +1 -1
  73. package/dist/components/item.min.css +1 -1
  74. package/dist/components/label.css +1 -2
  75. package/dist/components/label.min.css +2 -2
  76. package/dist/components/list.css +1 -1
  77. package/dist/components/list.min.css +1 -1
  78. package/dist/components/loader.css +1 -1
  79. package/dist/components/loader.min.css +1 -1
  80. package/dist/components/menu.css +1 -2
  81. package/dist/components/menu.min.css +2 -2
  82. package/dist/components/message.css +1 -1
  83. package/dist/components/message.min.css +1 -1
  84. package/dist/components/modal.css +1 -1
  85. package/dist/components/modal.js +7 -3
  86. package/dist/components/modal.min.css +1 -1
  87. package/dist/components/modal.min.js +2 -2
  88. package/dist/components/nag.css +1 -1
  89. package/dist/components/nag.js +11 -5
  90. package/dist/components/nag.min.css +1 -1
  91. package/dist/components/nag.min.js +3 -3
  92. package/dist/components/placeholder.css +1 -1
  93. package/dist/components/placeholder.min.css +1 -1
  94. package/dist/components/popup.css +1 -2
  95. package/dist/components/popup.js +10 -4
  96. package/dist/components/popup.min.css +2 -2
  97. package/dist/components/popup.min.js +2 -2
  98. package/dist/components/progress.css +1 -1
  99. package/dist/components/progress.js +4 -2
  100. package/dist/components/progress.min.css +1 -1
  101. package/dist/components/progress.min.js +2 -2
  102. package/dist/components/rail.css +1 -1
  103. package/dist/components/rail.min.css +1 -1
  104. package/dist/components/rating.css +1 -1
  105. package/dist/components/rating.js +4 -2
  106. package/dist/components/rating.min.css +1 -1
  107. package/dist/components/rating.min.js +2 -2
  108. package/dist/components/reset.css +1 -1
  109. package/dist/components/reset.min.css +1 -1
  110. package/dist/components/reveal.css +1 -1
  111. package/dist/components/reveal.min.css +1 -1
  112. package/dist/components/search.css +1 -1
  113. package/dist/components/search.js +64 -12
  114. package/dist/components/search.min.css +1 -1
  115. package/dist/components/search.min.js +3 -3
  116. package/dist/components/segment.css +1 -1
  117. package/dist/components/segment.min.css +1 -1
  118. package/dist/components/shape.css +1 -1
  119. package/dist/components/shape.js +4 -2
  120. package/dist/components/shape.min.css +1 -1
  121. package/dist/components/shape.min.js +2 -2
  122. package/dist/components/sidebar.css +1 -1
  123. package/dist/components/sidebar.js +4 -2
  124. package/dist/components/sidebar.min.css +1 -1
  125. package/dist/components/sidebar.min.js +2 -2
  126. package/dist/components/site.css +1 -1
  127. package/dist/components/site.js +4 -2
  128. package/dist/components/site.min.css +1 -1
  129. package/dist/components/site.min.js +2 -2
  130. package/dist/components/slider.css +1 -1
  131. package/dist/components/slider.js +4 -2
  132. package/dist/components/slider.min.css +1 -1
  133. package/dist/components/slider.min.js +2 -2
  134. package/dist/components/state.js +4 -2
  135. package/dist/components/state.min.js +2 -2
  136. package/dist/components/statistic.css +1 -1
  137. package/dist/components/statistic.min.css +1 -1
  138. package/dist/components/step.css +1 -1
  139. package/dist/components/step.min.css +1 -1
  140. package/dist/components/sticky.css +1 -1
  141. package/dist/components/sticky.js +4 -2
  142. package/dist/components/sticky.min.css +1 -1
  143. package/dist/components/sticky.min.js +2 -2
  144. package/dist/components/tab.css +1 -1
  145. package/dist/components/tab.js +4 -2
  146. package/dist/components/tab.min.css +1 -1
  147. package/dist/components/tab.min.js +2 -2
  148. package/dist/components/table.css +7 -7
  149. package/dist/components/table.min.css +2 -2
  150. package/dist/components/text.css +1 -1
  151. package/dist/components/text.min.css +1 -1
  152. package/dist/components/toast.css +1 -1
  153. package/dist/components/toast.js +4 -2
  154. package/dist/components/toast.min.css +1 -1
  155. package/dist/components/toast.min.js +2 -2
  156. package/dist/components/transition.css +1 -1
  157. package/dist/components/transition.js +7 -3
  158. package/dist/components/transition.min.css +1 -1
  159. package/dist/components/transition.min.js +2 -2
  160. package/dist/components/visibility.js +4 -2
  161. package/dist/components/visibility.min.js +2 -2
  162. package/dist/semantic.css +152 -101
  163. package/dist/semantic.js +336 -121
  164. package/dist/semantic.min.css +3 -3
  165. package/dist/semantic.min.js +3 -3
  166. package/dist/themes/basic/assets/fonts/LICENSE.txt +91 -0
  167. package/dist/themes/default/assets/fonts/LICENSE_Lato.txt +94 -0
  168. package/dist/themes/default/assets/fonts/LICENSE_icons.txt +165 -0
  169. package/dist/themes/github/assets/fonts/LICENSE.txt +94 -0
  170. package/dist/themes/material/assets/fonts/LICENSE.txt +202 -0
  171. package/package.json +3 -3
  172. package/src/definitions/behaviors/api.js +6 -2
  173. package/src/definitions/behaviors/form.js +41 -16
  174. package/src/definitions/behaviors/state.js +3 -1
  175. package/src/definitions/behaviors/visibility.js +3 -1
  176. package/src/definitions/collections/form.less +14 -4
  177. package/src/definitions/collections/grid.less +4 -4
  178. package/src/definitions/collections/table.less +6 -6
  179. package/src/definitions/elements/button.less +25 -3
  180. package/src/definitions/elements/header.less +5 -0
  181. package/src/definitions/elements/input.less +14 -6
  182. package/src/definitions/globals/site.js +3 -1
  183. package/src/definitions/modules/accordion.js +3 -1
  184. package/src/definitions/modules/calendar.js +3 -1
  185. package/src/definitions/modules/checkbox.js +9 -3
  186. package/src/definitions/modules/dimmer.js +3 -1
  187. package/src/definitions/modules/dropdown.js +98 -30
  188. package/src/definitions/modules/dropdown.less +12 -5
  189. package/src/definitions/modules/embed.js +16 -6
  190. package/src/definitions/modules/flyout.js +3 -1
  191. package/src/definitions/modules/modal.js +6 -2
  192. package/src/definitions/modules/nag.js +10 -4
  193. package/src/definitions/modules/popup.js +9 -3
  194. package/src/definitions/modules/progress.js +3 -1
  195. package/src/definitions/modules/rating.js +3 -1
  196. package/src/definitions/modules/search.js +63 -11
  197. package/src/definitions/modules/search.less +9 -2
  198. package/src/definitions/modules/shape.js +3 -1
  199. package/src/definitions/modules/sidebar.js +3 -1
  200. package/src/definitions/modules/slider.js +3 -1
  201. package/src/definitions/modules/sticky.js +3 -1
  202. package/src/definitions/modules/tab.js +3 -1
  203. package/src/definitions/modules/toast.js +3 -1
  204. package/src/definitions/modules/transition.js +6 -2
  205. package/src/themes/basic/assets/fonts/LICENSE.txt +91 -0
  206. package/src/themes/default/assets/fonts/LICENSE_Lato.txt +94 -0
  207. package/src/themes/default/assets/fonts/LICENSE_icons.txt +165 -0
  208. package/src/themes/default/collections/form.variables +1 -0
  209. package/src/themes/default/elements/button.variables +2 -0
  210. package/src/themes/default/globals/site.variables +3 -0
  211. package/src/themes/default/globals/variation.variables +3 -0
  212. package/src/themes/default/modules/dropdown.variables +3 -0
  213. package/src/themes/default/modules/search.variables +3 -0
  214. package/src/themes/github/assets/fonts/LICENSE.txt +94 -0
  215. package/src/themes/material/assets/fonts/LICENSE.txt +202 -0
  216. package/types/fomantic-ui-accordion.d.ts +1 -1
  217. package/types/fomantic-ui-api.d.ts +9 -3
  218. package/types/fomantic-ui-calendar.d.ts +93 -8
  219. package/types/fomantic-ui-checkbox.d.ts +14 -4
  220. package/types/fomantic-ui-dimmer.d.ts +1 -1
  221. package/types/fomantic-ui-dropdown.d.ts +36 -35
  222. package/types/fomantic-ui-embed.d.ts +1 -1
  223. package/types/fomantic-ui-flyout.d.ts +24 -10
  224. package/types/fomantic-ui-form.d.ts +123 -15
  225. package/types/fomantic-ui-modal.d.ts +75 -5
  226. package/types/fomantic-ui-nag.d.ts +4 -4
  227. package/types/fomantic-ui-popup.d.ts +11 -11
  228. package/types/fomantic-ui-progress.d.ts +12 -6
  229. package/types/fomantic-ui-rating.d.ts +1 -1
  230. package/types/fomantic-ui-search.d.ts +43 -13
  231. package/types/fomantic-ui-shape.d.ts +2 -2
  232. package/types/fomantic-ui-sidebar.d.ts +4 -4
  233. package/types/fomantic-ui-slider.d.ts +1 -1
  234. package/types/fomantic-ui-sticky.d.ts +1 -1
  235. package/types/fomantic-ui-tab.d.ts +5 -5
  236. package/types/fomantic-ui-toast.d.ts +7 -2
  237. package/types/fomantic-ui-transition.d.ts +29 -1
  238. package/types/fomantic-ui-visibility.d.ts +3 -3
  239. package/types/index.d.ts +25 -25
  240. package/types/tests.ts +188 -0
  241. package/types/tsconfig.json +1 -1
  242. package/types/fomantic-ui-tests.ts +0 -25
@@ -6,7 +6,7 @@ declare namespace FomanticUI {
6
6
  * Recreates dropdown menu from passed values.
7
7
  * values should be an object with the following structure: { values: [ {value, text, name} ] }.
8
8
  */
9
- (behavior: 'setup menu', values: object): void;
9
+ (behavior: 'setup menu', values: object): JQuery;
10
10
 
11
11
  /**
12
12
  * Changes dropdown to use new values.
@@ -17,7 +17,7 @@ declare namespace FomanticUI {
17
17
  /**
18
18
  * Refreshes all cached selectors and data
19
19
  */
20
- (behavior: 'refresh'): void;
20
+ (behavior: 'refresh'): JQuery;
21
21
 
22
22
  /**
23
23
  * Toggles current visibility of dropdown
@@ -29,20 +29,20 @@ declare namespace FomanticUI {
29
29
  * If a function is provided to callback, it's called after the dropdown-menu is shown.
30
30
  * Set preventFocus to true if you don't want the dropdown field to focus after the menu is shown
31
31
  */
32
- (behavior: 'show', callback: Function, preventFocus: boolean): void;
32
+ (behavior: 'show', callback?: Function, preventFocus?: boolean): void;
33
33
 
34
34
  /**
35
35
  * Hides dropdown.
36
36
  * If a function is provided to callback, it's called after the dropdown-menu is hidden.
37
37
  * Set preventBlur to true if you don't want the dropdown field to blur after the menu is hidden
38
38
  */
39
- (behavior: 'hide', callback:Function, preventBlur: boolean): void;
39
+ (behavior: 'hide', callback?: Function, preventBlur?: boolean): void;
40
40
 
41
41
  /**
42
42
  * Clears dropdown of selection.
43
43
  * Set preventChangeTrigger to true to omit the change event (default: false).
44
44
  */
45
- (behavior: 'clear', preventChangeTrigger: boolean): void;
45
+ (behavior: 'clear', preventChangeTrigger?: boolean): JQuery;
46
46
 
47
47
  /**
48
48
  * Hides all other dropdowns that is not current dropdown
@@ -53,7 +53,7 @@ declare namespace FomanticUI {
53
53
  * Restores dropdown text and value to its value on page load.
54
54
  * Set preventChangeTrigger to true to omit the change event (default: false).
55
55
  */
56
- (behavior: 'restore defaults', preventChangeTrigger: boolean): void;
56
+ (behavior: 'restore defaults', preventChangeTrigger?: boolean): void;
57
57
 
58
58
  /**
59
59
  * Restores dropdown text to its value on page load
@@ -79,33 +79,28 @@ declare namespace FomanticUI {
79
79
  * Sets value as selected.
80
80
  * Set preventChangeTrigger to true to omit the change event (default: false).
81
81
  */
82
- (behavior: 'set selected', value: string, preventChangeTrigger: boolean): void;
82
+ (behavior: 'set selected', value: string | string[], preventChangeTrigger?: boolean, keepSearchTerm?: boolean): JQuery;
83
83
 
84
84
  /**
85
85
  * Remove value from selected
86
86
  */
87
87
  (behavior: 'remove selected', value: string): void;
88
88
 
89
- /**
90
- * Adds a group of values as selected
91
- */
92
- (behavior: 'set selected', values: string[]): void;
93
-
94
89
  /**
95
90
  * Sets selected values to exactly specified values, removing current selection
96
91
  */
97
- (behavior: 'set exactly', values: string[]): void;
92
+ (behavior: 'set exactly', values: string[]): JQuery;
98
93
 
99
94
  /**
100
95
  * Sets dropdown text to a value
101
96
  */
102
- (behavior: 'text', text: string): void;
97
+ (behavior: 'set text', text: string): JQuery;
103
98
 
104
99
  /**
105
100
  * Sets dropdown input to value (does not update display state).
106
101
  * Set preventChangeTrigger to true to omit the change event (default: false).
107
102
  */
108
- (behavior: 'set value', value: string, preventChangeTrigger: boolean): void;
103
+ (behavior: 'set value', value: string, preventChangeTrigger?: boolean): JQuery;
109
104
 
110
105
  /**
111
106
  * Returns current dropdown text
@@ -215,7 +210,7 @@ declare namespace FomanticUI {
215
210
  (behavior: 'get placeholder text'): string;
216
211
 
217
212
  (behavior: 'destroy'): JQuery;
218
- <K extends keyof DropdownSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<DropdownSettings, keyof DropdownSettings>>;
213
+ <K extends keyof DropdownSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<DropdownSettings, keyof DropdownSettings>>;
219
214
  <K extends keyof DropdownSettings>(behavior: 'setting', name: K, value: DropdownSettings[K]): JQuery;
220
215
  (behavior: 'setting', value: Partial<Pick<DropdownSettings, keyof DropdownSettings>>): JQuery;
221
216
  (settings?: Partial<Pick<DropdownSettings, keyof DropdownSettings>>): JQuery;
@@ -265,7 +260,7 @@ declare namespace FomanticUI {
265
260
  * @see {@link https://fomantic-ui.com/behaviors/api.html#/settings}
266
261
  * @default false
267
262
  */
268
- apiSettings: false | APISettings | JQueryAjaxSettings;
263
+ apiSettings: false | Partial<Pick<APISettings, keyof APISettings>> | Partial<Pick<JQueryAjaxSettings, keyof JQueryAjaxSettings>>;
269
264
 
270
265
  /**
271
266
  * Whether dropdown should select new option when using keyboard shortcuts.
@@ -350,7 +345,7 @@ declare namespace FomanticUI {
350
345
  *
351
346
  * @default 'auto'
352
347
  */
353
- placeholder: 'auto' | String | false;
348
+ placeholder: 'auto' | string | false;
354
349
 
355
350
  /**
356
351
  * Whether HTML included in dropdown values should be preserved.
@@ -390,6 +385,12 @@ declare namespace FomanticUI {
390
385
  */
391
386
  ignoreSearchCase: boolean;
392
387
 
388
+ /**
389
+ * Whether search result should highlight matching strings
390
+ * @default false
391
+ */
392
+ highlightMatches: boolean;
393
+
393
394
  /**
394
395
  * If disabled user additions will appear in the dropdown's menu using a specially formatted selection item formatted by 'templates.addition'.
395
396
  * @default true
@@ -506,7 +507,7 @@ declare namespace FomanticUI {
506
507
  * Is called after a dropdown value changes.
507
508
  * Receives the name and value of selection and the active menu element.
508
509
  */
509
- onChange(value: string, text: string, $choice: JQuery): void;
510
+ onChange(value?: string, text?: string, $choice?: JQuery): void;
510
511
 
511
512
  /**
512
513
  * Is called after a dropdown selection is added using a multiple select dropdown, only receives the added value.
@@ -582,22 +583,22 @@ declare namespace FomanticUI {
582
583
  message: Dropdown.MessageSettings;
583
584
 
584
585
  /**
585
- *
586
+ *
586
587
  */
587
588
  regExp: Dropdown.RegExpSettings;
588
589
 
589
590
  /**
590
- *
591
+ *
591
592
  */
592
593
  metadata: Dropdown.MetadataSettings;
593
594
 
594
595
  /**
595
- *
596
+ *
596
597
  */
597
598
  fields: Dropdown.FieldsSettings;
598
599
 
599
600
  /**
600
- *
601
+ *
601
602
  */
602
603
  keys: Dropdown.KeysSettings;
603
604
 
@@ -743,7 +744,7 @@ declare namespace FomanticUI {
743
744
  */
744
745
  clearIcon: string;
745
746
  }
746
-
747
+
747
748
  interface ClassNames {
748
749
  /**
749
750
  * @default 'active'
@@ -920,7 +921,7 @@ declare namespace FomanticUI {
920
921
  */
921
922
  actionable: string;
922
923
  }
923
-
924
+
924
925
  interface Messages {
925
926
  /**
926
927
  * @default 'Add <b>{term}</b>'
@@ -952,9 +953,9 @@ declare namespace FomanticUI {
952
953
  /**
953
954
  * @default '/[-[\]{}()*+?.,\\^$|#\s]/g'
954
955
  */
955
- escape: string;
956
+ escape: string;
956
957
  }
957
-
958
+
958
959
  interface Metadatas {
959
960
  /**
960
961
  * @default 'defaultText'
@@ -964,24 +965,24 @@ declare namespace FomanticUI {
964
965
  /**
965
966
  * @default 'defaultValue'
966
967
  */
967
- defaultValue: string;
968
+ defaultValue: string;
968
969
 
969
970
  /**
970
971
  * @default 'placeholderText'
971
972
  */
972
- placeholderText: string;
973
+ placeholderText: string;
973
974
 
974
975
  /**
975
976
  * @default 'text'
976
977
  */
977
- text: string;
978
+ text: string;
978
979
 
979
980
  /**
980
981
  * @default 'value'
981
982
  */
982
- value: string;
983
+ value: string;
983
984
  }
984
-
985
+
985
986
  interface Fields {
986
987
  /**
987
988
  * Grouping for api results
@@ -993,13 +994,13 @@ declare namespace FomanticUI {
993
994
  * Grouping for all dropdown values
994
995
  * @default 'values'
995
996
  */
996
- values: string;
997
+ values: string;
997
998
 
998
999
  /**
999
1000
  * Whether value should be disabled
1000
1001
  * @default 'disabled'
1001
1002
  */
1002
- disabled: string;
1003
+ disabled: string;
1003
1004
 
1004
1005
  /**
1005
1006
  * Displayed dropdown text
@@ -1079,7 +1080,7 @@ declare namespace FomanticUI {
1079
1080
  */
1080
1081
  actionable: string;
1081
1082
  }
1082
-
1083
+
1083
1084
  interface Keys {
1084
1085
  /**
1085
1086
  * @default 8
@@ -57,7 +57,7 @@ declare namespace FomanticUI {
57
57
  */
58
58
  (behavior: 'destroy'): JQuery;
59
59
 
60
- <K extends keyof EmbedSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<EmbedSettings, keyof EmbedSettings>>;
60
+ <K extends keyof EmbedSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<EmbedSettings, keyof EmbedSettings>>;
61
61
  <K extends keyof EmbedSettings>(behavior: 'setting', name: K, value: EmbedSettings[K]): JQuery;
62
62
  (behavior: 'setting', value: Partial<Pick<EmbedSettings, keyof EmbedSettings>>): JQuery;
63
63
  (settings?: Partial<Pick<EmbedSettings, keyof EmbedSettings>>): JQuery;
@@ -48,8 +48,13 @@ declare namespace FomanticUI {
48
48
  */
49
49
  (behavior: 'get settings'): FlyoutSettings;
50
50
 
51
+ /**
52
+ * Templates handling
53
+ */
54
+ (behavior: keyof Flyout.TemplatesSettings, ...args: any): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;
55
+
51
56
  (behavior: 'destroy'): JQuery;
52
- <K extends keyof FlyoutSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;
57
+ <K extends keyof FlyoutSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;
53
58
  <K extends keyof FlyoutSettings>(behavior: 'setting', name: K, value: FlyoutSettings[K]): JQuery;
54
59
  (behavior: 'setting', value: Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>): JQuery;
55
60
  (settings?: Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>): JQuery;
@@ -145,43 +150,43 @@ declare namespace FomanticUI {
145
150
  * Content of the flyout header.
146
151
  * @default ''
147
152
  */
148
- title: boolean;
153
+ title: string;
149
154
 
150
155
  /**
151
156
  * Content of the flyout content.
152
157
  * @default ''
153
158
  */
154
- content: boolean;
159
+ content: string;
155
160
 
156
161
  /**
157
162
  * Can hold a string to be added to the flyout class to control its appearance.
158
163
  * @default ''
159
164
  */
160
- class: boolean;
165
+ class: string;
161
166
 
162
167
  /**
163
168
  * Can hold a string to be added to the title class to control its appearance.
164
169
  * @default ''
165
170
  */
166
- classTitle: boolean;
171
+ classTitle: string;
167
172
 
168
173
  /**
169
174
  * Can hold a string to be added to the content class to control its appearance.
170
175
  * @default ''
171
176
  */
172
- classContent: boolean;
177
+ classContent: string;
173
178
 
174
179
  /**
175
180
  * Can hold a string to be added to the actions class to control its appearance.
176
181
  * @default ''
177
182
  */
178
- classActions: boolean;
183
+ classActions: string;
179
184
 
180
185
  /**
181
186
  * Can hold a string to be added to the actions class to control its appearance.
182
187
  * @default false
183
188
  */
184
- closeIcon: boolean;
189
+ closeIcon: boolean | string;
185
190
 
186
191
  /**
187
192
  * An array of objects. Each object defines an action with properties `text`, `class`, `icon` and `click`.
@@ -261,6 +266,8 @@ declare namespace FomanticUI {
261
266
 
262
267
  // region Config Template Settings
263
268
 
269
+ templates: Flyout.TemplatesSettings;
270
+
264
271
  // endregion
265
272
 
266
273
  // region Debug Settings
@@ -311,6 +318,7 @@ declare namespace FomanticUI {
311
318
  type ClassNameSettings = Partial<Pick<Settings.ClassNames, keyof Settings.ClassNames>>;
312
319
  type RegExpSettings = Partial<Pick<Settings.RegExps, keyof Settings.RegExps>>;
313
320
  type ErrorSettings = Partial<Pick<Settings.Errors, keyof Settings.Errors>>;
321
+ type TemplatesSettings = Partial<Pick<Settings.Templates, keyof Settings.Templates>> & {[key: string]: (...args: any) => Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>};
314
322
 
315
323
  namespace Settings {
316
324
  interface Selectors {
@@ -364,7 +372,7 @@ declare namespace FomanticUI {
364
372
  */
365
373
  deny: string;
366
374
  }
367
-
375
+
368
376
  interface ClassNames {
369
377
  /**
370
378
  * @default 'ui flyout'
@@ -481,7 +489,7 @@ declare namespace FomanticUI {
481
489
  */
482
490
  prompt: string;
483
491
  }
484
-
492
+
485
493
  interface RegExps {
486
494
  /**
487
495
  * @default /(iPad|iPhone|iPod)/g
@@ -520,6 +528,12 @@ declare namespace FomanticUI {
520
528
  */
521
529
  notFound: string;
522
530
  }
531
+
532
+ interface Templates {
533
+ alert(): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;
534
+ confirm(): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;
535
+ prompt(): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;
536
+ }
523
537
  }
524
538
  }
525
539
  }
@@ -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'.
@@ -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.
@@ -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,10 +142,10 @@ 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
- * Automatically adds the "empty" rule or automatically checks a checkbox for all fields with classname or attribute 'required'.
148
+ * Automatically adds the "notEmpty" rule or automatically checks a checkbox for all fields with classname or attribute 'required'.
129
149
  */
130
150
  (behavior: 'set auto check'): void;
131
151
 
@@ -138,18 +158,39 @@ declare namespace FomanticUI {
138
158
  * Destroys instance and removes all events.
139
159
  */
140
160
  (behavior: 'destroy'): JQuery;
141
- <K extends keyof FormSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<FormSettings, keyof FormSettings>>;
161
+ <K extends keyof FormSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<FormSettings, keyof FormSettings>>;
142
162
  <K extends keyof FormSettings>(behavior: 'setting', name: K, value: FormSettings[K]): JQuery;
143
163
  (behavior: 'setting', value: Partial<Pick<FormSettings, keyof FormSettings>>): JQuery;
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
@@ -215,7 +256,7 @@ declare namespace FomanticUI {
215
256
  preventLeaving: boolean;
216
257
 
217
258
  /**
218
- * Whether fields with classname or attribute 'required' should automatically add the "empty" rule or automatically checks checkbox fields.
259
+ * Whether fields with classname or attribute 'required' should automatically add the "notEmpty" rule or automatically checks checkbox fields.
219
260
  * @default false
220
261
  */
221
262
  autoCheckRequired: boolean;
@@ -232,6 +273,12 @@ declare namespace FomanticUI {
232
273
  */
233
274
  errorLimit: number;
234
275
 
276
+ /**
277
+ *
278
+ * @default false
279
+ */
280
+ noNativeValidation: boolean;
281
+
235
282
  // endregion
236
283
 
237
284
  // region Form Prompts
@@ -248,6 +295,12 @@ declare namespace FomanticUI {
248
295
 
249
296
  // endregion
250
297
 
298
+ // region Formatters
299
+
300
+ rules: Form.RulesSettings;
301
+
302
+ // endregion
303
+
251
304
  // region Callbacks
252
305
 
253
306
  /**
@@ -258,17 +311,17 @@ declare namespace FomanticUI {
258
311
  /**
259
312
  * Callback on each invalid field.
260
313
  */
261
- onInvalid(this: JQuery): void;
314
+ onInvalid(this: JQuery, fieldErrors: string | string[]): void;
262
315
 
263
316
  /**
264
317
  * Callback if a form is all valid.
265
318
  */
266
- onSuccess(this: JQuery, event: Event, fields: object[]): void;
319
+ onSuccess(this: JQuery, event: Event, fields: {[key: string]: any}): void;
267
320
 
268
321
  /**
269
322
  * Callback if any form field is invalid.
270
323
  */
271
- onFailure(this: JQuery, formErrors: object[], fields: object[]): void;
324
+ onFailure(this: JQuery, formErrors: {[key: string]: any}, fields: {[key: string]: any}): void;
272
325
 
273
326
  /**
274
327
  * Callback if form state is modified to 'dirty'.
@@ -349,8 +402,9 @@ declare namespace FomanticUI {
349
402
 
350
403
  namespace Form {
351
404
  type TextSettings = Partial<Pick<Settings.Texts, keyof Settings.Texts>>;
352
- type PromptSettings = Partial<Pick<Settings.Prompts, keyof Settings.Prompts>>;
405
+ type PromptSettings = Partial<Pick<Settings.Prompts, keyof Settings.Prompts>> & {[key: string]: string | undefined};
353
406
  type FormatterSettings = Partial<Pick<Settings.Formatters, keyof Settings.Formatters>>;
407
+ type RulesSettings = Partial<Pick<Settings.Rules, keyof Settings.Rules>> & {[key: string]: (value?: any, identifier?: string, module?: any) => boolean};
354
408
  type SelectorSettings = Partial<Pick<Settings.Selectors, keyof Settings.Selectors>>;
355
409
  type MetadataSettings = Partial<Pick<Settings.Metadatas, keyof Settings.Metadatas>>;
356
410
  type ClassNameSettings = Partial<Pick<Settings.ClassNames, keyof Settings.ClassNames>>;
@@ -375,11 +429,32 @@ declare namespace FomanticUI {
375
429
  }
376
430
 
377
431
  interface Prompts {
432
+ /**
433
+ * @default '{name} must be in a range from {min} to {max}'
434
+ */
435
+ range: string;
436
+
437
+ /**
438
+ * @default '{name} must have a maximum value of {ruleValue}'
439
+ */
440
+ maxValue: string;
441
+
442
+ /**
443
+ * @default '{name} must have a minimum value of {ruleValue}'
444
+ */
445
+ minValue: string;
446
+
378
447
  /**
379
448
  * @default '{name} must have a value'
449
+ * @deprecated Use notEmpty instead
380
450
  */
381
451
  empty: string;
382
452
 
453
+ /**
454
+ * @default '{name} must have a value'
455
+ */
456
+ notEmpty: string;
457
+
383
458
  /**
384
459
  * @default '{name} must be checked'
385
460
  */
@@ -509,6 +584,39 @@ declare namespace FomanticUI {
509
584
  year(date: string): string;
510
585
  }
511
586
 
587
+ interface Rules {
588
+ empty(value: unknown): boolean;
589
+ notEmpty(value: unknown): boolean;
590
+ checked(): boolean;
591
+ email(value: unknown): boolean;
592
+ url(value: unknown): boolean;
593
+ regExp(value: unknown, regExp: RegExp): boolean;
594
+ minValue(value: unknown, range: string): boolean;
595
+ maxValue(value: unknown, range: string): boolean;
596
+ integer(value: unknown, range: string): boolean;
597
+ range(value: unknown, range: string, regExp: RegExp, testLength: boolean): boolean;
598
+ decimal(value: unknown, range: string): boolean;
599
+ number(value: unknown, range: string): boolean;
600
+ is(value: unknown, text: string): boolean;
601
+ isExactly(value: unknown, text: string): boolean;
602
+ not(value: unknown, notValue: unknown): boolean;
603
+ notExactly(value: unknown, notValue: unknown): boolean;
604
+ contains(value: unknown, text: string): boolean;
605
+ containsExactly(value: unknown, text: string): boolean;
606
+ doesntContain(value: unknown, text: string): boolean;
607
+ doesntContainExactly(value: unknown, text: string): boolean;
608
+ minLength(value: unknown, minLength: number): boolean;
609
+ exactLength(value: unknown, requiredLength: number): boolean;
610
+ maxLength(value: unknown, maxLength: number): boolean;
611
+ size(value: unknown, range: string): boolean;
612
+ match(value: unknown, identifier: string, module: unknown): boolean;
613
+ different(value: unknown, identifier: string, module: unknown): boolean;
614
+ creditCard(cardNumber: unknown, cardTypes: string): boolean;
615
+ minCount(value: unknown, minCount: number): boolean;
616
+ exactCount(value: unknown, exactCount: number): boolean;
617
+ maxCount(value: unknown, maxCount: number): boolean;
618
+ }
619
+
512
620
  interface Selectors {
513
621
  /**
514
622
  * @default 'input[type="checkbox"], input[type="radio"]'